ca.uhn.hl7v2.app
Class TwoPortService

java.lang.Object
  extended by ca.uhn.hl7v2.concurrent.Service
      extended by ca.uhn.hl7v2.app.HL7Service
          extended by ca.uhn.hl7v2.app.TwoPortService
All Implemented Interfaces:
Runnable

public class TwoPortService
extends HL7Service

A TCP/IP-based HL7 Service that uses separate ports for inbound and outbound messages. A connection is only activated when the same remote host connects to both the inbound and outbound ports.

Author:
Bryan Tripp

Field Summary
 
Fields inherited from class ca.uhn.hl7v2.app.HL7Service
llp, parser
 
Constructor Summary
TwoPortService(int inboundPort, int outboundPort)
           
TwoPortService(int inboundPort, int outboundPort, boolean tls)
           
TwoPortService(Parser parser, LowerLayerProtocol llp, int inboundPort, int outboundPort, boolean tls)
          Creates a new instance of TwoPortService
TwoPortService(Parser parser, LowerLayerProtocol llp, int inboundPort, int outboundPort, boolean tls, ExecutorService executorService)
          Creates a new instance of TwoPortService
 
Method Summary
protected  void afterStartup()
          Launches two threads that concurrently listen on the inboundPort and outboundPort.
protected  void afterTermination()
          Terminate the two acceptor threads
protected  ca.uhn.hl7v2.app.AcceptorThread createAcceptThread(int port)
           
protected  void handle()
          Polls for accepted sockets
static void main(String[] args)
          Run server from command line.
 
Methods inherited from class ca.uhn.hl7v2.app.HL7Service
getRemoteConnection, getRemoteConnections, keepRunning, loadApplicationsFromFile, newConnection, registerApplication, registerConnectionListener
 
Methods inherited from class ca.uhn.hl7v2.concurrent.Service
getExecutorService, getServiceExitedWithException, 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
 

Constructor Detail

TwoPortService

public TwoPortService(int inboundPort,
                      int outboundPort)

TwoPortService

public TwoPortService(int inboundPort,
                      int outboundPort,
                      boolean tls)

TwoPortService

public TwoPortService(Parser parser,
                      LowerLayerProtocol llp,
                      int inboundPort,
                      int outboundPort,
                      boolean tls)
Creates a new instance of TwoPortService


TwoPortService

public TwoPortService(Parser parser,
                      LowerLayerProtocol llp,
                      int inboundPort,
                      int outboundPort,
                      boolean tls,
                      ExecutorService executorService)
Creates a new instance of TwoPortService

Method Detail

afterStartup

protected void afterStartup()
Launches two threads that concurrently listen on the inboundPort and outboundPort.

Overrides:
afterStartup in class HL7Service
See Also:
HL7Service.afterStartup()

afterTermination

protected void afterTermination()
Terminate the two acceptor threads

Overrides:
afterTermination in class HL7Service
See Also:
HL7Service.afterTermination()

handle

protected void handle()
Polls for accepted sockets

Specified by:
handle in class Service

createAcceptThread

protected ca.uhn.hl7v2.app.AcceptorThread createAcceptThread(int port)
                                                      throws SocketException,
                                                             IOException
Throws:
SocketException
IOException

main

public static void main(String[] args)
Run server from command line. Inbound and outbound port numbers should be provided as arguments, and a file containing a list of Applications to use can also be specified as an optional argument (as per super.loadApplicationsFromFile(...)). Uses the default LowerLayerProtocol.



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