stomp.jdo
Class GenericPMFactory

java.lang.Object
  |
  +--stomp.jdo.GenericPMFactory
All Implemented Interfaces:
PMFactory

public class GenericPMFactory
extends java.lang.Object
implements PMFactory

standard PMFactory implementation. Clients may use this simple implementation to connect a third-party JDO implementation to Stomp, by specifying the location of a properties file in the jdoFactory.properties runtime pref, or may take control of the behavior of this object completely by implementing PMFactory on their own and specifying this class in the jdoFactory.pmFactory pref.

Author:
Eric Lindauer

Constructor Summary
GenericPMFactory(java.lang.String schemaGroup)
           
 
Method Summary
protected  javax.jdo.PersistenceManagerFactory configure(javax.jdo.PersistenceManagerFactory pmFactory)
          called immediately after creating any PMFactory.
 javax.jdo.PersistenceManager getNewTransactionalPersistenceManager()
          returns a PersistenceManager associated with it's own transaction.
 javax.jdo.PersistenceManager getNonTransactionalPersistenceManager()
          returns a PersistenceManager capable of returning all non-transactionally persistent objects.
 javax.jdo.PersistenceManager getReadOnlyPersistenceManager()
          returns a PM which should never be associated with a transaction.
 java.lang.String getSchemaGroup()
           
 javax.jdo.PersistenceManager getTransactionalPersistenceManager()
          returns a PersistenceManager which has already had a JDO transaction started.
 void transactionCompleted(javax.jdo.PersistenceManager pm)
          callback made whenever a transaction has just committed or rolled back, and just before they refresh all of the other threads.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericPMFactory

public GenericPMFactory(java.lang.String schemaGroup)
Method Detail

getSchemaGroup

public java.lang.String getSchemaGroup()

getReadOnlyPersistenceManager

public javax.jdo.PersistenceManager getReadOnlyPersistenceManager()
Description copied from interface: PMFactory
returns a PM which should never be associated with a transaction. The data in objects found should reflect the current state of the database, and this data should not be changable by the user.

Specified by:
getReadOnlyPersistenceManager in interface PMFactory

getTransactionalPersistenceManager

public javax.jdo.PersistenceManager getTransactionalPersistenceManager()
returns a PersistenceManager which has already had a JDO transaction started. No transactional code is needed ( and in fact is disallowed ) when using this pm. The Transaction will be automatically committed when the PersistenceManager is closed. all cache synchronization between this transactional PM and the other pms is taken care of automatically. Once the PM obtained from this method is closed, any instances related to it are considered to be out-of-date and should be discarded. This is the recommended way to get a transactional PM ( NOT newTransactionalPM () ), whenever possible, as it provides the most predictable ( read: intuitive ) reaction to calls to tx.rollback ().

Specified by:
getTransactionalPersistenceManager in interface PMFactory

getNewTransactionalPersistenceManager

public javax.jdo.PersistenceManager getNewTransactionalPersistenceManager()
returns a PersistenceManager associated with it's own transaction. Use this only when you must know that closing the PM commits the transaction, for example, in cases where you need to immediately refind the object through a read-only PM in order to return it.

Specified by:
getNewTransactionalPersistenceManager in interface PMFactory

getNonTransactionalPersistenceManager

public javax.jdo.PersistenceManager getNonTransactionalPersistenceManager()
returns a PersistenceManager capable of returning all non-transactionally persistent objects. In particular, it is guaranteed that PMs from this method have the non-transactional write set to true. Objects found in this pm are completely independent of other transactions, whether in the current JVM or elsewhere. They are never updated to reflect changes, never committed etc, and function as basically a transient version of a persistent object.

Specified by:
getNonTransactionalPersistenceManager in interface PMFactory

transactionCompleted

public void transactionCompleted(javax.jdo.PersistenceManager pm)
callback made whenever a transaction has just committed or rolled back, and just before they refresh all of the other threads.


configure

protected javax.jdo.PersistenceManagerFactory configure(javax.jdo.PersistenceManagerFactory pmFactory)
called immediately after creating any PMFactory.