org.activemq.io.impl
Class AbstractDefaultWireFormat

java.lang.Object
  extended by org.activemq.io.AbstractWireFormat
      extended by org.activemq.io.impl.AbstractDefaultWireFormat
All Implemented Interfaces:
Serializable, WireFormat
Direct Known Subclasses:
DefaultWireFormat, StatelessDefaultWireFormat

public abstract class AbstractDefaultWireFormat
extends AbstractWireFormat
implements Serializable

Default implementation used for Java-Java protocols. When talking to non-Java nodes we may use a different wire format.

Version:
$Revision: 1.1.1.1 $
See Also:
Serialized Form

Field Summary
protected  PacketReader brokerAdminCommandReader
           
protected  PacketWriter brokerAdminCommandWriter
           
protected  PacketReader brokerInfoReader
           
protected  PacketWriter brokerInfoWriter
           
protected  PacketReader bytesMessageReader
           
protected  PacketWriter bytesMessageWriter
           
protected  PacketReader cachedValueReader
           
protected  PacketWriter cachedValueWriter
           
protected  PacketReader capacityInfoReader
           
protected  PacketReader capacityInfoRequestReader
           
protected  PacketWriter capacityInfoRequestWriter
           
protected  PacketWriter capacityInfoWriter
           
protected  PacketReader cleanupConnectionAndSessionInfoReader
           
protected  PacketWriter cleanupConnectionAndSessionInfoWriter
           
protected  PacketReader connectionInfoReader
           
protected  PacketWriter connectionInfoWriter
           
protected  PacketReader consumerInfoReader
           
protected  PacketWriter consumerInfoWriter
           
protected  int currentWireFormatVersion
           
protected  PacketReader durableUnsubscribeReader
           
protected  PacketWriter durableUnsubscribeWriter
           
protected  PacketReader intReponseReceiptReader
           
protected  PacketWriter intReponseReceiptWriter
           
protected  PacketReader keepAliveReader
           
protected  PacketWriter keepAliveWriter
           
protected  PacketReader mapMessageReader
           
protected  PacketWriter mapMessageWriter
           
protected  PacketReader messageAckReader
           
protected  PacketWriter messageAckWriter
           
protected  PacketReader messageReader
           
protected  PacketWriter messageWriter
           
protected  PacketReader objectMessageReader
           
protected  PacketWriter objectMessageWriter
           
protected  PacketReader producerInfoReader
           
protected  PacketWriter producerInfoWriter
           
protected  PacketReader receiptReader
           
protected  PacketWriter receiptWriter
           
protected  PacketReader reponseReceiptReader
           
protected  PacketWriter reponseReceiptWriter
           
protected  PacketReader sessionInfoReader
           
protected  PacketWriter sessionInfoWriter
           
protected  PacketReader streamMessageReader
           
protected  PacketWriter streamMessageWriter
           
protected  PacketReader textMessageReader
           
protected  PacketWriter textMessageWriter
           
protected  PacketReader transactionInfoReader
           
protected  PacketWriter transactionInfoWriter
           
static int WIRE_FORMAT_VERSION
          Current wire format version for this implementation
protected  PacketReader wireFormatInfoReader
           
protected  PacketWriter wireFormatInfoWriter
           
protected  PacketReader xaTransactionInfoReader
           
protected  PacketWriter xaTransactionInfoWriter
           
 
Fields inherited from class org.activemq.io.AbstractWireFormat
cachingEnabled, transportDataIn, transportDataOut
 
Fields inherited from interface org.activemq.io.WireFormat
DEFAULT_MAXIMUM_MESSAGE_SIZE
 
Constructor Summary
AbstractDefaultWireFormat()
          Default Constructor
 
Method Summary
 boolean canProcessWireFormatVersion(int version)
          Can this wireformat process packets of this version
abstract  WireFormat copy()
          Creates a new copy of this wire format so it can be used in another thread/context
 int getCurrentWireFormatVersion()
           
abstract  Object getValueFromReadCache(short key)
           
protected  PacketWriter getWriter(Packet packet)
           
protected abstract  void handleCachedValue(CachedValue cv)
           
 void initiateClientSideProtocol(DataOutputStream dataOut, DataInputStream dataIn)
          Some wire formats require a handshake at start-up
 void initiateServerSideProtocol(DataOutputStream dataOut, DataInputStream dataIn)
          Some wire formats require a handshake at start-up
protected abstract  Packet readPacket(DataInput dataIn, PacketReader reader)
           
 Packet readPacket(int firstByte, DataInput dataIn)
          A helper method for working with sockets where the first byte is read first, then the rest of the message is read.
 void setCurrentWireFormatVersion(int version)
          set the current version
abstract  byte[] toBytes(Packet packet)
          A helper method which converts a packet into a byte array
abstract  Packet writePacket(Packet packet, DataOutput dataOut)
          Writes the packet to the given output stream
 
Methods inherited from class org.activemq.io.AbstractWireFormat
doesSupportMessageCompression, doesSupportMessageFragmentation, fromBytes, fromBytes, getTransportDataIn, getTransportDataOut, initiateClientSideProtocol, initiateServerSideProtocol, isCachingEnabled, readPacket, readPacket, registerTransportStreams, setCachingEnabled, setTransportDataIn, setTransportDataOut, writePacket
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WIRE_FORMAT_VERSION

public static final int WIRE_FORMAT_VERSION
Current wire format version for this implementation

See Also:
Constant Field Values

messageReader

protected transient PacketReader messageReader

textMessageReader

protected transient PacketReader textMessageReader

objectMessageReader

protected transient PacketReader objectMessageReader

bytesMessageReader

protected transient PacketReader bytesMessageReader

streamMessageReader

protected transient PacketReader streamMessageReader

mapMessageReader

protected transient PacketReader mapMessageReader

messageAckReader

protected transient PacketReader messageAckReader

receiptReader

protected transient PacketReader receiptReader

consumerInfoReader

protected transient PacketReader consumerInfoReader

producerInfoReader

protected transient PacketReader producerInfoReader

transactionInfoReader

protected transient PacketReader transactionInfoReader

xaTransactionInfoReader

protected transient PacketReader xaTransactionInfoReader

brokerInfoReader

protected transient PacketReader brokerInfoReader

connectionInfoReader

protected transient PacketReader connectionInfoReader

sessionInfoReader

protected transient PacketReader sessionInfoReader

durableUnsubscribeReader

protected transient PacketReader durableUnsubscribeReader

reponseReceiptReader

protected transient PacketReader reponseReceiptReader

intReponseReceiptReader

protected transient PacketReader intReponseReceiptReader

capacityInfoReader

protected transient PacketReader capacityInfoReader

capacityInfoRequestReader

protected transient PacketReader capacityInfoRequestReader

wireFormatInfoReader

protected transient PacketReader wireFormatInfoReader

keepAliveReader

protected transient PacketReader keepAliveReader

brokerAdminCommandReader

protected transient PacketReader brokerAdminCommandReader

cachedValueReader

protected transient PacketReader cachedValueReader

cleanupConnectionAndSessionInfoReader

protected transient PacketReader cleanupConnectionAndSessionInfoReader

messageWriter

protected transient PacketWriter messageWriter

textMessageWriter

protected transient PacketWriter textMessageWriter

objectMessageWriter

protected transient PacketWriter objectMessageWriter

bytesMessageWriter

protected transient PacketWriter bytesMessageWriter

streamMessageWriter

protected transient PacketWriter streamMessageWriter

mapMessageWriter

protected transient PacketWriter mapMessageWriter

messageAckWriter

protected transient PacketWriter messageAckWriter

receiptWriter

protected transient PacketWriter receiptWriter

consumerInfoWriter

protected transient PacketWriter consumerInfoWriter

producerInfoWriter

protected transient PacketWriter producerInfoWriter

transactionInfoWriter

protected transient PacketWriter transactionInfoWriter

xaTransactionInfoWriter

protected transient PacketWriter xaTransactionInfoWriter

brokerInfoWriter

protected transient PacketWriter brokerInfoWriter

connectionInfoWriter

protected transient PacketWriter connectionInfoWriter

sessionInfoWriter

protected transient PacketWriter sessionInfoWriter

durableUnsubscribeWriter

protected transient PacketWriter durableUnsubscribeWriter

reponseReceiptWriter

protected transient PacketWriter reponseReceiptWriter

intReponseReceiptWriter

protected transient PacketWriter intReponseReceiptWriter

capacityInfoWriter

protected transient PacketWriter capacityInfoWriter

capacityInfoRequestWriter

protected transient PacketWriter capacityInfoRequestWriter

wireFormatInfoWriter

protected transient PacketWriter wireFormatInfoWriter

keepAliveWriter

protected transient PacketWriter keepAliveWriter

brokerAdminCommandWriter

protected transient PacketWriter brokerAdminCommandWriter

cachedValueWriter

protected transient PacketWriter cachedValueWriter

cleanupConnectionAndSessionInfoWriter

protected transient PacketWriter cleanupConnectionAndSessionInfoWriter

currentWireFormatVersion

protected transient int currentWireFormatVersion
Constructor Detail

AbstractDefaultWireFormat

public AbstractDefaultWireFormat()
Default Constructor

Method Detail

toBytes

public abstract byte[] toBytes(Packet packet)
                        throws IOException
Description copied from class: AbstractWireFormat
A helper method which converts a packet into a byte array

Specified by:
toBytes in interface WireFormat
Overrides:
toBytes in class AbstractWireFormat
Returns:
a byte array representing the packet using some wire protocol
Throws:
IOException

writePacket

public abstract Packet writePacket(Packet packet,
                                   DataOutput dataOut)
                            throws IOException
Description copied from interface: WireFormat
Writes the packet to the given output stream

Specified by:
writePacket in interface WireFormat
Returns:
a response packet - or null
Throws:
IOException

readPacket

protected abstract Packet readPacket(DataInput dataIn,
                                     PacketReader reader)
                              throws IOException
Throws:
IOException

handleCachedValue

protected abstract void handleCachedValue(CachedValue cv)

getValueFromReadCache

public abstract Object getValueFromReadCache(short key)

initiateClientSideProtocol

public void initiateClientSideProtocol(DataOutputStream dataOut,
                                       DataInputStream dataIn)
                                throws JMSException
Some wire formats require a handshake at start-up

Parameters:
dataOut -
dataIn -
Throws:
JMSException

initiateServerSideProtocol

public void initiateServerSideProtocol(DataOutputStream dataOut,
                                       DataInputStream dataIn)
                                throws JMSException
Some wire formats require a handshake at start-up

Parameters:
dataOut -
dataIn -
Throws:
JMSException

copy

public abstract WireFormat copy()
Description copied from interface: WireFormat
Creates a new copy of this wire format so it can be used in another thread/context

Specified by:
copy in interface WireFormat
Returns:
new WireFormat

readPacket

public Packet readPacket(int firstByte,
                         DataInput dataIn)
                  throws IOException
Description copied from interface: WireFormat
A helper method for working with sockets where the first byte is read first, then the rest of the message is read.

Its common when dealing with sockets to have different timeout semantics until the first non-zero byte is read of a message, after which time a zero timeout is used.

Specified by:
readPacket in interface WireFormat
Parameters:
firstByte -
dataIn -
Returns:
Throws:
IOException

getWriter

protected PacketWriter getWriter(Packet packet)
                          throws IOException
Throws:
IOException

canProcessWireFormatVersion

public boolean canProcessWireFormatVersion(int version)
Can this wireformat process packets of this version

Specified by:
canProcessWireFormatVersion in interface WireFormat
Parameters:
version - the version number to test
Returns:
true if can accept the version

getCurrentWireFormatVersion

public int getCurrentWireFormatVersion()
Specified by:
getCurrentWireFormatVersion in interface WireFormat
Returns:
the current version of this wire format

setCurrentWireFormatVersion

public void setCurrentWireFormatVersion(int version)
set the current version

Parameters:
version -


Copyright © 2004-2010 Protique, Ltd.. All Rights Reserved.