Package org.apache.jackrabbit.core.data
Interface Backend
- All Known Implementing Classes:
AbstractBackend,FSBackend
public interface Backend
The interface defines the backend which can be plugged into
CachingDataStore.-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close backend and release resources like database connection if any.deleteAllOlderThan(long timestamp) Delete all records which are older than timestamp.voiddeleteRecord(DataIdentifier identifier) Delete record identified by identifier.booleanexists(DataIdentifier identifier) This method check the existence of record in backend.booleanexists(DataIdentifier identifier, boolean touch) This method check the existence of record in backend.Returns identifiers of all records that exists in backend.longgetLastModified(DataIdentifier identifier) Return lastModified of record identified by identifier.longgetLength(DataIdentifier identifier) Return length of record identified by identifier.voidinit(CachingDataStore store, String homeDir, String config) This method initialize backend with the configuration.read(DataIdentifier identifier) Return inputstream of record identified by identifier.voidtouch(DataIdentifier identifier, long minModifiedDate) Update the lastModified of record if it's lastModified < minModifiedDate.voidtouchAsync(DataIdentifier identifier, long minModifiedDate, AsyncTouchCallback callback) Update the lastModified of record if it's lastModified < minModifiedDate asynchronously.voidwrite(DataIdentifier identifier, File file) Stores file to backend with identifier used as key.voidwriteAsync(DataIdentifier identifier, File file, AsyncUploadCallback callback) Write file to backend in asynchronous mode.
-
Method Details
-
init
This method initialize backend with the configuration.- Parameters:
store-CachingDataStorehomeDir- path of repository home dir.config- path of config property file.- Throws:
DataStoreException
-
read
Return inputstream of record identified by identifier.- Parameters:
identifier- identifier of record.- Returns:
- inputstream of the record.
- Throws:
DataStoreException- if record not found or any error.
-
getLength
Return length of record identified by identifier.- Parameters:
identifier- identifier of record.- Returns:
- length of the record.
- Throws:
DataStoreException- if record not found or any error.
-
getLastModified
Return lastModified of record identified by identifier.- Parameters:
identifier- identifier of record.- Returns:
- lastModified of the record.
- Throws:
DataStoreException- if record not found or any error.
-
write
Stores file to backend with identifier used as key. If key pre-exists, it updates the timestamp of the key.- Parameters:
identifier- key of the filefile- file that would be stored in backend.- Throws:
DataStoreException- for any error.
-
writeAsync
void writeAsync(DataIdentifier identifier, File file, AsyncUploadCallback callback) throws DataStoreException Write file to backend in asynchronous mode.- Parameters:
identifier-file-callback- Callback interface to called after upload succeed or failed.- Throws:
DataStoreException
-
getAllIdentifiers
Returns identifiers of all records that exists in backend.- Returns:
- iterator consisting of all identifiers
- Throws:
DataStoreException
-
exists
This method check the existence of record in backend. Return true if records exists else false. This method also touch record identified by identifier if touch is true.- Parameters:
identifier-- Throws:
DataStoreException
-
exists
This method check the existence of record in backend.- Parameters:
identifier- identifier to be checked.- Returns:
- true if records exists else false.
- Throws:
DataStoreException
-
touch
Update the lastModified of record if it's lastModified < minModifiedDate.- Parameters:
identifier-minModifiedDate-- Throws:
DataStoreException
-
touchAsync
void touchAsync(DataIdentifier identifier, long minModifiedDate, AsyncTouchCallback callback) throws DataStoreException Update the lastModified of record if it's lastModified < minModifiedDate asynchronously. Result of update is passed using appropriateAsyncTouchCallbackmethods. If identifier's lastModified > minModifiedAsyncTouchCallback.onAbort(AsyncTouchResult)is called. Any exception is communicated throughAsyncTouchCallback.onFailure(AsyncTouchResult). On successful update of lastModified,AsyncTouchCallback.onSuccess(AsyncTouchResult)is invoked.- Parameters:
identifier-minModifiedDate-callback-- Throws:
DataStoreException
-
close
Close backend and release resources like database connection if any.- Throws:
DataStoreException
-
deleteAllOlderThan
Delete all records which are older than timestamp.- Parameters:
timestamp-- Returns:
Setof identifiers which are deleted.- Throws:
DataStoreException
-
deleteRecord
Delete record identified by identifier. No-op if identifier not found.- Parameters:
identifier-- Throws:
DataStoreException
-