|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--stomp.util.AbstractFactory
|
+--stomp.jdo.JDOFactory
Gives static access to a properly configured PersistenceManagers. In general, there is a single PersistenceManager that handles the brunt of the calls, acting as the main cache for the application. Transaction management is completely abstracted away from developers by the objects in this factory. To start a transaction, use the getTransactionalPersistenceManager () method. After obtaining this new PM, any object which is going to be involved in the transaction must be relocated in the transactional PM. To commit the transaction, simply close () the PersistenceManager. Note that after closing the PM, any instances that were found in the transactional PM are considered out-of-date and should be discarded. However, any instances found through a read-only PM, even before the transaction, are still good, and will respond to reads correctly once the transaction is committed. Note that attempting to start a transaction through a PM will result in an exception being thrown. Transactions are started by calling "getTransactionalPM" and committed by calling "close ()" on the transactional PM. Also note that transactional PMs must be closed when they are no longer in use, so try {} finally {pm.close} blocks are strongly encouraged.
| Constructor Summary | |
JDOFactory()
|
|
| Method Summary | |
void |
deleteAll(java.lang.Class persistentClass)
|
void |
deleteObject(java.lang.Object object)
|
void |
deleteObjectById(java.lang.Object id)
|
void |
deleteObjectById(java.lang.Object id,
javax.jdo.PersistenceManager pm)
|
java.util.Collection |
executeQuery(java.lang.Class theClass,
java.lang.String filter)
convenience method for executing a String filter on all the instances of a particular class in the database, as well as all of its subclasses. |
java.util.Collection |
executeQuery(java.lang.Class theClass,
java.lang.String filter,
javax.jdo.PersistenceManager pm)
|
java.lang.Object |
executeSingletonQuery(java.lang.Class theClass,
java.lang.String filter)
returns the first object in the Collection of matching results for the given query. |
java.lang.Object |
executeSingletonQuery(java.lang.Class theClass,
java.lang.String filter,
javax.jdo.PersistenceManager pm)
|
java.lang.Object |
findInPm(java.lang.Object pc,
javax.jdo.PersistenceManager pm)
takes an instance associated with some other PM and refinds it through the given PM. |
java.lang.Object |
findReadOnly(java.lang.Object pc)
takes an instance which has presumably been found through a transactional PM and refinds it through a read-only PM. |
static java.lang.String |
getDBName()
|
java.lang.Object |
getLock(javax.jdo.PersistenceManager pm)
returns the lock that should be used for the logical operation of synchronizing on the PM. |
javax.jdo.PersistenceManager |
getNewTransactionalPersistenceManager()
returns a new transactional PM. |
javax.jdo.PersistenceManager |
getNonTransactionalPersistenceManager()
returns a PersistenceManager capable of returning all non-transactionally persistent objects. |
java.lang.Object |
getObjectId(java.lang.Object pc)
if the given object isPersistent ( pc ), returns the ObjectID associated with this object. |
javax.jdo.PersistenceManager |
getPersistenceManager(java.lang.Object pc)
|
javax.jdo.PersistenceManager |
getReadOnlyPersistenceManager()
returns a singleton PersistenceManager obtained from this
class's singleton persistence manager factory. |
javax.jdo.PersistenceManager |
getTransactionalPersistenceManager()
returns a PM with a transaction already active. |
void |
idsDeleted(java.util.Collection deletedIds)
makes any necessary callbacks to listeners in this JVM, notifying them that the given Collection of objects was deleted. |
boolean |
isNonTransactional(java.lang.Object pc)
returns true if the given object is PersistenceCapable, persistent, and was found through a "non-transactional" PM. |
boolean |
isPersistent(java.lang.Object pc)
convenience method, returns true if the given object is already in the database, false otherwise. |
java.lang.Object |
persistNewObject(java.lang.Object pc)
starts a new transaction, makes the pc persistent, and commits the transaction. |
java.lang.Object |
persistNewObject(java.lang.Object pc,
javax.jdo.PersistenceManager pm)
makes the pc persistent and managed by the given persistence manager. |
void |
refreshAll()
refreshes the cache in the singleton, read-only pm, as well as the cache in PMs associated with currently running transactions. |
void |
refreshAll(java.util.Collection pcIds)
updates the state of the active PMs in the system. |
static JDOFactory |
singleton()
|
| Methods inherited from class stomp.util.AbstractFactory |
singletonFactory |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public JDOFactory()
| Method Detail |
public static JDOFactory singleton()
public java.lang.Object persistNewObject(java.lang.Object pc)
public java.lang.Object persistNewObject(java.lang.Object pc,
javax.jdo.PersistenceManager pm)
public boolean isPersistent(java.lang.Object pc)
public java.lang.Object findReadOnly(java.lang.Object pc)
public boolean isNonTransactional(java.lang.Object pc)
public javax.jdo.PersistenceManager getPersistenceManager(java.lang.Object pc)
public java.lang.Object findInPm(java.lang.Object pc,
javax.jdo.PersistenceManager pm)
public java.lang.Object getObjectId(java.lang.Object pc)
public java.util.Collection executeQuery(java.lang.Class theClass,
java.lang.String filter)
public java.util.Collection executeQuery(java.lang.Class theClass,
java.lang.String filter,
javax.jdo.PersistenceManager pm)
public java.lang.Object executeSingletonQuery(java.lang.Class theClass,
java.lang.String filter)
public java.lang.Object executeSingletonQuery(java.lang.Class theClass,
java.lang.String filter,
javax.jdo.PersistenceManager pm)
public javax.jdo.PersistenceManager getTransactionalPersistenceManager()
public javax.jdo.PersistenceManager getNewTransactionalPersistenceManager()
public javax.jdo.PersistenceManager getReadOnlyPersistenceManager()
PersistenceManager obtained from this
class's singleton persistence manager factory. This PM is *read-only*.
Any attempts to start a transaction with this PM will result in an exception.
To do anything that requires a transaction, use teh getTransactionalPersistenceManager
method.public javax.jdo.PersistenceManager getNonTransactionalPersistenceManager()
public void refreshAll()
public void refreshAll(java.util.Collection pcIds)
public void idsDeleted(java.util.Collection deletedIds)
public void deleteObject(java.lang.Object object)
public void deleteObjectById(java.lang.Object id)
public void deleteObjectById(java.lang.Object id,
javax.jdo.PersistenceManager pm)
public void deleteAll(java.lang.Class persistentClass)
public java.lang.Object getLock(javax.jdo.PersistenceManager pm)
public static java.lang.String getDBName()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||