Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.activemq.message
Class ActiveMQObjectMessage  view ActiveMQObjectMessage download ActiveMQObjectMessage.java

java.lang.Object
  extended byorg.activemq.message.AbstractPacket
      extended byorg.activemq.message.ActiveMQMessage
          extended byorg.activemq.message.ActiveMQObjectMessage
All Implemented Interfaces:
BodyPacket, java.lang.Comparable, org.activemq.io.util.MemoryManageable, javax.jms.Message, javax.jms.ObjectMessage, Packet

public class ActiveMQObjectMessage
extends ActiveMQMessage
implements javax.jms.ObjectMessage

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.


Field Summary
private  java.io.Serializable object
           
 
Fields inherited from class org.activemq.message.ActiveMQMessage
BOOLEAN, BROKER_NAME_INDEX, BYTE, BYTES, CACHED_DESTINATION_INDEX, CACHED_VALUES_INDEX, CHAR, CID_INDEX, CLUSTER_NAME_INDEX, CORRELATION_INDEX, DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE, DISPATCHED_FROM_DLQ_INDEX, DOUBLE, EOF, EXPIRATION_INDEX, EXTERNAL_MESSAGE_ID_INDEX, FLOAT, INT, LONG, LONG_SEQUENCE_INDEX, MESSAGE_PART_INDEX, NULL, PAYLOAD_INDEX, PROPERTIES_INDEX, readOnlyMessage, REDELIVERED_INDEX, REPLY_TO_INDEX, SHORT, STRING, TIMESTAMP_INDEX, TRANSACTION_ID_INDEX, TYPE_INDEX, XA_TRANS_INDEX
 
Fields inherited from class org.activemq.message.AbstractPacket
bitArray, BROKERS_VISITED_INDEX, cachedHashCode, RECEIPT_REQUIRED_INDEX
 
Fields inherited from interface javax.jms.Message
DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE
 
Fields inherited from interface org.activemq.message.Packet
ACTIVEMQ_BROKER_INFO, ACTIVEMQ_BYTES_MESSAGE, ACTIVEMQ_CONNECTION_INFO, ACTIVEMQ_MAP_MESSAGE, ACTIVEMQ_MESSAGE, ACTIVEMQ_MSG_ACK, ACTIVEMQ_OBJECT_MESSAGE, ACTIVEMQ_STREAM_MESSAGE, ACTIVEMQ_TEXT_MESSAGE, BROKER_ADMIN_COMMAND, CACHED_VALUE_COMMAND, CAPACITY_INFO, CAPACITY_INFO_REQUEST, CLEANUP_CONNECTION_INFO, CONSUMER_INFO, DURABLE_UNSUBSCRIBE, INT_RESPONSE_RECEIPT_INFO, KEEP_ALIVE, NOT_SET, PRODUCER_INFO, RECEIPT_INFO, RESPONSE_RECEIPT_INFO, SESSION_INFO, TRANSACTION_INFO, WIRE_FORMAT_INFO, XA_TRANSACTION_INFO
 
Constructor Summary
ActiveMQObjectMessage()
           
 
Method Summary
 void clearBody()
          Clears out the message body.
protected  javax.jms.JMSException createFailedToBuildBodyException(java.io.IOException ioe)
           
 ActiveMQMessage deepCopy()
           
 java.io.Serializable getObject()
          Gets the serializable object containing this message's data.
 int getPacketType()
          Return the type of Packet
 void prepareMessageBody()
          Prepare a message body for delivery
 void readBody(java.io.DataInput dataIn)
          Used to help build the body from an input stream
 void setObject(java.io.Serializable newObject)
          Sets the serializable object containing this message's data.
 void setObjectPayload(java.lang.Object newObject)
           
 ActiveMQMessage shallowCopy()
           
 java.lang.String toString()
          Convert this Object to a human-readable String.
 void writeBody(java.io.DataOutput dataOut)
          Used serialize the message body to an output stream
 
Methods inherited from class org.activemq.message.ActiveMQMessage
acknowledge, buildBodyFromBytes, clearProperties, compareTo, compareTo, convertBodyToBytes, equals, getBodyAsBytes, getBodyAsBytes, getBooleanProperty, getByteProperty, getConsumerIdentifer, getConsumerNos, getConsumerNosAsString, getDeliveryCount, getDoubleProperty, getEntryBrokerName, getEntryClusterName, getFloatProperty, getIntProperty, getJMSActiveMQDestination, getJMSClientID, getJMSCorrelationID, getJMSCorrelationIDAsBytes, getJMSDeliveryMode, getJMSDestination, getJMSExpiration, getJMSMessageID, getJMSMessageIdentity, getJMSPriority, getJMSRedelivered, getJMSReplyTo, getJMSTimestamp, getJMSType, getLongProperty, getMemoryId, getMessageAcknowledge, getMesssageHandle, getNumberOfParts, getObjectProperty, getParentMessageID, getPartNumber, getPriority, getProducerKey, getProperties, getPropertyNames, getReservedProperty, getSequenceNumber, getShortProperty, getStringProperty, getTransactionId, getTransactionIDString, getVanillaProperty, hashCode, incrementDeliveryCount, incrementRedeliveryCount, initializeOther, isAdvisory, isBodyConvertedToBytes, isConsumerTarget, isDispatchedFromDLQ, isEntryBroker, isEntryCluster, isExpired, isExpired, isExternalMessageId, isJMSMessage, isLastMessagePart, isMessageConsumed, isMessagePart, isPartOfTransaction, isPersistent, isTemporary, isTransientConsumed, isXaTransacted, propertyExists, readMapProperties, resetMessagePart, setBodyAsBytes, setBodyAsBytes, setBooleanProperty, setByteProperty, setConsumerIdentifer, setConsumerNos, setConsumerNosAsString, setDeliveryCount, setDispatchedFromDLQ, setDoubleProperty, setEntryBrokerName, setEntryClusterName, setExternalMessageId, setFloatProperty, setIntProperty, setJMSClientID, setJMSCorrelationID, setJMSCorrelationIDAsBytes, setJMSDeliveryMode, setJMSDestination, setJMSExpiration, setJMSMessageID, setJMSMessageIdentity, setJMSPriority, setJMSRedelivered, setJMSReplyTo, setJMSTimestamp, setJMSType, setLongProperty, setMessageAcknowledge, setMessageConsumed, setMessagePart, setMesssageHandle, setNumberOfParts, setObjectProperty, setParentMessageID, setPartNumber, setProducerKey, setProperties, setReadOnly, setSequenceNumber, setShortProperty, setStringProperty, setTransactionId, setTransactionIDString, setTransientConsumed, toString, vanillaToBoolean, vanillaToByte, vanillaToDouble, vanillaToFloat, vanillaToInt, vanillaToLong, vanillaToShort, vanillaToString, writeMapProperties
 
Methods inherited from class org.activemq.message.AbstractPacket
addBrokerVisited, clearBrokersVisited, decrementMemoryReferenceCount, equals, getBitArray, getBrokersVisited, getBrokersVisitedAsString, getId, getMemoryUsage, getMemoryUsageReferenceCount, getPacketTypeAsString, hasVisited, incrementMemoryReferenceCount, initializeBrokersVisited, initializeOther, isReceipt, isReceiptRequired, setBitArray, setBrokersVisitedAsString, setId, setMemoryUsage, setReceiptRequired
 
Methods inherited from class java.lang.Object
clone, finalize, 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
 
Methods inherited from interface org.activemq.io.util.MemoryManageable
decrementMemoryReferenceCount, getMemoryUsage, getMemoryUsageReferenceCount, incrementMemoryReferenceCount
 

Field Detail

object

private java.io.Serializable object
Constructor Detail

ActiveMQObjectMessage

public ActiveMQObjectMessage()
Method Detail

getPacketType

public int getPacketType()
Return the type of Packet

Specified by:
getPacketType in interface Packet
Overrides:
getPacketType in class ActiveMQMessage

shallowCopy

public ActiveMQMessage shallowCopy()
                            throws javax.jms.JMSException
Overrides:
shallowCopy in class ActiveMQMessage

deepCopy

public ActiveMQMessage deepCopy()
                         throws javax.jms.JMSException
Overrides:
deepCopy in class ActiveMQMessage

clearBody

public void clearBody()
               throws javax.jms.JMSException
Clears 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 in the same state as an empty body in a newly created message.

Specified by:
clearBody in interface javax.jms.Message
Overrides:
clearBody in class ActiveMQMessage

setObject

public void setObject(java.io.Serializable newObject)
               throws javax.jms.JMSException
Sets 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 effect on the ObjectMessage body.

Specified by:
setObject in interface javax.jms.ObjectMessage

setObjectPayload

public void setObjectPayload(java.lang.Object newObject)

getObject

public java.io.Serializable getObject()
                               throws javax.jms.JMSException
Gets the serializable object containing this message's data. The default value is null.

Specified by:
getObject in interface javax.jms.ObjectMessage

prepareMessageBody

public void prepareMessageBody()
                        throws javax.jms.JMSException
Prepare a message body for delivery

Overrides:
prepareMessageBody in class ActiveMQMessage

writeBody

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

Specified by:
writeBody in interface BodyPacket
Overrides:
writeBody in class ActiveMQMessage

readBody

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

Specified by:
readBody in interface BodyPacket
Overrides:
readBody in class ActiveMQMessage

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).

Overrides:
toString in class ActiveMQMessage

createFailedToBuildBodyException

protected javax.jms.JMSException createFailedToBuildBodyException(java.io.IOException ioe)