Class ProviderPersistence<T>

java.lang.Object
net.tangly.core.providers.Provider<T>
net.tangly.core.providers.ProviderPersistence<T>
Type Parameters:
T - type of the instances handled in the provider

public class ProviderPersistence<T> extends Provider<T>
Provider where all instances are cached in memory and persisted onto the file system or a database.

The update method uses an eager storage strategy to insure that all instance variables of a Java object are persisted. This approach is necessary due to the implementation restrictions of MicroStream. The current regular store operation does not persist fields based on collections.

  • Constructor Details

    • ProviderPersistence

      public ProviderPersistence(@NotNull @NotNull org.eclipse.store.storage.embedded.types.EmbeddedStorageManager storageManager, @NotNull @NotNull List<T> items)
  • Method Details

    • of

      public static <T> ProviderPersistence<T> of(@NotNull @NotNull org.eclipse.store.storage.embedded.types.EmbeddedStorageManager storageManager, @NotNull @NotNull List<T> items)
    • items

      public List<T> items()
      Description copied from class: Provider
      Returns a list containing all known instances of the entity type.
      Specified by:
      items in class Provider<T>
      Returns:
      list of all instances
    • update

      public void update(@NotNull T entity)
      Description copied from class: Provider
      Updates the data associated with the entity. If the entity is new, the update is handled as a create operation. The update is transitive and all referenced entities are also updated. The entity given as a parameter becomes the instance managed through the provider.
      Specified by:
      update in class Provider<T>
      Parameters:
      entity - entity to update
    • updateAll

      public void updateAll(@NotNull @NotNull Iterable<? extends T> entities)
      Description copied from class: Provider
      Updates the data associated with all entities.
      Overrides:
      updateAll in class Provider<T>
      Parameters:
      entities - entities to update
    • delete

      public void delete(@NotNull T entity)
      Description copied from class: Provider
      Deletes the data associated with the entity. The object identifier is invalidated.
      Specified by:
      delete in class Provider<T>
      Parameters:
      entity - entity to delete
    • deleteAll

      public void deleteAll()
      Description copied from class: Provider
      Deletes all the entities managed by the provider.
      Specified by:
      deleteAll in class Provider<T>