com.j_spaces.jms
Class GSObjectMessageImpl

java.lang.Object
  extended by com.j_spaces.jms.GSMessageImpl
      extended by com.j_spaces.jms.GSObjectMessageImpl
All Implemented Interfaces:
Serializable, Comparable, Message, ObjectMessage

public class GSObjectMessageImpl
extends GSMessageImpl
implements ObjectMessage

Implements the javax.jms.ObjectMessage interface for the GigaSpaces JMS API. An ObjectMessage object is used to send a message that contains a serializable object in the Java programming language ("Java object"). It inherits from the Message interface and adds a body containing a single reference to an object. Only Serializable Java objects can be used.

If a collection of Java objects must be sent, one of the Collection classes provided since JDK 1.2 can be used.

When a client receives an ObjectMessage, it is in read-only mode. If a client attempts to write to the message at this point, a MessageNotWriteableException is thrown. If clearBody is called, the message can now be both read from and written to.

See Also:
Session.createObjectMessage(), Session.createObjectMessage(Serializable), Message, Serialized Form

Field Summary
 
Fields inherited from class com.j_spaces.jms.GSMessageImpl
BODY_NUM, BODY_STR_NAME, BOOLEAN_CLASS_NAME, BYTES, CONTROL_MESSAGE, DESTINATION_CLASS_NAME, HASHMAP_CLASS_NAME, INTEGER_CLASS_NAME, JMS_CORRELATION_ID, JMS_CORRELATION_ID_NUM, JMS_DELIVERY_MODE, JMS_DELIVERY_MODE_NUM, JMS_DESTINATION, JMS_DESTINATION_NUM, JMS_EXPIRATION, JMS_EXPIRATION_NUM, JMS_GSPRODUCER_KEY_PROP_NAME, JMS_GSPRODUCER_KEY_PROP_NUM, JMS_GSTTL_KEY_PROP_NAME, JMS_GSTTL_PROP_NUM, JMS_MESSAGE_ID, JMS_MESSAGE_ID_NUM, JMS_PRIORITY, JMS_PRIORITY_NUM, JMS_REDELIVERED, JMS_REDELIVERED_NUM, JMS_REPLY_TO, JMS_REPLY_TO_NUM, JMS_TIMESTAMP, JMS_TIMESTAMP_NUM, JMS_TYPE, JMS_TYPE_NUM, JMSX_APPID, JMSX_GROUPID, JMSX_GROUPID_PROP_NUM, JMSX_GROUPSEQ, JMSX_GROUPSEQ_PROP_NUM, JMSX_RCV_TIMESTEMP, JMSX_USERID, JMSX_USERID_PROP_NUM, LONG_CLASS_NAME, m_deletedDest, m_denied, m_expired, m_ExtEntryFieldsNames, m_ExtEntryFieldsTypes, m_notWriteable, m_replyToId, m_totalNumOfValues, m_undeliverable, MAP, OBJECT, OBJECT_CLASS_NAME, PROPERTIES_NUM, PROPERTIES_STR_NAME, reservedNumOfValues, SIMPLE, STREAM, STRING_CLASS_NAME, TEXT
 
Fields inherited from interface javax.jms.Message
DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE
 
Constructor Summary
GSObjectMessageImpl(GSSessionImpl session)
          Contructor:
GSObjectMessageImpl(GSSessionImpl session, Serializable objBody)
          Instanciates a bright new GSObjectMessageImpl.
 
Method Summary
 void clearBody()
          Clear out the message body.
 Serializable getObject()
          Get the serializable object containing this message's data.
 void readBody(DataInput dataIn)
          Used to help build the body from an input stream
 void setObject(Serializable obj)
          Set the serializable object containing this message's data.
 String toString()
           
 void writeBody(DataOutput dataOut)
          Used serialize the message body to an output stream
 
Methods inherited from class com.j_spaces.jms.GSMessageImpl
acknowledge, buildBodyFromBytes, clearProperties, compareTo, convertBodyToBytes, getBodyAsBytes, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getMapBody, getObjectProperty, getObjProp, getOptionalHeader, getProperties, getPropertyNames, getShortProperty, getStreamBody, getStringProperty, getTextBody, getToDestination, isBodyRO, isValid, propertyExists, setBodyAsBytes, setBodyAsBytes, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setMapBody, setObjectProperty, setOptionalHeader, setShortProperty, setStreamBody, setStringProperty, setTextBody, setToDestination
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.jms.Message
acknowledge, clearProperties, getBooleanProperty, getByteProperty, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, propertyExists, setBooleanProperty, setByteProperty, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setShortProperty, setStringProperty
 

Constructor Detail

GSObjectMessageImpl

public GSObjectMessageImpl(GSSessionImpl session,
                           Serializable objBody)
                    throws JMSException
Instanciates a bright new GSObjectMessageImpl.

Parameters:
session -
objBody -
Throws:
JMSException

GSObjectMessageImpl

public GSObjectMessageImpl(GSSessionImpl session)
                    throws JMSException
Contructor:

Parameters:
session -
Throws:
JMSException
Method Detail

setObject

public final void setObject(Serializable obj)
                     throws MessageNotWriteableException,
                            JMSException
Set the serializable object containing this message's data. It is important to note that an ObjectMessage contains a snapshot of the object at the time setObject() is called - subsequent modifications of the object will have no affect on the ObjectMessage body.

Specified by:
setObject in interface ObjectMessage
Parameters:
obj - the message's data
Throws:
MessageFormatException - if object serialization fails
MessageNotWriteableException - if the message is read-only
JMSException

getObject

public final Serializable getObject()
                             throws MessageFormatException
Get the serializable object containing this message's data. The default value is null.

Specified by:
getObject in interface ObjectMessage
Returns:
the serializable object containing this message's data
Throws:
MessageFormatException - if object deserialization fails

clearBody

public final void clearBody()
                     throws JMSException
Clear out the message body. Clearing a message's body does not clear its header values or property entries. If this message body was read-only, calling this method leaves the message body is in the same state as an empty body in a newly created message

Specified by:
clearBody in interface Message
Overrides:
clearBody in class GSMessageImpl
Throws:
JMSException
See Also:
Message.clearBody()

toString

public String toString()
Overrides:
toString in class GSMessageImpl

writeBody

public void writeBody(DataOutput dataOut)
               throws IOException
Used serialize the message body to an output stream

Overrides:
writeBody in class GSMessageImpl
Parameters:
dataOut -
Throws:
IOException

readBody

public void readBody(DataInput dataIn)
              throws IOException
Used to help build the body from an input stream

Overrides:
readBody in class GSMessageImpl
Parameters:
dataIn -
Throws:
IOException