@NotStorableClass public abstract class AbstractHeapDataManager extends Object implements IHeapDataManager, Serializable
Modifier and Type | Field and Description |
---|---|
protected static String |
CLEAR_STANDBY_MODIFICATION_FAILED |
protected static String |
FAILED_READ_DATA_RECORD |
protected static String |
FLUSH_FAILED |
protected JoafipLogger |
logger |
Constructor and Description |
---|
AbstractHeapDataManager() |
Modifier and Type | Method and Description |
---|---|
DataRecordIdentifier |
ceilingDataRecordIdentifier(DataRecordIdentifier dataRecordIdentifier) |
protected DataRecordIdentifier |
ceilingDataRecordIdentifierImpl(DataRecordIdentifier dataRecordIdentifier) |
void |
clear()
clear the heap content.
|
protected abstract void |
clearImpl() |
void |
clearStandbyModification()
clear creation, modification, and deletion to do on the heap.
|
protected abstract void |
clearStandbyModificationImpl() |
protected abstract void |
closeHeapManagerAfterException()
close heap element manager after exception
|
Iterator<DataRecordIdentifier> |
dataRecordIterator() |
protected abstract Iterator<DataRecordIdentifier> |
dataRecordIteratorImpl() |
boolean |
deleteDataRecord(DataRecordIdentifier dataRecordIdentifier)
delete an existing data record knowing its identifier.
|
protected abstract boolean |
deleteDataRecordImpl(DataRecordIdentifier dataRecordIdentifier) |
DataRecordIdentifier |
firstDataRecordIdentifier() |
protected DataRecordIdentifier |
firstDataRecordIdentifierImpl() |
DataRecordIdentifier |
floorDataRecordIdentifier(DataRecordIdentifier dataRecordIdentifier) |
protected DataRecordIdentifier |
floorDataRecordIdentifierImpl(DataRecordIdentifier dataRecordIdentifier) |
void |
flush()
flush creation, modification, and deletion to the heap
the heap is updated. |
protected abstract void |
flushImp()
implement all flush action after call to
#updateHeapRecordImpl(DataRecordIdentifier, IHeapDataRecord) |
long |
freeSize()
get heap total free size in bytes.
|
protected abstract long |
freeSizeImpl() |
Set<DataRecordIdentifier> |
getDataRecordIdentifierSet()
for test purpose
|
protected abstract Set<DataRecordIdentifier> |
getDataRecordIdentifierSetImpl() |
DataRecordIdentifier |
getNewDataRecordIdentifier()
to get a new data identifier for data record creation: return the next
free data record identifier and internally increment the next free data
record identifier
when created #readHeapDataRecord(DataRecordIdentifier) can be
used for the data record identifierIHeapDataManager.flush() must be call to store the modification. |
protected abstract DataRecordIdentifier |
getNewDataRecordIdentifierImpl()
to get a new data identifier for future data record creation
|
DataRecordIdentifier |
getNextFreeDataRecordIdentifier()
get the next free data record identifier
|
protected abstract DataRecordIdentifier |
getNextFreeDataRecordIdentifierImpl() |
int |
getNumberOfDataRecord()
get number of data record in heap file.
|
protected abstract int |
getNumberOfDataRecordImpl() |
int |
getNumberOfFreeRecord()
get number of free record in heap file.
|
protected abstract int |
getNumberOfFreeRecordImpl() |
boolean |
hasDataRecord(DataRecordIdentifier dataRecordIdentifier)
to check if have data record for a data record identifier.
|
protected abstract boolean |
hasDataRecordImpl(DataRecordIdentifier dataRecordIdentifier) |
long |
heapSize()
get heap total size in bytes.
|
protected abstract long |
heapSizeImpl() |
DataRecordIdentifier |
higherDataRecordIdentifier(DataRecordIdentifier dataRecordIdentifier) |
protected DataRecordIdentifier |
higherDataRecordIdentifierImpl(DataRecordIdentifier dataRecordIdentifier) |
boolean |
isServiceStarted() |
DataRecordIdentifier |
lastDataRecordIdentifier() |
protected DataRecordIdentifier |
lastDataRecordIdentifierImpl() |
DataRecordIdentifier |
lowerDataRecordIdentifier(DataRecordIdentifier dataRecordIdentifier) |
protected DataRecordIdentifier |
lowerDataRecordIdentifierImpl(DataRecordIdentifier dataRecordIdentifier) |
DataRecordIdentifier |
nextDataRecordIdentifier(DataRecordIdentifier dataRecordIdentifier) |
protected DataRecordIdentifier |
nextDataRecordIdentifierImpl(DataRecordIdentifier dataRecordIdentifier) |
byte[] |
readDataRecord(DataRecordIdentifier dataRecordIdentifier)
read data for a data record.
|
protected abstract byte[] |
readDataRecordImpl(DataRecordIdentifier dataRecordIdentifier) |
protected abstract void |
removeFiles()
remove existing files
|
DataRecordIdentifier |
removeFirstDataRecord()
remove first data record and return its data record identifier.
|
protected abstract DataRecordIdentifier |
removeFirstDataRecordImpl() |
void |
setNextFreeDataRecordIdentifier(DataRecordIdentifier dataRecordIdentifier)
set the next free data record identifier.
|
protected abstract void |
setNextFreeDataRecordIdentifierImpl(DataRecordIdentifier dataRecordIdentifier) |
void |
startService(boolean removeFiles)
start heap data manager service.
|
protected abstract void |
startServiceImpl(boolean removeFiles)
to implement open actions
|
void |
stopService()
stop heap data manager service, do not flush in file any modification.
|
void |
stopService(boolean removeFiles) |
protected abstract void |
stopServiceImpl(boolean removeFiles)
to implement close actions
|
long |
usedSize()
get heap total used size in bytes.
|
protected abstract long |
usedSizeImpl() |
boolean |
writeDataRecord(DataRecordIdentifier dataRecordIdentifier,
byte[] data)
write data record.
|
protected abstract boolean |
writeDataRecordImpl(DataRecordIdentifier dataRecordIdentifier,
byte[] data) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
backup, getLastRecordPositionInFile, getRecordPositionInfile, getStorageFileName, isDataLost, setDataRecordKeyManager
protected final JoafipLogger logger
protected static final String FLUSH_FAILED
protected static final String FAILED_READ_DATA_RECORD
protected static final String CLEAR_STANDBY_MODIFICATION_FAILED
public final void startService(boolean removeFiles) throws HeapException
IHeapDataManager
startService
in interface IHeapDataManager
removeFiles
- true if remove files before open common initialization at
constructionHeapException
- read/write error, file restored from stable backup, file
management is not opened, no file in stable stateprotected abstract void removeFiles() throws HeapException
HeapException
protected abstract void startServiceImpl(boolean removeFiles) throws HeapException
removeFiles
- HeapException
public final void stopService() throws HeapException
IHeapDataManager
stopService
in interface IHeapDataManager
HeapException
public void stopService(boolean removeFiles) throws HeapException
stopService
in interface IHeapDataManager
HeapException
protected abstract void stopServiceImpl(boolean removeFiles) throws HeapException
HeapException
public boolean isServiceStarted()
isServiceStarted
in interface IHeapDataManager
public void clear() throws HeapException
IHeapDataManager
clear
in interface IHeapDataManager
HeapException
protected abstract void clearImpl() throws HeapException
HeapException
public void flush() throws HeapException
IHeapDataManager
flush
in interface IHeapDataManager
HeapException
protected abstract void flushImp() throws HeapException
#updateHeapRecordImpl(DataRecordIdentifier, IHeapDataRecord)
HeapException
public void clearStandbyModification() throws HeapException
IHeapDataManager
clearStandbyModification
in interface IHeapDataManager
HeapException
protected abstract void clearStandbyModificationImpl() throws HeapException
HeapException
public DataRecordIdentifier getNextFreeDataRecordIdentifier() throws HeapException
IHeapDataManager
getNextFreeDataRecordIdentifier
in interface IHeapDataManager
HeapException
protected abstract DataRecordIdentifier getNextFreeDataRecordIdentifierImpl() throws HeapException
HeapException
public void setNextFreeDataRecordIdentifier(DataRecordIdentifier dataRecordIdentifier) throws HeapException
IHeapDataManager
IHeapDataManager.flush()
must be call to store the modification.setNextFreeDataRecordIdentifier
in interface IHeapDataManager
dataRecordIdentifier
- the next free data record identifierHeapException
protected abstract void setNextFreeDataRecordIdentifierImpl(DataRecordIdentifier dataRecordIdentifier) throws HeapException
HeapException
public DataRecordIdentifier getNewDataRecordIdentifier() throws HeapException
IHeapDataManager
#readHeapDataRecord(DataRecordIdentifier)
can be
used for the data record identifierIHeapDataManager.flush()
must be call to store the modification.getNewDataRecordIdentifier
in interface IHeapDataManager
HeapException
protected abstract DataRecordIdentifier getNewDataRecordIdentifierImpl() throws HeapException
HeapException
public boolean deleteDataRecord(DataRecordIdentifier dataRecordIdentifier) throws HeapException
IHeapDataManager
IHeapDataManager.flush()
must be call to store the modification.deleteDataRecord
in interface IHeapDataManager
dataRecordIdentifier
- data record to delete identifierHeapException
protected abstract boolean deleteDataRecordImpl(DataRecordIdentifier dataRecordIdentifier) throws HeapException
HeapException
public byte[] readDataRecord(DataRecordIdentifier dataRecordIdentifier) throws HeapException
IHeapDataManager
readDataRecord
in interface IHeapDataManager
dataRecordIdentifier
- data record to read identifierHeapException
protected abstract byte[] readDataRecordImpl(DataRecordIdentifier dataRecordIdentifier) throws HeapException
HeapException
public boolean writeDataRecord(DataRecordIdentifier dataRecordIdentifier, byte[] data) throws HeapException
IHeapDataManager
IHeapDataManager.flush()
must be call to store the modification.writeDataRecord
in interface IHeapDataManager
dataRecordIdentifier
- data record to write identifierdata
- the data to writeHeapException
protected abstract boolean writeDataRecordImpl(DataRecordIdentifier dataRecordIdentifier, byte[] data) throws HeapException
dataRecordIdentifier
- data
- HeapException
public boolean hasDataRecord(DataRecordIdentifier dataRecordIdentifier) throws HeapException
IHeapDataManager
hasDataRecord
in interface IHeapDataManager
HeapException
protected abstract boolean hasDataRecordImpl(DataRecordIdentifier dataRecordIdentifier) throws HeapException
HeapException
public DataRecordIdentifier firstDataRecordIdentifier() throws HeapException
firstDataRecordIdentifier
in interface IHeapDataManager
HeapException
protected DataRecordIdentifier firstDataRecordIdentifierImpl() throws HeapException
HeapException
public DataRecordIdentifier nextDataRecordIdentifier(DataRecordIdentifier dataRecordIdentifier) throws HeapException
nextDataRecordIdentifier
in interface IHeapDataManager
dataRecordIdentifier
- wich for next is requestedHeapException
protected DataRecordIdentifier nextDataRecordIdentifierImpl(DataRecordIdentifier dataRecordIdentifier) throws HeapException
HeapException
public DataRecordIdentifier lastDataRecordIdentifier() throws HeapException
lastDataRecordIdentifier
in interface IHeapDataManager
HeapException
protected DataRecordIdentifier lastDataRecordIdentifierImpl() throws HeapException
HeapException
public DataRecordIdentifier lowerDataRecordIdentifier(DataRecordIdentifier dataRecordIdentifier) throws HeapException
lowerDataRecordIdentifier
in interface IHeapDataManager
dataRecordIdentifier
- the keynull
if there is no such key.HeapException
protected DataRecordIdentifier lowerDataRecordIdentifierImpl(DataRecordIdentifier dataRecordIdentifier) throws HeapException
HeapException
public DataRecordIdentifier floorDataRecordIdentifier(DataRecordIdentifier dataRecordIdentifier) throws HeapException
floorDataRecordIdentifier
in interface IHeapDataManager
dataRecordIdentifier
- the keykey
, or
null
if there is no such keyHeapException
protected DataRecordIdentifier floorDataRecordIdentifierImpl(DataRecordIdentifier dataRecordIdentifier) throws HeapException
HeapException
public DataRecordIdentifier ceilingDataRecordIdentifier(DataRecordIdentifier dataRecordIdentifier) throws HeapException
ceilingDataRecordIdentifier
in interface IHeapDataManager
dataRecordIdentifier
- the keykey
, or
null
if there is no such keyHeapException
protected DataRecordIdentifier ceilingDataRecordIdentifierImpl(DataRecordIdentifier dataRecordIdentifier) throws HeapException
HeapException
public DataRecordIdentifier higherDataRecordIdentifier(DataRecordIdentifier dataRecordIdentifier) throws HeapException
higherDataRecordIdentifier
in interface IHeapDataManager
dataRecordIdentifier
- the keykey
, or null
if there
is no such keyHeapException
protected DataRecordIdentifier higherDataRecordIdentifierImpl(DataRecordIdentifier dataRecordIdentifier) throws HeapException
HeapException
public DataRecordIdentifier removeFirstDataRecord() throws HeapException
IHeapDataManager
IHeapDataManager.flush()
must be call to store the modification.removeFirstDataRecord
in interface IHeapDataManager
HeapException
protected abstract DataRecordIdentifier removeFirstDataRecordImpl() throws HeapException
HeapException
public int getNumberOfDataRecord() throws HeapException
IHeapDataManager
getNumberOfDataRecord
in interface IHeapDataManager
HeapException
protected abstract int getNumberOfDataRecordImpl() throws HeapException
HeapException
public int getNumberOfFreeRecord() throws HeapException
IHeapDataManager
getNumberOfFreeRecord
in interface IHeapDataManager
HeapException
protected abstract int getNumberOfFreeRecordImpl() throws HeapException
HeapException
public long heapSize() throws HeapException
IHeapDataManager
heapSize
in interface IHeapDataManager
HeapException
protected abstract long heapSizeImpl() throws HeapException
HeapException
public long freeSize() throws HeapException
IHeapDataManager
freeSize
in interface IHeapDataManager
HeapException
protected abstract long freeSizeImpl() throws HeapException
HeapException
public long usedSize() throws HeapException
IHeapDataManager
usedSize
in interface IHeapDataManager
HeapException
protected abstract long usedSizeImpl() throws HeapException
HeapException
protected abstract void closeHeapManagerAfterException()
@Fortest public Set<DataRecordIdentifier> getDataRecordIdentifierSet() throws HeapException
IHeapDataManager
getDataRecordIdentifierSet
in interface IHeapDataManager
HeapException
@Fortest protected abstract Set<DataRecordIdentifier> getDataRecordIdentifierSetImpl() throws HeapException
HeapException
public Iterator<DataRecordIdentifier> dataRecordIterator() throws HeapException
dataRecordIterator
in interface IHeapDataManager
HeapException
protected abstract Iterator<DataRecordIdentifier> dataRecordIteratorImpl() throws HeapException
HeapException
Copyright © 2007-2012 Luc Peuvrier. All Rights Reserved.