org.ehcache.spi.persistence
Interface PersistableResourceService

All Superinterfaces:
MaintainableService, Service

public interface PersistableResourceService
extends MaintainableService

Interface for Services that handle a ResourceType which is persistable.


Nested Class Summary
static interface PersistableResourceService.PersistenceSpaceIdentifier<T extends PersistableResourceService>
          An identifier for an existing persistable resource.
 
Method Summary
 void destroy(java.lang.String name)
          Destroys the persistence space with the given name.
 void destroyAll()
          Destroys all persistence spaces.
 PersistableResourceService.PersistenceSpaceIdentifier<?> getPersistenceSpaceIdentifier(java.lang.String name, CacheConfiguration<?,?> config)
          Returns a PersistableResourceService.PersistenceSpaceIdentifier for the space associated to the provided arguments.
 StateRepository getStateRepositoryWithin(PersistableResourceService.PersistenceSpaceIdentifier<?> identifier, java.lang.String name)
          Returns a named state repository in the context of the given identifier.
 boolean handlesResourceType(ResourceType<?> resourceType)
          Returns true if this service handles the given resource type.
 void releasePersistenceSpaceIdentifier(PersistableResourceService.PersistenceSpaceIdentifier<?> identifier)
          Releases a previously obtained PersistableResourceService.PersistenceSpaceIdentifier.
 
Methods inherited from interface org.ehcache.spi.service.MaintainableService
startForMaintenance
 
Methods inherited from interface org.ehcache.spi.service.Service
start, stop
 

Method Detail

handlesResourceType

boolean handlesResourceType(ResourceType<?> resourceType)
Returns true if this service handles the given resource type.

Parameters:
resourceType - the resource type to check
Returns:
true if this service handles the resource type

getPersistenceSpaceIdentifier

PersistableResourceService.PersistenceSpaceIdentifier<?> getPersistenceSpaceIdentifier(java.lang.String name,
                                                                                       CacheConfiguration<?,?> config)
                                                                                       throws CachePersistenceException
Returns a PersistableResourceService.PersistenceSpaceIdentifier for the space associated to the provided arguments.

This method may create a new persistence space or load one. The returned identifier is the only way to interact with the persistence space.

Parameters:
name - the name of the persistence context
config - the configuration for the associated cache
Returns:
an identifier for the persistence space
Throws:
CachePersistenceException - if the persistence space cannot be created
See Also:
getStateRepositoryWithin(PersistenceSpaceIdentifier, String)

releasePersistenceSpaceIdentifier

void releasePersistenceSpaceIdentifier(PersistableResourceService.PersistenceSpaceIdentifier<?> identifier)
                                       throws CachePersistenceException
Releases a previously obtained PersistableResourceService.PersistenceSpaceIdentifier.

This indicates to the persistence space that resource linked to the given identifier are no longer needed and thus enables cleaning up any transient state left.

Parameters:
identifier - the PersistenceSpaceIdentifier to release
Throws:
CachePersistenceException - If the identifier is not known

getStateRepositoryWithin

StateRepository getStateRepositoryWithin(PersistableResourceService.PersistenceSpaceIdentifier<?> identifier,
                                         java.lang.String name)
                                         throws CachePersistenceException
Returns a named state repository in the context of the given identifier.

If the StateRepository already existed, this method returns it in a fully available state.

Parameters:
identifier - the space identifier
name - the state repository name
Returns:
a StateRepository
Throws:
CachePersistenceException - if the StateRepository cannot be created or recovered.

destroy

void destroy(java.lang.String name)
             throws CachePersistenceException
Destroys the persistence space with the given name.

This method can be called without having created the persistence space from this JVM.

Parameters:
name - persistence context name
Throws:
CachePersistenceException - if the persistence space cannot be destroyed

destroyAll

void destroyAll()
                throws CachePersistenceException
Destroys all persistence spaces.

Note that this method can be called without having created the persistence spaces from this JVM.

Throws:
CachePersistenceException - if the persistence storage cannot be destroyed