Sun Adapter for TCP/IP HL7

com.stc.connector.hl7.framework.llp
Class HL7LLPInfo

java.lang.Object
  extended by com.stc.connector.hl7.framework.llp.HL7LLPInfo
All Implemented Interfaces:
HL7LLPInfoInterface

public class HL7LLPInfo
extends java.lang.Object
implements HL7LLPInfoInterface

 MLLP (Minimal Lower Layer Protocol):   
 
   [ SOB ][ HL7 Data ][ EOD ][ EOB]
 
 HLLP (Hybrid Lower Layer Protocol):   
 
   [ SOB ][ N | D ][ VER ][ CR ][ HL7 Data ][ LEN ][ BCC ][ EOD ][ EOB ]
 
 where:
 
    SOB: start of block (character)
    EOD: end of data    (character)
    EOB: end of block   (character)
    BCC: block checksum (character)
    CR : Carriage return(character)
    LEN: Length of HL7 Data (starting from SOB to end of HL7 data)
    N  : NAK block
    D  : Data block
    VER: HL7 version :: 21, 22, 23 (i.e., 2.1, 2.2, 2.3, ...)
 
 Assumptions:
 
     LEN : is 5 digit decimal (left zero filled) 
          -- largest value is 99999 bytes
 
     BCC : is 3 digit decimal (left zero filled)
           calculation algorithm is XOR.
          (999 means ignore BCC verification/calculation)
 
 NOTE:
 
     The values of the Start of Block [SOB],  
     End of Data [EOD] and End of Block [EOB], 
     must be UNIQUE.
 
 
The original specification is as follow:
 For HLLP (Hybrid Lower Layer Protocol):
 
 tvvddddcccccxxx
 
 Blocks consist of the following fields. Note that these are LLP 
 fields and are not the same as HL7 message fields.
 
  = Start Block character (1 byte)
      Configurable on a site specific basis. Unless there is a conflict, the
      value should be ASCII , i.e., <0x0B>. This should
      not be confused with the ASCII characters SOH or STX.
 t = Block Type (1 byte)
      'D' = data block
      'N' = NAK block
 vv = Protocol ID (2 bytes)
      The characters '2' '3' for this version
  = Carriage Return (1 byte)
      The ASCII carriage return character, i.e., <0x0D>.
 dddd = Data (variable number of bytes)
      In a data block, this is the data content of the block. The data can
      contain any displayable ASCII characters and the carriage return
      character, . Carriage returns that are not part of the HL7
      message may be inserted as described in "Carriage Return Stuffing."
      In a NAK block, this field contains a 1-byte reason code as follows:
          'C' - character count wrong in previous data block received
          'X' - checksum wrong in previous data block received
          'B' - data too long for input buffer in previous block received
          'G' - Error not covered elsewhere.
 ccccc = Block Size (5 bytes)
      Character count of all characters so far in the data block up to and
      including the last data character. For this version of the protocol this
      is 5 + the size of the dddd field. Note: HL7 message ends with a
       character. This character is considered as part of the data.
 xxx = Checksum (3 bytes)
      Exclusive-OR checksum of all characters in the block up to and
      including the last data character. The checksum is expressed as a
      decimal number in three ASCII digits.
      If the value of this field is 999, the checksum should not be
      computed. Processing will proceed as if it were correct. This feature
      is used for applications where the messages will be translated from
      one character set to another during transmission.
  = End Block character (1 byte)
      Configurable on a site specific basis. Unless there is a conflict, the
      value should be ASCII , i.e., <0x1C>. This should not be
      confused with the ASCII characters ETX or EOT.
  = Carriage Return (1 byte)
      The ASCII carriage return character, i.e., <0x0D>.
 
 
 For MLLP (Minimal Lower Layer Protocol):
 
 dddd
 
  = Start Block character (1 byte)
      ASCII , i.e., <0x0B>. This should not be confused with the ASCII characters
      SOH or STX.
 dddd = Data (variable number of bytes)
      This is the HL7 data content of the block. The data can contain any displayable
      ASCII characters and the carriage return character, .
  = End Block character (1 byte)
      ASCII , i.e., <0x1C>. This should not be confused with the ASCII characters
      ETX or EOT.
  = Carriage Return (1 byte)
      The ASCII carriage return character, i.e., <0x0D>.
 

Version:
cvs revision: $Revision: 1.8 $ Last Modified: $Date: 2008/04/10 06:33:24 $
Author:
Harry Liu

Field Summary
static java.lang.String TYPE_HLLP
          TYPE_HLLP
static java.lang.String TYPE_MLLP
          TYPE_MLLP
static java.lang.String TYPE_MLLPV20
          TYPE_MLLPV2.0
static java.lang.String version
           
 
Constructor Summary
HL7LLPInfo()
          Constructor for HL7LLPInfo.
HL7LLPInfo(com.stc.connector.framework.util.ConfigurationHelper aConfiguration)
           
 
Method Summary
 char getEndBlockCharacter()
          Returns the endBlockCharacter.
 char getEndDataCharacter()
          Returns the endDataCharacter.
 boolean getHLLPChecksumEnabled()
          Returns the hllpChecksumEnabled.
 java.lang.String getLLPType()
          Returns the LLPType.
 long getMaxNumofRetries()
          Returns the maximum number of retires.
 char getStartBlockCharacter()
          Returns the startBlockCharacter.
 boolean isHLLPChecksumEnabled()
          Returns the hllpChecksumEnabled.
 boolean isHLLPMsg()
          Checks whether the Lower Layer Protocol type is HLLP.
 boolean isMLLPMsg()
          Checks whether the Lower Layer Protocol type is MLLP.
 boolean isMLLPv20Msg()
          Checks whether the Lower Layer Protocol type is MLLPV2.0.
 void setEndBlockCharacter(char endBlockCharacter)
          Sets the endBlockCharacter.
 void setEndDataCharacter(char endDataCharacter)
          Sets the endDataCharacter.
 void setHLLPChecksumEnabled(boolean hllpChecksumEnabled)
          Sets the hllpChecksumEnabled.
 void setLLPType(java.lang.String llpType)
          Sets the LLPType.
 void setMaxNumofRetries(long maxNumRetries)
          Sets the maxNumRetries.
 void setStartBlockCharacter(char startBlockCharacter)
          Sets the startBlockCharacter.
 void validate()
          Method validate.
 
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

TYPE_MLLP

public static final java.lang.String TYPE_MLLP
TYPE_MLLP

See Also:
Constant Field Values

TYPE_HLLP

public static final java.lang.String TYPE_HLLP
TYPE_HLLP

See Also:
Constant Field Values

TYPE_MLLPV20

public static final java.lang.String TYPE_MLLPV20
TYPE_MLLPV2.0

See Also:
Constant Field Values
Constructor Detail

HL7LLPInfo

public HL7LLPInfo()
           throws HL7ApplicationException
Constructor for HL7LLPInfo.

Throws:
HL7ApplicationException

HL7LLPInfo

public HL7LLPInfo(com.stc.connector.framework.util.ConfigurationHelper aConfiguration)
           throws HL7ApplicationException
Throws:
HL7ApplicationException
Method Detail

getEndBlockCharacter

public char getEndBlockCharacter()
Returns the endBlockCharacter.
 To be strictly compliant with the HL7 Standard, this parameter 
 MUST be set to a Carriage Return, i.e., decimal 13.
 

Specified by:
getEndBlockCharacter in interface HL7LLPInfoInterface
Returns:
char

getEndDataCharacter

public char getEndDataCharacter()
Returns the endDataCharacter.
 Configurable on a site specific basis. Unless there is a conflict, the
 value should be ASCII FS, i.e., decimal 28. This should not be
 confused with the ASCII characters ETX or EOT.
 

Specified by:
getEndDataCharacter in interface HL7LLPInfoInterface
Returns:
char

getLLPType

public java.lang.String getLLPType()
Returns the LLPType. It is MLLP (Minimal Lower Layer Protocol) or HLLP (Hybrid Lower Layer Protocol).

Specified by:
getLLPType in interface HL7LLPInfoInterface
Returns:
String

getStartBlockCharacter

public char getStartBlockCharacter()
Returns the startBlockCharacter.
 Configurable on a site specific basis. Unless there is a conflict, the
 value should be ASCII VT, i.e., decimal 11. This should
 not be confused with the ASCII characters SOH or STX.
 

Specified by:
getStartBlockCharacter in interface HL7LLPInfoInterface
Returns:
char

getMaxNumofRetries

public long getMaxNumofRetries()
Returns the maximum number of retires. This parameter willl be used when the LLPType is MLLPv2.0

Specified by:
getMaxNumofRetries in interface HL7LLPInfoInterface
Returns:
int

setEndBlockCharacter

public void setEndBlockCharacter(char endBlockCharacter)
                          throws HL7ApplicationException
Sets the endBlockCharacter. The allowed range is 1 to 127.
 To be strictly compliant with the HL7 Standard, this parameter 
 MUST be set to a Carriage Return, i.e., decimal 13.
 

Specified by:
setEndBlockCharacter in interface HL7LLPInfoInterface
Parameters:
endBlockCharacter - The endBlockCharacter to set
Throws:
HL7ApplicationException

setEndDataCharacter

public void setEndDataCharacter(char endDataCharacter)
                         throws HL7ApplicationException
Sets the endDataCharacter. The allowed range is 1 to 127.
 Configurable on a site specific basis. Unless there is a conflict, the
 value should be ASCII FS, i.e., decimal 28. This should not be
 confused with the ASCII characters ETX or EOT.
 

Specified by:
setEndDataCharacter in interface HL7LLPInfoInterface
Parameters:
endDataCharacter - The endDataCharacter to set
Throws:
HL7ApplicationException

setLLPType

public void setLLPType(java.lang.String llpType)
                throws HL7ApplicationException
Sets the LLPType. It is MLLP (Minimal Lower Layer Protocol) or HLLP (Hybrid Lower Layer Protocol).

Specified by:
setLLPType in interface HL7LLPInfoInterface
Parameters:
llpType - The LLPType to set
Throws:
HL7ApplicationException

setStartBlockCharacter

public void setStartBlockCharacter(char startBlockCharacter)
                            throws HL7ApplicationException
Sets the startBlockCharacter. The allowed range is 1 to 127.
 Configurable on a site specific basis. Unless there is a conflict, the
 value should be ASCII VT, i.e., decimal 11. This should
 not be confused with the ASCII characters SOH or STX.
 

Specified by:
setStartBlockCharacter in interface HL7LLPInfoInterface
Parameters:
startBlockCharacter - The startBlockCharacter to set
Throws:
HL7ApplicationException

isMLLPMsg

public boolean isMLLPMsg()
Checks whether the Lower Layer Protocol type is MLLP.

Specified by:
isMLLPMsg in interface HL7LLPInfoInterface
Returns:
boolean

isMLLPv20Msg

public boolean isMLLPv20Msg()
Checks whether the Lower Layer Protocol type is MLLPV2.0.

Specified by:
isMLLPv20Msg in interface HL7LLPInfoInterface
Returns:
boolean

isHLLPMsg

public boolean isHLLPMsg()
Checks whether the Lower Layer Protocol type is HLLP.

Specified by:
isHLLPMsg in interface HL7LLPInfoInterface
Returns:
boolean

getHLLPChecksumEnabled

public boolean getHLLPChecksumEnabled()
Returns the hllpChecksumEnabled.

Specified by:
getHLLPChecksumEnabled in interface HL7LLPInfoInterface
Returns:
boolean

isHLLPChecksumEnabled

public boolean isHLLPChecksumEnabled()
Returns the hllpChecksumEnabled.

Specified by:
isHLLPChecksumEnabled in interface HL7LLPInfoInterface
Returns:
boolean

setHLLPChecksumEnabled

public void setHLLPChecksumEnabled(boolean hllpChecksumEnabled)
Sets the hllpChecksumEnabled.

Specified by:
setHLLPChecksumEnabled in interface HL7LLPInfoInterface
Parameters:
mllpChecksumEnabled - The hllpChecksumEnabled to set

setMaxNumofRetries

public void setMaxNumofRetries(long maxNumRetries)
Sets the maxNumRetries.

Specified by:
setMaxNumofRetries in interface HL7LLPInfoInterface
Parameters:
maxNumRetries - The maximum number of retries to set

validate

public void validate()
              throws HL7ApplicationException
Method validate.

Throws:
HL7ApplicationException

Sun Adapter for TCP/IP HL7