org.springframework.extensions.surf.persister
Class AbstractObjectPersister

java.lang.Object
  extended by org.springframework.extensions.surf.persister.AbstractObjectPersister
All Implemented Interfaces:
org.springframework.beans.factory.BeanNameAware, ModelObjectPersister
Direct Known Subclasses:
AbstractCachedObjectPersister, MultiObjectPersister

public abstract class AbstractObjectPersister
extends Object
implements ModelObjectPersister, org.springframework.beans.factory.BeanNameAware

Abstract implementation of a model object persister. Provided to enable ease-of-extension by developers for customer object persisters. This class serves as a foundation and really only provides essential helper functions. Surf provides persister implementations that are largely file-based. Customizations may seek to incorporate persisters that interact with databases or Alfresco content models directly.

Author:
muzquiano, kevinr
See Also:
StoreObjectPersister, CachedStoreObjectPersister

Field Summary
protected static Class[] MODELOBJECT_CLASSES
           
 
Constructor Summary
AbstractObjectPersister()
           
 
Method Summary
protected  void disable()
          Disables the persister
 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
 WebFrameworkServiceRegistry getServiceRegistry()
          Gets the service registry.
protected  WebFrameworkConfigElement getWebFrameworkConfiguration()
          Gets the configuration.
protected  WebFrameworkManager getWebFrameworkManager()
          Gets the web framework manager.
 boolean hasObject(ModelPersistenceContext context, ModelObject object)
          Checks whether the given object is persisted
 void init(ModelPersistenceContext context)
          Initializes the persister by preloading the object cache
 boolean isEnabled()
          Indicates whether this persisted is currently enabled.
 boolean removeObject(ModelPersistenceContext context, ModelObject object)
          Removes an object from persisted storage
 void reset()
          Resets the persister, clearing cache and starting anew.
 void setBeanName(String name)
           
 void setServiceRegistry(WebFrameworkServiceRegistry serviceRegistry)
          Sets the web framework service registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.extensions.surf.ModelObjectPersister
getAllObjects, getAllObjectsByFilter, getObject, getTimestamp, hasObject, newObject, removeObject, saveObject
 

Field Detail

MODELOBJECT_CLASSES

protected static final Class[] MODELOBJECT_CLASSES
Constructor Detail

AbstractObjectPersister

public AbstractObjectPersister()
Method Detail

setBeanName

public void setBeanName(String name)
Specified by:
setBeanName in interface org.springframework.beans.factory.BeanNameAware

setServiceRegistry

public void setServiceRegistry(WebFrameworkServiceRegistry serviceRegistry)
Sets the web framework service registry.

Parameters:
serviceRegistry - the service registry

getServiceRegistry

public WebFrameworkServiceRegistry getServiceRegistry()
Gets the service registry.

Returns:
the service registry

getWebFrameworkConfiguration

protected WebFrameworkConfigElement getWebFrameworkConfiguration()
Gets the configuration.

Returns:
the configuration

getWebFrameworkManager

protected WebFrameworkManager getWebFrameworkManager()
Gets the web framework manager.

Returns:
the web framework manager

init

public void init(ModelPersistenceContext context)
Description copied from interface: ModelObjectPersister
Initializes the persister by preloading the object cache

Specified by:
init in interface ModelObjectPersister
Parameters:
context - the persistence context

reset

public void reset()
Description copied from interface: ModelObjectPersister
Resets the persister, clearing cache and starting anew.

Specified by:
reset in interface ModelObjectPersister

removeObject

public boolean removeObject(ModelPersistenceContext context,
                            ModelObject object)
                     throws ModelObjectPersisterException
Description copied from interface: ModelObjectPersister
Removes an object from persisted storage

Specified by:
removeObject in interface ModelObjectPersister
Returns:
whether the object was removed
Throws:
ModelObjectPersisterException

hasObject

public boolean hasObject(ModelPersistenceContext context,
                         ModelObject object)
                  throws ModelObjectPersisterException
Description copied from interface: ModelObjectPersister
Checks whether the given object is persisted

Specified by:
hasObject in interface ModelObjectPersister
Returns:
whether the object is persisted
Throws:
ModelObjectPersisterException

getId

public String getId()
Description copied from interface: ModelObjectPersister
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

Specified by:
getId in interface ModelObjectPersister
Returns:

isEnabled

public boolean isEnabled()
Description copied from interface: ModelObjectPersister
Indicates whether this persisted is currently enabled. Disabled persisters continue to work but do not modify data.

Specified by:
isEnabled in interface ModelObjectPersister
Returns:
flag

disable

protected void disable()
Disables the persister



Copyright © 2009 SpringSource, Inc. All Rights Reserved.