org.qi4j.spi.entitystore.helpers
Class MapEntityStoreMixin

java.lang.Object
  extended by org.qi4j.spi.entitystore.helpers.MapEntityStoreMixin
All Implemented Interfaces:
EntityStore, EntityStoreSPI, MapEntityStoreActivation, StateStore

public class MapEntityStoreMixin
extends java.lang.Object
implements EntityStore, EntityStoreSPI, StateStore, MapEntityStoreActivation

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.

EntityStores based on this mixin gets support for the Migration extension.

MapEntityStore implementations will get their values as JSON.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.qi4j.spi.entitystore.helpers.MapEntityStoreActivation
MapEntityStoreActivation.Activator
 
Field Summary
protected  java.lang.String uuid
           
 
Constructor Summary
MapEntityStoreMixin()
           
 
Method Summary
 void activateMapEntityStore()
           
 StateCommitter applyChanges(EntityStoreUnitOfWork unitofwork, java.lang.Iterable<EntityState> state)
           
 EntityState entityStateOf(EntityStoreUnitOfWork unitofwork, EntityReference identity)
           
 Input<EntityState,EntityStoreException> entityStates(Module module)
           
 org.json.JSONObject jsonStateOf(java.lang.String id)
           
 EntityState newEntityState(EntityStoreUnitOfWork unitOfWork, EntityReference identity, EntityDescriptor entityDescriptor)
           
 EntityStoreUnitOfWork newUnitOfWork(Usecase usecaseMetaInfo, Module module, long currentTime)
           
protected  java.lang.String newUnitOfWorkId()
           
protected  EntityState readEntityState(DefaultEntityStoreUnitOfWork unitOfWork, java.io.Reader entityState)
           
protected  void writeEntityState(DefaultEntityState state, java.io.Writer writer, java.lang.String version, long lastModified)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

uuid

protected java.lang.String uuid
Constructor Detail

MapEntityStoreMixin

public MapEntityStoreMixin()
Method Detail

activateMapEntityStore

public void activateMapEntityStore()
                            throws java.lang.Exception
Specified by:
activateMapEntityStore in interface MapEntityStoreActivation
Throws:
java.lang.Exception

newUnitOfWork

public EntityStoreUnitOfWork newUnitOfWork(Usecase usecaseMetaInfo,
                                           Module module,
                                           long currentTime)
Specified by:
newUnitOfWork in interface EntityStore

newEntityState

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

entityStateOf

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

applyChanges

public StateCommitter applyChanges(EntityStoreUnitOfWork unitofwork,
                                   java.lang.Iterable<EntityState> state)
                            throws EntityStoreException
Specified by:
applyChanges in interface EntityStoreSPI
Throws:
EntityStoreException

entityStates

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

newUnitOfWorkId

protected java.lang.String newUnitOfWorkId()

writeEntityState

protected void writeEntityState(DefaultEntityState state,
                                java.io.Writer writer,
                                java.lang.String version,
                                long lastModified)
                         throws EntityStoreException
Throws:
EntityStoreException

readEntityState

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

jsonStateOf

public org.json.JSONObject jsonStateOf(java.lang.String id)
                                throws java.io.IOException
Specified by:
jsonStateOf in interface StateStore
Throws:
java.io.IOException