Interface ObjectStorage

  • All Known Implementing Classes:
    ObjectStorageImpl

    public interface ObjectStorage
    Object Storage definition
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void close()  
      void delete​(String path)
      Delete a path from the object storage if exists.
      boolean exists​(String path)
      Checks if a path exists into the object storage.
      org.uberfire.java.nio.file.Path getPath​(String first, String... path)
      Return a path based on the filesystem that is implemented for storage
      void init​(URI rootURI)
      Initialize the object storage.
      <T> T read​(String path)
      Read the content of the path given
      <T> void write​(String path, T value)
      Write an object into the object storage.
      <T> void write​(String path, T value, boolean lock)
      Write an object into the object storage.
    • Method Detail

      • init

        void init​(URI rootURI)
        Initialize the object storage.
        Parameters:
        rootURI - The root URI where is going to create the file system
      • exists

        boolean exists​(String path)
        Checks if a path exists into the object storage.
        Parameters:
        path - the path to the stored object.
        Returns:
        true if exists that path into the storage else false.
      • read

        <T> T read​(String path)
        Read the content of the path given
        Parameters:
        path - The path where the content is stored
        Returns:
        The content of the file unmarshalled
      • write

        <T> void write​(String path,
                       T value)
        Write an object into the object storage. That object is marshalled into JSON. Lock will be enabled before write and disabled after it.
        Parameters:
        path - The path where the object is going to be written
        value - The object itself
      • write

        <T> void write​(String path,
                       T value,
                       boolean lock)
        Write an object into the object storage. That object is marshalled into JSON. You can avoid FS lock
        Parameters:
        path - The path where the object is going to be written
        value - The object itself
        lock - If the object storage should be locked while writing
      • delete

        void delete​(String path)
        Delete a path from the object storage if exists. That path contains the object stored.
        Parameters:
        path - The path to delete
      • getPath

        org.uberfire.java.nio.file.Path getPath​(String first,
                                                String... path)
        Return a path based on the filesystem that is implemented for storage
        Parameters:
        first - the path string or initial part of the path string
        path - additional strings to be joined to form the path string
        Returns:
        the path object that represents the path.
      • close

        void close()