ca.uhn.hl7v2.protocol.impl
Class HL7Server

java.lang.Object
  extended by ca.uhn.hl7v2.protocol.impl.HL7Server

public class HL7Server
extends java.lang.Object

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
HL7Server(java.net.ServerSocket theServerSocket, ApplicationRouter theRouter, SafeStorage theStorage)
           
HL7Server(java.net.ServerSocket theLocallyDriven, java.net.ServerSocket theRemotelyDriven, ApplicationRouter theRouter, SafeStorage theStorage)
           
 
Method Summary
 Processor accept(java.lang.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(java.lang.String[] args)
           
 void start(java.lang.String theAddress)
          Starts accepting connections in a new Thread.
 void stop()
          Stops running after the next connection is made.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HL7Server

public HL7Server(java.net.ServerSocket theServerSocket,
                 ApplicationRouter theRouter,
                 SafeStorage theStorage)
Parameters:
theServerSocket - a ServerSocket on which to listen for connections that will be used for both locally-driven and remotely-driven message exchanges
theRouter - used to send incoming messages to appropriate Applications
theStorage - used to commit incoming messages to safe storage before returning an accept ACK

HL7Server

public HL7Server(java.net.ServerSocket theLocallyDriven,
                 java.net.ServerSocket theRemotelyDriven,
                 ApplicationRouter theRouter,
                 SafeStorage theStorage)
Parameters:
theLocallyDriven - a ServerSocket on which to listen for connections that will be used for locally-initiated message exchanges
theRemotelyDriven - a ServerSocket on which to listen for connections that will be used for remotely-initiated message exchanges
theRouter - used to send incoming messages to appropriate Applications
theStorage - used to commit incoming messages to safe storage before returning an accept ACK
Method Detail

accept

public Processor accept(java.lang.String theAddress)
                 throws TransportException
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 Processor connected to the given address
Throws:
TransportException

start

public void start(java.lang.String theAddress)
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

public void stop()
Stops running after the next connection is made.


isRunning

public boolean isRunning()
Returns 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.

Returns:
true between when start() returns and when stop() is called.

getProcessors

public Processor[] getProcessors()
Returns:
Processors arising from connections to this server

main

public static void main(java.lang.String[] args)


Copyright © 2001-2011 University Health Network. All Rights Reserved.