|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectca.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 |
Method Summary | |
---|---|
Connection |
getRemoteConnection(java.lang.String IP)
Returns a connection to a remote host that was initiated by the given remote host. |
java.util.Vector |
getRemoteConnections()
Returns all currently active connections. |
boolean |
isRunning()
|
protected boolean |
keepRunning()
Deprecated. Use isRunning() . Deprecated as of version 0.6. |
void |
loadApplicationsFromFile(java.io.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(java.lang.String messageType,
java.lang.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. |
abstract void |
run()
Implemented by subclasses to accept remote connections, create Connection objects, and call newConnection() . |
void |
start()
Starts the server listening for connections in a new thread. |
void |
stop()
Stops the server from listening for new connections, and closes all existing Connections. |
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)
Method Detail |
---|
public abstract void run()
newConnection()
. Must stop running when
keepRunning()
returns false, and clean up all resources before
exiting. If this method quits because of an exception, it must call
HL7Service.stop() before exiting.
run
in interface java.lang.Runnable
protected boolean keepRunning()
isRunning()
. Deprecated as of version 0.6.
public boolean isRunning()
true
if the server has been started, and has not yet been stopped.public void start()
stop()
is called.
public void stop()
public void newConnection(Connection c)
public Connection getRemoteConnection(java.lang.String IP)
public java.util.Vector getRemoteConnections()
public void registerConnectionListener(ConnectionListener listener)
public void registerApplication(java.lang.String messageType, java.lang.String triggerEvent, Application handler)
public void loadApplicationsFromFile(java.io.File f) throws java.io.IOException, HL7Exception, java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.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.
java.io.IOException
HL7Exception
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |