Interface TemplateStorageProvider


public interface TemplateStorageProvider
The main api point to work with template storages. This api does not support registering or unregistering template storages. Storages are registered on each node using the local present service registry and are only accessed by that node. Remote api components like the wrapper can only access them if they know the name of them, but are not able to define own storages in any way. Furthermore, this means that storages might only be present on some nodes which are running in the cluster and not on all nodes.
Since:
4.0
  • Method Details

    • localTemplateStorage

      @NonNull @NonNull TemplateStorage localTemplateStorage()
      Returns the local template storage of the current node. This template storage is special as it is always present by default and writes all the data of a template to the local file system. This method does only throw an exception when accessing the storage if a module forcefully removed the local template storage from the node.

      Because this method is supposed to return a wrapper object on remote api components there is no need for an async variant of this method.

      Returns:
      the local template storage.
      Throws:
      UnsupportedOperationException - if the local template storage was unregistered.
    • templateStorage

      Get the template storage with the given name, this method returns null if no storage with that name is registered. Remote api components (like the wrapper) might always return a non-null value from this method, failing if methods are invoked remotely (on the associated node) on the returned storage object.

      The returned storage object is not stateless meaning that the storage might get closed and unregistered. Keeping an instance of a template storage object on non-remote api components is therefore not safe and should be avoided.

      Because this method is supposed to return a wrapper object on remote api components there is no need for an async variant of this method.

      Parameters:
      storage - the name of the storage to get.
      Returns:
      the template storage with the given name, null if the storage is unknown.
      Throws:
      NullPointerException - if the given storage name is null.
    • availableTemplateStorages

      @NonNull @NonNull Collection<String> availableTemplateStorages()
      Get the names of all template storages which are currently registered on the associated node. This collection is not safe to cache as it contents might change without a reflection into the returned collection.

      Obtaining a template storage object based on the names of the template storages which are returned by this method can still evaluate in an unknown template storage.

      Returns:
      the names of all template storages which are currently registered.
    • availableTemplateStoragesAsync

      @NonNull @NonNull CompletableFuture<Collection<String>> availableTemplateStoragesAsync()
      Get the names of all template storages which are currently registered on the associated node. This collection is not safe to cache as it contents might change without a reflection into the returned collection.

      Obtaining a template storage object based on the names of the template storages which are returned by this method can still evaluate in an unknown template storage.

      Returns:
      a task completed with the names of all template storages which are currently registered.