ca.uhn.hl7v2.protocol.impl
Class AbstractJMSTransport

java.lang.Object
  extended by ca.uhn.hl7v2.protocol.impl.AbstractTransport
      extended by ca.uhn.hl7v2.protocol.impl.AbstractJMSTransport
All Implemented Interfaces:
TransportLayer
Direct Known Subclasses:
JMSQueueTransport, JMSTopicTransport

public abstract class AbstractJMSTransport
extends AbstractTransport
implements TransportLayer

A TransportLayer that exchanges messages through JMS destinations.

Version:
$Revision: 1.1 $ updated on $Date: 2007/02/19 02:24:26 $ by $Author: jamesagnew $
Author:
Bryan Tripp

Field Summary
static java.lang.String CLIENT_ID_KEY
           
static java.lang.String CONNECTION_METADATA_KEY
           
static java.lang.String DESTINATION_NAME_KEY
           
 
Constructor Summary
AbstractJMSTransport()
           
 
Method Summary
 Transportable doReceive()
          Called by receive(), which then adds common metadata.
 void doSend(Transportable theMessage)
          The method send() delegates to this method after checking whether we are connected.
 java.util.Map getCommonMetadata()
          Returns metadata under the static keys defined by this class.
abstract  javax.jms.Connection getConnection()
           
protected abstract  java.lang.String getDestinationName()
           
protected abstract  javax.jms.Message getMessage()
           
protected abstract  javax.jms.Message receiveJMS()
           
protected abstract  void sendJMS(javax.jms.Message theMessage)
          Sends a message to the underlying Destination
protected  javax.jms.Message toMessage(Transportable theSource)
          Fills a JMS message object with text and metadata from the given Transportable.
protected  Transportable toTransportable(javax.jms.Message theMessage)
          Copies data from the given Message into a Transportable.
 
Methods inherited from class ca.uhn.hl7v2.protocol.impl.AbstractTransport
connect, disconnect, doConnect, doDisconnect, isConnected, receive, send
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ca.uhn.hl7v2.protocol.TransportLayer
connect, disconnect, isConnected, receive, send
 

Field Detail

CLIENT_ID_KEY

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

CONNECTION_METADATA_KEY

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

DESTINATION_NAME_KEY

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

AbstractJMSTransport

public AbstractJMSTransport()
Parameters:
theConnection - JMS connection over which messages are exchanged
theDestination - JMS destination to which messages are produced and from which messages are consumed
Method Detail

getDestinationName

protected abstract java.lang.String getDestinationName()
                                                throws javax.jms.JMSException
Returns:
the name of the destination at which messages are written and read
Throws:
javax.jms.JMSException

getConnection

public abstract javax.jms.Connection getConnection()
Returns:
the QueueConnection or TopicConnection over which messages are transported

getMessage

protected abstract javax.jms.Message getMessage()
                                         throws javax.jms.JMSException
Returns:
a new JMS Message created on the sending Session.
Throws:
javax.jms.JMSException

sendJMS

protected abstract void sendJMS(javax.jms.Message theMessage)
                         throws javax.jms.JMSException
Sends a message to the underlying Destination

Parameters:
theMessage -
Throws:
javax.jms.JMSException

receiveJMS

protected abstract javax.jms.Message receiveJMS()
                                         throws javax.jms.JMSException
Returns:
the next available message from the underlying Destination
Throws:
javax.jms.JMSException

doSend

public void doSend(Transportable theMessage)
            throws TransportException
Description copied from class: AbstractTransport
The method send() delegates to this method after checking whether we are connected.

Specified by:
doSend in class AbstractTransport
Throws:
TransportException
See Also:
ca.uhn.hl7v2.protocol.Transport#doSend(ca.uhn.hl7v2.protocol.Transportable)

toMessage

protected javax.jms.Message toMessage(Transportable theSource)
                               throws TransportException
Fills a JMS message object with text and metadata from the given Transportable. The default implementation obtains a the Message from getMessage(), and expects this to be a TextMessage. Override this method if you want to use a different message type.

Parameters:
theSource - a Transportable from which to obtain data for filling the given Message
Returns:
a Message containing data from the given Transportable
Throws:
TransportException

toTransportable

protected Transportable toTransportable(javax.jms.Message theMessage)
                                 throws TransportException
Copies data from the given Message into a Transportable. The default implementation expects a TextMessage, but this can be overridden.

Parameters:
theMessage - a JMS Message from which to obtain data
Returns:
a Transportable containing data from the given Message
Throws:
TransportException

doReceive

public Transportable doReceive()
                        throws TransportException
Description copied from class: AbstractTransport
Called by receive(), which then adds common metadata.

Specified by:
doReceive in class AbstractTransport
Returns:
Transportable the next available message
Throws:
TransportException
See Also:
ca.uhn.hl7v2.protocol.AbstractTransport#doReceive()

getCommonMetadata

public java.util.Map getCommonMetadata()
Returns metadata under the static keys defined by this class.

Specified by:
getCommonMetadata in interface TransportLayer
Overrides:
getCommonMetadata in class AbstractTransport
Returns:
metadata to be added to the metadata of all incoming messages. This provides a way of associating connection information with incoming messages (eg the IP address of the remote server).
See Also:
TransportLayer.getCommonMetadata()


Copyright © 2001-2011 University Health Network. All Rights Reserved.