|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectca.uhn.hl7v2.concurrent.Service
ca.uhn.hl7v2.app.HL7Service
public abstract class HL7Service
An HL7 service. Accepts incoming TCP/IP connections and creates Connection objects. Uses a single MessageTypeRouter object (for all Connections) to define the Applications to which message are sent. To configure, use registerApplication() or loadApplicationsFromFile().
A separate thread looks for Connections that have been closed (locally or remotely) and discards them.
| Field Summary | |
|---|---|
protected LowerLayerProtocol |
llp
|
protected Parser |
parser
|
| Constructor Summary | |
|---|---|
HL7Service(Parser parser,
LowerLayerProtocol llp)
Creates a new instance of Server using a default thread pool |
|
HL7Service(Parser parser,
LowerLayerProtocol llp,
ExecutorService executorService)
Creates a new instance of Server |
|
| Method Summary | |
|---|---|
protected void |
afterStartup()
Called after startup before the thread enters its main loop. |
protected void |
afterTermination()
Called after the thread has left its main loop. |
Connection |
getRemoteConnection(String IP)
Returns a connection to a remote host that was initiated by the given remote host. |
List<Connection> |
getRemoteConnections()
Returns all currently active connections. |
protected boolean |
keepRunning()
Deprecated. Use Service.isRunning(). Deprecated as of version 0.6. |
void |
loadApplicationsFromFile(File f)
A convenience method for registering applications (using registerApplication()
) with this service. |
void |
newConnection(Connection c)
Called by subclasses when a new Connection is made. |
void |
registerApplication(String messageType,
String triggerEvent,
Application handler)
Registers the given application to handle messages corresponding to the given type and trigger event. |
void |
registerConnectionListener(ConnectionListener listener)
Registers the given ConnectionListener with the HL7Service - when a remote host makes a new Connection, all registered listeners will be notified. |
| Methods inherited from class ca.uhn.hl7v2.concurrent.Service |
|---|
getExecutorService, getServiceExitedWithException, handle, isRunning, prepareTermination, run, setServiceExitedWithException, setShutdownTimeout, start, stop, stopAndWait, waitForTermination |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Parser parser
protected LowerLayerProtocol llp
| Constructor Detail |
|---|
public HL7Service(Parser parser,
LowerLayerProtocol llp)
public HL7Service(Parser parser,
LowerLayerProtocol llp,
ExecutorService executorService)
| Method Detail |
|---|
protected void afterStartup()
ServerSockets etc.
afterStartup in class ServiceIOExceptionprotected void afterTermination()
ServerSockets.
afterTermination in class Serviceprotected boolean keepRunning()
Service.isRunning(). Deprecated as of version 0.6.
public void newConnection(Connection c)
public Connection getRemoteConnection(String IP)
public List<Connection> getRemoteConnections()
public void registerConnectionListener(ConnectionListener listener)
public void registerApplication(String messageType,
String triggerEvent,
Application handler)
public void loadApplicationsFromFile(File f)
throws IOException,
HL7Exception,
ClassNotFoundException,
InstantiationException,
IllegalAccessException
A convenience method for registering applications (using
registerApplication()
) with this service. Information about which Applications should
handle which messages is read from the given text file. Each line in the
file should have the following format (entries tab delimited):
message_type trigger_event application_class
message_type trigger_event application_class
Note that message type and event can be the wildcard "*", which means any.
For example, if you write an Application called org.yourorganiztion.ADTProcessor that processes several types of ADT messages, and another called org.yourorganization.ResultProcessor that processes result messages, you might have a file that looks like this:
ADT * org.yourorganization.ADTProcessor
ORU R01 org.yourorganization.ResultProcessor
Each class listed in this file must implement Application and must have a zero-argument constructor.
IOException
HL7Exception
ClassNotFoundException
InstantiationException
IllegalAccessException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||