com.j_spaces.jms
Class GSObjectMessageImpl

java.lang.Object
  extended by com.j_spaces.core.client.MetaDataEntry
      extended by com.j_spaces.jms.GSMessageImpl
          extended by com.j_spaces.jms.GSObjectMessageImpl
All Implemented Interfaces:
IMetaDataEntry, Externalizable, Serializable, Message, ObjectMessage, Entry

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, BODY_STR_NAME, BYTES, DestinationName, JMS_CORRELATION_ID, JMS_DELIVERY_MODE, JMS_DESTINATION, JMS_EXPIRATION, JMS_GSCONNECTION_KEY_NAME, JMS_GSCONVERTER, JMS_GSPRODUCER_KEY_PROP_NAME, JMS_GSTTL_KEY_PROP_NAME, JMS_MESSAGE_ID, JMS_PRIORITY, JMS_REDELIVERED, JMS_REPLY_TO, JMS_TIMESTAMP, JMS_TYPE, JMSCorrelationID, JMSDeliveryMode, JMSDestination, JMSExpiration, JMSMessageID, JMSPriority, JMSRedelivered, JMSReplyTo, JMSTimestamp, JMSType, JMSX_GROUPID, JMSX_GROUPSEQ, JMSX_USERID, MAP, OBJECT, Properties, PROPERTIES_STR_NAME, SIMPLE, STREAM, TEXT
 
Fields inherited from interface javax.jms.Message
DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE
 
Constructor Summary
GSObjectMessageImpl()
          Instantiates a new GSObjectMessageImpl.
GSObjectMessageImpl(GSSessionImpl session)
          Instantiates a new GSObjectMessageImpl.
GSObjectMessageImpl(GSSessionImpl session, Serializable objBody)
          Instantiates a new GSObjectMessageImpl.
 
Method Summary
 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.
 void writeBody(DataOutput dataOut)
          Used serialize the message body to an output stream
 
Methods inherited from class com.j_spaces.jms.GSMessageImpl
__getSpaceIndexedFields, acknowledge, clearBody, clearProperties, equals, getBooleanProperty, getByteProperty, getDestinationName, getDoubleProperty, getFloatProperty, getIntProperty, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getObjectProperty, getPropertyNames, getShortProperty, getStringProperty, hashcode, propertyExists, readExternal, setBooleanProperty, setByteProperty, setDestinationName, setDoubleProperty, setFloatProperty, setIntProperty, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setObjectProperty, setProperties, setRoutingIndexes, setShortProperty, setStringProperty, toString, writeExternal
 
Methods inherited from class com.j_spaces.core.client.MetaDataEntry
__getEntryInfo, __setEntryInfo, isFifo, isNOWriteLeaseMode, isTransient, makePersistent, makeTransient, setFifo, setNOWriteLeaseMode
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.jms.Message
acknowledge, clearBody, 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()
                    throws JMSException
Instantiates a new GSObjectMessageImpl.

Throws:
JMSException - if falied to create the message

GSObjectMessageImpl

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

Parameters:
session - the session of the message
objBody - the object content of the message
Throws:
JMSException - if falied to create the message

GSObjectMessageImpl

public GSObjectMessageImpl(GSSessionImpl session)
                    throws JMSException
Instantiates a new GSObjectMessageImpl.

Parameters:
session - the session of the message
Throws:
JMSException - if falied to create the message
Method Detail

setObject

public final void setObject(Serializable obj)
                     throws 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

writeBody

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

Parameters:
dataOut -
Throws:
IOException

readBody

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

Parameters:
dataIn -
Throws:
IOException