ca.uhn.hl7v2.protocol.impl
Class AbstractTransport

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

public abstract class AbstractTransport
extends java.lang.Object
implements TransportLayer

A base implementation of TransportLayer which looks after the addition of common metadata to each inbound Transportable.

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

Constructor Summary
AbstractTransport()
           
 
Method Summary
 void connect()
          Sets isConnected() to false, then calls doConnect(), then sets isConnected() to true.
 void disconnect()
          Drops any existing connection to the remote server.
abstract  void doConnect()
          Performs connection as described in TransportLayer.connect().
abstract  void doDisconnect()
          Performs disconnection as described in TransportLayer.disconnect().
abstract  Transportable doReceive()
          Called by receive(), which then adds common metadata.
abstract  void doSend(Transportable theMessage)
          The method send() delegates to this method after checking whether we are connected.
 java.util.Map getCommonMetadata()
           
 boolean isConnected()
           
 Transportable receive()
          Delegates to doReceive() and adds common metadata to the resulting Transportable before it is returned.
 void send(Transportable theMessage)
          Delegates to doSend() after checking that we are connected.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTransport

public AbstractTransport()
Method Detail

getCommonMetadata

public java.util.Map getCommonMetadata()
Specified by:
getCommonMetadata in interface TransportLayer
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()

receive

public Transportable receive()
                      throws TransportException
Delegates to doReceive() and adds common metadata to the resulting Transportable before it is returned.

Specified by:
receive in interface TransportLayer
Returns:
the next available message
Throws:
TransportException

doReceive

public abstract Transportable doReceive()
                                 throws TransportException
Called by receive(), which then adds common metadata.

Returns:
Transportable the next available message
Throws:
TransportException

send

public void send(Transportable theMessage)
          throws TransportException
Delegates to doSend() after checking that we are connected.

Specified by:
send in interface TransportLayer
Parameters:
theMessage - the message to send
Throws:
TransportException
See Also:
TransportLayer.send(Transportable)

doSend

public abstract void doSend(Transportable theMessage)
                     throws TransportException
The method send() delegates to this method after checking whether we are connected.

Parameters:
theMessage -
Throws:
TransportException

connect

public void connect()
             throws TransportException
Sets isConnected() to false, then calls doConnect(), then sets isConnected() to true.

Specified by:
connect in interface TransportLayer
Throws:
TransportException
See Also:
TransportLayer.connect()

doConnect

public abstract void doConnect()
                        throws TransportException
Performs connection as described in TransportLayer.connect(). The connect() method of this class delegates to doConnect() after some internal housekeeping.

Throws:
TransportException

isConnected

public boolean isConnected()
Specified by:
isConnected in interface TransportLayer
Returns:
true if connect() has completed successfully. Note that true may be returned even if a connection is dead (ie the implementation need not test a connection during this call) but should return false if connect() has not been called, or if connect() has been called and is pending.
See Also:
TransportLayer.isConnected()

disconnect

public void disconnect()
                throws TransportException
Description copied from interface: TransportLayer
Drops any existing connection to the remote server.

Specified by:
disconnect in interface TransportLayer
Throws:
TransportException
See Also:
TransportLayer.disconnect()

doDisconnect

public abstract void doDisconnect()
                           throws TransportException
Performs disconnection as described in TransportLayer.disconnect(). The disconnect() method of this class delegates to doDisconnect() after some internal housekeeping.

Throws:
TransportException


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