org.qi4j.spi.entitystore.helpers
Class JSONMapEntityStoreMixin
java.lang.Object
org.qi4j.spi.entitystore.helpers.JSONMapEntityStoreMixin
- All Implemented Interfaces:
- EntityStore, EntityStoreSPI, JSONMapEntityStoreActivation, StateStore
public class JSONMapEntityStoreMixin
- extends java.lang.Object
- implements EntityStore, EntityStoreSPI, StateStore, JSONMapEntityStoreActivation
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 and Cache extensions.
MapEntityStore implementations will get their values as JSON.
Field Summary |
protected java.lang.String |
uuid
|
Method Summary |
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 JSONEntityState |
readEntityState(DefaultEntityStoreUnitOfWork unitOfWork,
java.io.Reader entityState)
|
void |
setUpJSONMapES()
|
void |
tearDownJSONMapES()
|
protected void |
writeEntityState(JSONEntityState state,
java.io.Writer writer,
java.lang.String identity,
long lastModified)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
uuid
protected java.lang.String uuid
JSONMapEntityStoreMixin
public JSONMapEntityStoreMixin()
setUpJSONMapES
public void setUpJSONMapES()
throws java.lang.Exception
- Specified by:
setUpJSONMapES
in interface JSONMapEntityStoreActivation
- Throws:
java.lang.Exception
tearDownJSONMapES
public void tearDownJSONMapES()
throws java.lang.Exception
- Specified by:
tearDownJSONMapES
in interface JSONMapEntityStoreActivation
- 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(JSONEntityState state,
java.io.Writer writer,
java.lang.String identity,
long lastModified)
throws EntityStoreException
- Throws:
EntityStoreException
readEntityState
protected JSONEntityState 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