public abstract class AbstractDataStore extends Object implements DataStore
Modifier and Type | Field and Description |
---|---|
protected String |
DIGEST
The digest algorithm used to uniquely identify records.
|
Constructor and Description |
---|
AbstractDataStore() |
Modifier and Type | Method and Description |
---|---|
protected static String |
encodeHexString(byte[] value)
Returns the hex encoding of the given bytes.
|
protected byte[] |
getOrCreateReferenceKey()
Returns the reference key of this data store.
|
DataRecord |
getRecord(DataIdentifier identifier)
Returns the identified data record.
|
DataRecord |
getRecordFromReference(String reference)
Returns the record that matches the given binary reference.
|
protected String |
getReferenceFromIdentifier(DataIdentifier identifier) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addRecord, clearInUse, close, deleteAllOlderThan, getAllIdentifiers, getMinRecordLength, getRecordIfStored, init, updateModifiedDateOnAccess
protected String DIGEST
public DataRecord getRecord(DataIdentifier identifier) throws DataStoreException
DataStore
getRecord
in interface DataStore
identifier
- data identifierDataStoreException
- if the data store could not be accessed,
or if the given identifier is invalidpublic DataRecord getRecordFromReference(String reference) throws DataStoreException
DataStore
null
if the reference is invalid, for example if it
points to a record that does not exist.getRecordFromReference
in interface DataStore
reference
- binary referencenull
DataStoreException
- if the data store could not be accessedprotected static String encodeHexString(byte[] value)
value
- value to be encodedprotected String getReferenceFromIdentifier(DataIdentifier identifier)
protected byte[] getOrCreateReferenceKey() throws DataStoreException
This method is called only once during the lifetime of a data store instance and the return value is cached in memory, so it's no problem if the implementation is slow.
DataStoreException
- if the key is not availableCopyright © 2004–2024 The Apache Software Foundation. All rights reserved.