Package ca.uhn.hl7v2.protocol.impl
Class HL7Server
java.lang.Object
ca.uhn.hl7v2.protocol.impl.HL7Server
A TCP/IP based server.
- Version:
- $Revision: 1.2 $ updated on $Date: 2009-06-30 13:30:45 $ by $Author: jamesagnew $
- Author:
- Bryan Tripp
-
Constructor Summary
ConstructorsConstructorDescriptionHL7Server(ServerSocket theServerSocket, ApplicationRouter theRouter, SafeStorage theStorage) HL7Server(ServerSocket theLocallyDriven, ServerSocket theRemotelyDriven, ApplicationRouter theRouter, SafeStorage theStorage) -
Method Summary
Modifier and TypeMethodDescriptionAccepts 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.booleanReturnstruebetween when start() returns and when stop() is called.static voidvoidStarts accepting connections in a new Thread.voidstop()Stops running after the next connection is made.
-
Constructor Details
-
HL7Server
- Parameters:
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 appropriateApplicationstheStorage- used to commit incoming messages to safe storage before returning an accept ACK
-
HL7Server
public HL7Server(ServerSocket theLocallyDriven, ServerSocket theRemotelyDriven, ApplicationRouter theRouter, SafeStorage theStorage) - Parameters:
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 appropriateApplicationstheStorage- used to commit incoming messages to safe storage before returning an accept ACK
-
-
Method Details
-
accept
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.- Parameters:
theAddress- the IP address from which to accept connections (null means accept from any address). Connection attempts from other addresses will be ignored.- Returns:
- a
Processorconnected to the given address - Throws:
TransportException
-
start
Starts accepting connections in a new Thread. Note that this can be called multiple times with separate addresses. The stop() method ends all Threads started here.- Parameters:
theAddress- IP address from which connections are accepted (null means any address is OK)
-
stop
Stops running after the next connection is made. -
isRunning
Returnstruebetween 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.- Returns:
- true between when start() returns and when stop() is called.
-
getProcessors
- Returns:
Processors arising from connections to this server
-
main
-