|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nakedobjects.runtime.persistence.PersistenceSessionAbstract
public abstract class PersistenceSessionAbstract
| Constructor Summary | |
|---|---|
PersistenceSessionAbstract(PersistenceSessionFactory persistenceSessionFactory,
AdapterFactory adapterFactory,
ObjectFactory objectFactory,
ServicesInjector servicesInjector,
OidGenerator oidGenerator,
AdapterManagerExtended identityMap)
|
|
| Method Summary | ||
|---|---|---|
void |
clearAllDirty()
Set as clean any Dirtiable objects. |
|
void |
close()
Calls doClose(), then closes all components. |
|
NakedObject |
createInstance(NakedObjectSpecification specification)
Create a root or standalone adapter. |
|
protected PersistenceQuery |
createPersistenceQueryFor(Query<?> query,
QueryCardinality cardinality)
Converts the applib representation of a query into the
NOF-internal representation. |
|
void |
debugData(DebugString debug)
|
|
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 |
doOpened()
Optional hook method for any final processing from open(). |
|
protected void |
ensureNotOpened()
|
|
protected void |
ensureOpen()
|
|
NakedObject |
findInstances(PersistenceQuery persistenceQuery)
Finds and returns instances that match the specified PersistenceQuery. |
|
|
findInstances(Query<T> query,
QueryCardinality cardinality)
Finds and returns instances that match the specified query. |
|
AdapterFactory |
getAdapterFactory()
Injected in constructor. |
|
AdapterManagerExtended |
getAdapterManager()
Injected in constructor. |
|
protected abstract NakedObject[] |
getInstances(PersistenceQuery persistenceQuery)
|
|
ObjectFactory |
getObjectFactory()
Obtained indirectly from the injected reflector. |
|
protected abstract Oid |
getOidForService(java.lang.String name)
Returns the OID for the adapted service. |
|
OidGenerator |
getOidGenerator()
Injected in constructor. |
|
PersistenceSessionFactory |
getPersistenceSessionFactory()
The PersistenceSessionFactory that created this PersistenceSession. |
|
NakedObject |
getService(java.lang.String id)
|
|
java.util.List<NakedObject> |
getServices()
|
|
ServicesInjector |
getServicesInjector()
The ServicesInjector. |
|
protected SpecificationLoader |
getSpecificationLoader()
|
|
NakedObjectTransactionManager |
getTransactionManager()
The configured NakedObjectTransactionManager. |
|
boolean |
hasServices()
Has any services. |
|
void |
injectInto(java.lang.Object candidate)
|
|
boolean |
isCheckObjectsForDirtyFlag()
|
|
protected boolean |
isImmutable(NakedObject adapter)
|
|
void |
objectChangedAllDirty()
If enabled, will mark as changed
any Dirtiable objects that have manually been marked as dirty. |
|
void |
open()
Injects components, calls doOpen(), and then creates service adapters. |
|
NakedObject |
recreateAdapter(Oid oid,
NakedObjectSpecification specification)
Returns an adapter of the type specified. |
|
NakedObject |
recreateAdapter(Oid oid,
java.lang.Object pojo)
Returns an adapter for the provided Oid, wrapping the provided domain object. |
|
protected abstract void |
registerService(java.lang.String name,
Oid oid)
Registers the specified service as having the specified OID. |
|
abstract void |
reload(NakedObject adapter)
Forces a reload of this object from the persistent object store. |
|
NakedObject |
reload(Oid oid)
|
|
void |
setDirtiableSupport(boolean checkObjectsForDirtyFlag)
Whether to notice manually-dirtied objects. |
|
void |
setSpecificationLoader(SpecificationLoader specificationLoader)
Injects the SpecificationLoader |
|
void |
setTransactionManager(NakedObjectTransactionManager transactionManager)
Inject the NakedObjectTransactionManager. |
|
void |
testReset()
For testing purposes only. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.nakedobjects.runtime.persistence.PersistenceSession |
|---|
isFixturesInstalled |
| Methods inherited from interface org.nakedobjects.runtime.persistence.PersistenceSessionContainer |
|---|
destroyObject, hasInstances, loadObject, makePersistent, objectChanged, resolveField, resolveImmediately |
| Methods inherited from interface org.nakedobjects.metamodel.commons.debug.DebugInfo |
|---|
debugTitle |
| Constructor Detail |
|---|
public PersistenceSessionAbstract(PersistenceSessionFactory persistenceSessionFactory,
AdapterFactory adapterFactory,
ObjectFactory objectFactory,
ServicesInjector servicesInjector,
OidGenerator oidGenerator,
AdapterManagerExtended identityMap)
| Method Detail |
|---|
public PersistenceSessionFactory getPersistenceSessionFactory()
PersistenceSessionPersistenceSessionFactory that created this PersistenceSession.
getPersistenceSessionFactory in interface PersistenceSessionpublic final void open()
doOpen(), and then creates service adapters.
open in interface SessionScopedComponentopen in interface PersistenceSessiondoOpen()public final void close()
doClose(), then closes all components.
close in interface SessionScopedComponentclose in interface PersistenceSessiondoClose()protected void doOpen()
protected void doOpened()
open().
protected void doClose()
protected void ensureNotOpened()
protected void ensureOpen()
public void testReset()
testReset in interface PersistenceSessionTestSupportpublic NakedObject createInstance(NakedObjectSpecification specification)
adapter.
The returned object will be initialied (had the relevant callback lifecycle methods invoked).
TODO: this is the same as RuntimeContextFromSession.createTransientInstance(NakedObjectSpecification); could it be unified?
createInstance in interface PersistenceSessionContainer
public NakedObject recreateAdapter(Oid oid,
NakedObjectSpecification specification)
PersistenceSessionHydratoradapter of the type specified.
If an adapter exists in the map then that adapter is returned immediately.
Otherwise a new domain object of the type specified is created and then an
adapter is recreated as per PersistenceSessionHydrator.recreateAdapter(Oid, Object).
Note: the similar looking method
PersistenceSessionContainer.loadObject(Oid, NakedObjectSpecification) retrieves the existing
object from the persistent store (if not available in the maps . Once the object
has been retrieved, the object store calls back to PersistenceSessionHydrator.recreateAdapter(Oid, Object) to map it.
recreateAdapter in interface PersistenceSessionHydratorPersistenceSessionHydrator.recreateAdapter(Oid, Object),
PersistenceSessionContainer.loadObject(Oid, NakedObjectSpecification)
public NakedObject recreateAdapter(Oid oid,
java.lang.Object pojo)
PersistenceSessionHydratorOid, wrapping the provided domain object.
If an adapter exists in the map for either the Oid or the domain object
then that adapter is returned immediately. Otherwise a new adapter is created using the specified
Oid and its resolved state set to either ResolveState.TRANSIENT or
ResolveState.GHOST based on whether the Oid is transient or
not.
recreateAdapter in interface PersistenceSessionHydratorpublic NakedObject reload(Oid oid)
reload in interface PersistenceSessionTransactionManagementpublic abstract void reload(NakedObject adapter)
PersistenceSessionForceReloader
reload in interface PersistenceSessionForceReloader
public <T> NakedObject findInstances(Query<T> query,
QueryCardinality cardinality)
PersistenceSessionContainer
The QueryCardinality determines whether all instances or just the first matching instance is returned.
findInstances in interface PersistenceSessionContainerpublic NakedObject findInstances(PersistenceQuery persistenceQuery)
PersistenceSessionContainerPersistenceQuery.
Compared to PersistenceSessionContainer.findInstances(Query, QueryCardinality), not that there is no
QueryCardinality parameter. That's because PersistenceQuery intrinsically
carry the knowledge as to how many rows they return.
findInstances in interface PersistenceSessionContainer
protected final PersistenceQuery createPersistenceQueryFor(Query<?> query,
QueryCardinality cardinality)
applib representation of a query into the
NOF-internal representation.
protected abstract NakedObject[] getInstances(PersistenceQuery persistenceQuery)
public boolean isCheckObjectsForDirtyFlag()
setDirtiableSupport(boolean)public void setDirtiableSupport(boolean checkObjectsForDirtyFlag)
manually-dirtied objects.
public void objectChangedAllDirty()
enabled, will mark as changed
any Dirtiable objects that have manually been marked as dirty.
objectChangedAllDirty in interface PersistenceSessionTransactionManagementpublic void clearAllDirty()
clean any Dirtiable objects.
clearAllDirty in interface PersistenceSessionTransactionManagementprotected abstract Oid getOidForService(java.lang.String name)
protected abstract void registerService(java.lang.String name,
Oid oid)
public NakedObject getService(java.lang.String id)
getService in interface PersistenceSessionAdaptedServiceManagerpublic java.util.List<NakedObject> getServices()
getServices in interface PersistenceSessionAdaptedServiceManagerpublic boolean hasServices()
protected boolean isImmutable(NakedObject adapter)
public void injectInto(java.lang.Object candidate)
injectInto in interface Injectablepublic void debugData(DebugString debug)
debugData in interface DebugInfopublic final AdapterFactory getAdapterFactory()
getAdapterFactory in interface PersistenceSessionpublic final OidGenerator getOidGenerator()
getOidGenerator in interface PersistenceSessionpublic final AdapterManagerExtended getAdapterManager()
getAdapterManager in interface PersistenceSessionpublic ServicesInjector getServicesInjector()
ServicesInjector.
getServicesInjector in interface PersistenceSessionpublic ObjectFactory getObjectFactory()
getObjectFactory in interface PersistenceSessionprotected SpecificationLoader getSpecificationLoader()
public void setSpecificationLoader(SpecificationLoader specificationLoader)
SpecificationLoader
setSpecificationLoader in interface SpecificationLoaderAwaresetSpecificationLoader in interface PersistenceSessionpublic void setTransactionManager(NakedObjectTransactionManager transactionManager)
PersistenceSessionNakedObjectTransactionManager.
This must be injected using setter-based injection rather than through the constructor
because there is a bidirectional relationship between the PersistenceSessionHydrator
and the NakedObjectTransactionManager.
setTransactionManager in interface PersistenceSessionsetTransactionManager in interface NakedObjectTransactionManagerAwarePersistenceSession.getTransactionManager()public NakedObjectTransactionManager getTransactionManager()
PersistenceSessionNakedObjectTransactionManager.
getTransactionManager in interface PersistenceSessionPersistenceSession.setTransactionManager(NakedObjectTransactionManager)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||