public abstract class AbstractDataStore extends Object implements DataStore
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
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-2020 The Apache Software Foundation. All Rights Reserved.