org.apache.servicemix.jms
Class DefaultJmsMarshaler

java.lang.Object
  extended by org.apache.servicemix.jms.DefaultJmsMarshaler
All Implemented Interfaces:
JmsMarshaler

public class DefaultJmsMarshaler
extends java.lang.Object
implements JmsMarshaler

Encapsulates the conversion to and from JMS messages


Field Summary
static java.lang.String CONTENT_TYPE
           
static java.lang.String DONE_JMS_PROPERTY
           
static java.lang.String ERROR_JMS_PROPERTY
           
static java.lang.String FAULT_JMS_PROPERTY
           
 
Constructor Summary
DefaultJmsMarshaler(JmsEndpoint endpoint)
           
 
Method Summary
 javax.jms.Message toJMS(java.lang.Exception e, javax.jms.Session session)
          Converts an Exception into an JMS message.
 javax.jms.Message toJMS(SoapMessage message, java.util.Map headers, javax.jms.Session session)
          Converts a SOAP message to a JMS message, including any message headers.
protected  javax.jms.Message toJMS(SoapMessage message, javax.jms.Session session)
          Template method to allow custom functionality.
 SoapMessage toSOAP(javax.jms.Message message)
          Converts a JMS message into a SOAP message
protected  java.io.InputStream toXmlInputStream(javax.jms.Message message)
          Template method to allow custom functionality.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTENT_TYPE

public static final java.lang.String CONTENT_TYPE
See Also:
Constant Field Values

DONE_JMS_PROPERTY

public static final java.lang.String DONE_JMS_PROPERTY
See Also:
Constant Field Values

FAULT_JMS_PROPERTY

public static final java.lang.String FAULT_JMS_PROPERTY
See Also:
Constant Field Values

ERROR_JMS_PROPERTY

public static final java.lang.String ERROR_JMS_PROPERTY
See Also:
Constant Field Values
Constructor Detail

DefaultJmsMarshaler

public DefaultJmsMarshaler(JmsEndpoint endpoint)
Method Detail

toJMS

public javax.jms.Message toJMS(java.lang.Exception e,
                               javax.jms.Session session)
                        throws java.lang.Exception
Converts an Exception into an JMS message. This method will be invoked when the MessageExchange contains an error.

Specified by:
toJMS in interface JmsMarshaler
Parameters:
e - Exception to convert
session - JMS session used to create JMS messages
Returns:
JMS message
Throws:
java.lang.Exception
See Also:
MessageExchange.getError()

toJMS

protected javax.jms.Message toJMS(SoapMessage message,
                                  javax.jms.Session session)
                           throws java.lang.Exception
Template method to allow custom functionality. Custom JmsMarshallers should override this method.

Parameters:
message - Source message
session - JMS session used to create JMS messages
Returns:
JMS version of the specified source SOAP message
Throws:
java.lang.Exception - if an IO error occurs
javax.jms.JMSException - if a JMS error occurs

toJMS

public javax.jms.Message toJMS(SoapMessage message,
                               java.util.Map headers,
                               javax.jms.Session session)
                        throws java.lang.Exception
Converts a SOAP message to a JMS message, including any message headers.

Specified by:
toJMS in interface JmsMarshaler
Parameters:
message - message to convert
headers - protocol headers present in the NormalizedMessage
session - JMS session used to create JMS messages
Returns:
JMS message
Throws:
java.lang.Exception - if something bad happens

toXmlInputStream

protected java.io.InputStream toXmlInputStream(javax.jms.Message message)
                                        throws java.lang.Exception
Template method to allow custom functionality. Custom JmsMarshalers should override this method.

Parameters:
message - Message to be turned into XML/SOAP
Returns:
Stream containing either the whole SOAP envelope or just the payload of the body.
Throws:
java.lang.Exception - if JMS message is an ObjectMessage containing an Exception (the containing exception is thrown.)
javax.jms.JMSException - if a JMS problem occurs
java.lang.UnsupportedOperationException - if the JMS message is an ObjectMessage which contains something other than an Exception
java.lang.IllegalArgumentException - if the message is anything other than a TextMessage or BytesMessage

toSOAP

public SoapMessage toSOAP(javax.jms.Message message)
                   throws java.lang.Exception
Converts a JMS message into a SOAP message

Specified by:
toSOAP in interface JmsMarshaler
Parameters:
message - JMS message to convert
Returns:
SOAP representation of the specified JMS message
Throws:
java.lang.Exception - if an IO exception occurs


Copyright © 2005-2014 FuseSource. All Rights Reserved.