Sun Adapter for TCP/IP HL7

com.stc.connector.tcpip.hl7.client
Class HL7v3AppMessageImpl

java.lang.Object
  extended by com.stc.connector.tcpip.hl7.client.HL7v3AppMessageImpl
All Implemented Interfaces:
HL7v3AppMessage, MLLPV2CommonInterface

public class HL7v3AppMessageImpl
extends java.lang.Object
implements HL7v3AppMessage, MLLPV2CommonInterface

This class implements the HL7 v3.0 application message interface.

Version:
cvs revision: $Revision: 1.5 $ Last Modified: $Date: 2008/04/24 12:54:13 $
Author:
Nageswara Samudrala

Field Summary
static java.lang.String version
           
 
Constructor Summary
HL7v3AppMessageImpl()
          Constructor for HL7v3AppMessageImpl.
HL7v3AppMessageImpl(HL7v3ClientApplication application)
          Constructor for HL7v3AppMessage.
 
Method Summary
 HL7v3ClientApplicationImpl getApplication()
          Returns the application.
 java.lang.String getApplicationName()
          Used to get the Application name.
 java.lang.String getDatasourceJNDIName()
          The getDatasourceJNDIName method is used to get the Datasource JNDI name bound to the perticular dataBase.
 byte[] getPayload()
          The payload holds HL7 data.
 int getSequenceNumber()
           
 boolean isHL7v3Message()
          The isHL7v3Message method is check the received hl7 message is V3 message or not.
 boolean isHL7v3QueuedAcknowledgementType()
          Used to find the configured Acknowledgment is Queued one or nor for HL7 v3 Message processing.
 boolean isServerConnectionType()
          The isServerConnectionType method is used to find the server connection type is server or client.
 int loadSequenceNumber()
          Loads the sequence number from the persistence file.
 void receive()
          Receives the enveloped data over the TCP/IP connection and de-envelopes/validates it (according to LLP settings).
 void send()
          Envelopes (according to LLP settings) the HL7 data which is stored in payload, The enveloped HL7 data is then sent out over the TCP/IP connection.
 void sendEnvelopedMsg(byte[] llpMessage)
          Envelopes (according to LLP settings) the HL7 data which is stored in payload, The enveloped HL7 data is then sent out over the MLLPv2.
 void sendMessagePayload()
          Envelopes (according to LLP settings) the HL7 data which is stored in payload, The enveloped HL7 data is then sent out over the MLLPv2.
 void setMessagePayload(byte[] payload)
          The payload holds HL7 data.
 void setPayload(byte[] payload)
          The payload holds HL7 data.
 void setSequenceNumber(int sequenceNumber)
           
 void storeHL7Ack(java.lang.String messageId, java.lang.String HL7ACK)
          Stores the HL7 Ack message in the MLLPV2's persistence storage.
 void storeHL7Nak(java.lang.String messageId, java.lang.String HL7NAK)
          Stores the HL7 NAK message in the MLLPV2's persistence storage.
 void storeSequenceNumber()
           
 void storeSequenceNumber(int sequenceNumber)
          Stores the sequence number to the persistence file.
 void updateMBeanProperty(java.lang.String propertyName, java.lang.String propertyDisplayValue)
          The updateMBeanProperty method is used to update the Mbean properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

version

public static final java.lang.String version
See Also:
Constant Field Values
Constructor Detail

HL7v3AppMessageImpl

public HL7v3AppMessageImpl()
Constructor for HL7v3AppMessageImpl.


HL7v3AppMessageImpl

public HL7v3AppMessageImpl(HL7v3ClientApplication application)
                    throws HL7ApplicationException
Constructor for HL7v3AppMessage.

Parameters:
application - HL7v3ClientApplication
Throws:
HL7ApplicationException
Method Detail

getApplication

public HL7v3ClientApplicationImpl getApplication()
Returns the application.

Returns:
HL7v3ClientApplicationImpl

getPayload

public byte[] getPayload()
                  throws HL7ApplicationException
Description copied from interface: HL7v3AppMessage
The payload holds HL7 data. Before calling the "send()" method, this payload should be set with HL7 data. After calling the "receive()" method, this payload should contain HL7 data.

Parameters:
None.

Specified by:
getPayload in interface HL7v3AppMessage
Returns:
byte[] - The payload in byte array.
Throws:
HL7ApplicationException
See Also:
com.stc.connector.appconn.tcpip.hl7.HL7V3AppMessage#getPayload()

setPayload

public void setPayload(byte[] payload)
                throws HL7ApplicationException
Description copied from interface: HL7v3AppMessage
The payload holds HL7 data. Before calling the "send()" method, this payload should be set with HL7 data. After calling the "receive()" method, this payload should contain a HL7 data.

Specified by:
setPayload in interface HL7v3AppMessage
Parameters:
payload - The payload to set.
Throws:
HL7ApplicationException
See Also:
com.stc.connector.appconn.tcpip.hl7.HL7V3AppMessage#setPayload(byte[])

loadSequenceNumber

public int loadSequenceNumber()
                       throws HL7ApplicationException,
                              java.io.IOException
Description copied from interface: HL7v3AppMessage
Loads the sequence number from the persistence file. The file location is defined by the configuration properties.

Parameters:
None.

Specified by:
loadSequenceNumber in interface HL7v3AppMessage
Returns:
int - The number stored in file.
Throws:
HL7ApplicationException
java.io.IOException
See Also:
HL7v3AppMessage.loadSequenceNumber()

storeSequenceNumber

public void storeSequenceNumber()
                         throws HL7ApplicationException,
                                java.io.IOException
Throws:
HL7ApplicationException
java.io.IOException
See Also:
com.stc.connector.appconn.tcpip.hl7.HL7V3AppMessage#storeSequenceNumber()

storeSequenceNumber

public void storeSequenceNumber(int sequenceNumber)
                         throws HL7ApplicationException,
                                java.io.IOException
Description copied from interface: HL7v3AppMessage
Stores the sequence number to the persistence file. The file location is defined by the configuration properties.

Specified by:
storeSequenceNumber in interface HL7v3AppMessage
Parameters:
sequenceNumber - The number to store.
Throws:
HL7ApplicationException
java.io.IOException
See Also:
com.stc.connector.appconn.tcpip.hl7.HL7V3AppMessage#storeSequenceNumber(int)

getSequenceNumber

public int getSequenceNumber()
                      throws HL7ApplicationException
Throws:
HL7ApplicationException
See Also:
com.stc.connector.appconn.tcpip.hl7.HL7v3AppMessage#getSequenceNumber()

setSequenceNumber

public void setSequenceNumber(int sequenceNumber)
                       throws HL7ApplicationException
Throws:
HL7ApplicationException
See Also:
com.stc.connector.appconn.tcpip.hl7.HL7V3AppMessage#setSequenceNumber(int)

receive

public void receive()
             throws HL7ApplicationException,
                    java.io.IOException,
                    TCPIPNoResponseException,
                    TCPIPIncompleteDataException
Description copied from interface: HL7v3AppMessage
Receives the enveloped data over the TCP/IP connection and de-envelopes/validates it (according to LLP settings). The HL7 data (the de-enveloped data) is then stores in payload. After this method is called, the received HL7 data is stored in payload. The HL7 data can be retrieved with the getPayload() method.

Note: If it fails to receive the enveloped data over the TCP/IP connection, java.io.IOException is thrown. There are 3 cases:

If it fails to de-envelope/validate data, com.stc.connector.tcpip.hl7.exception.HL7ApplicationException is thrown.

Parameters:
None.

Specified by:
receive in interface HL7v3AppMessage
Throws:
HL7ApplicationException
java.io.IOException
TCPIPNoResponseException
TCPIPIncompleteDataException
See Also:
com.stc.connector.appconn.tcpip.hl7.HL7V3AppMessage#receive()

send

public void send()
          throws HL7ApplicationException,
                 java.io.IOException
Description copied from interface: HL7v3AppMessage
Envelopes (according to LLP settings) the HL7 data which is stored in payload, The enveloped HL7 data is then sent out over the TCP/IP connection.

Before this method is called, the outgoing HL7 data should already be stored in payload by the setPayload() method. Note: If it fails to send the enveloped data over the TCP/IP connection, IOException will be thrown. If it fails to envelope data, HL7ApplicationException will be thrown.

Parameters:
None.

Specified by:
send in interface HL7v3AppMessage
Throws:
HL7ApplicationException
java.io.IOException
See Also:
com.stc.connector.appconn.tcpip.hl7.HL7V3AppMessage#send()

storeHL7Ack

public void storeHL7Ack(java.lang.String messageId,
                        java.lang.String HL7ACK)
                 throws HL7ApplicationException
Description copied from interface: HL7v3AppMessage
Stores the HL7 Ack message in the MLLPV2's persistence storage. The persistence storage is a database holding the HL7 messages. This ACK will be stored against the original HL7 request messageId.

Specified by:
storeHL7Ack in interface HL7v3AppMessage
Parameters:
messageId - The MSH message control Id of the original HL7 request message
HL7ACK - The complete HL7 ACK message to store
Throws:
HL7ApplicationException
See Also:
com.stc.connector.appconn.tcpip.hl7.HL7V3AppMessage#storeHL7Ack()

storeHL7Nak

public void storeHL7Nak(java.lang.String messageId,
                        java.lang.String HL7NAK)
                 throws HL7ApplicationException
Description copied from interface: HL7v3AppMessage
Stores the HL7 NAK message in the MLLPV2's persistence storage. The persistence storage is a database holding the HL7 messages. This NAK will be stored against the original HL7 request messageId.

Specified by:
storeHL7Nak in interface HL7v3AppMessage
Parameters:
messageId - The MSH message control Id of the original HL7 request message
HL7NAK - The complete HL7 NAK message to store
Throws:
HL7ApplicationException
See Also:
com.stc.connector.appconn.tcpip.hl7.HL7V3AppMessage#storeHL7Nak()

sendEnvelopedMsg

public void sendEnvelopedMsg(byte[] llpMessage)
                      throws TCPIPApplicationException,
                             java.io.IOException
Description copied from interface: MLLPV2CommonInterface
Envelopes (according to LLP settings) the HL7 data which is stored in payload, The enveloped HL7 data is then sent out over the MLLPv2.

Before this method is called, the outgoing HL7 data should already be stored in payload by the setPayload() method. Note: If it fails to send the enveloped data over the TCP/IP connection, IOException will be thrown. If it fails to envelope data, HL7ApplicationException will be thrown.

Parameters:

Specified by:
sendEnvelopedMsg in interface MLLPV2CommonInterface
Parameters:
llpMessage - --The enveloped HL7 Message
Throws:
TCPIPApplicationException
java.io.IOException
See Also:
MLLPV2CommonInterface.sendEnvelopedMsg(byte[] llpMessage)

isServerConnectionType

public boolean isServerConnectionType()
Description copied from interface: MLLPV2CommonInterface
The isServerConnectionType method is used to find the server connection type is server or client.

Specified by:
isServerConnectionType in interface MLLPV2CommonInterface
Returns:
boolean - true or false.
See Also:
MLLPV2CommonInterface.isServerConnectionType()

updateMBeanProperty

public void updateMBeanProperty(java.lang.String propertyName,
                                java.lang.String propertyDisplayValue)
Description copied from interface: MLLPV2CommonInterface
The updateMBeanProperty method is used to update the Mbean properties.

Specified by:
updateMBeanProperty in interface MLLPV2CommonInterface
Parameters:
propertyName - --The property name to be updated.
propertyDisplayValue - --The property display value.
See Also:
com.stc.connector.hl7.framework.llp.MLLPV2CommonInterface#updateMBeanProperty()

getDatasourceJNDIName

public java.lang.String getDatasourceJNDIName()
                                       throws HL7ApplicationException
Description copied from interface: MLLPV2CommonInterface
The getDatasourceJNDIName method is used to get the Datasource JNDI name bound to the perticular dataBase.

Specified by:
getDatasourceJNDIName in interface MLLPV2CommonInterface
Returns:
String - JNDI name.
Throws:
HL7ApplicationException
See Also:
MLLPV2CommonInterface.getDatasourceJNDIName()

getApplicationName

public java.lang.String getApplicationName()
Description copied from interface: MLLPV2CommonInterface
Used to get the Application name.

Specified by:
getApplicationName in interface MLLPV2CommonInterface
Returns:
String - Application Name.
See Also:
MLLPV2CommonInterface.getApplicationName()

sendMessagePayload

public void sendMessagePayload()
                        throws HL7ApplicationException,
                               java.io.IOException
Description copied from interface: MLLPV2CommonInterface
Envelopes (according to LLP settings) the HL7 data which is stored in payload, The enveloped HL7 data is then sent out over the MLLPv2.

Before this method is called, the outgoing HL7 data should already be stored in payload by the setPayload() method. Note: If it fails to send the enveloped data over the TCP/IP connection, IOException will be thrown. If it fails to envelope data, HL7ApplicationException will be thrown.

Parameters:
None.

Specified by:
sendMessagePayload in interface MLLPV2CommonInterface
Throws:
HL7ApplicationException
java.io.IOException
See Also:
MLLPV2CommonInterface.sendMessagePayload()

setMessagePayload

public void setMessagePayload(byte[] payload)
                       throws HL7ApplicationException
Description copied from interface: MLLPV2CommonInterface
The payload holds HL7 data. Before calling the "send()" method, this payload should be set with HL7 data. After calling the "receive()" method, this payload should contain a HL7 data.This method is used only with MLLPv2

Specified by:
setMessagePayload in interface MLLPV2CommonInterface
Parameters:
payload - The payload to set.
Throws:
HL7ApplicationException
See Also:
com.stc.connector.hl7.framework.llp.MLLPV2CommonInterface#setMessagePayload()

isHL7v3Message

public boolean isHL7v3Message()
Description copied from interface: MLLPV2CommonInterface
The isHL7v3Message method is check the received hl7 message is V3 message or not.

Specified by:
isHL7v3Message in interface MLLPV2CommonInterface
Returns:
boolean - return true or false.
See Also:
MLLPV2CommonInterface.isHL7v3Message()

isHL7v3QueuedAcknowledgementType

public boolean isHL7v3QueuedAcknowledgementType()
                                         throws HL7ApplicationException
Description copied from interface: MLLPV2CommonInterface
Used to find the configured Acknowledgment is Queued one or nor for HL7 v3 Message processing.

Specified by:
isHL7v3QueuedAcknowledgementType in interface MLLPV2CommonInterface
Returns:
boolean - return true or false.
Throws:
HL7ApplicationException
See Also:
MLLPV2CommonInterface.isHL7v3QueuedAcknowledgementType()

Sun Adapter for TCP/IP HL7