org.jpox.resource
Class ManagedConnectionImpl

java.lang.Object
  extended byorg.jpox.AbstractPersistenceManager
      extended byorg.jpox.resource.ManagedConnectionImpl
All Implemented Interfaces:
javax.resource.spi.LocalTransaction, javax.resource.spi.ManagedConnection, PersistenceManager, javax.jdo.PersistenceManager, javax.transaction.xa.XAResource

public class ManagedConnectionImpl
extends AbstractPersistenceManager
implements javax.resource.spi.LocalTransaction, javax.resource.spi.ManagedConnection, javax.transaction.xa.XAResource

Implementation of ManagedConnection persistence manager

Version:
$Revision: 1.14 $

Field Summary
 
Fields inherited from class org.jpox.AbstractPersistenceManager
apmf, clr, lifecycleListeners, LOCALISER, tx
 
Fields inherited from interface javax.transaction.xa.XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
 
Constructor Summary
ManagedConnectionImpl(javax.resource.spi.ManagedConnectionFactory mcf, javax.resource.spi.security.PasswordCredential credential)
          Constructor
 
Method Summary
 void addConnectionEventListener(javax.resource.spi.ConnectionEventListener cel)
          Mutator to add a connection listener
 void associateConnection(java.lang.Object c)
          Mutator to associate a connection
 void begin()
          Method to start the Transaction
 void cleanup()
          Cleanup method
 void commit()
          Method to commit the Transaction
 void commit(javax.transaction.xa.Xid xid, boolean flags)
           
 void destroy()
          Destroy method
 void end(javax.transaction.xa.Xid xid, int flags)
           
 void forget(javax.transaction.xa.Xid xid)
           
 java.lang.Object getConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cri)
          Accessor for the connection
 javax.jdo.datastore.JDOConnection getDataStoreConnection()
           
 javax.jdo.Transaction getJdoTransaction()
          Accessor for the JDO transaction
 javax.resource.spi.LocalTransaction getLocalTransaction()
          Accessor for the local transaction
 java.io.PrintWriter getLogWriter()
          Accessor for the Log
 javax.resource.spi.ManagedConnectionMetaData getMetaData()
          Accessor for the connection MetaData
 PersistenceManager getPMHandle()
          Accessor for the Persistence Manager handle
 int getTransactionTimeout()
           
 javax.transaction.xa.XAResource getXAResource()
          Accessor for the XA resource
 boolean isSamePM(javax.jdo.PersistenceManager pm)
          Accessor for whether this PM and the passed on are the same.
 boolean isSameRM(javax.transaction.xa.XAResource xares)
           
 void preCommit()
          Method to perform any pre-commit checks.
 int prepare(javax.transaction.xa.Xid flags)
           
 javax.transaction.xa.Xid[] recover(int flags)
           
 void removeConnectionEventListener(javax.resource.spi.ConnectionEventListener cel)
          Mutator to remove a connection listener
 void rollback()
          Method to rollback the Transaction
 void rollback(javax.transaction.xa.Xid xid)
           
 void setLogWriter(java.io.PrintWriter writer)
          Mutator for the Log
 boolean setTransactionTimeout(int seconds)
           
 void start(javax.transaction.xa.Xid xid, int flags)
           
 
Methods inherited from class org.jpox.AbstractPersistenceManager
addInstanceLifecycleListener, addQueryResult, addQueryRun, addStateManager, attachCopy, checkConsistency, clearDirty, clearDirty, close, currentTransaction, deletePersistent, deletePersistentAll, deletePersistentAll, detachCopy, detachCopyAll, detachCopyAll, detachCopyInternal, detachInternal, disconnectLifecycleListener, disconnectQueryCache, disconnectSMCache, dump, enlistInTransaction, evict, evictAll, evictAll, evictAll, evictFromTransaction, findStateManager, flush, getAbstractPersistenceManagerFactory, getClassLoaderResolver, getConnection, getConnection, getDetachAllOnCommit, getDetachOnClose, getExtent, getExtent, getFetchPlan, getIgnoreCache, getMetaDataManager, getMultithreaded, getObjectByAID, getObjectById, getObjectById, getObjectById, getObjectById, getObjectById, getObjectById, getObjectFromCache, getObjectId, getObjectIdClass, getObjectsById, getObjectsById, getObjectsById, getObjectsById, getPersistenceManagerFactory, getPMFContext, getSequence, getStateManagerById, getStoreManager, getTransactionalObjectId, getUserObject, getUserObject, hasQueryRun, hereIsStateManager, internalRetrieve, isClosed, isConnectionOpen, isDelayDatastoreOperationsEnabled, isInserting, makeNontransactional, makeNontransactionalAll, makeNontransactionalAll, makePersistent, makePersistentAll, makePersistentAll, makePersistentInternal, makeTransactional, makeTransactionalAll, makeTransactionalAll, makeTransient, makeTransient, makeTransientAll, makeTransientAll, makeTransientAll, makeTransientAll, makeTransientInternal, markDirty, newInstance, newNamedQuery, newObjectIdInstance, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, notifyLifecycleListenersForEvent, postCommit, preRollback, putObjectIntoCache, putUserObject, refresh, refreshAll, refreshAll, refreshAll, refreshAll, releaseConnection, removeAllInstanceLifecycleListeners, removeInstanceLifecycleListener, removeObjectFromCache, removeQueryResult, removeQueryRun, removeStateManager, removeUserObject, replaceObjectId, reset, retrieve, retrieve, retrieve, retrieveAll, retrieveAll, retrieveAll, retrieveAll, setDetachAllOnCommit, setDetachOnClose, setIgnoreCache, setMultithreaded, setUserObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ManagedConnectionImpl

public ManagedConnectionImpl(javax.resource.spi.ManagedConnectionFactory mcf,
                             javax.resource.spi.security.PasswordCredential credential)
                      throws javax.resource.ResourceException
Constructor

Parameters:
mcf - the ManagedConnectionFactory
credential - the PasswordCredential
Throws:
javax.resource.ResourceException
Method Detail

destroy

public void destroy()
             throws javax.resource.ResourceException
Destroy method

Specified by:
destroy in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException -

cleanup

public void cleanup()
             throws javax.resource.ResourceException
Cleanup method

Specified by:
cleanup in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException -

getConnection

public java.lang.Object getConnection(javax.security.auth.Subject subject,
                                      javax.resource.spi.ConnectionRequestInfo cri)
                               throws javax.resource.ResourceException
Accessor for the connection

Specified by:
getConnection in interface javax.resource.spi.ManagedConnection
Parameters:
subject -
cri -
Returns:
Throws:
javax.resource.ResourceException -

getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws javax.resource.ResourceException
Accessor for the Log

Specified by:
getLogWriter in interface javax.resource.spi.ManagedConnection
Returns:
The Log writer
Throws:
javax.resource.ResourceException -

setLogWriter

public void setLogWriter(java.io.PrintWriter writer)
                  throws javax.resource.ResourceException
Mutator for the Log

Specified by:
setLogWriter in interface javax.resource.spi.ManagedConnection
Parameters:
writer - PrintWriter to use for Log
Throws:
javax.resource.ResourceException -

addConnectionEventListener

public void addConnectionEventListener(javax.resource.spi.ConnectionEventListener cel)
Mutator to add a connection listener

Specified by:
addConnectionEventListener in interface javax.resource.spi.ManagedConnection
Parameters:
cel -

removeConnectionEventListener

public void removeConnectionEventListener(javax.resource.spi.ConnectionEventListener cel)
Mutator to remove a connection listener

Specified by:
removeConnectionEventListener in interface javax.resource.spi.ManagedConnection
Parameters:
cel -

associateConnection

public void associateConnection(java.lang.Object c)
                         throws javax.resource.ResourceException
Mutator to associate a connection

Specified by:
associateConnection in interface javax.resource.spi.ManagedConnection
Parameters:
c -
Throws:
javax.resource.ResourceException -

getLocalTransaction

public javax.resource.spi.LocalTransaction getLocalTransaction()
                                                        throws javax.resource.ResourceException
Accessor for the local transaction

Specified by:
getLocalTransaction in interface javax.resource.spi.ManagedConnection
Returns:
Throws:
javax.resource.ResourceException -

getJdoTransaction

public javax.jdo.Transaction getJdoTransaction()
Accessor for the JDO transaction

Returns:
The JDO transaction

getMetaData

public javax.resource.spi.ManagedConnectionMetaData getMetaData()
                                                         throws javax.resource.ResourceException
Accessor for the connection MetaData

Specified by:
getMetaData in interface javax.resource.spi.ManagedConnection
Returns:
Throws:
javax.resource.ResourceException -

getXAResource

public javax.transaction.xa.XAResource getXAResource()
                                              throws javax.resource.ResourceException
Accessor for the XA resource

Specified by:
getXAResource in interface javax.resource.spi.ManagedConnection
Returns:
Throws:
javax.resource.ResourceException -

begin

public void begin()
           throws javax.resource.ResourceException
Method to start the Transaction

Specified by:
begin in interface javax.resource.spi.LocalTransaction
Throws:
javax.resource.ResourceException -

commit

public void commit()
            throws javax.resource.ResourceException
Method to commit the Transaction

Specified by:
commit in interface javax.resource.spi.LocalTransaction
Throws:
javax.resource.ResourceException -

rollback

public void rollback()
              throws javax.resource.ResourceException
Method to rollback the Transaction

Specified by:
rollback in interface javax.resource.spi.LocalTransaction
Throws:
javax.resource.ResourceException -

preCommit

public void preCommit()
Description copied from class: AbstractPersistenceManager
Method to perform any pre-commit checks.

Overrides:
preCommit in class AbstractPersistenceManager

getPMHandle

public PersistenceManager getPMHandle()
Accessor for the Persistence Manager handle

Specified by:
getPMHandle in interface PersistenceManager
Specified by:
getPMHandle in class AbstractPersistenceManager
Returns:
The PM handle

isSamePM

public boolean isSamePM(javax.jdo.PersistenceManager pm)
Accessor for whether this PM and the passed on are the same.

Parameters:
pm - The other PM
Returns:
Whether they are the same

getDataStoreConnection

public javax.jdo.datastore.JDOConnection getDataStoreConnection()
Specified by:
getDataStoreConnection in interface javax.jdo.PersistenceManager

commit

public void commit(javax.transaction.xa.Xid xid,
                   boolean flags)
            throws javax.transaction.xa.XAException
Specified by:
commit in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

end

public void end(javax.transaction.xa.Xid xid,
                int flags)
         throws javax.transaction.xa.XAException
Specified by:
end in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

forget

public void forget(javax.transaction.xa.Xid xid)
            throws javax.transaction.xa.XAException
Specified by:
forget in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

getTransactionTimeout

public int getTransactionTimeout()
                          throws javax.transaction.xa.XAException
Specified by:
getTransactionTimeout in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

isSameRM

public boolean isSameRM(javax.transaction.xa.XAResource xares)
                 throws javax.transaction.xa.XAException
Specified by:
isSameRM in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

prepare

public int prepare(javax.transaction.xa.Xid flags)
            throws javax.transaction.xa.XAException
Specified by:
prepare in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

recover

public javax.transaction.xa.Xid[] recover(int flags)
                                   throws javax.transaction.xa.XAException
Specified by:
recover in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

rollback

public void rollback(javax.transaction.xa.Xid xid)
              throws javax.transaction.xa.XAException
Specified by:
rollback in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

setTransactionTimeout

public boolean setTransactionTimeout(int seconds)
                              throws javax.transaction.xa.XAException
Specified by:
setTransactionTimeout in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

start

public void start(javax.transaction.xa.Xid xid,
                  int flags)
           throws javax.transaction.xa.XAException
Specified by:
start in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException


Copyright © -2007 . All Rights Reserved.