public class HL7Server extends Object
Constructor and Description |
---|
HL7Server(ServerSocket theServerSocket,
ApplicationRouter theRouter,
SafeStorage theStorage) |
HL7Server(ServerSocket theLocallyDriven,
ServerSocket theRemotelyDriven,
ApplicationRouter theRouter,
SafeStorage theStorage) |
Modifier and Type | Method and Description |
---|---|
Processor |
accept(String theAddress)
Accepts a single inbound connection if the same ServerSocket is used for
all message exchanges, or a connection from each if two ServerSockets are
being used.
|
Processor[] |
getProcessors() |
boolean |
isRunning()
Returns
true between when start() returns and when stop() is called. |
static void |
main(String[] args) |
void |
start(String theAddress)
Starts accepting connections in a new Thread.
|
void |
stop()
Stops running after the next connection is made.
|
public HL7Server(ServerSocket theServerSocket, ApplicationRouter theRouter, SafeStorage theStorage)
theServerSocket
- a ServerSocket on which to listen for connections that will
be used for both locally-driven and remotely-driven message exchangestheRouter
- used to send incoming messages to appropriate Application
stheStorage
- used to commit incoming messages to safe storage before returning
an accept ACKpublic HL7Server(ServerSocket theLocallyDriven, ServerSocket theRemotelyDriven, ApplicationRouter theRouter, SafeStorage theStorage)
theLocallyDriven
- a ServerSocket on which to listen for connections that will
be used for locally-initiated message exchangestheRemotelyDriven
- a ServerSocket on which to listen for connections that will
be used for remotely-initiated message exchangestheRouter
- used to send incoming messages to appropriate Application
stheStorage
- used to commit incoming messages to safe storage before returning
an accept ACKpublic Processor accept(String theAddress) throws TransportException
theAddress
- the IP address from which to accept connections (null means
accept from any address). Connection attempts from other addresses will
be ignored.Processor
connected to the given addressTransportException
public void start(String theAddress)
theAddress
- IP address from which connections are accepted (null
means any address is OK)public void stop()
public boolean isRunning()
true
between when start() returns and when stop() is called.
Note that this is not the same as checking whether there are any active connections to
this server. To determine this, call getProcessors()
and check whether the array
returned is non-empty.public Processor[] getProcessors()
Processor
s arising from connections to this serverCopyright © 2001–2017 University Health Network. All rights reserved.