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 void
addConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
Adds a listener.void
associateConnection(Object connection)
Used by the container to change the association of an application-level connection handle with a ManagedConneciton instance.void
cleanup()
Application server calls this method to force any cleanup on the ManagedConnection instance.void
closeHandle(JCASessionHandle handle)
Close the handle.void
destroy()
Destroys the physical connection to the underlying resource manager.Object
getConnection(Subject subject, javax.resource.spi.ConnectionRequestInfo cri)
Creates a new connection handle for the underlying physical connection represented by the ManagedConnection instance.JCAConnectionRequestInfo
getConnectionRequestInfo()
Return the connection request info.String
getEISProductName()
Return the product name.String
getEISProductVersion()
Return the product version.javax.resource.spi.LocalTransaction
getLocalTransaction()
Returns an javax.resource.spi.LocalTransaction instance.PrintWriter
getLogWriter()
Get the log writer.JCAManagedConnectionFactory
getManagedConnectionFactory()
Return the managed connection factory.int
getMaxConnections()
Return number of max connections.javax.resource.spi.ManagedConnectionMetaData
getMetaData()
Gets the metadata information for this connection's underlying EIS resource manager instance.Session
getSession(JCASessionHandle handle)
Return the session.String
getUserName()
Return the user name.XAResource
getXAResource()
Returns an javax.transaction.xa.XAresource instance.void
log(String message)
Log a message.void
log(String message, Throwable exception)
Log a message.void
removeConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
Remove a listener.void
sendrrorEvent(JCASessionHandle handle, Exception cause)
Send connection error event.void
sendTxCommittedEvent(JCASessionHandle handle)
Send transaction committed event.void
sendTxRolledbackEvent(JCASessionHandle handle)
Send transaction rolledback event.void
sendTxStartedEvent(JCASessionHandle handle)
Send transaction started event.void
setLogWriter(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:
getLogWriter
in interfacejavax.resource.spi.ManagedConnection
-
setLogWriter
public void setLogWriter(PrintWriter logWriter) throws javax.resource.ResourceException
Set the log writer.- Specified by:
setLogWriter
in 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:
getConnection
in interfacejavax.resource.spi.ManagedConnection
- Throws:
javax.resource.ResourceException
-
destroy
public void destroy() throws javax.resource.ResourceException
Destroys the physical connection to the underlying resource manager.- Specified by:
destroy
in interfacejavax.resource.spi.ManagedConnection
- Throws:
javax.resource.ResourceException
-
cleanup
public void cleanup() throws javax.resource.ResourceException
Application server calls this method to force any cleanup on the ManagedConnection instance.- Specified by:
cleanup
in 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:
associateConnection
in 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:
getXAResource
in interfacejavax.resource.spi.ManagedConnection
- Throws:
javax.resource.ResourceException
-
getLocalTransaction
public javax.resource.spi.LocalTransaction getLocalTransaction() throws javax.resource.ResourceException
Returns an javax.resource.spi.LocalTransaction instance.- Specified by:
getLocalTransaction
in interfacejavax.resource.spi.ManagedConnection
- Throws:
javax.resource.ResourceException
-
getMetaData
public javax.resource.spi.ManagedConnectionMetaData getMetaData() throws javax.resource.ResourceException
Gets the metadata information for this connection's underlying EIS resource manager instance.- Specified by:
getMetaData
in 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:
getEISProductName
in interfacejavax.resource.spi.ManagedConnectionMetaData
- Throws:
javax.resource.ResourceException
-
getEISProductVersion
public String getEISProductVersion() throws javax.resource.ResourceException
Return the product version.- Specified by:
getEISProductVersion
in interfacejavax.resource.spi.ManagedConnectionMetaData
- Throws:
javax.resource.ResourceException
-
getMaxConnections
public int getMaxConnections() throws javax.resource.ResourceException
Return number of max connections.- Specified by:
getMaxConnections
in interfacejavax.resource.spi.ManagedConnectionMetaData
- Throws:
javax.resource.ResourceException
-
getUserName
public String getUserName() throws javax.resource.ResourceException
Return the user name.- Specified by:
getUserName
in 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:
addConnectionEventListener
in interfacejavax.resource.spi.ManagedConnection
-
removeConnectionEventListener
public void removeConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
Remove a listener.- Specified by:
removeConnectionEventListener
in 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.
-
-