Sun Adapter for TCP/IP HL7

com.stc.connector.appconn.tcpip.ext
Interface TCPIPEXTClientApplication

All Known Implementing Classes:
HL7ClientApplicationImpl, HL7ServerApplicationImpl, HL7v3ClientApplicationImpl, HL7v3ServerApplicationImpl, TCPIPEXTClientApplicationImpl, TCPIPEXTServerApplicationImpl

public interface TCPIPEXTClientApplication

This interface represents the extended TCP/IP client application with envelope message interface upon TCP/IP.

Version:
cvs revision: $Revision: 1.16 $ Last Modified: $Date: 2008/04/23 07:18:12 $
Author:
Harry Liu

Field Summary
static java.lang.String version
           
 
Method Summary
 void closeConnection()
          Closes the existing connection physically (whether it is good or bad).
 int getMaxDataSize()
          Returns the maxDataSize.
 MessageInfoInterface getMessageInfo()
          Gets the message configuration information.
 java.net.Socket getSocket()
          Returns the underlying java.net.Socket instance on which the eWay relys.
 java.lang.String getState()
          Returns the State that is set by user.
 TCPIPClientConfigInfoInterface getTCPIPOutboundConfigInfo()
          Returns an object which represents the base TCP/IP Outbound configuration information.
 boolean isClosed()
          Checks to see if the connection is closed.
 byte[] receiveBytes()
          Reads all available data on the TCP/IP connection.
 byte[] receiveEnvelopedMsg()
          Receives an EnvelopedMsg through the TCP/IP connection.
 java.lang.String receiveString()
          Reads all of the available data on TCP/IP connection.
 java.lang.String receiveString(java.lang.String encoding)
          Reads all available data on the TCP/IP connection.
 void sendBytes(byte[] bytes)
          Sends a byte array through the TCP/IP connection.
 void sendEnvelopedMsg(byte[] msg)
          Sends an EnvelopedMsg through the TCP/IP connection.
 void sendString(java.lang.String str)
          Sends a String with JVM default encoding through the TCP/IP connection.
 void sendString(java.lang.String str, java.lang.String encoding)
          Sends a String with the specified encoding through the TCP/IP connection.
 void setMaxDataSize(int maxDataSize)
          Sets the maxDataSize.
 void setState(java.lang.String stateValue)
          Sets the State.
 

Field Detail

version

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

getMessageInfo

MessageInfoInterface getMessageInfo()
                                    throws TCPIPApplicationException,
                                           java.io.IOException
Gets the message configuration information. You can change the message configuration dynamically at runtime through the returned instance.

Returns:
MessageInfo instance
Throws:
TCPIPApplicationException - on error
java.io.IOException - on i/o error

receiveEnvelopedMsg

byte[] receiveEnvelopedMsg()
                           throws TCPIPApplicationException,
                                  java.io.IOException
Receives an EnvelopedMsg through the TCP/IP connection. The envelope settings (e.g. Envelope Type, Store Until Char, etc) will be from the configuration.
 This e*Way Can be configured to handle different kinds of
 envelopes. Each envelope needs to be configured according to its
 components.
 
 Supported Envelope Types:
 +-----------------------+---------------------------------------------------+
 | Length Prefixed       | {Data Length} {Data}                              |
 +-----------------------+---------------------------------------------------+
 | End Marked            | {Data} {End Block}                                |
 +-----------------------+---------------------------------------------------+
 | Begin-End Marked      | {Start Block} {Data} {End Block}                  |
 +-----------------------+---------------------------------------------------+
 | Fixed Length          | {Data}                                            |
 +-----------------------+---------------------------------------------------+
 | Per Active Connection | {Data}                                            |
 +-----------------------+---------------------------------------------------+
 | Marked & Fixed        | {Start Block} {Data} {Marker} {Fixed Length Data} |
 +-----------------------+---------------------------------------------------+
 | Custom                | Customer defines the structure                    |
 +-----------------------+---------------------------------------------------+
 
 
 Summary Of Envelopes And Their Dependencies:
 +-----------------------+---------------------------------------------------+
 | Length Prefixed       | Width Of Length                                   |
 |                       | Numeric Representation                            |
 +-----------------------+---------------------------------------------------+
 | End Marked            | Store Until Character                             |
 +-----------------------+---------------------------------------------------+
 | Begin-End Marked      | Store Until Character                             |
 |                       | Ignore Until Character                            |
 +-----------------------+---------------------------------------------------+
 | Fixed Length          | Bytes To Read                                     |
 +-----------------------+---------------------------------------------------+
 | Per Active Connection |                                                   |
 +-----------------------+---------------------------------------------------+
 | Marked & Fixed        | Store Until Character                             |
 |                       | Ignore Until Character                            |
 |                       | Bytes To Read                                     |
 +-----------------------+---------------------------------------------------+
 | Custom                | Customer Defined Property                         |
 +-----------------------+---------------------------------------------------+
 
 
 Length Prefixed
 ===============
 
 This envelope has the following structure:
 
         {Data Length} {Data}
 
 The Length component of this envelope indicates the length of the
 Data component. The length is represented in one of the allowed
 numeric representations.
 
 The Data component of the envelope is treated as a fixed length 
 Event.
 
 The 'Width Of Length' must also be specified for the e*Way to be
 able to understand the Length field.
 
 
 End Marked
 ==========
 
 This envelope has the following structure:
 
         {Data} {End Block}
 
 The End Block component of this envelope is the same as the Store
 Until configurable parameter.
 
 
 Begin-End Marked
 ================
 
 This envelope has the following structure:
 
         {Start Block} {Data} {End Block}
 
 The Start Block component of this envelope is the same as the 
 Ignore Until configurable parameter, and the End Block component 
 of this envelope is the same as the Store Until configurable 
 parameter.
 
 
 Fixed Length
 ============
 
 This envelope has the following structure:
 
         {Data} -------------------------------> Fixed Length
 
 This envelope is configured via the 'Bytes To Read' configurable
 parameter.  It is assumed that all the Events will be the same 
 length as specified in 'Bytes To Read'.
 
 
 Per Active Connection
 =====================
 
 This envelope has the following structure:
 
         {Data} -------------------------------> Per active connection
 
 The Event has no envelopes around it. The connection to the e*Way 
 is dropped by the external application after the Event has been 
 sent in entire.
 
 
 Marked & Fixed
 ==============
 
 This envelope has the following structure:
 
         {Start Block} {Data} {Marker} {Fixed Length Data}
 
 This envelope is similar to the Begin-End Marked envelope. it is
 configured via the Ignore Until, Store Until, and Bytes To Read
 configurable parameters.
 
 The Marker component in this envelope is the same as the Store 
 Until Configurable parameter. After reading the marker the e*Way 
 will read the rest of the envelope as specified in the Bytes To 
 Read parameter.
 
 
 Custom
 ======
 
 This envelope has not pre-defined structure. Customer is responsible for
 providing the structure and defining the behavior.
 
 

Returns:
The message data.
 For following envelope types, only the message body without envelope will be returned:
     BeginEndMarked message
     EndMarked message
     FixedLength message
     LengthPrefixed message
     PerActiveConnection message
 
 For following envelope types, the entire message including body and envelope will be returned:
     MarkedAndFixed message
 
 
Throws:
TCPIPApplicationException - on error
java.io.IOException - on i/o error

sendEnvelopedMsg

void sendEnvelopedMsg(byte[] msg)
                      throws TCPIPApplicationException,
                             java.io.IOException
Sends an EnvelopedMsg through the TCP/IP connection. The envelope settings (e.g. Envelope Type, Store Until Char, etc) will be from the configuration.
 This e*Way Can be configured to handle different kinds of
 envelopes. Each envelope needs to be configured according to its
 components.
 
 Supported Envelope Types:
 +-----------------------+---------------------------------------------------+
 | Length Prefixed       | {Data Length} {Data}                              |
 +-----------------------+---------------------------------------------------+
 | End Marked            | {Data} {End Block}                                |
 +-----------------------+---------------------------------------------------+
 | Begin-End Marked      | {Start Block} {Data} {End Block}                  |
 +-----------------------+---------------------------------------------------+
 | Fixed Length          | {Data}                                            |
 +-----------------------+---------------------------------------------------+
 | Per Active Connection | {Data}                                            |
 +-----------------------+---------------------------------------------------+
 | Marked & Fixed        | {Start Block} {Data} {Marker} {Fixed Length Data} |
 +-----------------------+---------------------------------------------------+
 | Custom                | Customer defines the structure                    |
 +-----------------------+---------------------------------------------------+
 
 
 Summary Of Envelopes And Their Dependencies:
 +-----------------------+---------------------------------------------------+
 | Length Prefixed       | Width Of Length                                   |
 |                       | Numeric Representation                            |
 +-----------------------+---------------------------------------------------+
 | End Marked            | Store Until Character                             |
 +-----------------------+---------------------------------------------------+
 | Begin-End Marked      | Store Until Character                             |
 |                       | Ignore Until Character                            |
 +-----------------------+---------------------------------------------------+
 | Fixed Length          | Bytes To Read                                     |
 +-----------------------+---------------------------------------------------+
 | Per Active Connection |                                                   |
 +-----------------------+---------------------------------------------------+
 | Marked & Fixed        | Store Until Character                             |
 |                       | Ignore Until Character                            |
 |                       | Bytes To Read                                     |
 +-----------------------+---------------------------------------------------+
 | Custom                | Customer Defined Property                         |
 +-----------------------+---------------------------------------------------+
 
 
 Length Prefixed
 ===============
 
 This envelope has the following structure:
 
         {Data Length} {Data}
 
 The Length component of this envelope indicates the length of the
 Data component. The length is represented in one of the allowed
 numeric representations.
 
 The Data component of the envelope is treated as a fixed length 
 Event.
 
 The 'Width Of Length' must also be specified for the e*Way to be
 able to understand the Length field.
 
 
 End Marked
 ==========
 
 This envelope has the following structure:
 
         {Data} {End Block}
 
 The End Block component of this envelope is the same as the Store
 Until configurable parameter.
 
 
 Begin-End Marked
 ================
 
 This envelope has the following structure:
 
         {Start Block} {Data} {End Block}
 
 The Start Block component of this envelope is the same as the 
 Ignore Until configurable parameter, and the End Block component 
 of this envelope is the same as the Store Until configurable 
 parameter.
 
 
 Fixed Length
 ============
 
 This envelope has the following structure:
 
         {Data} -------------------------------> Fixed Length
 
 This envelope is configured via the 'Bytes To Read' configurable
 parameter.  It is assumed that all the Events will be the same 
 length as specified in 'Bytes To Read'.
 
 
 Per Active Connection
 =====================
 
 This envelope has the following structure:
 
         {Data} -------------------------------> Per active connection
 
 The Event has no envelopes around it. The connection to the e*Way 
 is dropped by the external application after the Event has been 
 sent in entire.
 
 
 Marked & Fixed
 ==============
 
 This envelope has the following structure:
 
         {Start Block} {Data} {Marker} {Fixed Length Data}
 
 This envelope is similar to the Begin-End Marked envelope. it is
 configured via the Ignore Until, Store Until, and Bytes To Read
 configurable parameters.
 
 The Marker component in this envelope is the same as the Store 
 Until Configurable parameter. After reading the marker the e*Way 
 will read the rest of the envelope as specified in the Bytes To 
 Read parameter.
 
 
 Custom
 ======
 
 This envelope has not pre-defined structure. Customer is responsible for
 providing the structure and defining the behavior.
 
 

Parameters:
msg - The message to be sent
 For following envelope types, this byte array means message body without envelope:
     BeginEndMarked message
     EndMarked message
     FixedLength message
     LengthPrefixed message
     PerActiveConnection message
 
 For following envelope types, this byte array means the entire message including body and envelope:
     MarkedAndFixed message
 
 
Throws:
TCPIPApplicationException - on error
java.io.IOException - on i/o error

getTCPIPOutboundConfigInfo

TCPIPClientConfigInfoInterface getTCPIPOutboundConfigInfo()
Returns an object which represents the base TCP/IP Outbound configuration information.

Parameters:
None.

Returns:
TCPIPClientConfigInfo - Object.
Throws:
None.

isClosed

boolean isClosed()
                 throws TCPIPApplicationException,
                        java.io.IOException
Checks to see if the connection is closed.

Parameters:
None.

Returns:
Boolean - Represents the status of the connection.
Throws:
TCPIPApplicationException - Thrown upon error.
java.io.IOException - Thrown upon i/o error.

closeConnection

void closeConnection()
                     throws TCPIPApplicationException,
                            java.io.IOException
Closes the existing connection physically (whether it is good or bad). Once the connection is closed, any action over this connection will be invalid and will get exception.

Parameters:
None.

Throws:
TCPIPApplicationException - Thrown upon error.
java.io.IOException - Thrown upon i/o error.

getSocket

java.net.Socket getSocket()
                          throws TCPIPApplicationException,
                                 java.io.IOException
Returns the underlying java.net.Socket instance on which the eWay relys. Socket operations can be perform through the returned Socket instance. Also, you can query/change some socket options dynamically at runtime through the corresponding getters/setters of the returned Socket instance. For more details, please refer the JDK javedoc on java.net.*.

Parameters:
None.

Returns:
Socket - The java.net.Socket instance.
Throws:
TCPIPApplicationException - Thrown upon error.
java.io.IOException - Thrown upon i/o error.

getMaxDataSize

int getMaxDataSize()
Returns the maxDataSize. This size defines the maximum amount of data that the programs can hold internally. The valid range is from 1 to 2GB (the max value of the java integer).

Parameters:
None.

Returns:
int - The max size of data that can be held.
Throws:
None.

setMaxDataSize

void setMaxDataSize(int maxDataSize)
                    throws TCPIPApplicationException
Sets the maxDataSize. Defines the maximum amount of data that the programs can hold internally. The valid range is from 1 to 2GB (the max value of the java integer).

Parameters:
maxDataSize - The maxDataSize to set.
Throws:
TCPIPApplicationException - Thrown upon error.

getState

java.lang.String getState()
                          throws TCPIPApplicationException
Returns the State that is set by user. The user uses this state to keep track of the progress of the Business Rules. The state has the same life cycle as the resource adapter; that is, it is attached with the resource adapter. Once you set the state, its value will be kept during the entire life cycle of the resource adapter.

Parameters:
None.

Returns:
String - The state value.
Throws:
TCPIPApplicationException - Thrown upon error.

setState

void setState(java.lang.String stateValue)
              throws TCPIPApplicationException
Sets the State. The state is used to keep track of the progress of the Business Rules. The state has the same life cycle as the resource adapter; that is, it is attached with the resource adapter. Once you set the state, its value will be kept during the entire life cycle of the resource adapter.

Parameters:
stateValue - The state value to set.
Throws:
TCPIPApplicationException - Thrown upon error.

receiveString

java.lang.String receiveString()
                               throws TCPIPApplicationException,
                                      java.io.IOException
Reads all of the available data on TCP/IP connection. Returns a String object with JVM default encoding.

The following are the end conditions of the read operation:

Once one of the above conditions are in effect, the attempted reading gracefully stops and all data is returned. An empty string "" is returned if no data is received.

Parameters:
None.

Returns:
String - Object.
Throws:
TCPIPApplicationException - Thrown upon error
java.io.IOException - Thrown upon i/o error

receiveString

java.lang.String receiveString(java.lang.String encoding)
                               throws TCPIPApplicationException,
                                      java.io.IOException
Reads all available data on the TCP/IP connection. Returns a String object with specified encoding.

The following are the end conditions of the read operation:

Once one of the above conditions are in effect, the attempted reading gracefully stops and all data is returned. An empty string "" is returned if no data is received.

Parameters:
encoding - The encoding charset name.
Returns:
String Object.
Throws:
TCPIPApplicationException - Thrown upon error.
java.io.IOException - Thrown upon i/o error.

receiveBytes

byte[] receiveBytes()
                    throws TCPIPApplicationException,
                           java.io.IOException
Reads all available data on the TCP/IP connection. Returns a byte array.

The following are the end conditions of the read operation:

Once one of the above conditions are in effect, the attempted reading gracefully stops and all data is returned. A zero-length byte array is returned if no data is received.

Parameters:
None.

Returns:
byte[] - A byte array.
Throws:
TCPIPApplicationException - Thrown upon error.
java.io.IOException - Thrown upon i/o error.

sendString

void sendString(java.lang.String str)
                throws TCPIPApplicationException,
                       java.io.IOException
Sends a String with JVM default encoding through the TCP/IP connection.

Parameters:
str - A String to send.
Throws:
TCPIPApplicationException - Thrown upon error.
java.io.IOException - Thrown upon i/o error.

sendString

void sendString(java.lang.String str,
                java.lang.String encoding)
                throws TCPIPApplicationException,
                       java.io.IOException
Sends a String with the specified encoding through the TCP/IP connection.

Parameters:
str - A String to send.
encoding - The encoding charset name.
Throws:
TCPIPApplicationException - Thrown upon error.
java.io.IOException - Thrown upon i/o error.

sendBytes

void sendBytes(byte[] bytes)
               throws TCPIPApplicationException,
                      java.io.IOException
Sends a byte array through the TCP/IP connection.

Parameters:
bytes - A byte array to send.
Throws:
TCPIPApplicationException - Thrown upon error.
java.io.IOException - Thrown upon i/o error.

Sun Adapter for TCP/IP HL7