org.ehcache.clustered.client.service
Interface ClientEntityFactory<E extends org.terracotta.connection.entity.Entity,C>


public interface ClientEntityFactory<E extends org.terracotta.connection.entity.Entity,C>

Factory used to create, fetch and destroy server entities.

Such factory is created with EntityService.newClientEntityFactory(String, Class, long, Object)


Method Summary
 void create()
          Creates the entity and validate that it can be effectively fetched
 void destroy()
          Destroy the entity matching the factory entity identifier and type
 C getConfiguration()
           
 java.lang.String getEntityIdentifier()
           
 java.lang.Class<E> getEntityType()
           
 long getEntityVersion()
           
 E retrieve()
           
 

Method Detail

getEntityIdentifier

java.lang.String getEntityIdentifier()
Returns:
The server entity name set by this factory

getEntityType

java.lang.Class<E> getEntityType()
Returns:
The entity type created by this factory

getEntityVersion

long getEntityVersion()
Returns:
The entity version

getConfiguration

C getConfiguration()
Returns:
The optional configuration object passed to the factory for entity creation, or null

create

void create()
            throws org.terracotta.exception.EntityAlreadyExistsException
Creates the entity and validate that it can be effectively fetched

Throws:
org.terracotta.exception.EntityAlreadyExistsException - If the entity has already been created

retrieve

E retrieve()
                                                           throws org.terracotta.exception.EntityNotFoundException
Returns:
The created entity matching the type and identifier of this factory
Throws:
org.terracotta.exception.EntityNotFoundException - If the entity has not been created yet

destroy

void destroy()
             throws org.terracotta.exception.EntityNotFoundException,
                    EntityBusyException
Destroy the entity matching the factory entity identifier and type

Throws:
org.terracotta.exception.EntityNotFoundException - If the entity does not exist on the server
EntityBusyException - If the entity is used and thus cannot be destroyed