|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.extensions.surf.persister.AbstractObjectPersister org.springframework.extensions.surf.persister.AbstractCachedObjectPersister org.springframework.extensions.surf.persister.ReadOnlyStoreObjectPersister org.springframework.extensions.surf.persister.StoreObjectPersister
public class StoreObjectPersister
Provides a real-time implementation of a persister on top of a Web Script Framework store. Unlike the read-only implementation, this implementation does not look to the cache as a "master copy" of the data. Rather, the "master copy" is considered to be the store itself. Any interactions with persisted content or its state are delegated to the store itself. The cache is only utilized for performance benefits. Since stores are based on file-path semantics, this persister must make assumptions on how to map ids to to file-paths in order to allow for lazy referencing and lazy loading of objects. The id to file-path and file-path to id conversion methods are split out so that they can be adjusted in inheriting implementations. In addition, path prefixes are empowered to utilize token replacement for object type ids and object ids.
Field Summary |
---|
Fields inherited from class org.springframework.extensions.surf.persister.ReadOnlyStoreObjectPersister |
---|
pathPrefix, store |
Fields inherited from class org.springframework.extensions.surf.persister.AbstractCachedObjectPersister |
---|
cacheDelay, caches, GLOBAL_STORE_ID, useCache |
Fields inherited from class org.springframework.extensions.surf.persister.AbstractObjectPersister |
---|
MODELOBJECT_CLASSES |
Constructor Summary | |
---|---|
StoreObjectPersister()
Instantiates a new store model object persister. |
Method Summary | |
---|---|
protected BasicCache<ModelObject> |
createCache()
Creates the cache. |
protected String |
generatePath(String objectTypeId,
String objectId)
Generates a persistence path for a given object id and object type id. |
Map<String,ModelObject> |
getAllObjects(ModelPersistenceContext context,
String objectTypeId)
Returns a map of all of the objects referenced by this persister. |
Map<String,ModelObject> |
getAllObjectsByFilter(ModelPersistenceContext context,
String objectTypeId,
String objectIdFilter)
Returns a map of all of the objects referenced by this persister filtered by the given ID filter. |
ModelObject |
getObject(ModelPersistenceContext context,
String objectTypeId,
String objectId)
Gets an object from persisted storage by id |
protected Map<String,ModelObject> |
getObjectsFromPaths(ModelPersistenceContext context,
String objectTypeId,
String[] docPaths)
|
String |
getPathPrefix(String objectTypeId,
String objectId)
Gets the path prefix for the given token replacements. |
long |
getTimestamp(ModelPersistenceContext context,
String objectTypeId,
String objectId)
Returns the timestamp of the given object in the underlying store |
boolean |
hasObject(ModelPersistenceContext context,
String objectTypeId,
String objectId)
Checks whether an object with the given path is persisted |
boolean |
removeObject(ModelPersistenceContext context,
String objectTypeId,
String objectId)
Removes an object from persisted storage |
boolean |
saveObject(ModelPersistenceContext context,
ModelObject modelObject)
Saves an object to persisted storage |
Methods inherited from class org.springframework.extensions.surf.persister.ReadOnlyStoreObjectPersister |
---|
createObject, getObjectByPath, getObjectId, getObjectTypeId, getPathPrefix, init, isModelObject, loadObjectsAndDependents, newObject, reset, setCache, setCacheCheckDelay, setPathPrefix, setStore |
Methods inherited from class org.springframework.extensions.surf.persister.AbstractCachedObjectPersister |
---|
cacheGet, cachePut, cacheRemove, getCache, invalidateCache |
Methods inherited from class org.springframework.extensions.surf.persister.AbstractObjectPersister |
---|
disable, getId, getServiceRegistry, getWebFrameworkConfiguration, getWebFrameworkManager, hasObject, isEnabled, removeObject, setBeanName, setServiceRegistry |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StoreObjectPersister()
Method Detail |
---|
protected String generatePath(String objectTypeId, String objectId)
ReadOnlyStoreObjectPersister
This method should never return a null value.
generatePath
in class ReadOnlyStoreObjectPersister
objectTypeId
- the object type idobjectId
- the object id
public String getPathPrefix(String objectTypeId, String objectId)
objectTypeId
- the object type idobjectId
- the object id
public boolean saveObject(ModelPersistenceContext context, ModelObject modelObject) throws ModelObjectPersisterException
ModelObjectPersister
saveObject
in interface ModelObjectPersister
saveObject
in class ReadOnlyStoreObjectPersister
ModelObjectPersisterException
public ModelObject getObject(ModelPersistenceContext context, String objectTypeId, String objectId) throws ModelObjectPersisterException
ModelObjectPersister
getObject
in interface ModelObjectPersister
getObject
in class ReadOnlyStoreObjectPersister
ModelObjectPersisterException
public boolean removeObject(ModelPersistenceContext context, String objectTypeId, String objectId) throws ModelObjectPersisterException
ModelObjectPersister
removeObject
in interface ModelObjectPersister
removeObject
in class ReadOnlyStoreObjectPersister
ModelObjectPersisterException
public boolean hasObject(ModelPersistenceContext context, String objectTypeId, String objectId) throws ModelObjectPersisterException
ModelObjectPersister
hasObject
in interface ModelObjectPersister
hasObject
in class ReadOnlyStoreObjectPersister
ModelObjectPersisterException
public long getTimestamp(ModelPersistenceContext context, String objectTypeId, String objectId) throws ModelObjectPersisterException
ModelObjectPersister
getTimestamp
in interface ModelObjectPersister
getTimestamp
in class ReadOnlyStoreObjectPersister
ModelObjectPersisterException
public Map<String,ModelObject> getAllObjects(ModelPersistenceContext context, String objectTypeId) throws ModelObjectPersisterException
ModelObjectPersister
In general, this is a very expensive call and should be avoided. Each object descriptor referenced by the persister is loaded into the model object cache.
getAllObjects
in interface ModelObjectPersister
getAllObjects
in class ReadOnlyStoreObjectPersister
ModelObjectPersisterException
public Map<String,ModelObject> getAllObjectsByFilter(ModelPersistenceContext context, String objectTypeId, String objectIdFilter) throws ModelObjectPersisterException
ModelObjectPersister
In general, this is an expensive call but less expensive than getAllObjects(). Each object descriptor referenced by the persister found using the filter is loaded into the model object cache.
getAllObjectsByFilter
in interface ModelObjectPersister
getAllObjectsByFilter
in class ReadOnlyStoreObjectPersister
ModelObjectPersisterException
protected Map<String,ModelObject> getObjectsFromPaths(ModelPersistenceContext context, String objectTypeId, String[] docPaths) throws ModelObjectPersisterException
context
- ModelPersistenceContextobjectTypeId
- object type iddocPaths
- Array of document paths
ModelObjectPersisterException
protected BasicCache<ModelObject> createCache()
AbstractCachedObjectPersister
createCache
in class ReadOnlyStoreObjectPersister
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |