Sun Adapter for TCP/IP HL7

com.stc.connector.tcpip.model.client
Class TCPIPEwayConnection

java.lang.Object
  extended by com.stc.connector.tcpip.model.client.TCPIPEwayConnection
All Implemented Interfaces:
com.stc.connector.framework.eway.EwayConnection, com.stc.connector.framework.eway.ValidatingEwayConnection, com.stc.connector.management.STCManagedSlave
Direct Known Subclasses:
TCPIPEXTEwayConnection

public class TCPIPEwayConnection
extends java.lang.Object
implements com.stc.connector.framework.eway.ValidatingEwayConnection, com.stc.connector.management.STCManagedSlave

This class implements the ValidatingEwayConnection interface for providing TCPIP connection oriented services for the Eway/JCA framework.

Version:
cvs revision: $Revision: 1.25 $ Last Modified: $Date: 2008/03/18 11:17:35 $
Author:
Harry Liu

Field Summary
protected  TCPIPMonitorData mMonitorData
           
static java.lang.String version
           
 
Constructor Summary
TCPIPEwayConnection()
          Constructor of TCPIPEwayConnection
 
Method Summary
 void cleanup()
          Perform clean up of any resources or reset of any state held by the instance of EwayConnection.
 void closeConnection(java.lang.Exception ex)
          Closes socket connection if any.
 TCPIPClientApplication createTCPIPClientApplication(TCPIPApplicationConnection appConn, java.lang.String appName)
          Creates TCPIPClientApplication object.
 void destroy()
          Release any resources prior to the destruction of the associated ManagedConnection.
 void destroyConnectionHandles()
           
protected  void generateAlert(java.lang.String msg, java.lang.String alertMsg, int state)
           
 com.stc.connector.framework.util.ConfigurationHelper getConfiguration()
          Returns the initial configuration.
 com.stc.connector.framework.client.AssociateableHandle getConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cri)
          Get a new instance of the connection handle (application connection).
 java.util.Set getConnectionHandles()
           
 TCPIPApplicationConnection getCurrentApplicationConnection()
          Returns the current application connection instance.
 javax.resource.spi.LocalTransaction getLocalTransaction()
          Get a LocalTransaction instance for local transaction demaracation.
 com.stc.connector.framework.eway.ManagedConnectionCallback getManagedConnectionCallback()
          Returns the ManagedConnectionCallback object.
 javax.resource.spi.ManagedConnectionMetaData getMetaData()
          Get a new instance of the ManagedConnectionMetaData which contains connection information for the currently established connection.
 com.stc.connector.management.util.ObjectReference getMonitor()
           
 java.net.Socket getSocket()
          Returns the Socket object.
 javax.security.auth.Subject getSubject()
          Returns the Subject object.
 TCPIPClientGeneralInfo getTCPIPClientGeneralInfo()
          Returns the TCPIPClientGeneralInfo object.
protected  TCPIPResourceAdapter getTCPIPResourceAdapter()
          Method getTCPIPResourceAdapter.
 TCPIPSocketInfo getTCPIPSocketInfo()
          Returns the TCPIPSocketInfo object.
 javax.transaction.xa.XAResource getXAResource()
          Get an XAResource instance for global transaction demaracation.
 void initialize(com.stc.connector.framework.eway.ManagedConnectionCallback aCallback, javax.security.auth.Subject aSubject, javax.resource.spi.ConnectionRequestInfo aConfiguration, com.stc.connector.management.jca.system.mbeans.MonitorDataContainer aMonitorDataContainer)
          Initialize the EwayConnection.
protected  void initializeMsg()
          Method initializeMsg.
 boolean isValidConnection()
           
 boolean matchConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cri)
          Determines whether this instance of the EwayConnection matches the the connection request with the connection information in Subject and/or ConnectionRequestInfo.
 void setMonitor(com.stc.connector.management.util.ObjectReference aMonitor)
           
 void setTCPIPClientGeneralInfo(TCPIPClientGeneralInfo clientGeneralInfo)
          Sets the TCPIPClientGeneralInfo object.
 void setTCPIPSocketInfo(TCPIPSocketInfo socketInfo)
          Sets the TCPIPSocketInfo object.
 void updateMBeanConnectionStatus(int status)
          Updates RA MBean status to indicate the status of the physical socket connection.
 
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

mMonitorData

protected TCPIPMonitorData mMonitorData
Constructor Detail

TCPIPEwayConnection

public TCPIPEwayConnection()
Constructor of TCPIPEwayConnection

Method Detail

initialize

public void initialize(com.stc.connector.framework.eway.ManagedConnectionCallback aCallback,
                       javax.security.auth.Subject aSubject,
                       javax.resource.spi.ConnectionRequestInfo aConfiguration,
                       com.stc.connector.management.jca.system.mbeans.MonitorDataContainer aMonitorDataContainer)
                throws javax.resource.ResourceException
Initialize the EwayConnection. Establish the connection to the external system (EIS).

Specified by:
initialize in interface com.stc.connector.framework.eway.EwayConnection
Parameters:
mcCallback - The callback object for getting services from the associated ManagedConnection.
aSubject - The Subject instance which holds the credentials for EIS signon.
aConfiguration - The ConnectionRequestInfo instance which can hold both EIS signon information or general connection specific information. The ConnectionRequestInfo provided will contain the union of the properties from the client connection request properties, the ResourceAdapter properties, and the ManagedConnectionFactory properties.
aMonitorDataContainer - MonitorDataContainer
Throws:
javax.resource.ResourceException - upon error.
See Also:
#initialize(ManagedConnectionCallback, Subject, ConnectionRequestInfo, MonitorDataContainer)

initializeMsg

protected void initializeMsg()
                      throws javax.resource.ResourceException
Method initializeMsg.

Throws:
javax.resource.ResourceException

cleanup

public void cleanup()
             throws javax.resource.ResourceException
Perform clean up of any resources or reset of any state held by the instance of EwayConnection.

Specified by:
cleanup in interface com.stc.connector.framework.eway.EwayConnection
Throws:
javax.resource.ResourceException - upon error.
See Also:
EwayConnection.cleanup()

destroy

public void destroy()
             throws javax.resource.ResourceException
Release any resources prior to the destruction of the associated ManagedConnection.

Specified by:
destroy in interface com.stc.connector.framework.eway.EwayConnection
Throws:
javax.resource.ResourceException - upon error.
See Also:
EwayConnection.destroy()

matchConnection

public boolean matchConnection(javax.security.auth.Subject subject,
                               javax.resource.spi.ConnectionRequestInfo cri)
Determines whether this instance of the EwayConnection matches the the connection request with the connection information in Subject and/or ConnectionRequestInfo.

Specified by:
matchConnection in interface com.stc.connector.framework.eway.EwayConnection
Parameters:
subject - The Subject instance which holds the credentials for EIS signon.
cri - The ConnectionRequestInfo instance which holds both EIS EIS signon information or general connection specific information. The ConnectionRequestInfo provided will contain the union of the properties from the client connection request properties, the ResourceAdapter properties, and the ManagedConnectionFactory properties.
Returns:
A boolean true if there is a connection match; false otherwise.
See Also:
EwayConnection.matchConnection(Subject, ConnectionRequestInfo)

getConnection

public com.stc.connector.framework.client.AssociateableHandle getConnection(javax.security.auth.Subject subject,
                                                                            javax.resource.spi.ConnectionRequestInfo cri)
                                                                     throws javax.resource.ResourceException
Get a new instance of the connection handle (application connection).

Specified by:
getConnection in interface com.stc.connector.framework.eway.EwayConnection
Parameters:
subject - The Subject instance which holds the credentials for EIS signon.
cri - The ConnectionRequestInfo instance which holds both EIS EIS signon information or general connection specific information. The ConnectionRequestInfo provided will contain the union of the properties from the client connection request properties, the ResourceAdapter properties, and the ManagedConnectionFactory properties.
Returns:
A connection handle (application connection) instance which implements the Associateable interface.
Throws:
javax.resource.ResourceException - upon error.
See Also:
EwayConnection.getConnection(Subject, ConnectionRequestInfo)

getCurrentApplicationConnection

public TCPIPApplicationConnection getCurrentApplicationConnection()
Returns the current application connection instance.

Returns:
TCPIPApplicationConnection

getLocalTransaction

public javax.resource.spi.LocalTransaction getLocalTransaction()
                                                        throws javax.resource.ResourceException
Get a LocalTransaction instance for local transaction demaracation.

Specified by:
getLocalTransaction in interface com.stc.connector.framework.eway.EwayConnection
Returns:
A LocalTransaction instance.
Throws:
javax.resource.ResourceException - upon error.
See Also:
EwayConnection.getLocalTransaction()

getMetaData

public javax.resource.spi.ManagedConnectionMetaData getMetaData()
                                                         throws javax.resource.ResourceException
Get a new instance of the ManagedConnectionMetaData which contains connection information for the currently established connection.

Specified by:
getMetaData in interface com.stc.connector.framework.eway.EwayConnection
Returns:
An instance of ManagedConnectionMetaData which contains information about the current established connection to the EIS.
Throws:
javax.resource.ResourceException - upon error.
See Also:
EwayConnection.getMetaData()

getXAResource

public javax.transaction.xa.XAResource getXAResource()
                                              throws javax.resource.ResourceException
Get an XAResource instance for global transaction demaracation.

Specified by:
getXAResource in interface com.stc.connector.framework.eway.EwayConnection
Returns:
A XAResource instance.
Throws:
javax.resource.ResourceException - upon error.
See Also:
EwayConnection.getXAResource()

getSocket

public java.net.Socket getSocket()
Returns the Socket object.

Returns:
The Socket instance.

getConfiguration

public com.stc.connector.framework.util.ConfigurationHelper getConfiguration()
Returns the initial configuration.

Returns:
ConfigurationHelper

getManagedConnectionCallback

public com.stc.connector.framework.eway.ManagedConnectionCallback getManagedConnectionCallback()
Returns the ManagedConnectionCallback object.

Returns:
The ManagedConnectionCallback instance.

getSubject

public javax.security.auth.Subject getSubject()
Returns the Subject object.

Returns:
The Subject instance.

getTCPIPClientGeneralInfo

public TCPIPClientGeneralInfo getTCPIPClientGeneralInfo()
Returns the TCPIPClientGeneralInfo object.

Returns:
The TCPIPClientGeneralInfo instance.

setTCPIPClientGeneralInfo

public void setTCPIPClientGeneralInfo(TCPIPClientGeneralInfo clientGeneralInfo)
Sets the TCPIPClientGeneralInfo object.

Parameters:
clientGeneralInfo - The TCPIPClientGeneralInfo instance.

getTCPIPSocketInfo

public TCPIPSocketInfo getTCPIPSocketInfo()
Returns the TCPIPSocketInfo object.

Returns:
The TCPIPSocketInfo instance.

setTCPIPSocketInfo

public void setTCPIPSocketInfo(TCPIPSocketInfo socketInfo)
Sets the TCPIPSocketInfo object.

Parameters:
socketInfo - The TCPIPSocketInfo instance.

createTCPIPClientApplication

public TCPIPClientApplication createTCPIPClientApplication(TCPIPApplicationConnection appConn,
                                                           java.lang.String appName)
                                                    throws TCPIPApplicationException
Creates TCPIPClientApplication object.

Parameters:
appConn - TCPIPApplicationConnection instance
appName - Application name
Returns:
TCPIPClientApplication object
Throws:
TCPIPApplicationException - up on an error

getTCPIPResourceAdapter

protected TCPIPResourceAdapter getTCPIPResourceAdapter()
Method getTCPIPResourceAdapter.

Returns:
TCPIPResourceAdapter

getConnectionHandles

public java.util.Set getConnectionHandles()
Returns:

destroyConnectionHandles

public void destroyConnectionHandles()

closeConnection

public void closeConnection(java.lang.Exception ex)
Closes socket connection if any. Also, an event CONNECTION_ERROR_OCCURRED is sent to container to remove the connection from connection pool.

Parameters:
ex -

updateMBeanConnectionStatus

public void updateMBeanConnectionStatus(int status)
Updates RA MBean status to indicate the status of the physical socket connection.

Parameters:
status - Notification Event.

isValidConnection

public boolean isValidConnection()
Specified by:
isValidConnection in interface com.stc.connector.framework.eway.ValidatingEwayConnection
See Also:
ValidatingEwayConnection.isValidConnection()

setMonitor

public void setMonitor(com.stc.connector.management.util.ObjectReference aMonitor)
Specified by:
setMonitor in interface com.stc.connector.management.STCManagedSlave
See Also:
STCManagedSlave.setMonitor(com.stc.connector.management.util.ObjectReference)

generateAlert

protected void generateAlert(java.lang.String msg,
                             java.lang.String alertMsg,
                             int state)

getMonitor

public com.stc.connector.management.util.ObjectReference getMonitor()

Sun Adapter for TCP/IP HL7