Package org.datanucleus.jdo.connector
Class ManagedConnectionImpl
- java.lang.Object
-
- org.datanucleus.jdo.connector.ManagedConnectionImpl
-
- All Implemented Interfaces:
javax.resource.spi.ManagedConnection
public class ManagedConnectionImpl extends Object implements javax.resource.spi.ManagedConnection
Implementation of ManagedConnection persistence manager Handle is the Object Instance of the API the user application is interacting with.
-
-
Constructor Summary
Constructors Constructor Description ManagedConnectionImpl(ManagedConnectionFactoryImpl mcf, javax.resource.spi.security.PasswordCredential credential)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConnectionEventListener(javax.resource.spi.ConnectionEventListener cel)Mutator to add a connection listenervoidassociateConnection(Object c)Mutator to associate a connectionvoidbegin()Method to start the Transactionvoidcleanup()Cleanup methodvoiddestroy()Destroy methodObjectgetConnection(Subject subject, javax.resource.spi.ConnectionRequestInfo cri)Accessor for the connectionjavax.resource.spi.LocalTransactiongetLocalTransaction()Accessor for the local transactionPrintWritergetLogWriter()Accessor for the Logjavax.resource.spi.ManagedConnectionMetaDatagetMetaData()Accessor for the connection MetaDataorg.datanucleus.api.jdo.JDOPersistenceManagergetPersistenceManager()XAResourcegetXAResource()Accessor for the XA resource.voidremoveConnectionEventListener(javax.resource.spi.ConnectionEventListener cel)Mutator to remove a connection listenervoidsetLogWriter(PrintWriter writer)Mutator for the Log
-
-
-
Constructor Detail
-
ManagedConnectionImpl
public ManagedConnectionImpl(ManagedConnectionFactoryImpl mcf, javax.resource.spi.security.PasswordCredential credential) throws javax.resource.ResourceException
Constructor.- Parameters:
mcf- the ManagedConnectionFactorycredential- the PasswordCredential- Throws:
javax.resource.ResourceException- if error occurs
-
-
Method Detail
-
begin
public void begin()
Method to start the Transaction
-
destroy
public void destroy() throws javax.resource.ResourceExceptionDestroy method- Specified by:
destroyin interfacejavax.resource.spi.ManagedConnection- Throws:
javax.resource.ResourceException- if error occurs
-
cleanup
public void cleanup() throws javax.resource.ResourceExceptionCleanup method- Specified by:
cleanupin interfacejavax.resource.spi.ManagedConnection- Throws:
javax.resource.ResourceException- if error occurs
-
getPersistenceManager
public org.datanucleus.api.jdo.JDOPersistenceManager getPersistenceManager()
-
getConnection
public Object getConnection(Subject subject, javax.resource.spi.ConnectionRequestInfo cri) throws javax.resource.ResourceException
Accessor for the connection- Specified by:
getConnectionin interfacejavax.resource.spi.ManagedConnection- Parameters:
subject- The subjectcri- request info- Returns:
- The connection
- Throws:
javax.resource.ResourceException- if error occurs
-
getLogWriter
public PrintWriter getLogWriter() throws javax.resource.ResourceException
Accessor for the Log- Specified by:
getLogWriterin interfacejavax.resource.spi.ManagedConnection- Returns:
- The Log writer
- Throws:
javax.resource.ResourceException- if error occurs
-
setLogWriter
public void setLogWriter(PrintWriter writer) throws javax.resource.ResourceException
Mutator for the Log- Specified by:
setLogWriterin interfacejavax.resource.spi.ManagedConnection- Parameters:
writer- PrintWriter to use for Log- Throws:
javax.resource.ResourceException- if error occurs
-
addConnectionEventListener
public void addConnectionEventListener(javax.resource.spi.ConnectionEventListener cel)
Mutator to add a connection listener- Specified by:
addConnectionEventListenerin interfacejavax.resource.spi.ManagedConnection- Parameters:
cel- event listener
-
removeConnectionEventListener
public void removeConnectionEventListener(javax.resource.spi.ConnectionEventListener cel)
Mutator to remove a connection listener- Specified by:
removeConnectionEventListenerin interfacejavax.resource.spi.ManagedConnection- Parameters:
cel- event listener
-
associateConnection
public void associateConnection(Object c) throws javax.resource.ResourceException
Mutator to associate a connection- Specified by:
associateConnectionin interfacejavax.resource.spi.ManagedConnection- Parameters:
c- connection- Throws:
javax.resource.ResourceException- if error occurs
-
getLocalTransaction
public javax.resource.spi.LocalTransaction getLocalTransaction() throws javax.resource.ResourceExceptionAccessor for the local transaction- Specified by:
getLocalTransactionin interfacejavax.resource.spi.ManagedConnection- Returns:
- local txn
- Throws:
javax.resource.ResourceException- if error occurs
-
getMetaData
public javax.resource.spi.ManagedConnectionMetaData getMetaData() throws javax.resource.ResourceExceptionAccessor for the connection MetaData- Specified by:
getMetaDatain interfacejavax.resource.spi.ManagedConnection- Returns:
- metadata for the connection
- Throws:
javax.resource.ResourceException- if error occurs
-
getXAResource
public XAResource getXAResource() throws javax.resource.ResourceException
Accessor for the XA resource. The application server enlists this XAResource into a XA transaction This is invoked only once per instance.- Specified by:
getXAResourcein interfacejavax.resource.spi.ManagedConnection- Returns:
- XA resource
- Throws:
javax.resource.ResourceException- if error occurs
-
-