Package ca.uhn.hl7v2.protocol.impl
Class AbstractTransport
java.lang.Object
ca.uhn.hl7v2.protocol.impl.AbstractTransport
- All Implemented Interfaces:
TransportLayer
- Direct Known Subclasses:
AbstractJMSTransport,JMSTransport,MLLPTransport,URLTransport
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconnect()Sets isConnected() to false, then calls doConnect(), then sets isConnected() to true.voidDrops any existing connection to the remote server.abstract voidPerforms connection as described in TransportLayer.connect().abstract voidPerforms disconnection as described in TransportLayer.disconnect().abstract TransportableCalled by receive(), which then adds common metadata.abstract voiddoSend(Transportable theMessage) The method send() delegates to this method after checking whether we are connected.booleanreceive()Delegates todoReceive()and adds common metadata to the resultingTransportablebefore it is returned.voidsend(Transportable theMessage) Delegates todoSend()after checking that we are connected.
-
Constructor Details
-
AbstractTransport
public AbstractTransport()
-
-
Method Details
-
getCommonMetadata
- Specified by:
getCommonMetadatain interfaceTransportLayer- 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:
-
receive
Delegates todoReceive()and adds common metadata to the resultingTransportablebefore it is returned.- Specified by:
receivein interfaceTransportLayer- Returns:
- the next available message
- Throws:
TransportException
-
doReceive
Called by receive(), which then adds common metadata.- Returns:
- Transportable the next available message
- Throws:
TransportException
-
send
Delegates todoSend()after checking that we are connected.- Specified by:
sendin interfaceTransportLayer- Parameters:
theMessage- the message to send- Throws:
TransportException- See Also:
-
doSend
The method send() delegates to this method after checking whether we are connected.- Parameters:
theMessage-- Throws:
TransportException
-
connect
Sets isConnected() to false, then calls doConnect(), then sets isConnected() to true.- Specified by:
connectin interfaceTransportLayer- Throws:
TransportException- See Also:
-
doConnect
Performs connection as described in TransportLayer.connect(). The connect() method of this class delegates to doConnect() after some internal housekeeping.- Throws:
TransportException
-
isConnected
- Specified by:
isConnectedin interfaceTransportLayer- 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:
-
disconnect
Description copied from interface:TransportLayerDrops any existing connection to the remote server.- Specified by:
disconnectin interfaceTransportLayer- Throws:
TransportException- See Also:
-
doDisconnect
Performs disconnection as described in TransportLayer.disconnect(). The disconnect() method of this class delegates to doDisconnect() after some internal housekeeping.- Throws:
TransportException
-