com.j_spaces.jms
Class GSMapMessageImpl

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

public class GSMapMessageImpl
extends GSMessageImpl
implements MapMessage

A MapMassage implementation for the GigaSpaces JMS API wrapping.

See Also:
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
GSMapMessageImpl()
          Instantiates a new MapMessage.
GSMapMessageImpl(GSSessionImpl session)
          Instantiates a new MapMessage.
GSMapMessageImpl(GSSessionImpl session, HashMap<String,Object> map)
          Instantiates a new MapMessage.
 
Method Summary
 void clearBody()
          API method.
 boolean getBoolean(String name)
           
 byte getByte(String name)
           
 byte[] getBytes(String name)
           
 char getChar(String name)
           
 double getDouble(String name)
           
 float getFloat(String name)
           
 int getInt(String name)
           
 long getLong(String name)
           
 HashMap<String,Object> getMap()
          Returns the object's map.
 Enumeration getMapNames()
          Return an Enumeration of all the Map message's names.
 Object getObject(String name)
          Return the Java object value with the given name Note that this method can be used to return in objectified format, an object that had been stored in the Map with the equivalent setObject method call, or it's equivalent primitive set method.
 short getShort(String name)
           
 String getString(String name)
           
 boolean itemExists(String name)
          Check if an item exists in this MapMessage
 void setBoolean(String name, boolean value)
          Set a boolean value with the given name, into the Map
 void setByte(String name, byte value)
          Set a byte value with the given name, into the Map
 void setBytes(String name, byte[] value)
          Set a byte array value with the given name, into the Map
 void setBytes(String name, byte[] value, int offset, int length)
          Set a portion of the byte array value with the given name, into the Map
 void setChar(String name, char value)
          Set a Unicode character value with the given name, into the Map
 void setDouble(String name, double value)
          Set a double value with the given name, into the Map
 void setFloat(String name, float value)
          Set a float value with the given name, into the Map
 void setInt(String name, int value)
          Set an integer value with the given name, into the Map
 void setLong(String name, long value)
          Set a long value with the given name, into the Map
 void setMap(HashMap<String,Object> map)
          Sets the object's map.
 void setObject(String name, Object value)
          Set a Java object value with the given name, into the Map Note that this method only works for the objectified primitive object types (Integer, Double, Long ...), String's and byte arrays.
 void setShort(String name, short value)
          Set a short value with the given name, into the Map
 void setString(String name, String value)
          Set a String value with the given name, into the Map
 
Methods inherited from class com.j_spaces.jms.GSMessageImpl
__getSpaceIndexedFields, acknowledge, 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, 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

GSMapMessageImpl

public GSMapMessageImpl()
                 throws JMSException
Instantiates a new MapMessage.

Throws:
JMSException - if falied to create the message

GSMapMessageImpl

public GSMapMessageImpl(GSSessionImpl session,
                        HashMap<String,Object> map)
                 throws JMSException
Instantiates a new MapMessage. It's important to note that map should contain only values that are valid according to the JMS specification.

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

GSMapMessageImpl

public GSMapMessageImpl(GSSessionImpl session)
                 throws JMSException
Instantiates a new MapMessage. It's important to note that map should contain only values that are valid according to the JMS specification.

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

setMap

public void setMap(HashMap<String,Object> map)
Sets the object's map. It's important to note that map should contain only values that are valid according to the JMS specification.

Parameters:
map - the map

getMap

public HashMap<String,Object> getMap()
Returns the object's map.

Returns:
the object's map

getBoolean

public final boolean getBoolean(String name)
                         throws JMSException,
                                MessageFormatException
Specified by:
getBoolean in interface MapMessage
Throws:
JMSException
MessageFormatException
See Also:
MapMessage.getBoolean(java.lang.String)

getByte

public final byte getByte(String name)
                   throws JMSException,
                          MessageFormatException
Specified by:
getByte in interface MapMessage
Throws:
JMSException
MessageFormatException
See Also:
MapMessage.getByte(java.lang.String)

getShort

public final short getShort(String name)
                     throws JMSException,
                            MessageFormatException
Specified by:
getShort in interface MapMessage
Throws:
JMSException
MessageFormatException
See Also:
MapMessage.getShort(java.lang.String)

getChar

public final char getChar(String name)
                   throws JMSException,
                          MessageFormatException
Specified by:
getChar in interface MapMessage
Throws:
JMSException
MessageFormatException
See Also:
MapMessage.getChar(java.lang.String)

getInt

public final int getInt(String name)
                 throws JMSException,
                        MessageFormatException
Specified by:
getInt in interface MapMessage
Throws:
JMSException
MessageFormatException
See Also:
MapMessage.getInt(java.lang.String)

getLong

public final long getLong(String name)
                   throws JMSException,
                          MessageFormatException
Specified by:
getLong in interface MapMessage
Throws:
JMSException
MessageFormatException
See Also:
javax.jms#getLong(java.lang.String)

getFloat

public final float getFloat(String name)
                     throws JMSException,
                            MessageFormatException
Specified by:
getFloat in interface MapMessage
Throws:
JMSException
MessageFormatException
See Also:
MapMessage.getFloat(java.lang.String)

getDouble

public final double getDouble(String name)
                       throws JMSException,
                              MessageFormatException
Specified by:
getDouble in interface MapMessage
Throws:
JMSException
MessageFormatException
See Also:
MapMessage.getDouble(java.lang.String)

getString

public final String getString(String name)
                       throws JMSException,
                              MessageFormatException
Specified by:
getString in interface MapMessage
Throws:
JMSException
MessageFormatException
See Also:
MapMessage.getString(java.lang.String)

getBytes

public final byte[] getBytes(String name)
                      throws JMSException,
                             MessageFormatException
Specified by:
getBytes in interface MapMessage
Throws:
JMSException
MessageFormatException
See Also:
MapMessage.getBytes(java.lang.String)

getObject

public final Object getObject(String name)
                       throws JMSException
Return the Java object value with the given name

Note that this method can be used to return in objectified format, an object that had been stored in the Map with the equivalent setObject method call, or it's equivalent primitive set method.

Specified by:
getObject in interface MapMessage
Parameters:
name - the name of the Java object
Returns:
a copy of the Java object value with the given name, in objectified format (e.g. if it set as an int, then an Integer is returned). Note that byte values are returned as byte[], not Byte[]. If there is no item by this name, a null value is returned.
Throws:
JMSException - if JMS fails to read the message due to some internal JMS error

getMapNames

public Enumeration getMapNames()
                        throws JMSException
Return an Enumeration of all the Map message's names.

Specified by:
getMapNames in interface MapMessage
Returns:
an enumeration of all the names in this Map message.
Throws:
JMSException
See Also:
MapMessage.getMapNames()

setBoolean

public final void setBoolean(String name,
                             boolean value)
                      throws JMSException
Set a boolean value with the given name, into the Map

Specified by:
setBoolean in interface MapMessage
Parameters:
name - the name of the boolean
value - the boolean value to set in the Map
Throws:
JMSException - if the message is in read-only mode

setByte

public final void setByte(String name,
                          byte value)
                   throws JMSException
Set a byte value with the given name, into the Map

Specified by:
setByte in interface MapMessage
Parameters:
name - the name of the byte
value - the byte value to set in the Map
Throws:
JMSException - if the message is in read-only mode

setShort

public final void setShort(String name,
                           short value)
                    throws JMSException
Set a short value with the given name, into the Map

Specified by:
setShort in interface MapMessage
Parameters:
name - the name of the short
value - the short value to set in the Map
Throws:
JMSException - if the message is in read-only mode

setChar

public final void setChar(String name,
                          char value)
                   throws JMSException
Set a Unicode character value with the given name, into the Map

Specified by:
setChar in interface MapMessage
Parameters:
name - the name of the Unicode character
value - the Unicode character value to set in the Map
Throws:
JMSException - if the message is in read-only mode

setInt

public final void setInt(String name,
                         int value)
                  throws JMSException
Set an integer value with the given name, into the Map

Specified by:
setInt in interface MapMessage
Parameters:
name - the name of the integer
value - the integer value to set in the Map
Throws:
JMSException - if the message is in read-only mode

setLong

public final void setLong(String name,
                          long value)
                   throws JMSException
Set a long value with the given name, into the Map

Specified by:
setLong in interface MapMessage
Parameters:
name - the name of the long
value - the long value to set in the Map
Throws:
JMSException - if the message is in read-only mode

setFloat

public final void setFloat(String name,
                           float value)
                    throws JMSException
Set a float value with the given name, into the Map

Specified by:
setFloat in interface MapMessage
Parameters:
name - the name of the float
value - the float value to set in the Map
Throws:
JMSException - if the message is in read-only mode

setDouble

public final void setDouble(String name,
                            double value)
                     throws JMSException
Set a double value with the given name, into the Map

Specified by:
setDouble in interface MapMessage
Parameters:
name - the name of the double
value - the double value to set in the Map
Throws:
JMSException - if the message is in read-only mode

setString

public final void setString(String name,
                            String value)
                     throws JMSException
Set a String value with the given name, into the Map

Specified by:
setString in interface MapMessage
Parameters:
name - the name of the String
value - the String value to set in the Map
Throws:
JMSException - if the message is in read-only mode

setBytes

public final void setBytes(String name,
                           byte[] value)
                    throws JMSException
Set a byte array value with the given name, into the Map

Specified by:
setBytes in interface MapMessage
Parameters:
name - the name of the byte array
value - the byte array value to set in the Map. The array is copied so the value for name will not be altered by future modifications.
Throws:
JMSException - if the message is in read-only mode

setBytes

public final void setBytes(String name,
                           byte[] value,
                           int offset,
                           int length)
                    throws JMSException
Set a portion of the byte array value with the given name, into the Map

Specified by:
setBytes in interface MapMessage
Parameters:
name - the name of the byte array
value - the byte array value to set in the Map.
offset - the initial offset within the byte array.
length - the number of bytes to use.
Throws:
JMSException - if the message is in read-only mode

setObject

public final void setObject(String name,
                            Object value)
                     throws JMSException
Set a Java object value with the given name, into the Map

Note that this method only works for the objectified primitive object types (Integer, Double, Long ...), String's and byte arrays.

Specified by:
setObject in interface MapMessage
Parameters:
name - the name of the Java object
value - the Java object value to set in the Map
Throws:
MessageFormatException - if object is invalid
JMSException - if message in read-only mode.

itemExists

public boolean itemExists(String name)
                   throws JMSException
Check if an item exists in this MapMessage

Specified by:
itemExists in interface MapMessage
Parameters:
name - the name of the item to test
Returns:
true if the item exists
Throws:
JMSException

clearBody

public void clearBody()
               throws JMSException
API method.

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