org.qi4j.entitystore.map
Class MapEntityStoreMixin

java.lang.Object
  extended by org.qi4j.entitystore.map.MapEntityStoreMixin
All Implemented Interfaces:
Activatable, StateStore, EntityStore, EntityStoreSPI

public class MapEntityStoreMixin
extends Object
implements EntityStore, EntityStoreSPI, StateStore, Activatable

Implementation of EntityStore that works with an implementation of MapEntityStore. Implement MapEntityStore and add as mixin to the service using this mixin. See MemoryMapEntityStoreMixin for reference.


Field Summary
protected  String uuid
           
 
Constructor Summary
MapEntityStoreMixin()
           
 
Method Summary
 void activate()
          This is invoked on the service when the instance is being activated
 StateCommitter applyChanges(EntityStoreUnitOfWork unitofwork, Iterable<EntityState> state, String version, long lastModified)
           
 Input<EntityState,EntityStoreException> entityStates(ModuleSPI module)
           
 EntityState getEntityState(EntityStoreUnitOfWork unitofwork, EntityReference identity)
           
 JSONObject getState(String id)
           
 EntityState newEntityState(EntityStoreUnitOfWork unitOfWork, EntityReference identity, EntityDescriptor entityDescriptor)
           
 EntityStoreUnitOfWork newUnitOfWork(Usecase usecaseMetaInfo, ModuleSPI module)
           
protected  String newUnitOfWorkId()
           
 void passivate()
          This is invoked on the service when the instance is being passivated
protected  EntityState readEntityState(DefaultEntityStoreUnitOfWork unitOfWork, Reader entityState)
           
protected  void writeEntityState(DefaultEntityState state, Writer writer, String identity, long lastModified)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

uuid

protected String uuid
Constructor Detail

MapEntityStoreMixin

public MapEntityStoreMixin()
Method Detail

activate

public void activate()
              throws Exception
Description copied from interface: Activatable
This is invoked on the service when the instance is being activated

Specified by:
activate in interface Activatable
Throws:
Exception - if service could not be activated

passivate

public void passivate()
               throws Exception
Description copied from interface: Activatable
This is invoked on the service when the instance is being passivated

Specified by:
passivate in interface Activatable
Throws:
Exception - if the service could not be passivated

newUnitOfWork

public EntityStoreUnitOfWork newUnitOfWork(Usecase usecaseMetaInfo,
                                           ModuleSPI module)
Specified by:
newUnitOfWork in interface EntityStore

newEntityState

public EntityState newEntityState(EntityStoreUnitOfWork unitOfWork,
                                  EntityReference identity,
                                  EntityDescriptor entityDescriptor)
Specified by:
newEntityState in interface EntityStoreSPI

getEntityState

public EntityState getEntityState(EntityStoreUnitOfWork unitofwork,
                                  EntityReference identity)
Specified by:
getEntityState in interface EntityStoreSPI

applyChanges

public StateCommitter applyChanges(EntityStoreUnitOfWork unitofwork,
                                   Iterable<EntityState> state,
                                   String version,
                                   long lastModified)
                            throws EntityStoreException
Specified by:
applyChanges in interface EntityStoreSPI
Throws:
EntityStoreException

entityStates

public Input<EntityState,EntityStoreException> entityStates(ModuleSPI module)
Specified by:
entityStates in interface EntityStore

newUnitOfWorkId

protected String newUnitOfWorkId()

writeEntityState

protected void writeEntityState(DefaultEntityState state,
                                Writer writer,
                                String identity,
                                long lastModified)
                         throws EntityStoreException
Throws:
EntityStoreException

readEntityState

protected EntityState readEntityState(DefaultEntityStoreUnitOfWork unitOfWork,
                                      Reader entityState)
                               throws EntityStoreException
Throws:
EntityStoreException

getState

public JSONObject getState(String id)
                    throws IOException
Specified by:
getState in interface StateStore
Throws:
IOException