Package org.apache.jackrabbit.jca
Class JCAManagedConnection
- java.lang.Object
-
- org.apache.jackrabbit.jca.JCAManagedConnection
-
- All Implemented Interfaces:
javax.resource.spi.ManagedConnection,javax.resource.spi.ManagedConnectionMetaData
public class JCAManagedConnection extends Object implements javax.resource.spi.ManagedConnection, javax.resource.spi.ManagedConnectionMetaData
This class implements the managed connection for this resource adapter.
-
-
Constructor Summary
Constructors Constructor Description JCAManagedConnection(JCAManagedConnectionFactory mcf, JCAConnectionRequestInfo cri)Construct the managed connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)Adds a listener.voidassociateConnection(Object connection)Used by the container to change the association of an application-level connection handle with a ManagedConneciton instance.voidcleanup()Application server calls this method to force any cleanup on the ManagedConnection instance.voidcloseHandle(JCASessionHandle handle)Close the handle.voiddestroy()Destroys the physical connection to the underlying resource manager.ObjectgetConnection(Subject subject, javax.resource.spi.ConnectionRequestInfo cri)Creates a new connection handle for the underlying physical connection represented by the ManagedConnection instance.JCAConnectionRequestInfogetConnectionRequestInfo()Return the connection request info.StringgetEISProductName()Return the product name.StringgetEISProductVersion()Return the product version.javax.resource.spi.LocalTransactiongetLocalTransaction()Returns an javax.resource.spi.LocalTransaction instance.PrintWritergetLogWriter()Get the log writer.JCAManagedConnectionFactorygetManagedConnectionFactory()Return the managed connection factory.intgetMaxConnections()Return number of max connections.javax.resource.spi.ManagedConnectionMetaDatagetMetaData()Gets the metadata information for this connection's underlying EIS resource manager instance.SessiongetSession(JCASessionHandle handle)Return the session.StringgetUserName()Return the user name.XAResourcegetXAResource()Returns an javax.transaction.xa.XAresource instance.voidlog(String message)Log a message.voidlog(String message, Throwable exception)Log a message.voidremoveConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)Remove a listener.voidsendrrorEvent(JCASessionHandle handle, Exception cause)Send connection error event.voidsendTxCommittedEvent(JCASessionHandle handle)Send transaction committed event.voidsendTxRolledbackEvent(JCASessionHandle handle)Send transaction rolledback event.voidsendTxStartedEvent(JCASessionHandle handle)Send transaction started event.voidsetLogWriter(PrintWriter logWriter)Set the log writer.
-
-
-
Constructor Detail
-
JCAManagedConnection
public JCAManagedConnection(JCAManagedConnectionFactory mcf, JCAConnectionRequestInfo cri) throws javax.resource.ResourceException
Construct the managed connection.- Throws:
javax.resource.ResourceException
-
-
Method Detail
-
getManagedConnectionFactory
public JCAManagedConnectionFactory getManagedConnectionFactory()
Return the managed connection factory.
-
getConnectionRequestInfo
public JCAConnectionRequestInfo getConnectionRequestInfo()
Return the connection request info.
-
getLogWriter
public PrintWriter getLogWriter()
Get the log writer.- Specified by:
getLogWriterin interfacejavax.resource.spi.ManagedConnection
-
setLogWriter
public void setLogWriter(PrintWriter logWriter) throws javax.resource.ResourceException
Set the log writer.- Specified by:
setLogWriterin interfacejavax.resource.spi.ManagedConnection- Throws:
javax.resource.ResourceException
-
getConnection
public Object getConnection(Subject subject, javax.resource.spi.ConnectionRequestInfo cri) throws javax.resource.ResourceException
Creates a new connection handle for the underlying physical connection represented by the ManagedConnection instance.- Specified by:
getConnectionin interfacejavax.resource.spi.ManagedConnection- Throws:
javax.resource.ResourceException
-
destroy
public void destroy() throws javax.resource.ResourceExceptionDestroys the physical connection to the underlying resource manager.- Specified by:
destroyin interfacejavax.resource.spi.ManagedConnection- Throws:
javax.resource.ResourceException
-
cleanup
public void cleanup() throws javax.resource.ResourceExceptionApplication server calls this method to force any cleanup on the ManagedConnection instance.- Specified by:
cleanupin interfacejavax.resource.spi.ManagedConnection- Throws:
javax.resource.ResourceException
-
associateConnection
public void associateConnection(Object connection) throws javax.resource.ResourceException
Used by the container to change the association of an application-level connection handle with a ManagedConneciton instance.- Specified by:
associateConnectionin interfacejavax.resource.spi.ManagedConnection- Throws:
javax.resource.ResourceException
-
getXAResource
public XAResource getXAResource() throws javax.resource.ResourceException
Returns an javax.transaction.xa.XAresource instance.- Specified by:
getXAResourcein interfacejavax.resource.spi.ManagedConnection- Throws:
javax.resource.ResourceException
-
getLocalTransaction
public javax.resource.spi.LocalTransaction getLocalTransaction() throws javax.resource.ResourceExceptionReturns an javax.resource.spi.LocalTransaction instance.- Specified by:
getLocalTransactionin interfacejavax.resource.spi.ManagedConnection- Throws:
javax.resource.ResourceException
-
getMetaData
public javax.resource.spi.ManagedConnectionMetaData getMetaData() throws javax.resource.ResourceExceptionGets the metadata information for this connection's underlying EIS resource manager instance.- Specified by:
getMetaDatain interfacejavax.resource.spi.ManagedConnection- Throws:
javax.resource.ResourceException
-
closeHandle
public void closeHandle(JCASessionHandle handle)
Close the handle.
-
getSession
public Session getSession(JCASessionHandle handle)
Return the session.
-
getEISProductName
public String getEISProductName() throws javax.resource.ResourceException
Return the product name.- Specified by:
getEISProductNamein interfacejavax.resource.spi.ManagedConnectionMetaData- Throws:
javax.resource.ResourceException
-
getEISProductVersion
public String getEISProductVersion() throws javax.resource.ResourceException
Return the product version.- Specified by:
getEISProductVersionin interfacejavax.resource.spi.ManagedConnectionMetaData- Throws:
javax.resource.ResourceException
-
getMaxConnections
public int getMaxConnections() throws javax.resource.ResourceExceptionReturn number of max connections.- Specified by:
getMaxConnectionsin interfacejavax.resource.spi.ManagedConnectionMetaData- Throws:
javax.resource.ResourceException
-
getUserName
public String getUserName() throws javax.resource.ResourceException
Return the user name.- Specified by:
getUserNamein interfacejavax.resource.spi.ManagedConnectionMetaData- Throws:
javax.resource.ResourceException
-
log
public void log(String message)
Log a message.
-
addConnectionEventListener
public void addConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
Adds a listener.- Specified by:
addConnectionEventListenerin interfacejavax.resource.spi.ManagedConnection
-
removeConnectionEventListener
public void removeConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
Remove a listener.- Specified by:
removeConnectionEventListenerin interfacejavax.resource.spi.ManagedConnection
-
sendrrorEvent
public void sendrrorEvent(JCASessionHandle handle, Exception cause)
Send connection error event.
-
sendTxCommittedEvent
public void sendTxCommittedEvent(JCASessionHandle handle)
Send transaction committed event.
-
sendTxRolledbackEvent
public void sendTxRolledbackEvent(JCASessionHandle handle)
Send transaction rolledback event.
-
sendTxStartedEvent
public void sendTxStartedEvent(JCASessionHandle handle)
Send transaction started event.
-
-