public class FileDataStore extends AbstractDataStore implements MultiDataStoreAware
<DataStore class="org.apache.jackrabbit.core.data.FileDataStore"> <param name="path
" value="/data/datastore"/> <param name="minRecordLength
" value="1024"/> </DataStore>
If the directory is not set, the directory <repository home>/repository/datastore is used.
A three level directory structure is used to avoid placing too many files in a single directory. The chosen structure is designed to scale up to billions of distinct records.
This implementation relies on the underlying file system to support
atomic O(1) move operations with File.renameTo(File)
.
Constructor and Description |
---|
FileDataStore() |
Modifier and Type | Method and Description |
---|---|
DataRecord |
addRecord(java.io.InputStream input)
Creates a new data record.
|
void |
clearInUse()
Clear the in-use list.
|
void |
close()
Close the data store
|
int |
deleteAllOlderThan(long min)
Delete objects that have a modified date older than the specified date.
|
void |
deleteRecord(DataIdentifier identifier)
Deletes a single DataRecord based on the given identifier.
|
java.util.Iterator<DataIdentifier> |
getAllIdentifiers()
Get all identifiers.
|
int |
getMinRecordLength()
Get the minimum size of an object that should be stored in this data store.
|
java.lang.String |
getPath()
Get the name of the directory where this data store keeps the files.
|
DataRecord |
getRecordIfStored(DataIdentifier identifier)
Get a data record for the given identifier.
|
void |
init(java.lang.String homeDir)
Initialized the data store.
|
void |
setMinRecordLength(int minRecordLength)
Set the minimum object length.
|
void |
setPath(java.lang.String directoryName)
Set the name of the directory where this data store keeps the files.
|
void |
updateModifiedDateOnAccess(long before)
From now on, update the modified date of an object even when accessing it.
|
getRecord, getRecordFromReference
public void init(java.lang.String homeDir)
public DataRecord getRecordIfStored(DataIdentifier identifier) throws DataStoreException
getRecordIfStored
in interface DataStore
identifier
- the identifierDataStoreException
- if the data store could not be accessedpublic DataRecord addRecord(java.io.InputStream input) throws DataStoreException
AbstractDataStore.DIGEST
message digest of the stream is calculated. If a
record with the same AbstractDataStore.DIGEST
digest (and length) is found then it is
returned. Otherwise the temporary file is moved in place to become
the new data record that gets returned.addRecord
in interface DataStore
input
- binary streamDataStoreException
- if the record could not be createdpublic void updateModifiedDateOnAccess(long before)
DataStore
updateModifiedDateOnAccess
in interface DataStore
before
- - update the modified date to the current time if it is older than this valuepublic void deleteRecord(DataIdentifier identifier) throws DataStoreException
MultiDataStoreAware
MultiDataStore.MoveDataTask
.deleteRecord
in interface MultiDataStoreAware
identifier
- data identifierDataStoreException
- if the data store could not be accessed, or if the given
identifier is invalidpublic int deleteAllOlderThan(long min)
DataStore
deleteAllOlderThan
in interface DataStore
min
- the minimum timepublic java.util.Iterator<DataIdentifier> getAllIdentifiers()
DataStore
getAllIdentifiers
in interface DataStore
public void clearInUse()
DataStore
clearInUse
in interface DataStore
public java.lang.String getPath()
public void setPath(java.lang.String directoryName)
directoryName
- the path namepublic int getMinRecordLength()
DataStore
getMinRecordLength
in interface DataStore
public void setMinRecordLength(int minRecordLength)
minRecordLength
- the lengthCopyright © 2010 - 2020 Adobe. All Rights Reserved