Class OakFileDataStore
- java.lang.Object
-
- org.apache.jackrabbit.core.data.AbstractDataStore
-
- org.apache.jackrabbit.core.data.FileDataStore
-
- org.apache.jackrabbit.oak.plugins.blob.datastore.OakFileDataStore
-
- All Implemented Interfaces:
DataStore
,MultiDataStoreAware
,SharedDataStore
- Direct Known Subclasses:
DummyDataStore
public class OakFileDataStore extends FileDataStore implements SharedDataStore
Oak specific extension of JR2 FileDataStore which enables provisioning the signing key via OSGi config
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.jackrabbit.oak.plugins.blob.SharedDataStore
SharedDataStore.Type
-
-
Field Summary
Fields Modifier and Type Field Description static Logger
LOG
-
Fields inherited from class org.apache.jackrabbit.core.data.FileDataStore
inUse
-
Fields inherited from class org.apache.jackrabbit.core.data.AbstractDataStore
DIGEST
-
-
Constructor Summary
Constructors Constructor Description OakFileDataStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMetadataRecord(File input, String name)
Adds the root record.void
addMetadataRecord(InputStream input, String name)
Adds the root record.void
deleteAllMetadataRecords(String prefix)
Deletes all records matching the given prefix.boolean
deleteMetadataRecord(String name)
Deletes the root record represented by the given parameters.Iterator<DataIdentifier>
getAllIdentifiers()
List<DataRecord>
getAllMetadataRecords(String prefix)
Gets the all root records.Iterator<DataRecord>
getAllRecords()
Retrieved an iterator over all DataRecords.DataRecord
getMetadataRecord(String name)
Retrieves the metadata record with the given nameprotected byte[]
getOrCreateReferenceKey()
DataRecord
getRecordForId(DataIdentifier id)
Retrieves the record for the given identifierSharedDataStore.Type
getType()
Gets the type.boolean
metadataRecordExists(String name)
Checks if the metadata record with the name existsvoid
setReferenceKey(byte[] referenceKey)
void
setReferenceKeyEncoded(String encodedKey)
Set Base64 encoded signing keyvoid
setReferenceKeyPlainText(String textKey)
Set the referenceKey from plain text.-
Methods inherited from class org.apache.jackrabbit.core.data.FileDataStore
addRecord, clearInUse, close, deleteAllOlderThan, deleteRecord, getMinRecordLength, getPath, getRecordIfStored, init, setMinRecordLength, setPath, updateModifiedDateOnAccess
-
Methods inherited from class org.apache.jackrabbit.core.data.AbstractDataStore
encodeHexString, getRecord, getRecordFromReference, getReferenceFromIdentifier
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.jackrabbit.oak.plugins.blob.SharedDataStore
getRepositoryId, setRepositoryId
-
-
-
-
Field Detail
-
LOG
public static final Logger LOG
-
-
Method Detail
-
getAllIdentifiers
public Iterator<DataIdentifier> getAllIdentifiers()
- Specified by:
getAllIdentifiers
in interfaceDataStore
- Overrides:
getAllIdentifiers
in classFileDataStore
-
getOrCreateReferenceKey
protected byte[] getOrCreateReferenceKey() throws DataStoreException
- Overrides:
getOrCreateReferenceKey
in classFileDataStore
- Throws:
DataStoreException
-
setReferenceKeyEncoded
public void setReferenceKeyEncoded(String encodedKey)
Set Base64 encoded signing key
-
setReferenceKeyPlainText
public void setReferenceKeyPlainText(String textKey)
Set the referenceKey from plain text. Key content would be UTF-8 encoding of the string.This is useful when setting key via generic bean property manipulation from string properties. User can specify the key in plain text and that would be passed on this object via
PropertiesUtil.populate(Object, java.util.Map, boolean)
- Parameters:
textKey
- base64 encoded key- See Also:
PropertiesUtil.populate(Object, java.util.Map, boolean)
-
setReferenceKey
public void setReferenceKey(byte[] referenceKey)
-
addMetadataRecord
public void addMetadataRecord(InputStream input, String name) throws DataStoreException
Description copied from interface:SharedDataStore
Adds the root record.- Specified by:
addMetadataRecord
in interfaceSharedDataStore
- Parameters:
input
- the streamname
- the name of the root record- Throws:
DataStoreException
- the data store exception
-
addMetadataRecord
public void addMetadataRecord(File input, String name) throws DataStoreException
Description copied from interface:SharedDataStore
Adds the root record.- Specified by:
addMetadataRecord
in interfaceSharedDataStore
- Parameters:
input
- the filename
- the name of the root record- Throws:
DataStoreException
- the data store exception
-
getMetadataRecord
public DataRecord getMetadataRecord(String name)
Description copied from interface:SharedDataStore
Retrieves the metadata record with the given name- Specified by:
getMetadataRecord
in interfaceSharedDataStore
- Parameters:
name
- the name of the record- Returns:
-
metadataRecordExists
public boolean metadataRecordExists(String name)
Description copied from interface:SharedDataStore
Checks if the metadata record with the name exists- Specified by:
metadataRecordExists
in interfaceSharedDataStore
- Returns:
-
getAllMetadataRecords
public List<DataRecord> getAllMetadataRecords(String prefix)
Description copied from interface:SharedDataStore
Gets the all root records.- Specified by:
getAllMetadataRecords
in interfaceSharedDataStore
- Returns:
- the all root records
-
deleteMetadataRecord
public boolean deleteMetadataRecord(String name)
Description copied from interface:SharedDataStore
Deletes the root record represented by the given parameters.- Specified by:
deleteMetadataRecord
in interfaceSharedDataStore
- Parameters:
name
- the name of the root record- Returns:
- success/failure
-
deleteAllMetadataRecords
public void deleteAllMetadataRecords(String prefix)
Description copied from interface:SharedDataStore
Deletes all records matching the given prefix.- Specified by:
deleteAllMetadataRecords
in interfaceSharedDataStore
- Parameters:
prefix
- metadata type identifier
-
getAllRecords
public Iterator<DataRecord> getAllRecords()
Description copied from interface:SharedDataStore
Retrieved an iterator over all DataRecords.- Specified by:
getAllRecords
in interfaceSharedDataStore
- Returns:
- iterator over DataRecords
-
getRecordForId
public DataRecord getRecordForId(DataIdentifier id) throws DataStoreException
Description copied from interface:SharedDataStore
Retrieves the record for the given identifier- Specified by:
getRecordForId
in interfaceSharedDataStore
- Parameters:
id
- the if of the record- Returns:
- data record
- Throws:
DataStoreException
-
getType
public SharedDataStore.Type getType()
Description copied from interface:SharedDataStore
Gets the type.- Specified by:
getType
in interfaceSharedDataStore
- Returns:
- the type
-
-