Sun Adapter for TCP/IP HL7

com.stc.connector.tcpip.model.server
Class TCPIPServerApplicationConnection

java.lang.Object
  extended by com.stc.connector.tcpip.model.server.TCPIPServerApplicationConnection
All Implemented Interfaces:
com.stc.connector.appconn.common.ApplicationConnection

public class TCPIPServerApplicationConnection
extends java.lang.Object
implements com.stc.connector.appconn.common.ApplicationConnection

This class implements the ApplicationConnection interface for the TCPIP Server Application Connection.

Version:
cvs revision: $Revision: 1.11 $ Last Modified: $Date: 2008/04/23 07:15:20 $
Author:
Harry Liu

Field Summary
static java.lang.String SCOPE_BUSINESS_RULE
           
static java.lang.String SCOPE_COLLABORATION
           
static java.lang.String SCOPE_RESOURCE_ADAPTER
           
static java.lang.String SCOPE_SESSION
           
static java.lang.String version
           
 
Constructor Summary
TCPIPServerApplicationConnection(TCPIPServerWorkerTask workerTask)
          Creates a new instance of TCPIPServerApplicationConnection.
 
Method Summary
 int available()
           
 int available(long timeOut)
          6633604 - In 5.1.3 when external HL7 system recycle its side the old connection is not getting relinquished.
 boolean checkIfClosed()
          Checks whether the Connection instance was already closed (if close was previously called).
 void close()
          Closes the application connection handle.
 java.lang.Object createApplication(java.lang.String appName)
          Creates an Application from the Application Connection.
 com.stc.connector.appconn.common.OutputHandler createOutputHandler()
          Creates an OutputHandler for "sending" data to the EIS.
 TCPIPServerEndpoint getEwayEndpoint()
          Gets the TCPIPServerEwayActivationSpec associated with this application connection.
 long getLastSuccessReceiveTime()
           
 byte[] getLeftOverFromLastRead()
           
 TCPIPServerWorkerTask getServerWorkerTask()
          Returns the workerTask.
 java.net.Socket getSocket()
          Gets the Socket associated with this application connection.
 State getState()
           
 boolean isUsedByBPEL()
          Returns the usedByBPEL.
 void setLastSuccessReceiveTime(long l)
           
 void setLeftOverFromLastRead(byte[] bs)
           
 void setState(State state)
           
 void setUsedByBPEL(boolean usedByBPEL)
          Sets the usedByBPEL.
 void setWorkerTask(TCPIPServerWorkerTask task)
           
 
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

SCOPE_RESOURCE_ADAPTER

public static final java.lang.String SCOPE_RESOURCE_ADAPTER
See Also:
Constant Field Values

SCOPE_SESSION

public static final java.lang.String SCOPE_SESSION
See Also:
Constant Field Values

SCOPE_COLLABORATION

public static final java.lang.String SCOPE_COLLABORATION
See Also:
Constant Field Values

SCOPE_BUSINESS_RULE

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

TCPIPServerApplicationConnection

public TCPIPServerApplicationConnection(TCPIPServerWorkerTask workerTask)
Creates a new instance of TCPIPServerApplicationConnection.

Parameters:
workerTask - The TCPIPServerWorkerTask which creates the connection.
Method Detail

close

public void close()
           throws TCPIPApplicationConnectionException
Closes the application connection handle. Once the close method is called, using the application created from the application connection must be forbidden and must result in an ApplicationConnectionException. The association between an application connection and the application is implementation specific.

Specified by:
close in interface com.stc.connector.appconn.common.ApplicationConnection
Throws:
TCPIPApplicationConnectionException - upon error.
See Also:
ApplicationConnection.close()

createApplication

public java.lang.Object createApplication(java.lang.String appName)
                                   throws TCPIPApplicationException
Creates an Application from the Application Connection. The application is an API which can be used to interact with the underlying EIS. The application API must be invalidated once the close method is called on the Application Connection. If null is passed for the application name, then the default application will be created. Otherwise, the application name will be used to create the appropriate connection.

Specified by:
createApplication in interface com.stc.connector.appconn.common.ApplicationConnection
Parameters:
appName - The name of the application to create.
Returns:
A java.lang.Object representing the EIS specific application component to interact with the EIS.
Throws:
TCPIPApplicationException - upon error.
See Also:
ApplicationConnection.createApplication(String)

createOutputHandler

public com.stc.connector.appconn.common.OutputHandler createOutputHandler()
                                                                   throws TCPIPApplicationException
Creates an OutputHandler for "sending" data to the EIS. If the eWay does not support an OutputHandler, then it should return null for its implementation of this method.

Specified by:
createOutputHandler in interface com.stc.connector.appconn.common.ApplicationConnection
Returns:
The eWay specific OutputHandler for handling "sending" data to the external system or null if the eWay does not have an OutputHandler.
Throws:
TCPIPApplicationException - upon error.
See Also:
ApplicationConnection.createOutputHandler()

checkIfClosed

public boolean checkIfClosed()
Checks whether the Connection instance was already closed (if close was previously called).

Returns:
true if already closed, false otherwise.

getSocket

public java.net.Socket getSocket()
Gets the Socket associated with this application connection.

Returns:
The Socket instance associated with this application connection.

getEwayEndpoint

public TCPIPServerEndpoint getEwayEndpoint()
Gets the TCPIPServerEwayActivationSpec associated with this application connection.

Returns:
The TCPIPServerEwayActivationSpec instance associated with this application connection.

getServerWorkerTask

public TCPIPServerWorkerTask getServerWorkerTask()
Returns the workerTask.

Returns:
TCPIPServerWorkerTask

isUsedByBPEL

public boolean isUsedByBPEL()
Returns the usedByBPEL.

Returns:
boolean

setUsedByBPEL

public void setUsedByBPEL(boolean usedByBPEL)
Sets the usedByBPEL.

Parameters:
usedByBPEL - The usedByBPEL to set

getState

public State getState()
See Also:
TCPIPClientApplication.getState()

setState

public void setState(State state)
See Also:
TCPIPClientApplication.setState(java.lang.String state)

getLastSuccessReceiveTime

public long getLastSuccessReceiveTime()
Returns:
returns the last success receive time set by user

setLastSuccessReceiveTime

public void setLastSuccessReceiveTime(long l)
Parameters:
l - the value to be set

setWorkerTask

public void setWorkerTask(TCPIPServerWorkerTask task)
Parameters:
task - The TCPIPServerWorkerTask to be set

getLeftOverFromLastRead

public byte[] getLeftOverFromLastRead()
Returns:
returns the data leftover from last read

setLeftOverFromLastRead

public void setLeftOverFromLastRead(byte[] bs)
Parameters:
sets - the data leftover from last read

available

public int available()
              throws TCPIPApplicationException,
                     java.io.IOException
Returns:
the length of available data for next read()
Throws:
TCPIPApplicationException
java.io.IOException

available

public int available(long timeOut)
              throws TCPIPApplicationException,
                     java.net.SocketException,
                     java.io.IOException
6633604 - In 5.1.3 when external HL7 system recycle its side the old connection is not getting relinquished. This is a port of fix for ESR 101086 to 5.1.3 This call does a blocking read with a timeout if no data is available.

Returns:
the length of available data for next read()
Throws:
TCPIPApplicationException
java.io.IOException
java.net.SocketException

Sun Adapter for TCP/IP HL7