|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.jackrabbit.core.data.FileDataStore
public class FileDataStore
Simple file-based data store. Data records are stored as normal files named using a message digest of the contained binary stream. Configuration:
<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).
| Field Summary | |
|---|---|
protected Map<DataIdentifier,WeakReference<DataIdentifier>> |
inUse
All data identifiers that are currently in use are in this set until they are garbage collected. |
| Constructor Summary | |
|---|---|
FileDataStore()
Creates a uninitialized data store. |
|
| Method Summary | |
|---|---|
DataRecord |
addRecord(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. |
Iterator<DataIdentifier> |
getAllIdentifiers()
Get all identifiers. |
int |
getMinRecordLength()
Get the minimum size of an object that should be stored in this data store. |
String |
getPath()
Get the name of the directory where this data store keeps the files. |
DataRecord |
getRecord(DataIdentifier identifier)
Returns the record with the given identifier. |
DataRecord |
getRecordIfStored(DataIdentifier identifier)
Check if a record for the given identifier exists, and return it if yes. |
void |
init(String homeDir)
Initialized the data store. |
void |
setMinRecordLength(int minRecordLength)
Set the minimum object length. |
void |
setPath(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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Map<DataIdentifier,WeakReference<DataIdentifier>> inUse
| Constructor Detail |
|---|
public FileDataStore()
| Method Detail |
|---|
public void init(String homeDir)
init in interface DataStorehomeDir - public DataRecord getRecordIfStored(DataIdentifier identifier)
getRecordIfStored in interface DataStoreidentifier - data identifier
public DataRecord getRecord(DataIdentifier identifier)
throws DataStoreException
getRecord in interface DataStoreidentifier - data identifier
DataStoreException - if the data store could not be accessed,
or if the given identifier is invalid
public DataRecord addRecord(InputStream input)
throws DataStoreException
addRecord in interface DataStoreinput - binary stream
DataStoreException - if the record could not be createdpublic void updateModifiedDateOnAccess(long before)
updateModifiedDateOnAccess in interface DataStorebefore - - update the modified date to the current time if it is older than this valuepublic int deleteAllOlderThan(long min)
deleteAllOlderThan in interface DataStoremin - the minimum time
public Iterator<DataIdentifier> getAllIdentifiers()
getAllIdentifiers in interface DataStorepublic void clearInUse()
clearInUse in interface DataStorepublic String getPath()
public void setPath(String directoryName)
directoryName - the path namepublic int getMinRecordLength()
getMinRecordLength in interface DataStorepublic void setMinRecordLength(int minRecordLength)
minRecordLength - the lengthpublic void close()
close in interface DataStore
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||