Sun Adapter for TCP/IP HL7

com.stc.connector.appconn.tcpip.hl7
Interface HL7AppMessage

All Known Implementing Classes:
HL7AppMessageImpl

public interface HL7AppMessage

This class is used as a place holder of HL7 specific functions.

Version:
cvs revision: $Revision: 1.21 $ Last Modified: $Date: 2008/04/22 05:43:17 $
Author:
Harry Liu

Field Summary
static java.lang.String version
           
 
Method Summary
 byte[] convertHL7MessagetoXML(java.lang.String payLoad)
          Convert HL7 raw message to HL7 XML message, if the hl7 eway receives hl7 xml data
 byte[] convertXMLtoMessage(java.lang.String hl7XmlMessage)
          Convert HL7 XML message to HL7 raw message, if the hl7 eway receives hl7 xml data
 java.lang.String getACKXMLPayLoad()
          The payload holds HL7 ACK XML message.
 char getBlockType()
          The getBlockType method is only used for HLLP (Hybrid Lower Layer Protocol).
 byte[] getPayload()
          The payload holds HL7 data.
 java.lang.String getXMLPayLoad()
          The payload holds HL7 XML message.
 boolean handleXMLMessage()
          Condition to check the incoming and outgoing message is xml or not.
 boolean isDataBlockType()
          The isDataBlockType is only used for HLLP (Hybrid Lower Layer Protocol).
 boolean isNAKBlockType()
          The isNAKBlockType is only used for HLLP (Hybrid Lower Layer Protocol).
 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 setACKXMLPayLoad(java.lang.String hl7AckXmlMessage)
          The payload holds HL7 ACK XML message.
 void setBlockType(char blockType)
          The setBlockType method is only used for HLLP (Hybrid Lower Layer Protocol).
 void setDataBlockType()
          The setDataBlockType is only used for HLLP (Hybrid Lower Layer Protocol).
 void setNAKBlockType()
          The setNAKBlockType is only used for HLLP (Hybrid Lower Layer Protocol).
 void setPayload(byte[] payload)
          The payload holds HL7 data.
 void setXMLPayLoad(java.lang.String hl7XmlMessage)
          The payload holds HL7 XML message.
 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(int sequenceNumber)
          Stores the sequence number to the persistence file.
 

Field Detail

version

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

send

void send()
          throws HL7ApplicationException,
                 java.io.IOException
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.

Throws:
HL7ApplicationException - Thrown upon LLP enveloping related error.
IOException - Thrown upon TCP/IP transport error.
HL7ApplicationException
java.io.IOException

receive

void receive()
             throws HL7ApplicationException,
                    java.io.IOException
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.

Throws:
HL7ApplicationException - Thrown upon LLP de-enveloping/validation related error.
IOException - Thrown upon TCP/IP i/o error.
HL7ApplicationException
java.io.IOException

getPayload

byte[] getPayload()
                  throws HL7ApplicationException
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.

Returns:
byte[] - The payload in byte array.
Throws:
HL7ApplicationException - Thrown upon error.
HL7ApplicationException

setPayload

void setPayload(byte[] payload)
                throws HL7ApplicationException
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.

Parameters:
payload - The payload to set.
Throws:
HL7ApplicationException - Thrown upon error.
HL7ApplicationException

isNAKBlockType

boolean isNAKBlockType()
                       throws HL7ApplicationException
The isNAKBlockType is only used for HLLP (Hybrid Lower Layer Protocol). The blockType can be 'D' (data block) or 'N' (NAK block).

Parameters:
None.

Returns:
Boolean
Throws:
HL7ApplicationException - Thrown upon error.
HL7ApplicationException

setNAKBlockType

void setNAKBlockType()
                     throws HL7ApplicationException
The setNAKBlockType is only used for HLLP (Hybrid Lower Layer Protocol). The blockType can be 'D' (data block) or 'N' (NAK block).

Parameters:
None.

Throws:
HL7ApplicationException - Thrown upon error.
HL7ApplicationException

isDataBlockType

boolean isDataBlockType()
                        throws HL7ApplicationException
The isDataBlockType is only used for HLLP (Hybrid Lower Layer Protocol). The blockType can be 'D' (data block) or 'N' (NAK block).

Parameters:
None.

Returns:
Boolean
Throws:
HL7ApplicationException - Thrown upon error.
HL7ApplicationException

setDataBlockType

void setDataBlockType()
                      throws HL7ApplicationException
The setDataBlockType is only used for HLLP (Hybrid Lower Layer Protocol). The blockType can be 'D' (data block) or 'N' (NAK block).

Parameters:
None.

Throws:
HL7ApplicationException - Thrown upon error.
HL7ApplicationException

getBlockType

char getBlockType()
                  throws HL7ApplicationException
The getBlockType method is only used for HLLP (Hybrid Lower Layer Protocol). The blockType can be 'D' (data block) or 'N' (NAK block).

Parameters:
None.

Returns:
char - The block type.
Throws:
HL7ApplicationException - Thrown upon error.
HL7ApplicationException

setBlockType

void setBlockType(char blockType)
                  throws HL7ApplicationException
The setBlockType method is only used for HLLP (Hybrid Lower Layer Protocol). The blockType can be 'D' (data block) or 'N' (NAK block).

Parameters:
blockType - The type to set.
Throws:
HL7ApplicationException - Thrown upon error.
HL7ApplicationException

loadSequenceNumber

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

Parameters:
None.

Returns:
int - The number stored in file.
Throws:
HL7ApplicationException - Thrown upon error.
IOException - Thrown upon i/o error.
HL7ApplicationException
java.io.IOException

storeSequenceNumber

void storeSequenceNumber(int sequenceNumber)
                         throws HL7ApplicationException,
                                java.io.IOException
Stores the sequence number to the persistence file. The file location is defined by the configuration properties.

Parameters:
sequenceNumber - The number to store.
Throws:
HL7ApplicationException - Thrown upon error.
IOException - Thrown upon i/o error.
HL7ApplicationException
java.io.IOException

storeHL7Ack

void storeHL7Ack(java.lang.String messageId,
                 java.lang.String HL7ACK)
                 throws HL7ApplicationException
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.

Parameters:
messageId - The MSH message control Id of the original HL7 request message
HL7ACK - The complete HL7 ACK message to store
Throws:
HL7ApplicationException - Thrown upon error.
HL7ApplicationException

storeHL7Nak

void storeHL7Nak(java.lang.String messageId,
                 java.lang.String HL7NAK)
                 throws HL7ApplicationException
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.

Parameters:
messageId - The MSH message control Id of the original HL7 request message
HL7NAK - The complete HL7 NAK message to store
Throws:
HL7ApplicationException - Thrown upon error.
HL7ApplicationException

convertXMLtoMessage

byte[] convertXMLtoMessage(java.lang.String hl7XmlMessage)
                           throws HL7ApplicationException
Convert HL7 XML message to HL7 raw message, if the hl7 eway receives hl7 xml data

Parameters:
hl7XmlMessage - The xml message to convert.
Returns:
byte[] - The payload is byte array.
Throws:
HL7ApplicationException - Thrown upon error.
HL7ApplicationException

convertHL7MessagetoXML

byte[] convertHL7MessagetoXML(java.lang.String payLoad)
                              throws HL7ApplicationException
Convert HL7 raw message to HL7 XML message, if the hl7 eway receives hl7 xml data

Parameters:
hl7XmlMessage - The HL7 raw message to convert to xml message.
Returns:
byte[] - The xml message in byte array.
Throws:
HL7ApplicationException - Thrown upon error.
HL7ApplicationException

handleXMLMessage

boolean handleXMLMessage()
                         throws HL7ApplicationException
Condition to check the incoming and outgoing message is xml or not. This is required if the hl7 eway receives hl7 xml data.

Returns:
boolean -true/false.
Throws:
HL7ApplicationException - Thrown upon error.
HL7ApplicationException

setXMLPayLoad

void setXMLPayLoad(java.lang.String hl7XmlMessage)
                   throws HL7ApplicationException
The payload holds HL7 XML message. Before calling the "send()" method, this payload should be set with HL7 XML message. After calling the "receive()" method, this payload should contain a HL7 XML message.This is required if the hl7 eway receives hl7 xml data

Parameters:
hl7XmlMessage - The xml message to store.
Throws:
HL7ApplicationException - Thrown upon error.
HL7ApplicationException

getXMLPayLoad

java.lang.String getXMLPayLoad()
                               throws HL7ApplicationException
The payload holds HL7 XML message. Before calling the "send()" method, this payload should be set with HL7 XML message. After calling the "receive()" method, this payload should contain a HL7 XML message.This is required if the hl7 eway receives hl7 xml data.

Parameters:
None.

Returns:
String - The payload in XML payload.
Throws:
HL7ApplicationException - Thrown upon error.
HL7ApplicationException

setACKXMLPayLoad

void setACKXMLPayLoad(java.lang.String hl7AckXmlMessage)
                      throws HL7ApplicationException
The payload holds HL7 ACK XML message. After calling the "convertXMLtoMessage(String payload)" method, this payload should be set with HL7 XML message. After calling the "convertXMLtoMessage(String hl7xmlMessage)" method, this payload should contain a HL7 ACK XML message.This is required if the hl7 eway receives hl7 xml data.

Parameters:
hl7ACKXmlMessage - The xml ACK message to store.
Throws:
HL7ApplicationException - Thrown upon error.
HL7ApplicationException

getACKXMLPayLoad

java.lang.String getACKXMLPayLoad()
                                  throws HL7ApplicationException
The payload holds HL7 ACK XML message. After calling the "convertXMLtoMessage(String payload)" method, this payload should be set with HL7 XML message. After calling the "convertXMLtoMessage(String hl7xmlMessage)" method, this payload should contain a HL7 ACK XML message.This is required if the hl7 eway receives hl7 xml data.

Parameters:
None.

Returns:
String - The payload is xml ack message.
Throws:
HL7ApplicationException - Thrown upon error.
HL7ApplicationException

Sun Adapter for TCP/IP HL7