javax.resource.spi
Interface ManagedConnection

All Known Implementing Classes:
BaseWrapperManagedConnection (src) , FSManagedConnection (src) , JmsManagedConnection (src) , TestManagedConnection (src)

public interface ManagedConnection

A ManagedConnection instance represents a connection to the underlying recource. A ManagedConnection provides access to the two transaction interfaces, XAResource and LocalTransaction. These interfaces are used to manage transactions on the resource.


Method Summary
 void addConnectionEventListener(ConnectionEventListener (src)  listener)
          Adds a connection event listener
 void associateConnection(java.lang.Object connection)
          Associates a new application level connection handle with the connection.
 void cleanup()
          Application server calls this to force cleanup of connection.
 void destroy()
          Destroys the connection to the underlying resource.
 java.lang.Object getConnection(javax.security.auth.Subject subject, ConnectionRequestInfo (src)  cxRequestInfo)
          Creates a new connection handle for the underlying connection.
 LocalTransaction (src) getLocalTransaction()
          Returns a LocalTransaction instance.
 java.io.PrintWriter getLogWriter()
          Gets the logwriter for this instance.
 ManagedConnectionMetaData (src) getMetaData()
          Gets metadata inormation for this instances underlying resource manager instance.
 XAResource (src) getXAResource()
          Returns an XAResource instance.
 void removeConnectionEventListener(ConnectionEventListener (src)  listener)
          Removes a connection event listener
 void setLogWriter(java.io.PrintWriter out)
          Sets the logwriter for this instance.
 

Method Detail

getConnection

public java.lang.Object getConnection(javax.security.auth.Subject subject,
                                      ConnectionRequestInfo (src)  cxRequestInfo)
                               throws ResourceException (src) 
Creates a new connection handle for the underlying connection.

Parameters:
subject - the subject
cxRequestInfo - the connection request info
Throws:
ResourceException (src) - for a generic error
ResourceAdapterInternalException (src) - for an internal error in the resource adapter
SecurityException (src) - for a security problem
CommException (src) - for a communication failure with the EIS
EISSystemException (src) - for an error from the EIS

destroy

public void destroy()
             throws ResourceException (src) 
Destroys the connection to the underlying resource.

Throws:
ResourceException (src) - for a generic error
IllegalStateException (src) - if the connection is not a legal state for destruction

cleanup

public void cleanup()
             throws ResourceException (src) 
Application server calls this to force cleanup of connection.

Throws:
ResourceException (src) - for a generic error
ResourceAdapterInternalException (src) - for an internal error in the resource adapter
IllegalStateException (src) - if the connection is not a legal state for cleanup

associateConnection

public void associateConnection(java.lang.Object connection)
                         throws ResourceException (src) 
Associates a new application level connection handle with the connection.

Parameters:
connection - the connection
Throws:
ResourceException (src) - for a generic error
IllegalStateException (src) - for an illegal state
ResourceAdapterInternalException (src) - for an internal error in the resource adapter

addConnectionEventListener

public void addConnectionEventListener(ConnectionEventListener (src)  listener)
Adds a connection event listener

Parameters:
listener - the listener

removeConnectionEventListener

public void removeConnectionEventListener(ConnectionEventListener (src)  listener)
Removes a connection event listener

Parameters:
listener - the listener

getXAResource

public XAResource (src)  getXAResource()
                         throws ResourceException (src) 
Returns an XAResource instance.

Returns:
the XAResource
Throws:
ResourceException (src) - for a generic error
NotSupportedException - if not supported
ResourceAdapterInternalException (src) - for an internal error in the resource adapter

getLocalTransaction

public LocalTransaction (src)  getLocalTransaction()
                                     throws ResourceException (src) 
Returns a LocalTransaction instance.

Returns:
the local transaction
Throws:
ResourceException (src) - for a generic error
NotSupportedException - if not supported
ResourceAdapterInternalException (src) - for an internal error in the resource adapter

getMetaData

public ManagedConnectionMetaData (src)  getMetaData()
                                      throws ResourceException (src) 
Gets metadata inormation for this instances underlying resource manager instance.

Returns:
the managed connection meta data
Throws:
ResourceException (src) - for a generic error
NotSupportedException - if not supported

getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws ResourceException (src) 
Gets the logwriter for this instance.

Returns:
the log writer
Throws:
ResourceException (src) - for a generic error

setLogWriter

public void setLogWriter(java.io.PrintWriter out)
                  throws ResourceException (src) 
Sets the logwriter for this instance.

Parameters:
out - the writer
Throws:
ResourceException (src) - for a generic error
ResourceAdapterInternalException (src) - for an internal error in the resource adapter