Interface StorageManager<T>

Type Parameters:
T - type of the managed element
All Known Subinterfaces:
ProjectManager, RepositoryManager

public interface StorageManager<T>
An abstract interface to define operations performed on the storage.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    close(Supplier<CentralDogmaException> failureCauseSupplier)
    Closes this manager.
    create(String name, long creationTimeMillis, Author author)
    Returns a newly-created element with the specified name and the specified creationTimeMillis by the specified Author.
    default T
    create(String name, Author author)
    Returns a newly-created element with the specified name by the specified Author.
    void
    Ensures that this manager is open.
    boolean
    exists(String name)
    Returns true if an element with the specified name exists.
    get(String name)
    Returns an element with the specified name.
    Returns all elements as a Map of the name and the element.
    Returns all removed elements as a Map of the name and the removal timestamp.
    void
    Marks the specified name element for purge.
    void
    Purges a set of names for the elements which have been marked for purge.
    void
    remove(String name)
    Removes an element with the specified name.
    Restores an element with the specified name.
  • Method Details

    • close

      void close(Supplier<CentralDogmaException> failureCauseSupplier)
      Closes this manager.
      Parameters:
      failureCauseSupplier - the supplier which provides a reason why it is closed
    • exists

      boolean exists(String name)
      Returns true if an element with the specified name exists.
      Parameters:
      name - the name of an element
    • get

      T get(String name)
      Returns an element with the specified name.
      Parameters:
      name - the name of an element
      Throws:
      CentralDogmaException - if no element with the specified name exists
    • create

      default T create(String name, Author author)
      Returns a newly-created element with the specified name by the specified Author.
      Parameters:
      name - the name of an element which is supposed to be created
      author - the author who is creating the new element
    • create

      T create(String name, long creationTimeMillis, Author author)
      Returns a newly-created element with the specified name and the specified creationTimeMillis by the specified Author.
      Parameters:
      name - the name of an element which is supposed to be created
      creationTimeMillis - the creation time in milliseconds
      author - the author who is creating the new element
    • list

      Map<String,T> list()
      Returns all elements as a Map of the name and the element.
    • listRemoved

      Map<String,Instant> listRemoved()
      Returns all removed elements as a Map of the name and the removal timestamp.
    • remove

      void remove(String name)
      Removes an element with the specified name.
      Parameters:
      name - the name of an element which is supposed to be removed
    • unremove

      T unremove(String name)
      Restores an element with the specified name.
      Parameters:
      name - the name of an element which is supposed to be restored
    • purgeMarked

      void purgeMarked()
      Purges a set of names for the elements which have been marked for purge.
    • markForPurge

      void markForPurge(String name)
      Marks the specified name element for purge.
      Parameters:
      name - the name of an element which is supposed to be purged
    • ensureOpen

      void ensureOpen()
      Ensures that this manager is open.
      Throws:
      IllegalStateException - if this manager is not initialized yet
      CentralDogmaException - if this manager has already been closed with a cause. See close(Supplier) method.