Interface ContentStoreProvider

  • All Known Implementing Classes:
    MockContentStoreProvider

    public interface ContentStoreProvider
    The ContentStoreProvider provides access to AIE's content store. Content is stored within namespaces, each identified by a unique String. Content may be any series of bytes and is identified by a String id unique within the namespace. The result of simultaneous operations (method calls) that change the state of the content (add, delete, deleteAll) is undefined.

    The DEFAULT_NAMESPACE is optimized for storage of temporary files. Storage of non-ephemeral content should use a custom namespace.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void add​(java.lang.String namespace, java.lang.String id, java.io.InputStream in)
      Content will be copied from the InputStream and stored within the namespace under the id.
      boolean contains​(java.lang.String namespace, java.lang.String id)  
      void delete​(java.lang.String namespace, java.lang.String id)
      Deletes id from the namespace.
      void deleteAll​(java.lang.String namespace)
      Deletes all content from the store within the namespace
      java.lang.String externalize​(java.lang.String storeName, java.lang.String id)
      Returns an externally accessible URI for the content suitable for HTTP GET.
      java.io.InputStream get​(java.lang.String namespace, java.lang.String id)
      Returns an InputStream to access the content.
      long getDiskUtilization()  
      long getLastModified​(java.lang.String namespace, java.lang.String id)  
      java.util.List<java.lang.String> getNamespaces()  
      long getSize​(java.lang.String namespace, java.lang.String id)  
      long getTotalRecords​(java.lang.String namespace)  
    • Method Detail

      • contains

        boolean contains​(java.lang.String namespace,
                         java.lang.String id)
                  throws AttivioException
        Parameters:
        namespace - the namespace for the content
        id - the id of the content
        Returns:
        true if id exists within the namespace
        Throws:
        AttivioException
      • add

        void add​(java.lang.String namespace,
                 java.lang.String id,
                 java.io.InputStream in)
          throws AttivioException
        Content will be copied from the InputStream and stored within the namespace under the id. If the content currently exists, it will be replaced. The stream is not closed.
        Parameters:
        namespace - the namespace for the content
        id - the id of the content
        in - stream containing the content.
        Throws:
        AttivioException
      • delete

        void delete​(java.lang.String namespace,
                    java.lang.String id)
             throws AttivioException
        Deletes id from the namespace. The content need not be present.
        Parameters:
        namespace - the namespace for the content
        id - the id of the content
        Throws:
        AttivioException
      • deleteAll

        void deleteAll​(java.lang.String namespace)
                throws AttivioException
        Deletes all content from the store within the namespace
        Parameters:
        namespace - the namespace to delete
        Throws:
        AttivioException
      • getTotalRecords

        long getTotalRecords​(java.lang.String namespace)
                      throws AttivioException
        Parameters:
        namespace - the namespace to query
        Returns:
        the number of unique content records associated with the namespace.
        Throws:
        AttivioException
      • getNamespaces

        java.util.List<java.lang.String> getNamespaces()
                                                throws AttivioException
        Returns:
        list of all namespaces in the content store
        Throws:
        AttivioException
      • get

        java.io.InputStream get​(java.lang.String namespace,
                                java.lang.String id)
                         throws AttivioException
        Returns an InputStream to access the content.
        Parameters:
        namespace - the namespace for the content
        id - the id of the content
        Returns:
        an InputStream for the content or null if it does not exist
        Throws:
        AttivioException
      • getSize

        long getSize​(java.lang.String namespace,
                     java.lang.String id)
              throws AttivioException
        Parameters:
        namespace - the namespace for the content
        id - the id of the content
        Returns:
        the number of bytes the InputStream returned by get(String, String) should provide.
        Throws:
        AttivioException
      • externalize

        java.lang.String externalize​(java.lang.String storeName,
                                     java.lang.String id)
                              throws AttivioException
        Returns an externally accessible URI for the content suitable for HTTP GET.
        Parameters:
        storeName - namespace for the content
        id - id for the content
        Returns:
        URI as a string
        Throws:
        AttivioException