| Modifier and Type | Field and Description |
|---|---|
static String |
FS_BACKEND_PATH |
| Constructor and Description |
|---|
FSBackend() |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close backend and release resources like database connection if any.
|
protected Executor |
createAsyncWriteExecutor()
Creates a
Executor. |
Set<DataIdentifier> |
deleteAllOlderThan(long min)
Delete all records which are older than timestamp.
|
void |
deleteRecord(DataIdentifier identifier)
Delete record identified by identifier.
|
boolean |
exists(DataIdentifier identifier)
This method check the existence of record in backend.
|
boolean |
exists(DataIdentifier identifier,
boolean touch)
This method check the existence of record in backend.
|
Iterator<DataIdentifier> |
getAllIdentifiers()
Returns identifiers of all records that exists in backend.
|
protected Executor |
getAsyncWriteExecutor()
Returns ThreadPoolExecutor used to execute asynchronous write or touch jobs.
|
long |
getLastModified(DataIdentifier identifier)
Return lastModified of record identified by identifier.
|
long |
getLength(DataIdentifier identifier)
Return length of record identified by identifier.
|
void |
init(CachingDataStore store,
String homeDir,
Properties prop) |
void |
init(CachingDataStore store,
String homeDir,
String config)
This method initialize backend with the configuration.
|
InputStream |
read(DataIdentifier identifier)
Return inputstream of record identified by identifier.
|
void |
setProperties(Properties properties)
Properties used to configure the backend.
|
void |
touch(DataIdentifier identifier,
long minModifiedDate)
Update the lastModified of record if it's lastModified < minModifiedDate.
|
void |
touchAsync(DataIdentifier identifier,
long minModifiedDate,
AsyncTouchCallback callback)
Update the lastModified of record if it's lastModified < minModifiedDate
asynchronously.
|
void |
write(DataIdentifier identifier,
File src)
Stores file to backend with identifier used as key.
|
void |
writeAsync(DataIdentifier identifier,
File src,
AsyncUploadCallback callback)
Write file to backend in asynchronous mode.
|
public static final String FS_BACKEND_PATH
public void init(CachingDataStore store, String homeDir, String config) throws DataStoreException
Backendinit in interface Backendstore - CachingDataStorehomeDir - path of repository home dir.config - path of config property file.DataStoreExceptionpublic void init(CachingDataStore store, String homeDir, Properties prop) throws DataStoreException
DataStoreExceptionpublic InputStream read(DataIdentifier identifier) throws DataStoreException
Backendread in interface Backendidentifier - identifier of record.DataStoreException - if record not found or any error.public long getLength(DataIdentifier identifier) throws DataStoreException
BackendgetLength in interface Backendidentifier - identifier of record.DataStoreException - if record not found or any error.public long getLastModified(DataIdentifier identifier) throws DataStoreException
BackendgetLastModified in interface Backendidentifier - identifier of record.DataStoreException - if record not found or any error.public void write(DataIdentifier identifier, File src) throws DataStoreException
Backendwrite in interface Backendidentifier - key of the filesrc - file that would be stored in backend.DataStoreException - for any error.public void writeAsync(DataIdentifier identifier, File src, AsyncUploadCallback callback) throws DataStoreException
BackendwriteAsync in interface Backendcallback - Callback interface to called after upload succeed or failed.DataStoreExceptionpublic Iterator<DataIdentifier> getAllIdentifiers() throws DataStoreException
BackendgetAllIdentifiers in interface BackendDataStoreExceptionpublic boolean exists(DataIdentifier identifier, boolean touch) throws DataStoreException
Backendexists in interface BackendDataStoreExceptionpublic boolean exists(DataIdentifier identifier) throws DataStoreException
Backendexists in interface Backendidentifier - identifier to be checked.DataStoreExceptionpublic void touch(DataIdentifier identifier, long minModifiedDate) throws DataStoreException
Backendtouch in interface BackendDataStoreExceptionpublic void touchAsync(DataIdentifier identifier, long minModifiedDate, AsyncTouchCallback callback) throws DataStoreException
BackendAsyncTouchCallback methods. If identifier's lastModified >
minModified AsyncTouchCallback.onAbort(AsyncTouchResult) is
called. Any exception is communicated through
AsyncTouchCallback.onFailure(AsyncTouchResult) . On successful
update of lastModified,
AsyncTouchCallback.onSuccess(AsyncTouchResult)
is invoked.touchAsync in interface BackendDataStoreExceptionpublic void close()
throws DataStoreException
Backendclose in interface BackendDataStoreExceptionpublic Set<DataIdentifier> deleteAllOlderThan(long min) throws DataStoreException
BackenddeleteAllOlderThan in interface BackendSet of identifiers which are deleted.DataStoreExceptionpublic void deleteRecord(DataIdentifier identifier) throws DataStoreException
BackenddeleteRecord in interface BackendDataStoreExceptionpublic void setProperties(Properties properties)
properties - to configure S3Backendprotected Executor createAsyncWriteExecutor()
Executor.
This method is invoked during the initialization for asynchronous write/touch job executions.Executorprotected Executor getAsyncWriteExecutor()
Copyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.