Class JmsFrameTranslator
- java.lang.Object
-
- org.apache.activemq.transport.stomp.LegacyFrameTranslator
-
- org.apache.activemq.transport.stomp.JmsFrameTranslator
-
- All Implemented Interfaces:
BrokerContextAware
,FrameTranslator
public class JmsFrameTranslator extends LegacyFrameTranslator implements BrokerContextAware
Frame translator implementation that uses XStream to convert messages to and from XML and JSON
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.activemq.transport.stomp.FrameTranslator
FrameTranslator.Helper
-
-
Constructor Summary
Constructors Constructor Description JmsFrameTranslator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ActiveMQMessage
convertFrame(ProtocolConverter converter, StompFrame command)
StompFrame
convertMessage(ProtocolConverter converter, ActiveMQMessage message)
protected ActiveMQMapMessage
createMapMessage(com.thoughtworks.xstream.io.HierarchicalStreamReader in)
protected ActiveMQObjectMessage
createObjectMessage(com.thoughtworks.xstream.io.HierarchicalStreamReader in)
protected com.thoughtworks.xstream.XStream
createXStream()
BrokerContext
getBrokerContext()
com.thoughtworks.xstream.XStream
getXStream()
protected String
marshall(Serializable object, String transformation)
Marshal the Object to a string using XML or JSON encodingprotected String
marshallAdvisory(DataStructure ds)
Return an Advisory message as a JSON formatted stringprotected String
marshallAdvisory(DataStructure ds, String transformation)
void
setBrokerContext(BrokerContext brokerContext)
void
setXStream(com.thoughtworks.xstream.XStream xStream)
-
Methods inherited from class org.apache.activemq.transport.stomp.LegacyFrameTranslator
convertDestination, convertDestination
-
-
-
-
Method Detail
-
convertFrame
public ActiveMQMessage convertFrame(ProtocolConverter converter, StompFrame command) throws JMSException, ProtocolException
- Specified by:
convertFrame
in interfaceFrameTranslator
- Overrides:
convertFrame
in classLegacyFrameTranslator
- Throws:
JMSException
ProtocolException
-
convertMessage
public StompFrame convertMessage(ProtocolConverter converter, ActiveMQMessage message) throws IOException, JMSException
- Specified by:
convertMessage
in interfaceFrameTranslator
- Overrides:
convertMessage
in classLegacyFrameTranslator
- Throws:
IOException
JMSException
-
marshall
protected String marshall(Serializable object, String transformation) throws JMSException
Marshal the Object to a string using XML or JSON encoding- Parameters:
object
- the object to marshaltransformation
- the transformation to apply to the object.- Throws:
JMSException
- if an error occurs during the marshal operation.
-
createObjectMessage
protected ActiveMQObjectMessage createObjectMessage(com.thoughtworks.xstream.io.HierarchicalStreamReader in) throws JMSException
- Throws:
JMSException
-
createMapMessage
protected ActiveMQMapMessage createMapMessage(com.thoughtworks.xstream.io.HierarchicalStreamReader in) throws JMSException
- Throws:
JMSException
-
marshallAdvisory
protected String marshallAdvisory(DataStructure ds, String transformation)
-
getXStream
public com.thoughtworks.xstream.XStream getXStream()
-
setXStream
public void setXStream(com.thoughtworks.xstream.XStream xStream)
-
createXStream
protected com.thoughtworks.xstream.XStream createXStream()
-
setBrokerContext
public void setBrokerContext(BrokerContext brokerContext)
- Specified by:
setBrokerContext
in interfaceBrokerContextAware
-
getBrokerContext
public BrokerContext getBrokerContext()
- Specified by:
getBrokerContext
in interfaceBrokerContextAware
-
marshallAdvisory
protected String marshallAdvisory(DataStructure ds)
Return an Advisory message as a JSON formatted string- Parameters:
ds
- the DataStructure instance that is being marshaled.- Returns:
- the JSON marshaled form of the given DataStructure instance.
-
-