Sun Adapter for TCP/IP HL7

com.stc.connector.appconn.tcpip.model
Interface TCPIPClientApplication

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

public interface TCPIPClientApplication

This interface represents the outbound TCP/IP application interface.

Version:
cvs revision: $Revision: 1.12 $ Last Modified: $Date: 2005/10/02 18:36:38 $
Author:
Harry Liu

Field Summary
static java.lang.String version
           
 
Method Summary
 void closeConnection()
          Closes the existing connection physically (no matter it is good or bad).
 int getMaxDataSize()
          Returns the maxDataSize.
 java.net.Socket getSocket()
          Returns the underlying java.net.Socket instance which the e*Way relys on.
 java.lang.String getState()
          Returns the State which is set by user.
 TCPIPClientConfigInfoInterface getTCPIPOutboundConfigInfo()
          Returns an object which represents the base TCP/IP Outbound configuration information.
 boolean isClosed()
          Checks whether the connection is closed.
 byte[] receiveBytes()
          Reads all data which is available on TCP/IP connection.
 java.lang.String receiveString()
          Reads all data which is available on TCP/IP connection.
 java.lang.String receiveString(java.lang.String encoding)
          Reads all data which is available on TCP/IP connection.
 void sendBytes(byte[] bytes)
          Sends a byte array 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 State.
 

Field Detail

version

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

getTCPIPOutboundConfigInfo

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

Returns:
TCPIPClientConfigInfo object

isClosed

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

Returns:
boolean Represents the status of the connection
Throws:
TCPIPApplicationException - on error
java.io.IOException - on i/o error

closeConnection

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

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

getSocket

java.net.Socket getSocket()
                          throws TCPIPApplicationException,
                                 java.io.IOException
Returns the underlying java.net.Socket instance which the e*Way relys on. You can perform Socket operations 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.*.

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

getMaxDataSize

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

Returns:
The max size of data that can be held.

setMaxDataSize

void setMaxDataSize(int maxDataSize)
                    throws TCPIPApplicationException
Sets the maxDataSize. This size defines the max size of data which the programs can hold internally. The valid range is from 1 to 2GB (the max value of java integer).

Parameters:
maxDataSize - The maxDataSize to set
Throws:
TCPIPApplicationException - on error

getState

java.lang.String getState()
                          throws TCPIPApplicationException
Returns the State which is set by user. User can use this state to keep track the progress of the business rules. This state has 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 whole life cycle of the resource adapter.

Returns:
The state value.
Throws:
TCPIPApplicationException - on error

setState

void setState(java.lang.String stateValue)
              throws TCPIPApplicationException
Sets State. User can use this state to keep track the progress of the business rules. This state has 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 whole life cycle of the resource adapter.

Parameters:
stateValue - The state value to set
Throws:
TCPIPApplicationException - on error

receiveString

java.lang.String receiveString()
                               throws TCPIPApplicationException,
                                      java.io.IOException
Reads all data which is available on TCP/IP connection. Returns a String object with JVM default encoding.
 Followings are the end conditions of the read operation:
   - No more data in the socket stream (end of file)
   - Timeout occurs (note: here timeout is treated as an indication instead of error)
 
Once one of the above conditions stands, the reading attempt will gracefully stop and all data will be returned. An empty string "" will be returned if no any data is received.

Returns:
A String
Throws:
TCPIPApplicationException - on error
java.io.IOException - on i/o error

receiveString

java.lang.String receiveString(java.lang.String encoding)
                               throws TCPIPApplicationException,
                                      java.io.IOException
Reads all data which is available on TCP/IP connection. Returns a String object with specified encoding.
 Followings are the end conditions of the read operation:
   - No more data in the socket stream (end of file)
   - Timeout occurs (note: here timeout is treated as an indication instead of error)
 
Once one of the above conditions stands, the reading attempt will gracefully stop and all data will be returned. An empty string "" will be returned if no any data is received.

Parameters:
encoding - The encoding charset name.
Returns:
A String
Throws:
TCPIPApplicationException - on error
java.io.IOException - on i/o error

receiveBytes

byte[] receiveBytes()
                    throws TCPIPApplicationException,
                           java.io.IOException
Reads all data which is available on TCP/IP connection. Returns a byte array.
 Followings are the end conditions of the read operation:
   - No more data in the socket stream (end of file)
   - Timeout occurs (note: here timeout is treated as an indication instead of error)
 
Once one of the above conditions stands, the reading attempt will gracefully stop and all data will be returned. A zero-length byte array will be returned if no any data is received.

Returns:
A byte array
Throws:
TCPIPApplicationException - on error
java.io.IOException - on 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 - on error
java.io.IOException - on 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 - on error
java.io.IOException - on 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 - on error
java.io.IOException - on i/o error

Sun Adapter for TCP/IP HL7