org.springframework.extensions.surf
Interface ModelObjectPersister

All Known Implementing Classes:
AbstractCachedObjectPersister, AbstractObjectPersister, MultiObjectPersister, ReadOnlyStoreObjectPersister, StoreObjectPersister

public interface ModelObjectPersister

Author:
muzquiano

Method Summary
 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 objectIdPattern)
          Returns a map of all of the objects referenced by this persister filtered by the given ID filter.
 String getId()
          Returns a unique id for this persister If this persister is wrapped around a ClassPath store, a LocalFileSystem store or a Repository store, this will return the value provided getBasePath() If this is wrapped around a RemoteStore, this will return the AVM Store ID to which this persister is bound
 ModelObject getObject(ModelPersistenceContext context, String objectTypeId, String objectId)
          Gets an object from persisted storage by id
 long getTimestamp(ModelPersistenceContext context, String objectTypeId, String objectId)
          Returns the timestamp of the given object in the underlying store
 boolean hasObject(ModelPersistenceContext context, ModelObject object)
          Checks whether the given object is persisted
 boolean hasObject(ModelPersistenceContext context, String objectTypeId, String objectId)
          Checks whether an object with the given path is persisted
 void init(ModelPersistenceContext context)
          Initializes the persister by preloading the object cache
 boolean isEnabled()
          Indicates whether this persisted is currently enabled.
 ModelObject newObject(ModelPersistenceContext context, String objectTypeId, String objectId)
          Creates a new object
 boolean removeObject(ModelPersistenceContext context, ModelObject object)
          Removes an object from persisted storage
 boolean removeObject(ModelPersistenceContext context, String objectTypeId, String objectId)
          Removes an object from persisted storage
 void reset()
          Resets the persister, clearing cache and starting anew.
 boolean saveObject(ModelPersistenceContext context, ModelObject object)
          Saves an object to persisted storage
 

Method Detail

init

void init(ModelPersistenceContext context)
Initializes the persister by preloading the object cache

Parameters:
context - the persistence context

reset

void reset()
Resets the persister, clearing cache and starting anew.


getId

String getId()
Returns a unique id for this persister If this persister is wrapped around a ClassPath store, a LocalFileSystem store or a Repository store, this will return the value provided getBasePath() If this is wrapped around a RemoteStore, this will return the AVM Store ID to which this persister is bound

Returns:

getObject

ModelObject getObject(ModelPersistenceContext context,
                      String objectTypeId,
                      String objectId)
                      throws ModelObjectPersisterException
Gets an object from persisted storage by id

Parameters:
context -
objectTypeId -
objectId -
Returns:
object instance
Throws:
ModelObjectPersisterException

saveObject

boolean saveObject(ModelPersistenceContext context,
                   ModelObject object)
                   throws ModelObjectPersisterException
Saves an object to persisted storage

Parameters:
context -
object -
Returns:
whether the object was saved
Throws:
ModelObjectPersisterException

removeObject

boolean removeObject(ModelPersistenceContext context,
                     ModelObject object)
                     throws ModelObjectPersisterException
Removes an object from persisted storage

Parameters:
context -
object -
Returns:
whether the object was removed
Throws:
ModelObjectPersisterException

removeObject

boolean removeObject(ModelPersistenceContext context,
                     String objectTypeId,
                     String objectId)
                     throws ModelObjectPersisterException
Removes an object from persisted storage

Parameters:
context -
objectTypeId -
objectId -
Returns:
whether the object was removed
Throws:
ModelObjectPersisterException

hasObject

boolean hasObject(ModelPersistenceContext context,
                  ModelObject object)
                  throws ModelObjectPersisterException
Checks whether the given object is persisted

Parameters:
context -
object -
Returns:
whether the object is persisted
Throws:
ModelObjectPersisterException

hasObject

boolean hasObject(ModelPersistenceContext context,
                  String objectTypeId,
                  String objectId)
                  throws ModelObjectPersisterException
Checks whether an object with the given path is persisted

Parameters:
context -
objectTypeId -
objectId -
Returns:
whether the object is persisted
Throws:
ModelObjectPersisterException

newObject

ModelObject newObject(ModelPersistenceContext context,
                      String objectTypeId,
                      String objectId)
                      throws ModelObjectPersisterException
Creates a new object

Parameters:
context -
objectTypeId -
objectId -
Returns:
the object
Throws:
ModelObjectPersisterException

getAllObjects

Map<String,ModelObject> getAllObjects(ModelPersistenceContext context,
                                      String objectTypeId)
                                      throws ModelObjectPersisterException
Returns a map of all of the objects referenced by this persister.

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.

Parameters:
context -
objectTypeId -
Returns:
Map of object IDs to ModelObject instances
Throws:
ModelObjectException
ModelObjectPersisterException

getAllObjectsByFilter

Map<String,ModelObject> getAllObjectsByFilter(ModelPersistenceContext context,
                                              String objectTypeId,
                                              String objectIdPattern)
                                              throws ModelObjectPersisterException
Returns a map of all of the objects referenced by this persister filtered by the given ID filter.

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.

Parameters:
context -
objectTypeId -
objectIdPattern -
Returns:
Map of object IDs to ModelObject instances
Throws:
ModelObjectException
ModelObjectPersisterException

getTimestamp

long getTimestamp(ModelPersistenceContext context,
                  String objectTypeId,
                  String objectId)
                  throws ModelObjectPersisterException
Returns the timestamp of the given object in the underlying store

Parameters:
context -
objectTypeId -
objectId -
Returns:
Throws:
ModelObjectPersisterException

isEnabled

boolean isEnabled()
Indicates whether this persisted is currently enabled. Disabled persisters continue to work but do not modify data.

Returns:
flag


Copyright © 2009 SpringSource, Inc. All Rights Reserved.