Package org.apache.jackrabbit.aws.ext.ds
Class S3Backend
- java.lang.Object
-
- org.apache.jackrabbit.core.data.AbstractBackend
-
- org.apache.jackrabbit.aws.ext.ds.S3Backend
-
- All Implemented Interfaces:
org.apache.jackrabbit.core.data.Backend
public class S3Backend extends org.apache.jackrabbit.core.data.AbstractBackendA 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 voidclose()Set<org.apache.jackrabbit.core.data.DataIdentifier>deleteAllOlderThan(long min)voiddeleteRecord(org.apache.jackrabbit.core.data.DataIdentifier identifier)booleanexists(org.apache.jackrabbit.core.data.DataIdentifier identifier)Check if record identified by identifier exists in Amazon S3.booleanexists(org.apache.jackrabbit.core.data.DataIdentifier identifier, boolean touch)Iterator<org.apache.jackrabbit.core.data.DataIdentifier>getAllIdentifiers()StringgetBucket()longgetLastModified(org.apache.jackrabbit.core.data.DataIdentifier identifier)longgetLength(org.apache.jackrabbit.core.data.DataIdentifier identifier)voidinit(org.apache.jackrabbit.core.data.CachingDataStore store, String homeDir, String config)Initialize S3Backend.voidinit(org.apache.jackrabbit.core.data.CachingDataStore store, String homeDir, Properties prop)InputStreamread(org.apache.jackrabbit.core.data.DataIdentifier identifier)voidsetBucket(String bucket)voidsetProperties(Properties properties)Properties used to configure the backend.voidtouch(org.apache.jackrabbit.core.data.DataIdentifier identifier, long minModifiedDate)voidtouchAsync(org.apache.jackrabbit.core.data.DataIdentifier identifier, long minModifiedDate, org.apache.jackrabbit.core.data.AsyncTouchCallback callback)voidwrite(org.apache.jackrabbit.core.data.DataIdentifier identifier, File file)It uploads file to Amazon S3.voidwriteAsync(org.apache.jackrabbit.core.data.DataIdentifier identifier, File file, org.apache.jackrabbit.core.data.AsyncUploadCallback callback)
-
-
-
Method Detail
-
init
public void init(org.apache.jackrabbit.core.data.CachingDataStore store, String homeDir, String config) throws org.apache.jackrabbit.core.data.DataStoreExceptionInitialize S3Backend. It creates AmazonS3Client and TransferManager from aws.properties. It creates S3 bucket if it doesn't pre-exist in S3.- Specified by:
initin interfaceorg.apache.jackrabbit.core.data.Backend- Overrides:
initin classorg.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.DataStoreExceptionIt 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.DataStoreExceptionCheck 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:
closein interfaceorg.apache.jackrabbit.core.data.Backend- Overrides:
closein classorg.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
-
-