Class PersistenceManager

java.lang.Object
org.episteme.core.util.persistence.PersistenceManager

public final class PersistenceManager extends Object
Central manager for persistent scientific object graphs.

This manager discovers GraphProvider implementations via the Java Service Provider Interface (SPI).

Since:
2.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Method Details

    • getInstance

      public static PersistenceManager getInstance()
      Returns the singleton instance of the persistence manager.
      Returns:
      the manager instance.
    • getProvider

      public GraphProvider getProvider()
      Returns the current graph provider.
      Returns:
      the provider.
    • setProvider

      public void setProvider(GraphProvider provider)
      Sets the graph provider to use.
      Parameters:
      provider - the provider to set.
    • save

      public <T> void save(T entity)
      Saves an entity using the current provider.
      Type Parameters:
      T - the type of the entity
      Parameters:
      entity - the entity to save
    • load

      public <T> T load(Class<T> type, Object id)
      Loads an entity using the current provider.
      Type Parameters:
      T - the type of the entity
      Parameters:
      type - the class of the entity
      id - the unique identifier
      Returns:
      the loaded entity
    • delete

      public <T> void delete(T entity)
      Deletes an entity using the current provider.
      Type Parameters:
      T - the type of the entity
      Parameters:
      entity - the entity to delete
    • query

      public <T> List<T> query(Class<T> type, String query)
      Queries for entities using the current provider.
      Type Parameters:
      T - the type of the entities
      Parameters:
      type - the class of the entities
      query - symbols or criteria for search
      Returns:
      a list of matching entities