org.qi4j.entitystore.prefs
Class PreferencesEntityStoreMixin

java.lang.Object
  extended by org.qi4j.entitystore.prefs.PreferencesEntityStoreMixin
All Implemented Interfaces:
ServiceActivation, EntityStore, EntityStoreSPI

public class PreferencesEntityStoreMixin
extends java.lang.Object
implements ServiceActivation, EntityStore, EntityStoreSPI

Implementation of EntityStore that is backed by the Preferences API.

@see Preferences

ManyAssociation is stored as string, one identity string per line

Nested ValuesComposites, Collections and Maps are stored using available ValueSerialization service.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.qi4j.api.service.ServiceActivation
ServiceActivation.ServiceActivator
 
Field Summary
 org.slf4j.Logger logger
           
 java.util.concurrent.ScheduledThreadPoolExecutor reloadExecutor
           
protected  java.lang.String uuid
           
 
Constructor Summary
PreferencesEntityStoreMixin()
           
 
Method Summary
 void activateService()
          Called after ServiceComposite Activation.
 StateCommitter applyChanges(EntityStoreUnitOfWork unitofwork, java.lang.Iterable<EntityState> state)
           
 EntityState entityStateOf(EntityStoreUnitOfWork unitOfWork, EntityReference identity)
           
 Input<EntityState,EntityStoreException> entityStates(Module module)
           
 EntityState newEntityState(EntityStoreUnitOfWork unitOfWork, EntityReference identity, EntityDescriptor entityDescriptor)
           
 EntityStoreUnitOfWork newUnitOfWork(Usecase usecase, Module module, long currentTime)
           
protected  java.lang.String newUnitOfWorkId()
           
 void passivateService()
          Called before ServiceComposite Passivation.
protected  void writeEntityState(DefaultEntityState state, java.util.prefs.Preferences entityPrefs, java.lang.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 java.lang.String uuid

logger

public org.slf4j.Logger logger

reloadExecutor

public java.util.concurrent.ScheduledThreadPoolExecutor reloadExecutor
Constructor Detail

PreferencesEntityStoreMixin

public PreferencesEntityStoreMixin()
Method Detail

activateService

public void activateService()
                     throws java.lang.Exception
Description copied from interface: ServiceActivation
Called after ServiceComposite Activation.

Specified by:
activateService in interface ServiceActivation
Throws:
java.lang.Exception

passivateService

public void passivateService()
                      throws java.lang.Exception
Description copied from interface: ServiceActivation
Called before ServiceComposite Passivation.

Specified by:
passivateService in interface ServiceActivation
Throws:
java.lang.Exception

newUnitOfWork

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

entityStates

public Input<EntityState,EntityStoreException> entityStates(Module module)
Specified by:
entityStates 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)
Specified by:
applyChanges in interface EntityStoreSPI

writeEntityState

protected void writeEntityState(DefaultEntityState state,
                                java.util.prefs.Preferences entityPrefs,
                                java.lang.String identity,
                                long lastModified)
                         throws EntityStoreException
Throws:
EntityStoreException

newUnitOfWorkId

protected java.lang.String newUnitOfWorkId()