org.eclipse.ohf.ihe.common.mllp
Class MLLPDestination

java.lang.Object
  extended by org.eclipse.ohf.ihe.common.mllp.MLLPDestination

public class MLLPDestination
extends java.lang.Object

This class handles transmission of a given HL7 message to a designated recipient. It supports use of either secured or non-secured sockets. It will return the response returned by the recipient.

Author:
Rick Stevens, Sondra Renly

Constructor Summary
MLLPDestination(java.lang.String tcpHost, int tcpPort)
          Deprecated. Use MLLPDestination(URI) instead
MLLPDestination(TCPPort destination)
          Create a new MLLPDestination instance.
MLLPDestination(java.net.URI uri)
          Create a new MLLPDestination instance.
 
Method Summary
 int getMaxRetry()
          Get default maximum times to retry a connection.
 int getRetryWait()
          Get default wait time between retry attempts.
 java.net.URI getURI()
          Get MLLP server and port in URI format.
static boolean getUseATNA()
          Get the current class setting for the use of ATNA or MLLP legacy.
 java.lang.String sendMessage(java.lang.String msg)
          Send specified message to destination host and port and return response received.
 void setMaxRetry(int retryCount)
          Modify default maximum times to retry a connection.
 void setRetryWait(int retryWait)
          Modify default wait time between retry attempts.
static void setUseATNA(boolean atna)
          Select if the MLLPDestination class should use the ATNA Agent communications, or the legacy MLLP implementation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MLLPDestination

public MLLPDestination(TCPPort destination)
Create a new MLLPDestination instance.

Parameters:
destination - Identifies the host and port that will be the destination for a given MLLP HL7 message.

MLLPDestination

public MLLPDestination(java.lang.String tcpHost,
                       int tcpPort)
Deprecated. Use MLLPDestination(URI) instead

Create a new MLLPDestination instance with unsecure port details. Defaults in the start and end characters as well as a buffer size of 4096.

Parameters:
tcpHost - - destination address
tcpPort - - destination port

MLLPDestination

public MLLPDestination(java.net.URI uri)
Create a new MLLPDestination instance. If the uri scheme is "mllp" an unsecure port will be created, and "mllps" will produce a secure port. Otherwise an illegal argument exception will be thrown. Defaults in the start and end characters as well as a buffer size of 4096.

Parameters:
uri -
Method Detail

getMaxRetry

public int getMaxRetry()
Get default maximum times to retry a connection.

Returns:
maxRetry

setMaxRetry

public void setMaxRetry(int retryCount)
Modify default maximum times to retry a connection. Default is 3.

Parameters:
retryCount -

getRetryWait

public int getRetryWait()
Get default wait time between retry attempts.

Returns:
retryCount

setRetryWait

public void setRetryWait(int retryWait)
Modify default wait time between retry attempts. Default is 2000.

Parameters:
retryWait -

getURI

public java.net.URI getURI()
Get MLLP server and port in URI format.

Returns:
URI

sendMessage

public java.lang.String sendMessage(java.lang.String msg)
                             throws MLLPException
Send specified message to destination host and port and return response received.

Parameters:
msg - Message to send.
Returns:
Response message received; any kind of internal error will result in null response message being returned.
Throws:
MLLPException

getUseATNA

public static boolean getUseATNA()
Get the current class setting for the use of ATNA or MLLP legacy.

Returns:
true = use ATNA, false = MLLP Legacy

setUseATNA

public static void setUseATNA(boolean atna)
Select if the MLLPDestination class should use the ATNA Agent communications, or the legacy MLLP implementation. The default is to use ANTA.

Parameters:
atna - true = use ATNA, false = use MLLP legacy