|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | 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)
|
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()
Deprecated. |
javax.jdo.Extent |
getExtent(java.lang.Class theClass,
boolean subClasses)
Conveniencte metod for obtaining Extents of objects. |
javax.jdo.PersistenceManager |
getNewTransactionalPersistenceManager()
returns a new transactional PM. |
javax.jdo.PersistenceManager |
getNewTransactionalPersistenceManager(java.lang.String schemaGroup)
|
javax.jdo.PersistenceManager |
getNonTransactionalPersistenceManager()
returns a PersistenceManager capable of returning all non-transactionally persistent objects. |
javax.jdo.PersistenceManager |
getNonTransactionalPersistenceManager(java.lang.String schemaGroup)
|
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
config's singleton persistence manager factory. |
javax.jdo.PersistenceManager |
getReadOnlyPersistenceManager(java.lang.String schemaGroup)
|
java.lang.String |
getSchemaGroup(java.lang.Class theClass)
attempts to invoke 'getStaticSchemaGroup' on the given class. |
java.lang.String |
getSchemaGroup(java.lang.Object pc)
If the object is persistent, returns the result of a call to 'getSchemaGroup'. |
javax.jdo.PersistenceManager |
getTransactionalPersistenceManager()
returns a PM with a transaction already active. |
javax.jdo.PersistenceManager |
getTransactionalPersistenceManager(java.lang.String schemaGroup)
|
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. |
javax.jdo.Query |
newQuery(java.lang.Class theClass)
Convenience method for obtaining Query objects. |
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 |
refresh(java.lang.Object pc)
Convenience method for refreshing an object |
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 getTransactionalPersistenceManager(java.lang.String schemaGroup)
public javax.jdo.PersistenceManager getNewTransactionalPersistenceManager()
public javax.jdo.PersistenceManager getNewTransactionalPersistenceManager(java.lang.String schemaGroup)
public javax.jdo.PersistenceManager getReadOnlyPersistenceManager()
PersistenceManager
obtained from this
config'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 getReadOnlyPersistenceManager(java.lang.String schemaGroup)
public javax.jdo.PersistenceManager getNonTransactionalPersistenceManager()
public javax.jdo.PersistenceManager getNonTransactionalPersistenceManager(java.lang.String schemaGroup)
public void idsDeleted(java.util.Collection deletedIds)
public void deleteObject(java.lang.Object object)
public void deleteAll(java.lang.Class persistentClass)
public static java.lang.String getDBName()
public javax.jdo.Query newQuery(java.lang.Class theClass)
public javax.jdo.Extent getExtent(java.lang.Class theClass, boolean subClasses)
public void refresh(java.lang.Object pc)
public java.lang.String getSchemaGroup(java.lang.Object pc)
public java.lang.String getSchemaGroup(java.lang.Class theClass)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |