com.ibm.connector2.hod
Class J2HODManagedConnection

java.lang.Object
  |
  +--com.ibm.connector2.hod.J2HODManagedConnection
All Implemented Interfaces:
javax.resource.spi.ManagedConnection

public class J2HODManagedConnection
extends java.lang.Object
implements javax.resource.spi.ManagedConnection

ManagedConnection instance represents a physical connection to the underlying EIS.

A ManagedConnection instance provides access to a pair of interfaces: javax.transaction.xa.XAResource and javax.resource.spi.LocalTransaction.

XAResource interface is used by the transaction manager to associate and dissociate a transaction with the underlying EIS resource manager instance and to perform two-phase commit protocol. The ManagedConnection interface is not directly used by the transaction manager. More detail on the XAResource interface are described in the JTA specification.

The LocalTransaction interface is used by the application server to manage local transactions.


Field Summary
static int PS_SIZE_24X132
           
static int PS_SIZE_24X80
           
static int PS_SIZE_27X132
           
static int PS_SIZE_32X80
           
static int PS_SIZE_43X80
           
 
Constructor Summary
J2HODManagedConnection()
          Creates an instance of J2HODManagedConnection.
J2HODManagedConnection(javax.resource.spi.ManagedConnectionFactory aFactory, javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo requestInfo, java.util.Properties prop, java.lang.String aUserName, java.lang.String aPassword)
          Creates an instance of J2HODManagedConnection.
 
Method Summary
 void addConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
          Adds a connection event listener to the ManagedConnection instance.
 void associateConnection(java.lang.Object handle)
          Used by the container to change the association of an application-level connection handle with a ManagedConnection instance.
 void cleanup()
          Application server calls this method to force any cleanup on the ManagedConnection instance.
 void destroy()
          Destroys the physical connection to the underlying resource manager.
 java.lang.Object getConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo requestInfo)
          Creates a new connection handle for the underlying physical connection represented by the ManagedConnection instance.
 javax.resource.spi.LocalTransaction getLocalTransaction()
          Returns a javax.resource.spi.LocalTransaction instance.
 java.io.PrintWriter getLogWriter()
          getLogWriter method comment.
 javax.resource.spi.ManagedConnectionMetaData getMetaData()
          Gets the metadata information for this connection's underlying EIS resource manager instance.
 javax.transaction.xa.XAResource getXAResource()
          Returns an javax.transaction.xa.XAresource instance.
 boolean isDirty()
          Indicatates whether there have been an error or not.
 boolean isLoggedOn()
          Indicates whether this connection is logged on or not.
 boolean isReauthentication()
          Indicates whether is is a reauthentication or not.
 void removeConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
          Removes connection event listener.
 void setLogWriter(java.io.PrintWriter out)
          Sets log-writer output.
 void setReauthentication(boolean newReauthentication)
          Specifies whether to reauthenticate or not.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PS_SIZE_24X80

public static final int PS_SIZE_24X80

PS_SIZE_32X80

public static final int PS_SIZE_32X80

PS_SIZE_43X80

public static final int PS_SIZE_43X80

PS_SIZE_27X132

public static final int PS_SIZE_27X132

PS_SIZE_24X132

public static final int PS_SIZE_24X132
Constructor Detail

J2HODManagedConnection

public J2HODManagedConnection()
Creates an instance of J2HODManagedConnection.

J2HODManagedConnection

public J2HODManagedConnection(javax.resource.spi.ManagedConnectionFactory aFactory,
                              javax.security.auth.Subject subject,
                              javax.resource.spi.ConnectionRequestInfo requestInfo,
                              java.util.Properties prop,
                              java.lang.String aUserName,
                              java.lang.String aPassword)
                       throws javax.resource.ResourceException
Creates an instance of J2HODManagedConnection.
Parameters:
aFactory - ManagedConnectionFactory
subject - javax.security.auth.Subject
requestInfo - ConnectionRequestInfo
prop - java.util.Properties
aUserName - java.lang.String
aPassword - java.lang.String
Throws:
javax.resource.ResourceException -  
Method Detail

addConnectionEventListener

public void addConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
Adds a connection event listener to the ManagedConnection instance. The registered ConnectionEventListener instances are notified of connection close and error events, also of local transaction related events on the Managed Connection.
Specified by:
addConnectionEventListener in interface javax.resource.spi.ManagedConnection
Parameters:
listener - javax.resource.spi.ConnectionEventListener - a new ConnectionEventListener to be registered

associateConnection

public void associateConnection(java.lang.Object handle)
                         throws javax.resource.ResourceException
Used by the container to change the association of an application-level connection handle with a ManagedConnection instance. The container should find the right ManagedConnection instance and call the associateConnection method.

The resource adapter is required to implement the associateConnection method. The method implementation for a ManagedConnection should dissociate the connection handle (passed as a parameter) from its currently associated ManagedConnection and associate the new connection handle with itself.

Specified by:
associateConnection in interface javax.resource.spi.ManagedConnection
Parameters:
handle - java.lang.Object

cleanup

public void cleanup()
             throws javax.resource.ResourceException
Application server calls this method to force any cleanup on the ManagedConnection instance.

The method ManagedConnection cleanup initiates a cleanup of any client-specific state as maintained by a ManagedConnection instance. The cleanup should invalidate all connection handles that had been created using this ManagedConnection instance. Any attempt by an application component to use the connection handle after cleanup of the underlying ManagedConnection should result in an exception.

The cleanup of ManagedConnection is always driven by an application server. An appliation server should not invoke ManagedConnection.cleanup() when there is an uncompleted transaction (associated with ManagedConnection instance) in progress.

The invocation of ManagedConnection cleanup method on an already cleaned-up connection should not throw an exception.

The cleanup of ManagedConnection instance resets its client specific state and prepares the connection to be put back in to a connection pool. The cleanup method should not cause resource adapter to close the physical pipe and reclaim system resources associated with the physical connection.

Specified by:
cleanup in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException - - generic exception if operation fails

destroy

public void destroy()
             throws javax.resource.ResourceException
Destroys the physical connection to the underlying resource manager.

To manage the isze of the connection pool, an application server can explicitly call ManagedConnection destroy to destroy a physical connection. A resource adapter should destroy all allocated system resources for this ManagedConnection instance when the method destroy is called.

Specified by:
destroy in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException - - generic exception if operation failed

getConnection

public java.lang.Object getConnection(javax.security.auth.Subject subject,
                                      javax.resource.spi.ConnectionRequestInfo requestInfo)
                               throws javax.resource.ResourceException
Creates a new connection handle for the underlying physical connection represented by the ManagedConnection instance. This connection handle is used by the application code to refer to the underlying physical connection. A connection handle is tied to its ManagedConnection instance in a resource adapter implementation specific way.

The ManagedConnection uses the Subject and additional ConnectionRequest Info (which is specific to resource adapter and opaque to application server) to set the state of the physical connection.

Specified by:
getConnection in interface javax.resource.spi.ManagedConnection
Parameters:
subject - javax.security.auth.Subject - security context as JAAS subject
requestInfo - ConnectionRequestInfo
Returns:
Object - generic Object instance representing the connection handle. For CCI, the connection handle created by a ManagedConnection instance isof the type javax.resource.cci.Connection

getLocalTransaction

public javax.resource.spi.LocalTransaction getLocalTransaction()
                                                        throws javax.resource.ResourceException
Returns a javax.resource.spi.LocalTransaction instance. The LocalTransaction interface is used by the container to manage local transactions for a RM instance.
Specified by:
getLocalTransaction in interface javax.resource.spi.ManagedConnection
Returns:
javax.resource.spi.LocalTransaction
Throws:
javax.resource.ResourceException - - generic exception if operation fails

getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws javax.resource.ResourceException
getLogWriter method comment.
Specified by:
getLogWriter in interface javax.resource.spi.ManagedConnection

getMetaData

public javax.resource.spi.ManagedConnectionMetaData getMetaData()
                                                         throws javax.resource.ResourceException
Gets the metadata information for this connection's underlying EIS resource manager instance. The ManagedConnectionMetaData interface provides information about the underlying EIS instance associated with the ManagedConenction instance.
Specified by:
getMetaData in interface javax.resource.spi.ManagedConnection
Returns:
javax.resource.spi.ManagedConnectionMetaData
Throws:
javax.resource.ResourceException - - generic exception if operation fails

getXAResource

public javax.transaction.xa.XAResource getXAResource()
                                              throws javax.resource.ResourceException
Returns an javax.transaction.xa.XAresource instance. An application server enlists this XAResource instance with the Transaction Manager if the ManagedConnection instance is being used in a JTA transaction that is being coordinated by the Transaction Manager.
Specified by:
getXAResource in interface javax.resource.spi.ManagedConnection
Returns:
javax.transaction.xa.XAResource
Throws:
javax.resource.ResourceException - - generic exception if operation fails

isDirty

public boolean isDirty()
Indicatates whether there have been an error or not.
Returns:
boolean - true if error has occurred

isLoggedOn

public boolean isLoggedOn()
Indicates whether this connection is logged on or not.
Returns:
boolean - true if logged on; otherwise false

isReauthentication

public boolean isReauthentication()
Indicates whether is is a reauthentication or not.
Returns:
boolean - true if reauthenticate; otherwise false

removeConnectionEventListener

public void removeConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
Removes connection event listener.
Specified by:
removeConnectionEventListener in interface javax.resource.spi.ManagedConnection
Parameters:
listener - javax.resource.spi.ConnectionEventListener

setLogWriter

public void setLogWriter(java.io.PrintWriter out)
                  throws javax.resource.ResourceException
Sets log-writer output.
Specified by:
setLogWriter in interface javax.resource.spi.ManagedConnection
Parameters:
out - java.io.PrintWriter - logwriter output
Throws:
javax.resource.ResourceException -  

setReauthentication

public void setReauthentication(boolean newReauthentication)
Specifies whether to reauthenticate or not.
Parameters:
newReauthentication - boolean - true if setting to reauthenticate; false otherwise.