activemq-cpp-3.6.0
activemq::wireformat::openwire::OpenWireFormat Class Reference

#include <src/main/activemq/wireformat/openwire/OpenWireFormat.h>

Inheritance diagram for activemq::wireformat::openwire::OpenWireFormat:

Public Member Functions

 OpenWireFormat (const decaf::util::Properties &properties)
 Constructs a new OpenWireFormat object.
virtual ~OpenWireFormat ()
virtual bool hasNegotiator () const
 Returns true if this WireFormat has a Negotiator that needs to wrap the Transport that uses it.
Returns
true if the WireFormat provides a Negotiator.

virtual Pointer
< transport::Transport
createNegotiator (const Pointer< transport::Transport > transport)
 If the Transport Provides a Negotiator this method will create and return a new instance of the Negotiator.
Parameters
transportThe Transport to Wrap the Negotiator around.
Returns
new instance of a WireFormatNegotiator as a Pointer<Transport>.
Exceptions
UnsupportedOperationExceptionif the WireFormat doesn't have a Negotiator.

void addMarshaller (marshal::DataStreamMarshaller *marshaler)
 Allows an external source to add marshalers to this object for types that may be marshaled or unmarshaled.
virtual void marshal (const Pointer< commands::Command > command, const activemq::transport::Transport *transport, decaf::io::DataOutputStream *out)
 Stream based marshaling of a Command, this method blocks until the entire Command has been written out to the output stream.
Parameters
commandThe Command to Marshal
transportThe Transport that called this method.
outThe output stream to write the command to.
Exceptions
IOExceptionif an I/O error occurs.

virtual Pointer
< commands::Command
unmarshal (const activemq::transport::Transport *transport, decaf::io::DataInputStream *in)
 Stream based unmarshaling, blocks on reads on the input stream until a complete command has been read and unmarshaled into the correct form.Returns a Pointer to the newly unmarshaled Command.
Parameters
transportPointer to the transport that is making this request.
inThe input stream to read the command from.
Returns
the newly marshaled Command, caller owns the pointer
Exceptions
IOExceptionif an I/O error occurs.

virtual int tightMarshalNestedObject1 (commands::DataStructure *object, utils::BooleanStream *bs)
 Utility method for Tight Marshaling the given object to the boolean stream passed.
void tightMarshalNestedObject2 (commands::DataStructure *o, decaf::io::DataOutputStream *ds, utils::BooleanStream *bs)
 Utility method that will Tight marshal some internally nested object that implements the DataStructure interface.
commands::DataStructuretightUnmarshalNestedObject (decaf::io::DataInputStream *dis, utils::BooleanStream *bs)
 Utility method used to Unmarshal a Nested DataStructure type object from the given DataInputStream.
commands::DataStructurelooseUnmarshalNestedObject (decaf::io::DataInputStream *dis)
 Utility method to unmarshal an DataStructure object from an DataInputStream using the Loose Unmarshaling format.
void looseMarshalNestedObject (commands::DataStructure *o, decaf::io::DataOutputStream *dataOut)
 Utility method to loosely Marshal an object that is derived from the DataStrucutre interface.
void renegotiateWireFormat (const commands::WireFormatInfo &info)
 Called to re-negotiate the settings for the WireFormatInfo, these determine how the client and broker communicate.
void setPreferedWireFormatInfo (const Pointer< commands::WireFormatInfo > info)
 Configures this object using the provided WireformatInfo object.
const Pointer
< commands::WireFormatInfo > & 
getPreferedWireFormatInfo () const
 Gets the Preferred WireFormatInfo object that this class holds.
bool isStackTraceEnabled () const
 Checks if the stackTraceEnabled flag is on.
void setStackTraceEnabled (bool stackTraceEnabled)
 Sets if the stackTraceEnabled flag is on.
bool isTcpNoDelayEnabled () const
 Checks if the tcpNoDelayEnabled flag is on.
void setTcpNoDelayEnabled (bool tcpNoDelayEnabled)
 Sets if the tcpNoDelayEnabled flag is on.
int getVersion () const
 Get the current Wireformat Version.
void setVersion (int version)
 Set the current Wireformat Version.
virtual bool inReceive () const
 Is there a Message being unmarshaled?
bool isCacheEnabled () const
 Checks if the cacheEnabled flag is on.
void setCacheEnabled (bool cacheEnabled)
 Sets if the cacheEnabled flag is on.
int getCacheSize () const
 Returns the currently set Cache size.
void setCacheSize (int value)
 Sets the current Cache size.
bool isTightEncodingEnabled () const
 Checks if the tightEncodingEnabled flag is on.
void setTightEncodingEnabled (bool tightEncodingEnabled)
 Sets if the tightEncodingEnabled flag is on.
bool isSizePrefixDisabled () const
 Checks if the sizePrefixDisabled flag is on.
void setSizePrefixDisabled (bool sizePrefixDisabled)
 Sets if the sizePrefixDisabled flag is on.
long long getMaxInactivityDuration () const
 Gets the MaxInactivityDuration setting.
void setMaxInactivityDuration (long long value)
 Sets the MaxInactivityDuration setting.
long long getMaxInactivityDurationInitialDelay () const
 Gets the MaxInactivityDurationInitialDelay setting.
void setMaxInactivityDurationInitialDelay (long long value)
 Sets the MaxInactivityDurationInitialDelay setting.
- Public Member Functions inherited from activemq::wireformat::WireFormat
virtual ~WireFormat ()

Protected Member Functions

commands::DataStructuredoUnmarshal (decaf::io::DataInputStream *dis)
 Perform the actual unmarshal of data from the given DataInputStream return the unmarshalled DataStrucutre object once done, caller takes ownership of this object.
void destroyMarshalers ()
 Cleans up all registered Marshallers and empties the dataMarshallers vector.

Static Protected Attributes

static const unsigned char NULL_TYPE
static const int DEFAULT_VERSION
static const int MAX_SUPPORTED_VERSION

Constructor & Destructor Documentation

activemq::wireformat::openwire::OpenWireFormat::OpenWireFormat ( const decaf::util::Properties properties)

Constructs a new OpenWireFormat object.

Parameters
properties- can contain optional config params.
virtual activemq::wireformat::openwire::OpenWireFormat::~OpenWireFormat ( )
virtual

Member Function Documentation

void activemq::wireformat::openwire::OpenWireFormat::addMarshaller ( marshal::DataStreamMarshaller marshaler)

Allows an external source to add marshalers to this object for types that may be marshaled or unmarshaled.

Parameters
marshaler- the Marshaler to add to the collection.
virtual Pointer<transport::Transport> activemq::wireformat::openwire::OpenWireFormat::createNegotiator ( const Pointer< transport::Transport transport)
virtual

If the Transport Provides a Negotiator this method will create and return a new instance of the Negotiator.

Parameters
transportThe Transport to Wrap the Negotiator around.
Returns
new instance of a WireFormatNegotiator as a Pointer<Transport>.
Exceptions
UnsupportedOperationExceptionif the WireFormat doesn't have a Negotiator.

Implements activemq::wireformat::WireFormat.

void activemq::wireformat::openwire::OpenWireFormat::destroyMarshalers ( )
protected

Cleans up all registered Marshallers and empties the dataMarshallers vector.

This should be called before a reconfiguration of the version marshallers, or on destruction of this object

commands::DataStructure* activemq::wireformat::openwire::OpenWireFormat::doUnmarshal ( decaf::io::DataInputStream dis)
protected

Perform the actual unmarshal of data from the given DataInputStream return the unmarshalled DataStrucutre object once done, caller takes ownership of this object.

This method can return null if the type of the object to unmarshal is NULL, empty data.

Parameters
disThe DataInputStream to read from.
Returns
new DataStructure* that the caller owns.
Exceptions
IOExceptionif an error occurs during the unmarshal.
int activemq::wireformat::openwire::OpenWireFormat::getCacheSize ( ) const
inline

Returns the currently set Cache size.

Returns
the current value of the broker's cache size.
long long activemq::wireformat::openwire::OpenWireFormat::getMaxInactivityDuration ( ) const
inline

Gets the MaxInactivityDuration setting.

Returns
maximum inactivity duration value in milliseconds.
long long activemq::wireformat::openwire::OpenWireFormat::getMaxInactivityDurationInitialDelay ( ) const
inline

Gets the MaxInactivityDurationInitialDelay setting.

Returns
maximum inactivity duration initial delay value in milliseconds.
const Pointer<commands::WireFormatInfo>& activemq::wireformat::openwire::OpenWireFormat::getPreferedWireFormatInfo ( ) const
inline

Gets the Preferred WireFormatInfo object that this class holds.

Returns
pointer to a preferred WireFormatInfo object
int activemq::wireformat::openwire::OpenWireFormat::getVersion ( ) const
inlinevirtual

Get the current Wireformat Version.

Returns
int that identifies the version

Implements activemq::wireformat::WireFormat.

virtual bool activemq::wireformat::openwire::OpenWireFormat::hasNegotiator ( ) const
inlinevirtual

Returns true if this WireFormat has a Negotiator that needs to wrap the Transport that uses it.

Returns
true if the WireFormat provides a Negotiator.

Implements activemq::wireformat::WireFormat.

virtual bool activemq::wireformat::openwire::OpenWireFormat::inReceive ( ) const
inlinevirtual

Is there a Message being unmarshaled?

Returns
true while in the doUnmarshal method.

Implements activemq::wireformat::WireFormat.

bool activemq::wireformat::openwire::OpenWireFormat::isCacheEnabled ( ) const
inline

Checks if the cacheEnabled flag is on.

Returns
true if the flag is on.
bool activemq::wireformat::openwire::OpenWireFormat::isSizePrefixDisabled ( ) const
inline

Checks if the sizePrefixDisabled flag is on.

Returns
true if the flag is on.
bool activemq::wireformat::openwire::OpenWireFormat::isStackTraceEnabled ( ) const
inline

Checks if the stackTraceEnabled flag is on.

Returns
true if the flag is on.
bool activemq::wireformat::openwire::OpenWireFormat::isTcpNoDelayEnabled ( ) const
inline

Checks if the tcpNoDelayEnabled flag is on.

Returns
true if the flag is on.
bool activemq::wireformat::openwire::OpenWireFormat::isTightEncodingEnabled ( ) const
inline

Checks if the tightEncodingEnabled flag is on.

Returns
true if the flag is on.
void activemq::wireformat::openwire::OpenWireFormat::looseMarshalNestedObject ( commands::DataStructure o,
decaf::io::DataOutputStream dataOut 
)

Utility method to loosely Marshal an object that is derived from the DataStrucutre interface.

The marshaled data is written to the passed in DataOutputStream.

Parameters
o- DataStructure derived Object to Marshal
dataOut- DataOutputStream to write the data to
Exceptions
IOExceptionif an error occurs.
commands::DataStructure* activemq::wireformat::openwire::OpenWireFormat::looseUnmarshalNestedObject ( decaf::io::DataInputStream dis)

Utility method to unmarshal an DataStructure object from an DataInputStream using the Loose Unmarshaling format.

Will read the Data and construct a new DataStructure based Object, the pointer to the Object returned is now owned by the caller.

Parameters
dis- the DataInputStream to read the data from
Returns
a new DataStructure derived Object pointer
Exceptions
IOExceptionif an error occurs.
virtual void activemq::wireformat::openwire::OpenWireFormat::marshal ( const Pointer< commands::Command command,
const activemq::transport::Transport transport,
decaf::io::DataOutputStream out 
)
virtual

Stream based marshaling of a Command, this method blocks until the entire Command has been written out to the output stream.

Parameters
commandThe Command to Marshal
transportThe Transport that called this method.
outThe output stream to write the command to.
Exceptions
IOExceptionif an I/O error occurs.

Implements activemq::wireformat::WireFormat.

void activemq::wireformat::openwire::OpenWireFormat::renegotiateWireFormat ( const commands::WireFormatInfo info)

Called to re-negotiate the settings for the WireFormatInfo, these determine how the client and broker communicate.

Parameters
infoThe new Wireformat Info settings.
Exceptions
IllegalStateExceptionis wire format can't be negotiated.
void activemq::wireformat::openwire::OpenWireFormat::setCacheEnabled ( bool  cacheEnabled)
inline

Sets if the cacheEnabled flag is on.

Parameters
cacheEnabled- true to turn flag is on
void activemq::wireformat::openwire::OpenWireFormat::setCacheSize ( int  value)
inline

Sets the current Cache size.

Parameters
value- the value to send as the broker's cache size.
void activemq::wireformat::openwire::OpenWireFormat::setMaxInactivityDuration ( long long  value)
inline

Sets the MaxInactivityDuration setting.

Parameters
value- the Max inactivity duration value in milliseconds.
void activemq::wireformat::openwire::OpenWireFormat::setMaxInactivityDurationInitialDelay ( long long  value)
inline

Sets the MaxInactivityDurationInitialDelay setting.

Parameters
value- the Max inactivity Initial Delay duration value in milliseconds.
void activemq::wireformat::openwire::OpenWireFormat::setPreferedWireFormatInfo ( const Pointer< commands::WireFormatInfo info)

Configures this object using the provided WireformatInfo object.

Parameters
infoA WireFormatInfo object, takes ownership.
Exceptions
IllegalStateExceptionif the WireFormat object has not been initialized.
void activemq::wireformat::openwire::OpenWireFormat::setSizePrefixDisabled ( bool  sizePrefixDisabled)
inline

Sets if the sizePrefixDisabled flag is on.

Parameters
sizePrefixDisabled- true to turn flag is on
void activemq::wireformat::openwire::OpenWireFormat::setStackTraceEnabled ( bool  stackTraceEnabled)
inline

Sets if the stackTraceEnabled flag is on.

Parameters
stackTraceEnabled- true to turn flag is on
void activemq::wireformat::openwire::OpenWireFormat::setTcpNoDelayEnabled ( bool  tcpNoDelayEnabled)
inline

Sets if the tcpNoDelayEnabled flag is on.

Parameters
tcpNoDelayEnabled- true to turn flag is on
void activemq::wireformat::openwire::OpenWireFormat::setTightEncodingEnabled ( bool  tightEncodingEnabled)
inline

Sets if the tightEncodingEnabled flag is on.

Parameters
tightEncodingEnabled- true to turn flag is on
void activemq::wireformat::openwire::OpenWireFormat::setVersion ( int  version)
virtual

Set the current Wireformat Version.

Parameters
versionAn int that identifies the version
Exceptions
IllegalArgumentExceptionif the version given is not supported.

Implements activemq::wireformat::WireFormat.

virtual int activemq::wireformat::openwire::OpenWireFormat::tightMarshalNestedObject1 ( commands::DataStructure object,
utils::BooleanStream bs 
)
virtual

Utility method for Tight Marshaling the given object to the boolean stream passed.

Parameters
object- The DataStructure to marshal
bs- the BooleanStream to write to
Returns
size of the data returned.
void activemq::wireformat::openwire::OpenWireFormat::tightMarshalNestedObject2 ( commands::DataStructure o,
decaf::io::DataOutputStream ds,
utils::BooleanStream bs 
)

Utility method that will Tight marshal some internally nested object that implements the DataStructure interface.

Writes the data to the Data Output Stream provided.

Parameters
o- DataStructure object
ds- DataOuputStream for writing
bs- BooleanStream
Exceptions
IOExceptionif an error occurs.
commands::DataStructure* activemq::wireformat::openwire::OpenWireFormat::tightUnmarshalNestedObject ( decaf::io::DataInputStream dis,
utils::BooleanStream bs 
)

Utility method used to Unmarshal a Nested DataStructure type object from the given DataInputStream.

The DataStructure instance that is returned is now the property of the caller.

Parameters
dis- DataInputStream to read from
bs- BooleanStream to read from
Returns
Newly allocated DataStructure Object
Exceptions
IOExceptionif an error occurs.
virtual Pointer<commands::Command> activemq::wireformat::openwire::OpenWireFormat::unmarshal ( const activemq::transport::Transport transport,
decaf::io::DataInputStream in 
)
virtual

Stream based unmarshaling, blocks on reads on the input stream until a complete command has been read and unmarshaled into the correct form.Returns a Pointer to the newly unmarshaled Command.

Parameters
transportPointer to the transport that is making this request.
inThe input stream to read the command from.
Returns
the newly marshaled Command, caller owns the pointer
Exceptions
IOExceptionif an I/O error occurs.

Implements activemq::wireformat::WireFormat.

Field Documentation

const int activemq::wireformat::openwire::OpenWireFormat::DEFAULT_VERSION
staticprotected
const int activemq::wireformat::openwire::OpenWireFormat::MAX_SUPPORTED_VERSION
staticprotected
const unsigned char activemq::wireformat::openwire::OpenWireFormat::NULL_TYPE
staticprotected

The documentation for this class was generated from the following file: