org.ehcache.internal.persistence
Class DefaultLocalPersistenceService

java.lang.Object
  extended by org.ehcache.internal.persistence.DefaultLocalPersistenceService
All Implemented Interfaces:
LocalPersistenceService, Service

public class DefaultLocalPersistenceService
extends java.lang.Object
implements LocalPersistenceService


Constructor Summary
DefaultLocalPersistenceService(PersistenceConfiguration persistenceConfiguration)
           
 
Method Summary
 FileBasedPersistenceContext createPersistenceContext(java.lang.Object identifier, Store.PersistentStoreConfiguration<?,?,?> storeConfiguration)
          Creates a new persistence context
 void destroyAllPersistenceContext()
          Destroys all persistence context Note that this method can be called without creating the persistence context beforehand in the same JVM.
 void destroyPersistenceContext(java.lang.Object identifier)
          Destroys the persistence context with the given identifier.
 java.io.File getDirectoryFor(java.lang.String identifier)
           
 void start(ServiceProvider serviceProvider)
          Start this service using the provided configuration and ServiceProvider.
 void stop()
          Stops this service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLocalPersistenceService

public DefaultLocalPersistenceService(PersistenceConfiguration persistenceConfiguration)
Method Detail

start

public void start(ServiceProvider serviceProvider)
Description copied from interface: Service
Start this service using the provided configuration and ServiceProvider.

The goal of the service provider is to allow a service to use other services.

Specified by:
start in interface Service
Parameters:
serviceProvider - the service provider.

stop

public void stop()
Description copied from interface: Service
Stops this service.

Specified by:
stop in interface Service

createPersistenceContext

public FileBasedPersistenceContext createPersistenceContext(java.lang.Object identifier,
                                                            Store.PersistentStoreConfiguration<?,?,?> storeConfiguration)
                                                     throws CachePersistenceException
Description copied from interface: LocalPersistenceService
Creates a new persistence context

Specified by:
createPersistenceContext in interface LocalPersistenceService
Parameters:
identifier - the identifier to be used for the persistence context
storeConfiguration - the configuration of the Store that will use the persistence context
Returns:
a FileBasedPersistenceContext
Throws:
CachePersistenceException - if the persistence context cannot be created

destroyPersistenceContext

public void destroyPersistenceContext(java.lang.Object identifier)
                               throws CachePersistenceException
Description copied from interface: LocalPersistenceService
Destroys the persistence context with the given identifier. Note that this method can be called without creating the persistence context beforehand in the same JVM. It will nonetheless try to delete any persistent data that could have been associated with the identifier.

Specified by:
destroyPersistenceContext in interface LocalPersistenceService
Parameters:
identifier - the identifier of the persistence context
Throws:
CachePersistenceException - if the persistence context cannot be destroyed

destroyAllPersistenceContext

public void destroyAllPersistenceContext()
Description copied from interface: LocalPersistenceService
Destroys all persistence context Note that this method can be called without creating the persistence context beforehand in the same JVM. It will nonetheless try to delete any persistent data associated with the root directory provided in the service.

Specified by:
destroyAllPersistenceContext in interface LocalPersistenceService

getDirectoryFor

public java.io.File getDirectoryFor(java.lang.String identifier)