org.logicblaze.lingo.jms.marshall
Class DefaultMarshaller

java.lang.Object
  extended by org.logicblaze.lingo.jms.marshall.DefaultMarshaller
All Implemented Interfaces:
Marshaller
Direct Known Subclasses:
XStreamMarshaller

public class DefaultMarshaller
extends Object
implements Marshaller

Represents the strategy of marshalling of requests and responses in and out of JMS messages

Version:
$Revision: 1.5 $

Constructor Summary
DefaultMarshaller()
           
 
Method Summary
protected  void addResponseMessageHeaders(ObjectMessage answer, org.springframework.remoting.support.RemoteInvocationResult result, Message requestMessage)
          A strategy for derived classes to allow them to plug in custom header processing for responses
protected  void appendMessageHeaders(Message message, Requestor requestor, LingoInvocation invocation)
          A strategy method for derived classes to allow them a plugin point to perform custom header processing
protected  void appendMessageHeaders(Message message, Session session, Object value)
           
 Message createObjectMessage(Session session, Object value)
          Creates a message for a Java Object for when distributing objects in collections
 Message createRequestMessage(Requestor requestor, LingoInvocation invocation)
          Creates the request message
 Message createResponseMessage(Session session, org.springframework.remoting.support.RemoteInvocationResult result, Message requestMessage)
          Creates the response message
 org.springframework.remoting.support.RemoteInvocationResult extractInvocationResult(Message message)
          Extracts the invocation result from the response message
protected  String getStickySessionID()
           
protected  void handleInvocationHeaders(Message message)
          A strategy method to allow derived classes to process the headers in a special way
protected  void handleInvocationResultHeaders(Message message)
          A strategy method to allow derived classes to process the headers in a special way
protected  void handleMessageHeaders(Message message)
          A strategy method to allow derived classes to process the headers in a special way
 boolean isIgnoreInvalidMessages()
           
protected  org.springframework.remoting.support.RemoteInvocationResult onInvalidClientMessage(Message message)
           
protected  org.springframework.remoting.support.RemoteInvocation onInvalidMessage(Message message)
          Handle invalid messages by just logging, though a different implementation may wish to throw exceptions
 Object readMessage(Message message)
          Extracts the body from the given JMS message
 org.springframework.remoting.support.RemoteInvocation readRemoteInvocation(Message message)
          Read a RemoteInvocation from the given JMS message
 void setIgnoreInvalidMessages(boolean ignoreInvalidMessages)
          Sets whether invalidly formatted messages should be silently ignored or not
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMarshaller

public DefaultMarshaller()
Method Detail

createRequestMessage

public Message createRequestMessage(Requestor requestor,
                                    LingoInvocation invocation)
                             throws JMSException
Description copied from interface: Marshaller
Creates the request message

Specified by:
createRequestMessage in interface Marshaller
invocation - the remote invocation to send
Throws:
JMSException - if the message could not be created

createResponseMessage

public Message createResponseMessage(Session session,
                                     org.springframework.remoting.support.RemoteInvocationResult result,
                                     Message requestMessage)
                              throws JMSException
Description copied from interface: Marshaller
Creates the response message

Specified by:
createResponseMessage in interface Marshaller
Parameters:
session - the JMS session to use
result - the result invocation
requestMessage - the original request message
Returns:
the response message to send
Throws:
JMSException - if the message could not be created

extractInvocationResult

public org.springframework.remoting.support.RemoteInvocationResult extractInvocationResult(Message message)
                                                                                    throws JMSException
Description copied from interface: Marshaller
Extracts the invocation result from the response message

Specified by:
extractInvocationResult in interface Marshaller
Parameters:
message - the response message
Returns:
the invocation result
Throws:
JMSException - is thrown if a JMS exception occurs

readRemoteInvocation

public org.springframework.remoting.support.RemoteInvocation readRemoteInvocation(Message message)
                                                                           throws JMSException
Description copied from interface: Marshaller
Read a RemoteInvocation from the given JMS message

Specified by:
readRemoteInvocation in interface Marshaller
Parameters:
message - current JMS message
Returns:
the RemoteInvocation object
Throws:
JMSException

createObjectMessage

public Message createObjectMessage(Session session,
                                   Object value)
                            throws JMSException
Description copied from interface: Marshaller
Creates a message for a Java Object for when distributing objects in collections

Specified by:
createObjectMessage in interface Marshaller
Throws:
JMSException

readMessage

public Object readMessage(Message message)
                   throws JMSException
Description copied from interface: Marshaller
Extracts the body from the given JMS message

Specified by:
readMessage in interface Marshaller
Throws:
JMSException

isIgnoreInvalidMessages

public boolean isIgnoreInvalidMessages()

setIgnoreInvalidMessages

public void setIgnoreInvalidMessages(boolean ignoreInvalidMessages)
Sets whether invalidly formatted messages should be silently ignored or not


onInvalidClientMessage

protected org.springframework.remoting.support.RemoteInvocationResult onInvalidClientMessage(Message message)
                                                                                      throws JMSException
Throws:
JMSException

onInvalidMessage

protected org.springframework.remoting.support.RemoteInvocation onInvalidMessage(Message message)
Handle invalid messages by just logging, though a different implementation may wish to throw exceptions


appendMessageHeaders

protected void appendMessageHeaders(Message message,
                                    Requestor requestor,
                                    LingoInvocation invocation)
                             throws JMSException
A strategy method for derived classes to allow them a plugin point to perform custom header processing

Throws:
JMSException

appendMessageHeaders

protected void appendMessageHeaders(Message message,
                                    Session session,
                                    Object value)

getStickySessionID

protected String getStickySessionID()

addResponseMessageHeaders

protected void addResponseMessageHeaders(ObjectMessage answer,
                                         org.springframework.remoting.support.RemoteInvocationResult result,
                                         Message requestMessage)
                                  throws JMSException
A strategy for derived classes to allow them to plug in custom header processing for responses

Throws:
JMSException

handleInvocationHeaders

protected void handleInvocationHeaders(Message message)
A strategy method to allow derived classes to process the headers in a special way


handleInvocationResultHeaders

protected void handleInvocationResultHeaders(Message message)
A strategy method to allow derived classes to process the headers in a special way


handleMessageHeaders

protected void handleMessageHeaders(Message message)
A strategy method to allow derived classes to process the headers in a special way



Copyright © 2005-2006 LogicBlaze, Inc.. All Rights Reserved.