com.ibm.j2ca.base
Class WBIConnection

java.lang.Object
  extended bycom.ibm.j2ca.base.WBIConnection
All Implemented Interfaces:
javax.resource.cci.Connection

public abstract class WBIConnection
extends java.lang.Object
implements javax.resource.cci.Connection

A Connection instance represents a client-level handle to the physical EIS connection.

This class provides a foundation implementation that offers:

A subclass should:


Constructor Summary
WBIConnection(WBIManagedConnection managedConnection)
          Constructor will automatically associate the handle and extract needed configuration details from the ManagedConnection instance provided.
 
Method Summary
protected  void checkValidity()
          Verifies that this connection handle is still valid.
 void close()
          Invalidates this connection handle and notifies both the underlying WBIManagedConnection as well as the resource adapter container that this handle is no longer needed by the client.
abstract  javax.resource.cci.Interaction createInteraction()
          Developers should provide an EIS-specific Interaction implementation that can handle processing requests on the EIS.
 boolean getAutoCommit()
          Returns whether this connection handle should commit changes to the EIS after each interaction or wait for the resource adapter container to direct the managed connection to commit changes.
 javax.resource.cci.LocalTransaction getLocalTransaction()
          Returns a LocalTransaction instance that delegates calls to the underlying WBIManagedConnection.
 LogUtils getLogUtils()
           
 WBIManagedConnection getManagedConnection()
          Returns the ManagedConnection instance associated with the handle.
 javax.resource.cci.ConnectionMetaData getMetaData()
          Returns information to the client on the capabilities and underlying EIS reflected by this connection handle.
 javax.resource.cci.ResultSetInfo getResultSetInfo()
          By default, this method throws a NotSupportedException.
protected  void setLogUtils(LogUtils utils)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WBIConnection

public WBIConnection(WBIManagedConnection managedConnection)
              throws javax.resource.ResourceException
Constructor will automatically associate the handle and extract needed configuration details from the ManagedConnection instance provided.

Method Detail

createInteraction

public abstract javax.resource.cci.Interaction createInteraction()
                                                          throws javax.resource.ResourceException
Developers should provide an EIS-specific Interaction implementation that can handle processing requests on the EIS.

Specified by:
createInteraction in interface javax.resource.cci.Connection
Throws:
javax.resource.ResourceException

close

public void close()
           throws javax.resource.ResourceException
Invalidates this connection handle and notifies both the underlying WBIManagedConnection as well as the resource adapter container that this handle is no longer needed by the client.

Specified by:
close in interface javax.resource.cci.Connection
Throws:
javax.resource.ResourceException

getMetaData

public javax.resource.cci.ConnectionMetaData getMetaData()
                                                  throws javax.resource.ResourceException
Returns information to the client on the capabilities and underlying EIS reflected by this connection handle.

Specified by:
getMetaData in interface javax.resource.cci.Connection
Throws:
javax.resource.ResourceException

getResultSetInfo

public javax.resource.cci.ResultSetInfo getResultSetInfo()
                                                  throws javax.resource.ResourceException
By default, this method throws a NotSupportedException. If a subclass supports result sets (not batch results), it should override this method.

Specified by:
getResultSetInfo in interface javax.resource.cci.Connection
Throws:
javax.resource.NotSupportedException - if the managed connection does not support result sets.
javax.resource.ResourceException

getLocalTransaction

public javax.resource.cci.LocalTransaction getLocalTransaction()
                                                        throws javax.resource.ResourceException
Returns a LocalTransaction instance that delegates calls to the underlying WBIManagedConnection.

Specified by:
getLocalTransaction in interface javax.resource.cci.Connection
Throws:
javax.resource.NotSupportedException - if the managed connection does not support local transactions.
javax.resource.ResourceException

getManagedConnection

public WBIManagedConnection getManagedConnection()
                                          throws javax.resource.ResourceException
Returns the ManagedConnection instance associated with the handle. A subclass should always use this method, since the resource adapter container may dissociate a handle from its original managed connection to free up resources; this method will check and automatically re-associate the handle if it has become dissociated. Caching a reference to maintain the association will lead to unpredictable results.

Throws:
javax.resource.ResourceException

checkValidity

protected void checkValidity()
                      throws javax.resource.spi.IllegalStateException
Verifies that this connection handle is still valid. A subclass should always call this method before executing any method.

Throws:
java.lang.IllegalStateException - (intended for the client) if the handle was closed or invalidated previously.
javax.resource.spi.IllegalStateException

getAutoCommit

public boolean getAutoCommit()
                      throws javax.resource.ResourceException
Returns whether this connection handle should commit changes to the EIS after each interaction or wait for the resource adapter container to direct the managed connection to commit changes.

Note that this does not change the atomicity of requested interactions; for example, if an interaction requires the creation of two entities in the EIS and auto-commit is set to true, the two entities should be created as part of a single atomic operation rather than two discrete create operations. The failure of an interaction should always rollback the EIS to the original state it was in before the interaction was started, regardless of this flag.

Throws:
javax.resource.ResourceException

getLogUtils

public LogUtils getLogUtils()

setLogUtils

protected void setLogUtils(LogUtils utils)