T - The class name of the object which the repository class
manages.public abstract class Factory<T> extends Object
© Copyright 2006 Sans Pareil Technologies, Inc.
| Modifier and Type | Field and Description |
|---|---|
protected static Logger |
logger
The logger to use for all repository classes.
|
| Constructor and Description |
|---|
Factory() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addAlphabeticalIndex(Object object,
javax.jdo.PersistenceManager pm)
Check for the
AlphabeticalIndex
annotation and populate JDOObject.startLetter as appropriate. |
void |
begin(javax.jdo.PersistenceManager pm)
Start a transaction in the specified persistence manager.
|
void |
close(javax.jdo.PersistenceManager pm)
Close the specified PersistenceManager.
|
void |
close(javax.jdo.Query query)
Close the specified query if it is not null.
|
void |
commit(javax.jdo.PersistenceManager pm)
Commit the active transaction in the specified persistence manager.
|
protected long |
count(Class cls,
javax.jdo.PersistenceManager pm)
Return the total number of objects persisted in the data store.
|
void |
delete(T object,
javax.jdo.PersistenceManager pm)
Delete the specified persistence capable object from the data store.
|
protected Collection<T> |
fetch(Class cls,
long start,
long end,
javax.jdo.PersistenceManager pm)
Return a collection that contains all instances in the data store of
the specified class within the specified range.
|
protected Collection<T> |
fetch(Class cls,
long start,
long end,
String sortClause,
javax.jdo.PersistenceManager pm)
Return a collection that contains all instances in the data store of
the specified class within the specified range.
|
T |
fetch(Object oid,
javax.jdo.PersistenceManager pm)
Fetch the object identified by the
ObjectId specified. |
protected Collection<T> |
fetchAll(Class cls,
javax.jdo.PersistenceManager pm)
Return a collection that contains all instances in the data store of
the specified class.
|
javax.jdo.PersistenceManager |
getPersistenceManager()
Return a PersistenceManager from the
PersistenceManagerFactory |
protected void |
removeStartLetter(Object object,
StartLetter startLetter,
javax.jdo.PersistenceManager pm)
Remove start letters that are not in use by instances of the type
of object specified.
|
void |
rollback(javax.jdo.PersistenceManager pm)
Roll back any active transaction associated wih the specified
persistence manager.
|
T |
save(T object,
javax.jdo.PersistenceManager pm)
Save the specified persistence capable object to the data store.
|
protected static final Logger logger
public javax.jdo.PersistenceManager getPersistenceManager()
PersistenceManagerFactoryPersistenceManagerFactory.getPersistenceManager()public void begin(javax.jdo.PersistenceManager pm)
pm - The persistence manager for which a transaction is to be
started if necessary.public void commit(javax.jdo.PersistenceManager pm)
pm - The persistence manager for which a transaction is to be
committed.public void rollback(javax.jdo.PersistenceManager pm)
pm - The persistence manager whose associated transaction
is to be rolled back.public void close(javax.jdo.PersistenceManager pm)
Transactions prior to closing the manager.pm - The PersistenceManager that is to be closed.rollback(javax.jdo.PersistenceManager)public void close(javax.jdo.Query query)
query - The query to close.public T save(T object, javax.jdo.PersistenceManager pm) throws javax.jdo.JDOException
object - The instance to persist to the data store.pm - The persistence manager to use to interact with the data
store. It is assumed that an active transaction is in operation.javax.jdo.JDOException - If errors are encountered while persisting the
object.addAlphabeticalIndex(java.lang.Object, javax.jdo.PersistenceManager)public void delete(T object, javax.jdo.PersistenceManager pm) throws javax.jdo.JDOException
object - The instance to delete from the data store.pm - The persistence manager to use to interact with the data
store. It is assumed that an active transaction is in operation.javax.jdo.JDOException - If errors are encountered while deleting the
persistent object.protected Collection<T> fetchAll(Class cls, javax.jdo.PersistenceManager pm) throws javax.jdo.JDOException
cls - The class whose instances are to be retrieved. This should
be the same as the class of parametrised type T. This
parameter is required since we cannot infer the type of the
parametriced handle T.pm - The persistence manager to use. It is assumed that an
active transaction exists (if non-transaction read is not enabled).javax.jdo.JDOException - If errors are encountered while fetching the
objects.protected Collection<T> fetch(Class cls, long start, long end, javax.jdo.PersistenceManager pm) throws javax.jdo.JDOException
count(java.lang.Class, javax.jdo.PersistenceManager) method to fetch the total number of
persistent instances in the data store.cls - The class whose instances are to be retrieved. This should
be the same as the class of parametrised type T. This
parameter is required since we cannot infer the type of the
parametriced handle T.start - The index (inclusive) from which objects are to be
retrieved from the data store.end - The index (exclusive) till which objects are to be retrieved
from the data store.pm - The persistence manager to use. It is assumed that an
active transaction exists (if non-transaction read is not enabled).javax.jdo.JDOException - If errors are encountered while fetching the
objects.protected Collection<T> fetch(Class cls, long start, long end, String sortClause, javax.jdo.PersistenceManager pm) throws javax.jdo.JDOException
count(java.lang.Class, javax.jdo.PersistenceManager) method to fetch the total number of
persistent instances in the data store.cls - The class whose instances are to be retrieved. This should
be the same as the class of parametrised type T. This
parameter is required since we cannot infer the type of the
parametriced handle T.start - The index (inclusive) from which objects are to be
retrieved from the data store.end - The index (exclusive) till which objects are to be retrieved
from the data store.sortClause - The sort clause to use to order the query results.
See Query.setOrdering(java.lang.String) for details on how to
specify this parameter.pm - The persistence manager to use. It is assumed that an
active transaction exists (if non-transaction read is not enabled).javax.jdo.JDOException - If errors are encountered while fetching the
objects.public T fetch(Object oid, javax.jdo.PersistenceManager pm) throws javax.jdo.JDOException
ObjectId specified.oid - The object id using which the persistent object is to be
retrieved.pm - The persistence manager to use to interact with the data
store. It is assumed that an active transaction is in operation.null if
no corresponding object could be found.javax.jdo.JDOException - If errors are encountered while fetching the object.protected final long count(Class cls, javax.jdo.PersistenceManager pm)
cls - The class whose instance count is to be retrieved.pm - The persistence manager to use to interact with the data
store. It is assumed that an active transaction is in operation.0 if no
instances exist.protected void addAlphabeticalIndex(Object object, javax.jdo.PersistenceManager pm)
AlphabeticalIndex
annotation and populate JDOObject.startLetter as appropriate.object - The object that is to be indexed if required.pm - The persistence manager to use.protected void removeStartLetter(Object object, StartLetter startLetter, javax.jdo.PersistenceManager pm)
object - The object for which associated indices are to be cleaned.startLetter - The object that is to be deleted if required.pm - The persistence manager to use.