ca.infoway.messagebuilder.transport
Class SimpleRequestMessage

Package class diagram package SimpleRequestMessage
java.lang.Object
  extended by ca.infoway.messagebuilder.transport.SimpleRequestMessage
All Implemented Interfaces:
RequestMessage

public class SimpleRequestMessage
extends Object
implements RequestMessage

A basic implementation of a message that can be sent across a transport layer. Allows the message to be accessed as a string or as a Document.

Must make use of static creation methods in order to construct a SimpleRequestMessage.

Author:
Intelliware Development

Method Summary
static RequestMessage create(Document message)
          Create a message object based on a Document.
static RequestMessage create(Document messageAsDocument, String messageAsString)
          Create a message object based on a Document and string representation.
static RequestMessage create(String message)
          Create a message object based on a string.
 String getInteractionId()
          Obtains the message's interaction id.
 Document getMessageAsDocument()
          Obtains the message as a DOM, converting the underlying structure if necessary (i.e.
 String getMessageAsString()
          Obtains the message as a string, converting the underlying structure if necessary (i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInteractionId

public String getInteractionId()
                        throws TransportLayerException

Obtains the message's interaction id.

Specified by:
getInteractionId in interface RequestMessage
Returns:
the message's interaction id
Throws:
TransportLayerException - if the message's interaction id could not be determined

getMessageAsDocument

public Document getMessageAsDocument()
                              throws TransportLayerException

Obtains the message as a DOM, converting the underlying structure if necessary (i.e. string -> DOM).

Specified by:
getMessageAsDocument in interface RequestMessage
Returns:
the underlying message in a DOM structure
Throws:
TransportLayerException - if there were problems creating the DOM

getMessageAsString

public String getMessageAsString()
                          throws TransportLayerException

Obtains the message as a string, converting the underlying structure if necessary (i.e. DOM -> string).

Specified by:
getMessageAsString in interface RequestMessage
Returns:
the underlying message rendered as a string
Throws:
TransportLayerException - if a string representation of the message could not be constructed

create

public static RequestMessage create(String message)
                             throws TransportLayerException

Create a message object based on a string.

Parameters:
message - the message as a string
Returns:
the constructed message object
Throws:
TransportLayerException - if the message could not be converted into a Document

create

public static RequestMessage create(Document message)
                             throws TransportLayerException

Create a message object based on a Document.

Parameters:
message - the message as a Document
Returns:
the constructed message object
Throws:
TransportLayerException - if the message could not be rendered as a string

create

public static RequestMessage create(Document messageAsDocument,
                                    String messageAsString)
                             throws TransportLayerException

Create a message object based on a Document and string representation.

Parameters:
messageAsDocument - the message as a Document
messageAsString - the message as a string
Returns:
the constructed message object
Throws:
TransportLayerException - if the message could not be constructed


Copyright © 2013. All Rights Reserved.