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


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.ehcache.spi.service.LocalPersistenceService
LocalPersistenceService.PersistenceSpaceIdentifier
 
Constructor Summary
DefaultLocalPersistenceService(PersistenceConfiguration persistenceConfiguration)
           
 
Method Summary
 FileBasedPersistenceContext createPersistenceContextWithin(LocalPersistenceService.PersistenceSpaceIdentifier space, java.lang.String name)
          Creates a new persistence context within the given space.
 void destroyAllPersistenceSpaces()
          Destroys all persistence spaces Note that this method can be called without creating the persistence space beforehand in the same JVM.
 void destroyPersistenceSpace(java.lang.String name)
          Destroys the persistence space with the given name.
 java.io.File getDirectoryFor(java.lang.String identifier)
           
 LocalPersistenceService.PersistenceSpaceIdentifier getOrCreatePersistenceSpace(java.lang.String name)
          Retrieves an existing or creates a new persistence space
 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

getOrCreatePersistenceSpace

public LocalPersistenceService.PersistenceSpaceIdentifier getOrCreatePersistenceSpace(java.lang.String name)
                                                                               throws CachePersistenceException
Description copied from interface: LocalPersistenceService
Retrieves an existing or creates a new persistence space

Specified by:
getOrCreatePersistenceSpace in interface LocalPersistenceService
Parameters:
name - the name to be used for the persistence space
Returns:
a LocalPersistenceService.PersistenceSpaceIdentifier
Throws:
CachePersistenceException - if the persistence space cannot be created

destroyPersistenceSpace

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

Specified by:
destroyPersistenceSpace in interface LocalPersistenceService
Parameters:
name - the name of the persistence context
Throws:
CachePersistenceException - if the persistence space cannot be destroyed

destroyAllPersistenceSpaces

public void destroyAllPersistenceSpaces()
Description copied from interface: LocalPersistenceService
Destroys all persistence spaces Note that this method can be called without creating the persistence space 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:
destroyAllPersistenceSpaces in interface LocalPersistenceService

createPersistenceContextWithin

public FileBasedPersistenceContext createPersistenceContextWithin(LocalPersistenceService.PersistenceSpaceIdentifier space,
                                                                  java.lang.String name)
                                                           throws CachePersistenceException
Description copied from interface: LocalPersistenceService
Creates a new persistence context within the given space.

Specified by:
createPersistenceContextWithin in interface LocalPersistenceService
Parameters:
space - space to create within
name - name of the context to create
Returns:
a FileBasedPersistenceContext
Throws:
CachePersistenceException

getDirectoryFor

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