public abstract class AbstractTransport extends Object implements TransportLayer
TransportLayer
which looks after the
addition of common metadata to each inbound Transportable
.Constructor and Description |
---|
AbstractTransport() |
Modifier and Type | Method and Description |
---|---|
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.
|
Map<String,Object> |
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. |
public AbstractTransport()
public Map<String,Object> getCommonMetadata()
getCommonMetadata
in interface TransportLayer
TransportLayer.getCommonMetadata()
public Transportable receive() throws TransportException
doReceive()
and adds common metadata
to the resulting Transportable
before it is returned.receive
in interface TransportLayer
TransportException
public abstract Transportable doReceive() throws TransportException
TransportException
public void send(Transportable theMessage) throws TransportException
doSend()
after checking that we are connected.send
in interface TransportLayer
theMessage
- the message to sendTransportException
TransportLayer.send(Transportable)
public abstract void doSend(Transportable theMessage) throws TransportException
theMessage
- TransportException
public void connect() throws TransportException
connect
in interface TransportLayer
TransportException
TransportLayer.connect()
public abstract void doConnect() throws TransportException
TransportException
public boolean isConnected()
isConnected
in interface TransportLayer
TransportLayer.isConnected()
public void disconnect() throws TransportException
TransportLayer
disconnect
in interface TransportLayer
TransportException
TransportLayer.disconnect()
public abstract void doDisconnect() throws TransportException
TransportException
Copyright © 2001–2017 University Health Network. All rights reserved.