|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nakedobjects.metamodel.commons.logging.Logger
org.nakedobjects.runtime.persistence.PersistenceSessionLogger
public class PersistenceSessionLogger
| Constructor Summary | |
|---|---|
PersistenceSessionLogger(PersistenceSession decorated)
|
|
PersistenceSessionLogger(PersistenceSession decorated,
java.lang.String logFileName)
|
|
| Method Summary | |
|---|---|
void |
clearAllDirty()
|
void |
close()
|
NakedObject |
createInstance(NakedObjectSpecification specification)
Creates a new instance of the specified type and returns it in an adapter whose resolved state set to ResolveState.TRANSIENT (except if the type is marked as aggregated
in which case it will be set to ResolveState.VALUE). |
void |
debugData(DebugString debug)
|
java.lang.String |
debugTitle()
|
void |
destroyObject(NakedObject object)
|
NakedObject |
findInstances(PersistenceQuery criteria)
Finds and returns instances that match the specified PersistenceQuery. |
NakedObject |
findInstances(Query query,
QueryCardinality cardinality)
Finds and returns instances that match the specified query. |
AdapterFactory |
getAdapterFactory()
The configured AdapterFactory. |
AdapterManager |
getAdapterManager()
The configured AdapterManager. |
protected java.lang.Class<?> |
getDecoratedClass()
|
ObjectFactory |
getObjectFactory()
The configured ObjectFactory. |
OidGenerator |
getOidGenerator()
The configured OidGenerator. |
PersistenceSessionFactory |
getPersistenceSessionFactory()
The PersistenceSessionFactory that created this PersistenceSession. |
NakedObject |
getService(java.lang.String id)
|
java.util.List<NakedObject> |
getServices()
|
ServicesInjector |
getServicesInjector()
The configured ServicesInjector. |
NakedObjectTransactionManager |
getTransactionManager()
The configured NakedObjectTransactionManager. |
boolean |
hasInstances(NakedObjectSpecification specification)
Whether there are any instances of the specified type. |
void |
injectInto(java.lang.Object candidate)
|
boolean |
isFixturesInstalled()
Determine if the object store has been initialized with its set of start up objects. |
NakedObject |
loadObject(Oid oid,
NakedObjectSpecification hint)
Loads the object identified by the specified Oid from the persisted
set of objects. |
void |
makePersistent(NakedObject object)
Makes a naked object persistent. |
void |
objectChanged(NakedObject object)
Mark the NakedObject as changed, and therefore requiring flushing
to the persistence mechanism. |
void |
objectChangedAllDirty()
Mark as changed all Dirtiable
objects that have been manually marked
as dirty. |
void |
open()
|
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. |
void |
reload(NakedObject object)
Forces a reload of this object from the persistent object store. |
NakedObject |
reload(Oid oid)
|
void |
resolveField(NakedObject object,
NakedObjectAssociation field)
Hint that specified field within the specified object is likely to be needed soon. |
void |
resolveImmediately(NakedObject object)
Re-initialises the fields of an object. |
void |
setSpecificationLoader(SpecificationLoader specificationLoader)
Inject the SpecificationLoader. |
void |
setTransactionManager(NakedObjectTransactionManager transactionManager)
Inject the NakedObjectTransactionManager. |
void |
testReset()
Only for testing purposes. |
| Methods inherited from class org.nakedobjects.metamodel.commons.logging.Logger |
|---|
isLogToFile, isLogToLog4j, log, log, setFileName, setLogAlso, setShowTime, setTimeFormat |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PersistenceSessionLogger(PersistenceSession decorated,
java.lang.String logFileName)
public PersistenceSessionLogger(PersistenceSession decorated)
| Method Detail |
|---|
public void destroyObject(NakedObject object)
destroyObject in interface PersistenceSessionContainer
public NakedObject findInstances(Query query,
QueryCardinality cardinality)
throws UnsupportedFindException
PersistenceSessionContainer
The QueryCardinality determines whether all instances or just the first matching instance is returned.
findInstances in interface PersistenceSessionContainerUnsupportedFindException - if the criteria is not support by this persistorpublic NakedObject findInstances(PersistenceQuery criteria)
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 PersistenceSessionContainerpublic void debugData(DebugString debug)
debugData in interface DebugInfopublic java.lang.String debugTitle()
debugTitle in interface DebugInfoprotected java.lang.Class<?> getDecoratedClass()
getDecoratedClass in class Logger
public NakedObject loadObject(Oid oid,
NakedObjectSpecification hint)
throws ObjectNotFoundException
PersistenceSessionContainerOid from the persisted
set of objects.
As used primarily by ServerDistribution.
loadObject in interface PersistenceSessionContainerObjectNotFoundExceptionpublic boolean hasInstances(NakedObjectSpecification specification)
PersistenceSessionContainertype.
Used (ostensibly) by client-side code.
hasInstances in interface PersistenceSessionContainerpublic boolean isFixturesInstalled()
PersistenceSession
This method is called only once after the ApplicationScopedComponent.init() has been called. If this flag
returns false the framework will run the fixtures to initialise the persistor.
isFixturesInstalled in interface PersistenceSessionpublic void open()
open in interface SessionScopedComponentopen in interface PersistenceSessionpublic void close()
close in interface SessionScopedComponentclose in interface PersistenceSessionclose in class Loggerpublic void makePersistent(NakedObject object)
PersistenceSessionContainersetOid method). The object, should also be added to the cache 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 PersistenceSessionContainerpublic void objectChanged(NakedObject object)
PersistenceSessionContainerNakedObject as changed, and therefore requiring flushing
to the persistence mechanism.
objectChanged in interface PersistenceSessionContainerpublic void reload(NakedObject object)
PersistenceSessionForceReloader
reload in interface PersistenceSessionForceReloaderpublic void testReset()
PersistenceSessionTestSupport
testReset in interface PersistenceSessionTestSupportpublic void resolveImmediately(NakedObject object)
PersistenceSessionContainer
resolveImmediately in interface PersistenceSessionContainer
public void resolveField(NakedObject object,
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 objectChangedAllDirty()
PersistenceSessionTransactionManagementchanged all Dirtiable
objects that have been manually marked
as dirty.
Called by the NakedObjectTransactionManager.
objectChangedAllDirty in interface PersistenceSessionTransactionManagementpublic NakedObject getService(java.lang.String id)
getService in interface PersistenceSessionAdaptedServiceManagerpublic java.util.List<NakedObject> getServices()
getServices in interface PersistenceSessionAdaptedServiceManagerpublic NakedObject createInstance(NakedObjectSpecification specification)
PersistenceSessionContainerResolveState.TRANSIENT (except if the type is marked as aggregated
in which case it will be set to ResolveState.VALUE).
REVIEW: not sure about ResolveState.VALUE - see comments in
#adapterFor(Object, Oid, Version).
While creating the object the it will be initialised with default values and its created
lifecycle method (its logical constructor) will be invoked. Contrast this with
#recreateTransientInstance(Oid, NakedObjectSpecification).
This method is ultimately delegated to by the DomainObjectContainer.
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 void setSpecificationLoader(SpecificationLoader specificationLoader)
PersistenceSessionSpecificationLoader.
The need to inject the reflector was introduced to support the HibernateObjectStore, which installs its own HibernateClassStrategy to cope with the proxy classes that Hibernate wraps around lists, sets and maps.
setSpecificationLoader in interface SpecificationLoaderAwaresetSpecificationLoader in interface PersistenceSessionpublic OidGenerator getOidGenerator()
PersistenceSessionOidGenerator.
getOidGenerator in interface PersistenceSessionpublic AdapterFactory getAdapterFactory()
PersistenceSessionAdapterFactory.
getAdapterFactory in interface PersistenceSessionpublic PersistenceSessionFactory getPersistenceSessionFactory()
PersistenceSessionPersistenceSessionFactory that created this PersistenceSession.
getPersistenceSessionFactory in interface PersistenceSessionpublic ServicesInjector getServicesInjector()
PersistenceSessionServicesInjector.
getServicesInjector in interface PersistenceSessionpublic NakedObjectTransactionManager getTransactionManager()
PersistenceSessionNakedObjectTransactionManager.
getTransactionManager in interface PersistenceSessionPersistenceSession.setTransactionManager(NakedObjectTransactionManager)public 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 ObjectFactory getObjectFactory()
PersistenceSessionObjectFactory.
getObjectFactory in interface PersistenceSessionpublic void clearAllDirty()
clearAllDirty in interface PersistenceSessionTransactionManagementpublic NakedObject reload(Oid oid)
reload in interface PersistenceSessionTransactionManagementpublic AdapterManager getAdapterManager()
PersistenceSessionAdapterManager.
getAdapterManager in interface PersistenceSession
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 void injectInto(java.lang.Object candidate)
injectInto in interface Injectable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||