|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.bea.adapter.spi.AbstractManagedConnection
Provides functionality that is common across resource adapters for
implementing the ManagedConnection
interface. A
ManagedConnection
represents a physical connection to an
underlying EIS. The creation of a ManagedConnection
instance
typically results in the allocation of EIS and resource adapter resources.
Constructor Summary | |
protected |
AbstractManagedConnection(AbstractManagedConnectionFactory myFactory,
LogContext logContext,
boolean bSupportsXAResource,
boolean bSupportsLocalTransactions)
Initializes the base class components provided by this class for concrete ManagedConnections. |
Method Summary | |
void |
addConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
Adds a connection event listener to this ManagedConnection
instance. |
void |
addConnectionHandle(Object connectionHandle)
Adds an application-level connection handle to the collection maintained by this ManagedConnection . |
void |
associateConnection(Object connection)
Used by the container to change the association of an application-level connection handle with a ManagedConnection instance. |
boolean |
checkConnection()
Check to see if this managed connection is alive, and if not fire a ConnectionErrorOccurred event. |
protected void |
checkIfDestroyed()
Checks to see if the client has already called the "destroy" on this instance. |
void |
cleanup()
Application server calls this to force any cleanup on the ManagedConnection instance. |
boolean |
compareCredentials(Subject subject,
javax.resource.spi.ConnectionRequestInfo info)
This method is invoked when the ManagedConnectionFactory is attempting to match this connection with a connection request for the ConnectionManager. |
protected javax.resource.spi.LocalTransaction |
createLocalTransaction()
Returns a LocalTransaction. |
protected abstract javax.resource.spi.ManagedConnectionMetaData |
createMetaData()
Returns an object that provides information about the underlying EIS instance associated with "this" ManagedConnection instance. |
protected XAResource |
createXAResource()
Creates the XA resource if supported. |
void |
destroy()
Destroys the physical connection to the underlying EIS. |
protected void |
destroyConnectionHandle(Object obj)
This method gets invoked by the cleanup method to allow any clean-up of resources held by this instance for a particular connection handle. |
protected void |
destroyPhysicalConnection(Object obj)
This method gets invoked by the destroy method to allow destruction of resources held by this instance for a particular physical connection to the EIS. |
protected void |
doAdditionalCleanup()
This method gets invoked by the cleanup method to allow any clean-up of additional resources held by this instance |
void |
fireConnectionErrorOccurredEvent(Exception exception)
Notifies all registered listeners of a connection error. |
void |
fireConnectionHandleClosedEvent(Object connectionHandle)
Notifies all registered listeners that a connection was closed. |
void |
fireLocalTransactionCommittedEvent()
Notifies all registered listeners that a transaction was committed. |
void |
fireLocalTransactionRolledBackEvent()
Notifies all registered listeners that a transaction was rolled back. |
void |
fireLocalTransactionStartedEvent()
Notifies all registered listeners that a transaction was started. |
AbstractManagedConnectionFactory |
getFactory()
|
javax.resource.spi.LocalTransaction |
getLocalTransaction()
Returns a LocalTransaction that is tied to the EIS connection represented by this ManagedConnection. |
javax.resource.spi.LocalTransaction |
getLocalTransaction(boolean notify)
Returns a LocalTransaction that is tied to the EIS connection represented by this ManagedConnection. |
LogContext |
getLogContext()
Retrieves an object that determines the logging configuration for this instance in the logging framework. |
ILogger |
getLogger()
Retrieves an object used to log information to. |
PrintWriter |
getLogWriter()
|
javax.resource.spi.ManagedConnectionMetaData |
getMetaData()
Gets the metadata information for this connection's underlying EIS resource manager instance. |
Object |
getPhysicalConnection()
A ManagedConnection object is typically a wrapper around an object that is native to the EIS's external API. |
XAResource |
getXAResource()
|
boolean |
isBusy()
|
boolean |
isDestroyed()
|
protected void |
notifyListenersOfEvent(javax.resource.spi.ConnectionEvent event)
Notifies all currently registered listeners of a connection event |
void |
removeConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
Removes an already registered connection event listener from the ManagedConnection instance. |
void |
removeConnectionHandle(Object connectionHandle)
Removes connectionHandle from the set of application-level
connection handles that is managed by this instance. |
void |
setLogWriter(PrintWriter out)
Adds out as a runtime destination to the ILogger for this
instance. |
void |
setPhysicalConnection(Object obj)
A convenience method that allows an adapter developer to save an object that represents the underlying physical connection to the EIS. |
String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface javax.resource.spi.ManagedConnection |
getConnection |
Constructor Detail |
protected AbstractManagedConnection(AbstractManagedConnectionFactory myFactory, LogContext logContext, boolean bSupportsXAResource, boolean bSupportsLocalTransactions) throws javax.resource.ResourceException
myFactory
- - the factory that instantiated thislogContext
- - an object that provides access to an
ILogger
instance for logging.bSupportsXAResource
- - a flag to indicate if the resource adapter
implements XAResource to provide support for transaction management.bSupportsLocalTransactions
- - a flag to indicate if the resource
adapter supports local transactions.
javax.resource.ResourceException
- - an exceptional condition was encountered while
attempting to initialize this instance; either there was a null parameter
or failed to get metadata.Method Detail |
public boolean checkConnection()
public boolean isBusy()
public void addConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
ManagedConnection
instance.
addConnectionEventListener
in interface javax.resource.spi.ManagedConnection
listener
- - enables the application server to get notifications
related to the state of this ManagedConnection
instance. The
application server uses these notifications to manage connection pooling,
transactions, cleanup connections, and handle any error conditions.public void removeConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
removeConnectionEventListener
in interface javax.resource.spi.ManagedConnection
public void addConnectionHandle(Object connectionHandle)
ManagedConnection
. An application server can call
getConnection
multiple times, thus multiple connection handles
can exist concurrently for a single instance.
connectionHandle
- - represents an application-level connection
handle to the EIS.public void removeConnectionHandle(Object connectionHandle)
connectionHandle
from the set of application-level
connection handles that is managed by this instance. There can be more
than one application-level connection handles associated with a
ManagedConnection instance.
public void associateConnection(Object connection) throws javax.resource.ResourceException
connection
is an instance of
com.bea.adapter.cci.AbstractConnection
. Adapter developers should
override this if their connection object does not extend
com.bea.adapter.cci.AbstractConnection
.
associateConnection
in interface javax.resource.spi.ManagedConnection
connection
- - the application-level connection handle
javax.resource.ResourceException
- - an exceptional condition was encountered while
attempting to associate an application-level connection handle with this
instance.protected void checkIfDestroyed() throws javax.resource.spi.IllegalStateException
javax.resource.spi.IllegalStateException
- - the destoy has
already been called on this instance.public void cleanup() throws javax.resource.ResourceException
ManagedConnection
instance. This might include any
transaction or security state associated with the connection. This method
does NOT close the undelying physical connection to the EIS, use
destroy
for that.
cleanup
in interface javax.resource.spi.ManagedConnection
javax.resource.ResourceException
- - an exceptional condition was encountered while
cleaning up the connection handles associated with this instance.protected javax.resource.spi.LocalTransaction createLocalTransaction() throws javax.resource.ResourceException
javax.resource.ResourceException
protected abstract javax.resource.spi.ManagedConnectionMetaData createMetaData() throws javax.resource.ResourceException
javax.resource.ResourceException
protected XAResource createXAResource() throws javax.resource.ResourceException
javax.resource.ResourceException
public void destroy() throws javax.resource.ResourceException
destroy
in interface javax.resource.spi.ManagedConnection
javax.resource.ResourceException
protected void destroyConnectionHandle(Object obj) throws Exception
Exception
protected void destroyPhysicalConnection(Object obj) throws Exception
Exception
protected void doAdditionalCleanup() throws Exception
Exception
public void fireConnectionErrorOccurredEvent(Exception exception)
public void fireConnectionHandleClosedEvent(Object connectionHandle)
public void fireLocalTransactionCommittedEvent()
public void fireLocalTransactionRolledBackEvent()
public void fireLocalTransactionStartedEvent()
public AbstractManagedConnectionFactory getFactory()
public javax.resource.spi.LocalTransaction getLocalTransaction() throws javax.resource.ResourceException
getLocalTransaction
in interface javax.resource.spi.ManagedConnection
javax.resource.ResourceException
- if the adapter does not support local
transactionspublic javax.resource.spi.LocalTransaction getLocalTransaction(boolean notify) throws javax.resource.ResourceException
notify
- Indicates whether the returned LocalTransaction object should
notify listeners of connection events or not. When obtaining a
LocalTransaction object from the client connection handle, JCA 1.0
says notifications should be sent, but if obtaining the object from
the managed connection directly, no notifications should be sent
(because the latter case indicates a container managed transaction).
javax.resource.ResourceException
- if the adapter does not support local
transactionspublic LogContext getLogContext()
public ILogger getLogger()
public PrintWriter getLogWriter() throws javax.resource.ResourceException
getLogWriter
in interface javax.resource.spi.ManagedConnection
javax.resource.ResourceException
public javax.resource.spi.ManagedConnectionMetaData getMetaData() throws javax.resource.ResourceException
getMetaData
in interface javax.resource.spi.ManagedConnection
javax.resource.ResourceException
public Object getPhysicalConnection() throws javax.resource.ResourceException
javax.resource.ResourceException
- if the physical connection has not been set for
this instance, using the setPhysicalConnection method.public void setPhysicalConnection(Object obj) throws javax.resource.ResourceException
javax.resource.ResourceException
- if obj
is null.public XAResource getXAResource() throws javax.resource.ResourceException
getXAResource
in interface javax.resource.spi.ManagedConnection
javax.resource.ResourceException
- if the resource adapter does not support XA.public boolean isDestroyed()
protected void notifyListenersOfEvent(javax.resource.spi.ConnectionEvent event)
event
- - the connection eventpublic void setLogWriter(PrintWriter out) throws javax.resource.ResourceException
out
as a runtime destination to the ILogger for this
instance.
setLogWriter
in interface javax.resource.spi.ManagedConnection
javax.resource.ResourceException
public String toString()
public boolean compareCredentials(Subject subject, javax.resource.spi.ConnectionRequestInfo info) throws javax.resource.ResourceException
javax.resource.ResourceException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |