Class AmqpSerializedObjectDelegate
- java.lang.Object
-
- org.apache.qpid.jms.provider.amqp.message.AmqpSerializedObjectDelegate
-
- All Implemented Interfaces:
AmqpObjectTypeDelegate,ClassLoadingAwareObjectInputStream.TrustedClassFilter
public class AmqpSerializedObjectDelegate extends Object implements AmqpObjectTypeDelegate, ClassLoadingAwareObjectInputStream.TrustedClassFilter
Wrapper around an AMQP Message instance that will be treated as a JMS ObjectMessage type.
-
-
Constructor Summary
Constructors Constructor Description AmqpSerializedObjectDelegate(AmqpJmsMessageFacade parent, JmsDeserializationPolicy deserializationPolicy)Create a new delegate that uses Java serialization to store the message content.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcopyInto(AmqpObjectTypeDelegate copy)Copy the internal data into the given instance.SerializablegetObject()Read a Serialized object from the AMQP message using the strategy implemented by this delegate.booleanhasBody()booleanisAmqpTypeEncoded()booleanisTrusted(Class<?> clazz)voidonSend()Signals that the message is about to be sent so we should ensure proper state of the marshaled object and message annotations prior to that.voidsetObject(Serializable value)Given a serializable instance, store the value into the AMQP message using the strategy implemented by this delegate.
-
-
-
Constructor Detail
-
AmqpSerializedObjectDelegate
public AmqpSerializedObjectDelegate(AmqpJmsMessageFacade parent, JmsDeserializationPolicy deserializationPolicy)
Create a new delegate that uses Java serialization to store the message content.- Parameters:
parent- the AMQP message facade instance where the object is to be stored / read.deserializationPolicy- the JmsDeserializationPolicy that is used to validate the security of message content, may be null (e.g on new outgoing messages).
-
-
Method Detail
-
getObject
public Serializable getObject() throws IOException, ClassNotFoundException
Description copied from interface:AmqpObjectTypeDelegateRead a Serialized object from the AMQP message using the strategy implemented by this delegate.- Specified by:
getObjectin interfaceAmqpObjectTypeDelegate- Returns:
- an Object that has been read from the stored object data in the message.
- Throws:
IOException- if an error occurs while reading the stored object.ClassNotFoundException- if no class can be found for the stored type.
-
setObject
public void setObject(Serializable value) throws IOException
Description copied from interface:AmqpObjectTypeDelegateGiven a serializable instance, store the value into the AMQP message using the strategy implemented by this delegate.- Specified by:
setObjectin interfaceAmqpObjectTypeDelegate- Parameters:
value- A serializable object instance to be stored in the message.- Throws:
IOException- if an error occurs during the store operation.
-
onSend
public void onSend()
Description copied from interface:AmqpObjectTypeDelegateSignals that the message is about to be sent so we should ensure proper state of the marshaled object and message annotations prior to that.- Specified by:
onSendin interfaceAmqpObjectTypeDelegate
-
copyInto
public void copyInto(AmqpObjectTypeDelegate copy) throws Exception
Description copied from interface:AmqpObjectTypeDelegateCopy the internal data into the given instance.- Specified by:
copyIntoin interfaceAmqpObjectTypeDelegate- Parameters:
copy- the new delegate that will receive a copy of this instances object data.- Throws:
Exception- if an error occurs while copying the contents to the target.
-
isAmqpTypeEncoded
public boolean isAmqpTypeEncoded()
- Specified by:
isAmqpTypeEncodedin interfaceAmqpObjectTypeDelegate
-
isTrusted
public boolean isTrusted(Class<?> clazz)
- Specified by:
isTrustedin interfaceClassLoadingAwareObjectInputStream.TrustedClassFilter
-
hasBody
public boolean hasBody()
- Specified by:
hasBodyin interfaceAmqpObjectTypeDelegate
-
-