Class S3Backend

  • All Implemented Interfaces:
    org.apache.jackrabbit.core.data.Backend

    public class S3Backend
    extends org.apache.jackrabbit.core.data.AbstractBackend
    A data store backend that stores data on Amazon S3.
    • Constructor Summary

      Constructors 
      Constructor Description
      S3Backend()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      Set<org.apache.jackrabbit.core.data.DataIdentifier> deleteAllOlderThan​(long min)  
      void deleteRecord​(org.apache.jackrabbit.core.data.DataIdentifier identifier)  
      boolean exists​(org.apache.jackrabbit.core.data.DataIdentifier identifier)
      Check if record identified by identifier exists in Amazon S3.
      boolean exists​(org.apache.jackrabbit.core.data.DataIdentifier identifier, boolean touch)  
      Iterator<org.apache.jackrabbit.core.data.DataIdentifier> getAllIdentifiers()  
      String getBucket()  
      long getLastModified​(org.apache.jackrabbit.core.data.DataIdentifier identifier)  
      long getLength​(org.apache.jackrabbit.core.data.DataIdentifier identifier)  
      void init​(org.apache.jackrabbit.core.data.CachingDataStore store, String homeDir, String config)
      Initialize S3Backend.
      void init​(org.apache.jackrabbit.core.data.CachingDataStore store, String homeDir, Properties prop)  
      InputStream read​(org.apache.jackrabbit.core.data.DataIdentifier identifier)  
      void setBucket​(String bucket)  
      void setProperties​(Properties properties)
      Properties used to configure the backend.
      void touch​(org.apache.jackrabbit.core.data.DataIdentifier identifier, long minModifiedDate)  
      void touchAsync​(org.apache.jackrabbit.core.data.DataIdentifier identifier, long minModifiedDate, org.apache.jackrabbit.core.data.AsyncTouchCallback callback)  
      void write​(org.apache.jackrabbit.core.data.DataIdentifier identifier, File file)
      It uploads file to Amazon S3.
      void writeAsync​(org.apache.jackrabbit.core.data.DataIdentifier identifier, File file, org.apache.jackrabbit.core.data.AsyncUploadCallback callback)  
      • Methods inherited from class org.apache.jackrabbit.core.data.AbstractBackend

        createAsyncWriteExecutor, getAsyncWriteExecutor, getAsyncWritePoolSize, getConfig, getDataStore, getHomeDir, setAsyncWritePoolSize, setConfig, setDataStore, setHomeDir
    • Constructor Detail

      • S3Backend

        public S3Backend()
    • Method Detail

      • init

        public void init​(org.apache.jackrabbit.core.data.CachingDataStore store,
                         String homeDir,
                         String config)
                  throws org.apache.jackrabbit.core.data.DataStoreException
        Initialize S3Backend. It creates AmazonS3Client and TransferManager from aws.properties. It creates S3 bucket if it doesn't pre-exist in S3.
        Specified by:
        init in interface org.apache.jackrabbit.core.data.Backend
        Overrides:
        init in class org.apache.jackrabbit.core.data.AbstractBackend
        Throws:
        org.apache.jackrabbit.core.data.DataStoreException
      • init

        public void init​(org.apache.jackrabbit.core.data.CachingDataStore store,
                         String homeDir,
                         Properties prop)
                  throws org.apache.jackrabbit.core.data.DataStoreException
        Throws:
        org.apache.jackrabbit.core.data.DataStoreException
      • write

        public void write​(org.apache.jackrabbit.core.data.DataIdentifier identifier,
                          File file)
                   throws org.apache.jackrabbit.core.data.DataStoreException
        It uploads file to Amazon S3. If file size is greater than 5MB, this method uses parallel concurrent connections to upload.
        Throws:
        org.apache.jackrabbit.core.data.DataStoreException
      • writeAsync

        public void writeAsync​(org.apache.jackrabbit.core.data.DataIdentifier identifier,
                               File file,
                               org.apache.jackrabbit.core.data.AsyncUploadCallback callback)
                        throws org.apache.jackrabbit.core.data.DataStoreException
        Throws:
        org.apache.jackrabbit.core.data.DataStoreException
      • exists

        public boolean exists​(org.apache.jackrabbit.core.data.DataIdentifier identifier)
                       throws org.apache.jackrabbit.core.data.DataStoreException
        Check if record identified by identifier exists in Amazon S3.
        Throws:
        org.apache.jackrabbit.core.data.DataStoreException
      • exists

        public boolean exists​(org.apache.jackrabbit.core.data.DataIdentifier identifier,
                              boolean touch)
                       throws org.apache.jackrabbit.core.data.DataStoreException
        Throws:
        org.apache.jackrabbit.core.data.DataStoreException
      • touchAsync

        public void touchAsync​(org.apache.jackrabbit.core.data.DataIdentifier identifier,
                               long minModifiedDate,
                               org.apache.jackrabbit.core.data.AsyncTouchCallback callback)
                        throws org.apache.jackrabbit.core.data.DataStoreException
        Throws:
        org.apache.jackrabbit.core.data.DataStoreException
      • touch

        public void touch​(org.apache.jackrabbit.core.data.DataIdentifier identifier,
                          long minModifiedDate)
                   throws org.apache.jackrabbit.core.data.DataStoreException
        Throws:
        org.apache.jackrabbit.core.data.DataStoreException
      • read

        public InputStream read​(org.apache.jackrabbit.core.data.DataIdentifier identifier)
                         throws org.apache.jackrabbit.core.data.DataStoreException
        Throws:
        org.apache.jackrabbit.core.data.DataStoreException
      • getAllIdentifiers

        public Iterator<org.apache.jackrabbit.core.data.DataIdentifier> getAllIdentifiers()
                                                                                   throws org.apache.jackrabbit.core.data.DataStoreException
        Throws:
        org.apache.jackrabbit.core.data.DataStoreException
      • getLastModified

        public long getLastModified​(org.apache.jackrabbit.core.data.DataIdentifier identifier)
                             throws org.apache.jackrabbit.core.data.DataStoreException
        Throws:
        org.apache.jackrabbit.core.data.DataStoreException
      • getLength

        public long getLength​(org.apache.jackrabbit.core.data.DataIdentifier identifier)
                       throws org.apache.jackrabbit.core.data.DataStoreException
        Throws:
        org.apache.jackrabbit.core.data.DataStoreException
      • deleteRecord

        public void deleteRecord​(org.apache.jackrabbit.core.data.DataIdentifier identifier)
                          throws org.apache.jackrabbit.core.data.DataStoreException
        Throws:
        org.apache.jackrabbit.core.data.DataStoreException
      • deleteAllOlderThan

        public Set<org.apache.jackrabbit.core.data.DataIdentifier> deleteAllOlderThan​(long min)
                                                                               throws org.apache.jackrabbit.core.data.DataStoreException
        Throws:
        org.apache.jackrabbit.core.data.DataStoreException
      • close

        public void close()
                   throws org.apache.jackrabbit.core.data.DataStoreException
        Specified by:
        close in interface org.apache.jackrabbit.core.data.Backend
        Overrides:
        close in class org.apache.jackrabbit.core.data.AbstractBackend
        Throws:
        org.apache.jackrabbit.core.data.DataStoreException
      • getBucket

        public String getBucket()
      • setBucket

        public void setBucket​(String bucket)
      • setProperties

        public void setProperties​(Properties properties)
        Properties used to configure the backend. If provided explicitly before init is invoked then these take precedence
        Parameters:
        properties - to configure S3Backend