org.qi4j.entitystore.prefs

## Class PreferencesEntityStoreMixin

- java.lang.Object
- - org.qi4j.entitystore.prefs.PreferencesEntityStoreMixin

- All Implemented Interfaces:
    ServiceActivation, EntityStore, EntityStoreSPI

      public class PreferencesEntityStoreMixin
      extends Object
      implements ServiceActivation, EntityStore, EntityStoreSPI

  Implementation of EntityStore that is backed by the Preferences API.

  @see Preferences

  Associations are stored as the identity of the referenced Entity, ManyAssociations are stored as multi-line strings (one identity per line), and NamedAssociations are stored as multi-line strings (one name on a line, identity on the next 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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `org.slf4j.Logger` | `logger`
    `ScheduledThreadPoolExecutor` | `reloadExecutor`
    `protected String` | `uuid`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PreferencesEntityStoreMixin()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `activateService()` Called after ServiceComposite Activation.
    `StateCommitter` | `applyChanges(EntityStoreUnitOfWork unitofwork, Iterable<EntityState> state)`
    `EntityState` | `entityStateOf(EntityStoreUnitOfWork unitOfWork, ModuleSpi module, EntityReference identity)`
    `Input<EntityState,EntityStoreException>` | `entityStates(ModuleSpi module)`
    `EntityState` | `newEntityState(EntityStoreUnitOfWork unitOfWork, ModuleSpi module, EntityReference identity, EntityDescriptor entityDescriptor)`
    `EntityStoreUnitOfWork` | `newUnitOfWork(Usecase usecase, ModuleSpi module, long currentTime)`
    `protected String` | `newUnitOfWorkId()`
    `void` | `passivateService()` Called before ServiceComposite Passivation.
    `protected void` | `writeEntityState(DefaultEntityState state, Preferences entityPrefs, 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

    - #### logger

          public org.slf4j.Logger logger

    - #### reloadExecutor

          public ScheduledThreadPoolExecutor reloadExecutor

  - ### Constructor Detail

    - #### PreferencesEntityStoreMixin

          public PreferencesEntityStoreMixin()

  - ### Method Detail

    - #### activateService

          public void activateService()
                               throws Exception

      Description copied from interface: `ServiceActivation`
      Called after ServiceComposite Activation.
      Specified by:
        `activateService` in interface `ServiceActivation`
      Throws:
        `Exception`

    - #### passivateService

          public void passivateService()
                                throws Exception

      Description copied from interface: `ServiceActivation`
      Called before ServiceComposite Passivation.
      Specified by:
        `passivateService` in interface `ServiceActivation`
      Throws:
        `Exception`

    - #### newUnitOfWork

          public EntityStoreUnitOfWork newUnitOfWork(Usecase usecase,
                                            ModuleSpi module,
                                            long currentTime)

      Specified by:
        `newUnitOfWork` in interface `EntityStore`

    - #### entityStates

          public Input<EntityState,EntityStoreException> entityStates(ModuleSpi module)

      Specified by:
        `entityStates` in interface `EntityStore`

    - #### newEntityState

          public EntityState newEntityState(EntityStoreUnitOfWork unitOfWork,
                                   ModuleSpi module,
                                   EntityReference identity,
                                   EntityDescriptor entityDescriptor)

      Specified by:
        `newEntityState` in interface `EntityStoreSPI`

    - #### entityStateOf

          public EntityState entityStateOf(EntityStoreUnitOfWork unitOfWork,
                                  ModuleSpi module,
                                  EntityReference identity)

      Specified by:
        `entityStateOf` in interface `EntityStoreSPI`

    - #### applyChanges

          public StateCommitter applyChanges(EntityStoreUnitOfWork unitofwork,
                                    Iterable<EntityState> state)

      Specified by:
        `applyChanges` in interface `EntityStoreSPI`

    - #### writeEntityState

          protected void writeEntityState(DefaultEntityState state,
                              Preferences entityPrefs,
                              String identity,
                              long lastModified)
                                   throws EntityStoreException

      Throws:
        `EntityStoreException`

    - #### newUnitOfWorkId

          protected String newUnitOfWorkId()