Class HL7Server

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

public class HL7Server extends 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 Details

    • HL7Server

      public HL7Server(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(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 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 Details

    • accept

      public Processor accept(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(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

      Returns:
      Processors arising from connections to this server
    • main

      public static void main(String[] args)