|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nakedobjects.runtime.persistence.PersistenceSessionAbstract
org.nakedobjects.runtime.persistence.objectstore.PersistenceSessionObjectStore
public class PersistenceSessionObjectStore
| Constructor Summary | |
|---|---|
PersistenceSessionObjectStore(PersistenceSessionFactory persistenceSessionFactory,
AdapterFactory adapterFactory,
ObjectFactory objectFactory,
ServicesInjector servicesInjector,
OidGenerator oidGenerator,
AdapterManagerExtended identityMap,
PersistAlgorithm persistAlgorithm,
ObjectStorePersistence objectStore)
Initialize the object store so that calls to this object store access persisted objects and persist changes to the object that are saved. |
|
| Method Summary | |
|---|---|
void |
addPersistedObject(NakedObject object)
Uses the ObjectStore to
create a
CreateObjectCommand, and adds to the
NakedObjectTransactionManager. |
void |
debugData(DebugString debug)
|
java.lang.String |
debugTitle()
|
void |
destroyObject(NakedObject adapter)
Removes the specified object from the system. |
protected void |
doClose()
Optional hook method to close subclass' components. |
protected void |
doOpen()
Optional hook method called prior to creating service adapters for subclass to initialize its components. |
protected void |
finalize()
|
protected NakedObject[] |
getInstances(PersistenceQuery persistenceQuery)
|
ObjectStorePersistence |
getObjectStore()
Injected by constructor. |
protected Oid |
getOidForService(java.lang.String name)
Returns the OID for the adapted service. |
PersistAlgorithm |
getPersistAlgorithm()
Injected by constructor. |
ObjectStoreTransactionManager |
getTransactionManager()
Just downcasts. |
boolean |
hasInstances(NakedObjectSpecification specification)
Checks whether there are any instances of the specified type. |
boolean |
isFixturesInstalled()
Returns the cached value of whether fixtures are installed from the
PersistenceSessionFactory (provided it implements
FixturesInstalledFlag), otherwise queries ObjectStore
directly. |
NakedObject |
loadObject(Oid oid,
NakedObjectSpecification hintSpec)
Loads the object identified by the specified Oid from the persisted
set of objects. |
void |
makePersistent(NakedObject adapter)
Makes a naked object persistent. |
protected void |
makePersistentInPersistenceLayer(NakedObject adapter)
|
void |
objectChanged(NakedObject adapter)
Mark the NakedObject as changed, and therefore requiring flushing
to the persistence mechanism. |
protected void |
registerService(java.lang.String name,
Oid oid)
Registers the specified service as having the specified OID. |
void |
reload(NakedObject object)
Does nothing. |
void |
remapAsPersistent(NakedObject adapter)
Callback from the PersistAlgorithm (or equivalent; some object
stores such as Hibernate will use listeners instead) to indicate that the
adapter is persisted, and the adapter maps should be
updated. |
void |
resolveField(NakedObject objectAdapter,
NakedObjectAssociation field)
Hint that specified field within the specified object is likely to be needed soon. |
void |
resolveImmediately(NakedObject adapter)
Re-initialises the fields of an object. |
void |
testReset()
For testing purposes only. |
java.lang.String |
toString()
|
| Methods inherited from class org.nakedobjects.runtime.persistence.PersistenceSessionAbstract |
|---|
clearAllDirty, close, createInstance, createPersistenceQueryFor, doOpened, ensureNotOpened, ensureOpen, findInstances, findInstances, getAdapterFactory, getAdapterManager, getObjectFactory, getOidGenerator, getPersistenceSessionFactory, getService, getServices, getServicesInjector, getSpecificationLoader, hasServices, injectInto, isCheckObjectsForDirtyFlag, isImmutable, objectChangedAllDirty, open, recreateAdapter, recreateAdapter, reload, setDirtiableSupport, setSpecificationLoader, setTransactionManager |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public PersistenceSessionObjectStore(PersistenceSessionFactory persistenceSessionFactory,
AdapterFactory adapterFactory,
ObjectFactory objectFactory,
ServicesInjector servicesInjector,
OidGenerator oidGenerator,
AdapterManagerExtended identityMap,
PersistAlgorithm persistAlgorithm,
ObjectStorePersistence objectStore)
| Method Detail |
|---|
protected void doOpen()
PersistenceSessionAbstract
doOpen in class PersistenceSessionAbstractpublic boolean isFixturesInstalled()
whether fixtures are installed from the
PersistenceSessionFactory (provided it implements
FixturesInstalledFlag), otherwise queries ObjectStore
directly.
This caching is important because if we've determined, for a given run, that fixtures are not installed, then we don't want to change our mind by asking the object store again in another session.
isFixturesInstalled in interface PersistenceSessionFixturesInstalledFlagprotected void doClose()
PersistenceSessionAbstract
doClose in class PersistenceSessionAbstractpublic void testReset()
PersistenceSessionAbstract
testReset in interface PersistenceSessionTestSupporttestReset in class PersistenceSessionAbstract
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwable
public NakedObject loadObject(Oid oid,
NakedObjectSpecification hintSpec)
PersistenceSessionContainerOid from the persisted
set of objects.
As used primarily by ServerDistribution.
loadObject in interface PersistenceSessionContainerpublic void reload(NakedObject object)
reload in interface PersistenceSessionForceReloaderreload in class PersistenceSessionAbstractpublic void resolveImmediately(NakedObject adapter)
PersistenceSessionContainer
resolveImmediately in interface PersistenceSessionContainer
public void resolveField(NakedObject objectAdapter,
NakedObjectAssociation field)
PersistenceSessionContainerThis method need not do anything, but offers the object store the opportunity to load in objects before their use. Contrast this with resolveImmediately, which requires an object to be loaded before continuing.
resolveField in interface PersistenceSessionContainerPersistenceSessionContainer.resolveImmediately(NakedObject)public void makePersistent(NakedObject adapter)
AdapterManager as the object is implicitly 'in use'.
If the object has any associations then each of these, where they aren't already persistent, should also be made persistent by recursively calling this method.
If the object to be persisted is a collection, then each element of that collection, that is not already persistent, should be made persistent by recursively calling this method.
makePersistent in interface PersistenceSessionContainerremapAsPersistent(NakedObject)protected void makePersistentInPersistenceLayer(NakedObject adapter)
public void objectChanged(NakedObject adapter)
PersistenceSessionContainerNakedObject as changed, and therefore requiring flushing
to the persistence mechanism.
objectChanged in interface PersistenceSessionContainerpublic void destroyObject(NakedObject adapter)
destroyObject in interface PersistenceSessionContainerpublic void remapAsPersistent(NakedObject adapter)
PersistAlgorithm (or equivalent; some object
stores such as Hibernate will use listeners instead) to indicate that the
adapter is persisted, and the adapter maps should be
updated.
The object store is expected to have already updated the Oid
state and the ResolveState . Some object stores (again, we're
thinking Hibernate here) might also have updated collections, both the
Oid of the collection and the pojo wrapped by the adapter.
The PersistAlgorithm is called from
makePersistent(NakedObject).
TODO: the PersistenceSessionProxy doesn't have this method; should document better why this is the case, and where the equivalent functionality is (somewhere in the marshalling stuff, I think).
remapAsPersistent in interface ToPersistObjectSetremapAsPersistent(NakedObject)protected NakedObject[] getInstances(PersistenceQuery persistenceQuery)
getInstances in class PersistenceSessionAbstractpublic boolean hasInstances(NakedObjectSpecification specification)
true if there are, or
false if there are not.
hasInstances in interface PersistenceSessionContainerprotected Oid getOidForService(java.lang.String name)
PersistenceSessionAbstract
getOidForService in class PersistenceSessionAbstract
protected void registerService(java.lang.String name,
Oid oid)
PersistenceSessionAbstract
registerService in class PersistenceSessionAbstractpublic ObjectStoreTransactionManager getTransactionManager()
getTransactionManager in interface PersistenceSessiongetTransactionManager in class PersistenceSessionAbstractPersistenceSession.setTransactionManager(NakedObjectTransactionManager)public void addPersistedObject(NakedObject object)
ObjectStore to
create a
CreateObjectCommand, and adds to the
NakedObjectTransactionManager.
addPersistedObject in interface ToPersistObjectSetpublic void debugData(DebugString debug)
debugData in interface DebugInfodebugData in class PersistenceSessionAbstractpublic java.lang.String debugTitle()
debugTitle in interface DebugInfopublic java.lang.String toString()
toString in class java.lang.Objectpublic ObjectStorePersistence getObjectStore()
public PersistAlgorithm getPersistAlgorithm()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||