com.ibm.vap.ctgadapter
Class CTGRequester
java.lang.Object
|
+--com.ibm.vap.generic.Requester
|
+--com.ibm.vap.ctgadapter.CTGRequester
- public class CTGRequester
- extends com.ibm.vap.generic.Requester
Class used to adapt the CTG connectors to the Visualage Pacbase Runtime.
This class is a subclass of the com.ibm.vap.generic.Requester.
- Since:
- 2.5v11
Method Summary |
int |
getMaxMessageLength()
Gets the maximum message length. |
int |
receive(char[] message,
int offset,
int length)
Waits for a response associated to the last request. |
int |
receiveCheck()
Checks for a response associated to the last request, without waiting. |
void |
release()
This method will free the ECIRequest instance. |
int |
send(char[] message,
int offset,
int length)
Sends a message to the server. |
Methods inherited from class com.ibm.vap.generic.Requester |
getMessageId,
getProperty,
setMessageId,
setProperty |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
getMaxMessageLength
public int getMaxMessageLength()
throws com.ibm.vap.generic.CommunicationError
- Gets the maximum message length.
Return the maximum message length it requires.
The VisualAge Pacbase runtime garanties that no buffer passed to the function "send" will
be longer than this maximum.
If this function returns a value equals to or lower than 0, no maximum message
length is considered by the VisualAge Pacbase Runtime.
- Overrides:
- getMaxMessageLength in class com.ibm.vap.generic.Requester
receive
public int receive(char[] message,
int offset,
int length)
throws com.ibm.vap.generic.CommunicationError
- Waits for a response associated to the last request.
This function must wait until at least one character has been received from the
VisualAge Pacbase communication monitor at the server side.
The received characters must be stored in the given char array, starting at the given offset and
stopping when either "length" characters have been copied or no more character is available for
reception.
The function must return the total number of characters currently received.
When this method returns the value "nbReturn", two cases can be considered :
- "nbReturn <= length" : only "nbReturn" characters have been currently received and are stored in the
char array. A subsequent call to "receive" will likely block.
- "nbReturn > length" : more than "length" characters have been received, but only the first "length"
have been stored in the char array. Subsequent calls to "receive" will not block until at least all the
remaining characters (nbReturn-length) have been returned.
Calling "receive" with a length of 0 is a good way to wait for characters without getting any of them (thus,
without having to allocate a char array). Then "receive" can be called a second time to get all the currently
received characters (passing the value returned by the first call as "length" parameter).
Since this method must wait until characters are received, it should never return 0.
The only case where the returned value can be 0 is when a receive timeout has expired.
- Overrides:
- receive in class com.ibm.vap.generic.Requester
- Throws:
- com.ibm.vap.generic.CommunicationError - is thrown if an error condition is encountered.
receiveCheck
public int receiveCheck()
- Checks for a response associated to the last request, without waiting.
The method returns the number of characters currently received.
When this method returns 0, it means that a subsequent call to "receive" will likely block.
Else, it means that a subsequent call to receive will not block.
- Overrides:
- receiveCheck in class com.ibm.vap.generic.Requester
release
public void release()
- This method will free the ECIRequest instance.
- Overrides:
- release in class com.ibm.vap.generic.Requester
send
public int send(char[] message,
int offset,
int length)
throws com.ibm.vap.generic.CommunicationError
- Sends a message to the server.
The given message must be passed to the Visualage Pacbase communication monitor at the server side.
- Overrides:
- send in class com.ibm.vap.generic.Requester
- Parameters:
message
- to be sent to the serveroffset
- defines the starting charactere where to start sending the messagelength
- of the message to be sent- Returns:
- the number of bytes effectively sent
- Throws:
- com.ibm.vap.generic.CommunicationError - if the flow method fails
Licensed Materials - Property of IBM - 5655-F37 - (C) Copyright IBM Corp. 1983, 2003. All Rights Reserved.
IBM, VisualAge and Pacbase are trademarks of International Business Machines Corporation registered in the United States, other countries, or both.
Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States,other countries, or both.
Other company, product or service names may be the trademarks or service marks of others.