|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.ashridgetech.prevdb.client.PrevDb
The overall controller for all the Persistent objects in a PrevDb system.
Manages loading and saving data and transactions.
Needs to be configured at startup with the Persistent classes to be managed,
and the SystemStore implementations.
| Constructor Summary | |
PrevDb()
|
|
| Method Summary | |
protected void |
applyTransaction(Transaction tran)
Apply the effects of a Transaction to the objects in this PrevDb. |
Transaction |
commitTransaction()
Commit the current unit of work. |
void |
defineNonUniqueIndex(PersistentField field)
Define a non-unique index required for a class managed by this PrevDb. |
void |
definePersistentClass(Class persistentClass,
PersistentField oidField)
Define a new persistent class. |
Transaction |
getCurrentTransaction()
Get the Transaction currently in progress |
Collection |
getPersistentClasses()
Get the collection of persistent object classes. |
SystemStore |
getSystemStore()
Get the default SystemStore for this PrevDb. |
protected boolean |
isLoading()
Indicate whether this prevDb is loading objects. |
PersistentManager |
manager(Class persistentClass)
Find the PersistentManager for a Class. |
protected void |
notifyFieldUpdate(Persistent obj,
PersistentField field,
Object oldValue,
Object newValue)
Notify this PrevDb that a field in one of its persistent objects has been updated. |
protected void |
notifyNewObject(Persistent obj)
Notify this PrevDb that a new persistent object has been created. |
void |
rollbackTransaction()
Abandon the current unit of work. |
protected void |
rollbackTransaction(Transaction tran)
Undo the effects of a Transaction on the objects in this PrevDb. |
void |
setSystemStore(SystemStore systemStore)
Set the default SystemStore for this PrevDb. |
void |
shutdown()
End the operation of this PrevDb. |
void |
snapshot()
Take a snapshot of the system data during running. |
void |
startTransaction()
Start a new unit of work that will be managed by this PrevDb. |
void |
startup()
Start the operation of this PrevDb. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public PrevDb()
| Method Detail |
public void startup()
throws DataException
PrevDb. Loads the data
from the SystemStore, which must have previously been set
by setSystemStore(com.ashridgetech.prevdb.store.SystemStore).
DataExceptionpublic void shutdown()
PrevDb.
Save the system data to the SystemStore.
public void snapshot()
public PersistentManager manager(Class persistentClass)
PersistentManager for a Class.
persistentClass - the class for which the PersistentManager is needed.
ObjectNotFoundException - if there is no object with the given oidpublic SystemStore getSystemStore()
SystemStore for this PrevDb.
IllegalStateException - if no store has been set with setSystemStore(com.ashridgetech.prevdb.store.SystemStore)public void setSystemStore(SystemStore systemStore)
SystemStore for this PrevDb.
systemStore - the store
public void definePersistentClass(Class persistentClass,
PersistentField oidField)
Persistent.
NOTE: if the class is a subclass of another Persistent class, that class
must have been defined already.
persistentClass - the class to define.oidField - the oid field of persistentClass.public void defineNonUniqueIndex(PersistentField field)
PrevDb.
field - the field to be indexed - the PersistentField knows which class it belongs topublic Collection getPersistentClasses()
public void startTransaction()
PrevDb.
All changes made to objects managed by this PrevDb during the
transaction will be recorded. They may be made permanent in the
system store, or reversed if necessary.
IllegalStateException - if a transaction is currently in progress#rollbackTransactionpublic Transaction getCurrentTransaction()
Transaction currently in progress
Transaction, or null if there is no Transaction in progresspublic Transaction commitTransaction()
PrevDb during the
transaction are made permanent in the
system store. The getCurrentTransaction()
will return nullafter this call.
Transaction that has been committed, so that its contents can be used
by the application if required
IllegalStateException - if no transaction is currently in progressrollbackTransaction()public void rollbackTransaction()
PrevDb during the
transaction are reversed, and they are not made permanent in the
system store. The getCurrentTransaction()
will return nullafter this call.
IllegalStateException - if no transaction is currently in progresscommitTransaction()
protected void applyTransaction(Transaction tran)
throws DataException
Transaction to the objects in this PrevDb.
tran - the Transaction to apply
DataExceptionprotected void rollbackTransaction(Transaction tran)
Transaction on the objects in this PrevDb.
tran - the Transaction to undoprotected void notifyNewObject(Persistent obj)
PrevDb that a new persistent object has been created.
Do nothing if during the operation of startup()
obj - the new object
protected void notifyFieldUpdate(Persistent obj,
PersistentField field,
Object oldValue,
Object newValue)
PrevDb that a field in one of its persistent objects has been updated.
obj - the new objectprotected boolean isLoading()
prevDb is loading objects.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||