org.objectweb.speedo.pm.lib
Class AbstractPOManager

java.lang.Object
  extended by org.objectweb.speedo.pm.lib.AbstractPOManager
All Implemented Interfaces:
javax.transaction.Synchronization, POManagerItf
Direct Known Subclasses:
EJBPOManager, JDOPOManager

public abstract class AbstractPOManager
extends java.lang.Object
implements POManagerItf


Field Summary
static java.lang.String COMPONENT_BINDING
           
protected  java.lang.Object connectionSpec
          is the information permiting the access to the data store
protected  java.lang.Thread currentThread
          The lastest thread associated to the current POManagerItf
protected  FetchPlanItf fetchPlan
           
protected  JormFactory jf
          The JormFactory able to initialize the Persistent of classes
static java.lang.String JORM_FACTORY_BINDING
           
protected  org.objectweb.util.monolog.api.Logger logger
           
protected  org.objectweb.util.monolog.api.LoggerFactory loggerFactory
           
protected  short nbUse
          Indicates if number of po manager user.
protected  POManagerFactoryItf pmf
          The POManagedFactory managing this POManagerItf
static java.lang.String PNAME_CODER_BINDING
           
protected  org.objectweb.jorm.naming.api.PNameCoder pnc
          The PNameCoder able to encode/decode all PName
static java.lang.String PO_MANAGER_FACTORY_BINDING
           
protected  boolean prefetchOnExtent
           
protected  boolean prefetchOnQuery
           
static java.lang.String QUERY_MANAGER_BINDING
           
protected  QueryManager queryManager
          The manager of Query.
protected  org.objectweb.perseus.concurrency.lib.Semaphore semaphore
          A semaphore object used to support the multithread mode
protected  POManagerItf thisPM
          The fractal reference to this
protected  TransactionalPersistenceManager tpm
          The TransactionalPersistenceManager (Perseus)
static java.lang.String TRANSACTION_BINDING
           
static java.lang.String TRANSACTIONAL_PERSISTENCE_MANAGER_BINDING
           
protected  TransactionItf tx
          The transaction associated to this po manager.
 
Constructor Summary
AbstractPOManager()
           
 
Method Summary
 void addUse()
          Signal to the persistence maneger that it is used.
 void afterCompletion(int i)
           
protected  void assertIsOpen()
          Verify the persistence manager is open.
protected  void assertIsPO(java.lang.Object pc, java.lang.String cmd)
          Verify that an instance is persistence object.
protected  void assertPOManager(PersistentObjectItf sp)
          Verify the instance is managed by this persistence manager.
 void beforeCompletion()
           
 void bindFc(java.lang.String s, java.lang.Object o)
           
protected  void bindPMThread()
           
 void closePOManager()
          Close the POM
 org.objectweb.jorm.naming.api.PName decodeIdentifier(java.lang.Class aClass, java.lang.Object s)
           
 java.lang.Object getConnectionSpec()
           
 java.lang.Object getEncodedPName(PersistentObjectItf o)
          Encodes a PName into a serializable representation which could be decoded later.
 POManagerFactoryItf getPOManagerFactory()
           
 org.objectweb.perseus.concurrency.lib.Semaphore getSemaphore()
          Retrieves the semaphore object permiting the multithreading mode.
 TransactionItf getSpeedoTransaction()
           
 TransactionalPersistenceManager getTransactionalPersistenceManager()
          Retrieves the TransactionalPersistenceManager used by this POManagerItf.
 boolean isPOMClosed()
          A POManager instance can be used until it is closed.
 java.lang.String[] listFc()
           
 java.lang.Object lookupFc(java.lang.String s)
           
 void open(java.lang.Object connectionspec)
          Opens the persistent manager.
protected  void resetPMOnOpen(java.lang.Object connectionspec)
           
 void speedoDeletePersistentAll(java.lang.Object[] o)
           
 void speedoFlush()
           
abstract  FetchPlanItf speedoGetFetchPlan()
           
 java.lang.Object speedoGetObject(java.lang.Object id, java.lang.Class poc, boolean validate)
           
 java.lang.Object speedoGetObject(org.objectweb.jorm.naming.api.PName pn, boolean validate)
           
protected  java.lang.Object speedoPersist(PersistentObjectItf po, java.util.Map map)
           
 void unbindFc(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.speedo.pm.api.POManagerItf
speedoAttachCopy, speedoDeletePersistent, speedoDeletePersistent, speedoDetachCopy, speedoMakePersistent, speedoRefresh, speedoRetrieve
 

Field Detail

PO_MANAGER_FACTORY_BINDING

public static final java.lang.String PO_MANAGER_FACTORY_BINDING
See Also:
Constant Field Values

TRANSACTIONAL_PERSISTENCE_MANAGER_BINDING

public static final java.lang.String TRANSACTIONAL_PERSISTENCE_MANAGER_BINDING
See Also:
Constant Field Values

QUERY_MANAGER_BINDING

public static final java.lang.String QUERY_MANAGER_BINDING
See Also:
Constant Field Values

TRANSACTION_BINDING

public static final java.lang.String TRANSACTION_BINDING
See Also:
Constant Field Values

JORM_FACTORY_BINDING

public static final java.lang.String JORM_FACTORY_BINDING
See Also:
Constant Field Values

PNAME_CODER_BINDING

public static final java.lang.String PNAME_CODER_BINDING
See Also:
Constant Field Values

COMPONENT_BINDING

public static final java.lang.String COMPONENT_BINDING
See Also:
Constant Field Values

logger

protected org.objectweb.util.monolog.api.Logger logger

loggerFactory

protected org.objectweb.util.monolog.api.LoggerFactory loggerFactory

pmf

protected POManagerFactoryItf pmf
The POManagedFactory managing this POManagerItf


tx

protected TransactionItf tx
The transaction associated to this po manager.


queryManager

protected QueryManager queryManager
The manager of Query. It contains the optimized queries already used.


tpm

protected TransactionalPersistenceManager tpm
The TransactionalPersistenceManager (Perseus)


jf

protected JormFactory jf
The JormFactory able to initialize the Persistent of classes


pnc

protected org.objectweb.jorm.naming.api.PNameCoder pnc
The PNameCoder able to encode/decode all PName


connectionSpec

protected java.lang.Object connectionSpec
is the information permiting the access to the data store


nbUse

protected short nbUse
Indicates if number of po manager user. O means the POManagerItf is closed.


thisPM

protected POManagerItf thisPM
The fractal reference to this


currentThread

protected java.lang.Thread currentThread
The lastest thread associated to the current POManagerItf


semaphore

protected org.objectweb.perseus.concurrency.lib.Semaphore semaphore
A semaphore object used to support the multithread mode


prefetchOnExtent

protected boolean prefetchOnExtent

prefetchOnQuery

protected boolean prefetchOnQuery

fetchPlan

protected FetchPlanItf fetchPlan
Constructor Detail

AbstractPOManager

public AbstractPOManager()
Method Detail

listFc

public java.lang.String[] listFc()

lookupFc

public java.lang.Object lookupFc(java.lang.String s)

bindFc

public void bindFc(java.lang.String s,
                   java.lang.Object o)

unbindFc

public void unbindFc(java.lang.String s)

speedoGetFetchPlan

public abstract FetchPlanItf speedoGetFetchPlan()
Specified by:
speedoGetFetchPlan in interface POManagerItf

getTransactionalPersistenceManager

public TransactionalPersistenceManager getTransactionalPersistenceManager()
Description copied from interface: POManagerItf
Retrieves the TransactionalPersistenceManager used by this POManagerItf.

Specified by:
getTransactionalPersistenceManager in interface POManagerItf

open

public void open(java.lang.Object connectionspec)
Description copied from interface: POManagerItf
Opens the persistent manager. This operation is the opposite of the javax.jdo.PersistenceManager.close() method. It prepares a POManagerItf to be used. During the preparation, the optimistic and multithread modes are initialized.

Specified by:
open in interface POManagerItf
Parameters:
connectionspec - is the information to access to the data store (user, password, ...)

getConnectionSpec

public java.lang.Object getConnectionSpec()
Specified by:
getConnectionSpec in interface POManagerItf
Returns:
the connection information to access the data store

addUse

public void addUse()
Description copied from interface: POManagerItf
Signal to the persistence maneger that it is used. A persistence managed can be used by several thread. In this case each thread have done a PersistenceManagerFactory.getPersistentceManager() to obtain a po manager instance. The threads will do a close() operation, but only the last has to be taken in account. This method permits to knwon how many users uses the current pomanager.

Specified by:
addUse in interface POManagerItf

isPOMClosed

public boolean isPOMClosed()
A POManager instance can be used until it is closed.

Specified by:
isPOMClosed in interface POManagerItf
Returns:
true if this POManager has been closed
See Also:
closePOManager()

closePOManager

public void closePOManager()
Description copied from interface: POManagerItf
Close the POM

Specified by:
closePOManager in interface POManagerItf

getSpeedoTransaction

public TransactionItf getSpeedoTransaction()
Specified by:
getSpeedoTransaction in interface POManagerItf
Returns:
the unique transaction associate to the POM.

getPOManagerFactory

public POManagerFactoryItf getPOManagerFactory()
Specified by:
getPOManagerFactory in interface POManagerItf
Returns:
the factory of this POM.

getEncodedPName

public java.lang.Object getEncodedPName(PersistentObjectItf o)
Description copied from interface: POManagerItf
Encodes a PName into a serializable representation which could be decoded later. The representation depends on the PName structure.

Specified by:
getEncodedPName in interface POManagerItf
Parameters:
o - is a persistent object

decodeIdentifier

public org.objectweb.jorm.naming.api.PName decodeIdentifier(java.lang.Class aClass,
                                                            java.lang.Object s)
Specified by:
decodeIdentifier in interface POManagerItf

speedoDeletePersistentAll

public void speedoDeletePersistentAll(java.lang.Object[] o)
Specified by:
speedoDeletePersistentAll in interface POManagerItf

beforeCompletion

public void beforeCompletion()
Specified by:
beforeCompletion in interface javax.transaction.Synchronization

afterCompletion

public void afterCompletion(int i)
Specified by:
afterCompletion in interface javax.transaction.Synchronization

speedoGetObject

public java.lang.Object speedoGetObject(org.objectweb.jorm.naming.api.PName pn,
                                        boolean validate)
Specified by:
speedoGetObject in interface POManagerItf

speedoGetObject

public java.lang.Object speedoGetObject(java.lang.Object id,
                                        java.lang.Class poc,
                                        boolean validate)
                                 throws org.objectweb.jorm.api.PException,
                                        PersistenceException
Throws:
org.objectweb.jorm.api.PException
PersistenceException

speedoPersist

protected java.lang.Object speedoPersist(PersistentObjectItf po,
                                         java.util.Map map)
                                  throws org.objectweb.jorm.api.PException,
                                         PersistenceException
Throws:
org.objectweb.jorm.api.PException
PersistenceException

speedoFlush

public void speedoFlush()
                 throws PersistenceException
Throws:
PersistenceException

resetPMOnOpen

protected void resetPMOnOpen(java.lang.Object connectionspec)

getSemaphore

public org.objectweb.perseus.concurrency.lib.Semaphore getSemaphore()
Description copied from interface: POManagerItf
Retrieves the semaphore object permiting the multithreading mode.

Specified by:
getSemaphore in interface POManagerItf

bindPMThread

protected void bindPMThread()

assertIsOpen

protected void assertIsOpen()
Verify the persistence manager is open.

Throws:
SpeedoRuntimeException - if the pomanager is closed.

assertIsPO

protected void assertIsPO(java.lang.Object pc,
                          java.lang.String cmd)
Verify that an instance is persistence object.

Parameters:
pc - the object to test.
Throws:
SpeedoRuntimeException - if the object is not persistence capable.

assertPOManager

protected void assertPOManager(PersistentObjectItf sp)
Verify the instance is managed by this persistence manager.

Parameters:
sp - a speedo po instance.
Throws:
SpeedoRuntimeException - if the instance is managed by another persistence manager.