Websphere MQ Everyplace

com.ibm.mqe.adapters
Class MQeTcpipLengthAdapter

java.lang.Object
  |
  +--com.ibm.mqe.adapters.MQeCommunicationsAdapter
        |
        +--com.ibm.mqe.adapters.MQeTcpipAdapter
              |
              +--com.ibm.mqe.adapters.MQeTcpipLengthAdapter
Direct Known Subclasses:
MQeTcpipHistoryAdapter

public class MQeTcpipLengthAdapter
extends MQeTcpipAdapter

The MQeTcpipLengthAdapter adds a simple protocol to the MQeTcpipAdapter that enables two WebSphere MQ Everyplace systems to communicate over a TCP/IP network.

This adapter overrides the read and write calls from MQeTcpipAdapter to attach a header of between one and three bytes to each data flow. This header indicates the length of the following data. Using this protocol a flow of up to 1,073,741,823 bytes (230 1) is possible.

This class is a descendant of MQeTcpipAdapter. All usual adapter operations that are not listed here, use the implementation provided by this super-class.

See Also:
MQeTcpipAdapter

Field Summary
 
Fields inherited from class com.ibm.mqe.adapters.MQeCommunicationsAdapter
COMMS_ADAPTER_ADDRESS, COMMS_ADAPTER_CLASS, COMMS_ADAPTER_GROUP_SIZE, COMMS_ADAPTER_HTTP_VERSION, COMMS_ADAPTER_LISTEN, COMMS_ADAPTER_NONBLOCKING_TIMEOUT, COMMS_ADAPTER_NOPERSIST, COMMS_ADAPTER_PERSIST, COMMS_ADAPTER_PKTSIZE, COMMS_ADAPTER_PORT, COMMS_ADAPTER_RETRIES, COMMS_ADAPTER_SERVLET, COMMS_ADAPTER_TIMEOUT, COMMS_ADAPTER_VARIANCE, listeningAdapter, persistentAdapter, responderAdapter
 
Constructor Summary
MQeTcpipLengthAdapter()
           
 
Method Summary
 void activate(MQePropertyProvider info)
          Initialises a new MQeTcpipLengthAdapter object.
 byte[] read()
          Reads bytes from the underlying TCP/IP stream.
 void writeData(byte[] data)
          Writes bytes to the underlying TCP/IP stream.
 void writeResponse(byte[] data)
          Writes repsonse in bytes to the underlying TCP/IP stream.
 
Methods inherited from class com.ibm.mqe.adapters.MQeTcpipAdapter
close, open, readLength, readln, temporaryClose, waitForContact
 
Methods inherited from class com.ibm.mqe.adapters.MQeCommunicationsAdapter
createNewAdapter, isStopDemanded, isStopRequested
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MQeTcpipLengthAdapter

public MQeTcpipLengthAdapter()
Method Detail

activate

public void activate(MQePropertyProvider info)
              throws java.lang.Exception

Initialises a new MQeTcpipLengthAdapter object.

Checks to see if COMMS_ADAPTER_NOPERSIST and COMMS_ADAPTER_PERSIST has been specified. If neither have been set, use COMMS_ADAPTER_PERSIST as a default.

Note : This entry point is meant to be used by the WebSphere MQ Everyplace object library not by application programs.

Overrides:
activate in class MQeTcpipAdapter
Returns:
void
Throws:
java.lang.Exception
See Also:
MQeCommunicationsAdapter.COMMS_ADAPTER_ADDRESS, MQeCommunicationsAdapter.COMMS_ADAPTER_PORT, MQeCommunicationsAdapter.COMMS_ADAPTER_LISTEN, MQeCommunicationsAdapter.COMMS_ADAPTER_TIMEOUT, MQeCommunicationsAdapter.COMMS_ADAPTER_PKTSIZE, MQeCommunicationsAdapter.COMMS_ADAPTER_RETRIES, com.ibm.mqe.adapters.MQeCommunicationsAdapter#COMMS_ADAPTER_THREAD_STOP_CHECK

read

public byte[] read()
            throws java.lang.Exception

Reads bytes from the underlying TCP/IP stream.

Note : This entry point is meant to be used by the WebSphere MQ Everyplace object library not by application programs.

Specified by:
read in class MQeCommunicationsAdapter
Returns:
byte[] The data in a byte array read from the TCP/IP Stream.
Throws:
EOFException - If no more data is available.
java.lang.Exception

writeData

public void writeData(byte[] data)
               throws java.lang.Exception

Writes bytes to the underlying TCP/IP stream.

Writes the given array of bytes to the TCP/IP output stream. Once written, the data stream is flushed to prevent unwanted data being left on the sender.

Note : This entry point is meant to be used by the WebSphere MQ Everyplace object library not by application programs.

Specified by:
writeData in class MQeCommunicationsAdapter
Parameters:
data - byte[], the bytes to be written.
Returns:
void
Throws:
java.lang.Exception

writeResponse

public void writeResponse(byte[] data)
                   throws java.lang.Exception

Writes repsonse in bytes to the underlying TCP/IP stream. For this adapter there is no difference in writing the response from writing the actual data, hence this method just calls writeData.

Note : This entry point is meant to be used by the WebSphere MQ Everyplace object library not by application programs.

Specified by:
writeResponse in class MQeCommunicationsAdapter
Parameters:
data - byte[], the bytes to be written.
Returns:
void
Throws:
java.lang.Exception

Websphere MQ Everyplace