public class DummyIndexedStorageUtility<T extends Persistable> extends Object implements IStorageUtilityIndexed<T>
| Constructor and Description |
|---|
DummyIndexedStorageUtility() |
| Modifier and Type | Method and Description |
|---|---|
int |
add(T e)
Add a new record to the store.
|
void |
close()
Close all resources associated with this StorageUtility.
|
void |
destroy()
Delete the storage utility itself, along with all stored records and meta-data
|
boolean |
exists(int id)
Return whether a record exists in the store
|
Object |
getAccessLock()
Fetch the object that acts as the synchronization lock for this StorageUtility
|
List<Integer> |
getIDsForValue(String fieldName,
Object value)
Retrieves a List of IDs of Externalizable objects in storage for which the field
specified contains the value specified.
|
int |
getNumRecords()
Return the number of records in the store
|
T |
getRecordForValue(String fieldName,
Object value)
Retrieves a Externalizable object from the storage which is reference by the unique index fieldName.
|
int |
getRecordSize(int id)
Get the size of a record
|
int |
getTotalSize()
Return total size of device storage consumed by this StorageUtility
|
boolean |
isEmpty()
Return whether the store is empty
|
IStorageIterator<T> |
iterate()
Return an iterator to iterate through all records in this store
|
T |
read(int id)
Read and return the record corresponding to 'id'.
|
byte[] |
readBytes(int id)
Read and return the raw bytes for the record corresponding to 'id'.
|
void |
registerIndex(String filterIndex)
Optional.
|
void |
remove(int id)
Remove record with the given ID from the store.
|
void |
remove(Persistable p)
Remove object from the store
|
void |
removeAll() |
List<Integer> |
removeAll(EntityFilter ef) |
void |
repack()
Perform any clean-up/consolidation of the StorageUtility's underlying datastructures that is too expensive to do during
normal usage (e.g., if all the records are scattered among 10 half-empty RMSes, repack them into 5 full RMSes)
|
void |
repair()
If the StorageUtility has been left in a corrupt/inconsistent state, restore it to a non-corrupt state, even if it results
in data loss.
|
void |
setReadOnly() |
void |
update(int id,
T e)
Update a record in the store.
|
void |
write(Persistable p)
Write an object to the store.
|
public List<Integer> getIDsForValue(String fieldName, Object value)
IStorageUtilityIndexedgetIDsForValue in interface IStorageUtilityIndexed<T extends Persistable>fieldName - The name of a field which should be evaluatedvalue - The value which should be contained by the field specifiedpublic T getRecordForValue(String fieldName, Object value) throws NoSuchElementException, InvalidIndexException
IStorageUtilityIndexedgetRecordForValue in interface IStorageUtilityIndexed<T extends Persistable>fieldName - The name of the index field which will be evaluatedvalue - The value which should be set in the index specified by fieldName for the returned
object.NoSuchElementException - If no objects reside in storage for which the return condition
can be successful.InvalidIndexException - If the field used is an invalid index, because more than one field in the Storage
contains the value of the index requested.public int add(T e) throws StorageFullException
IStorageUtilityadd in interface IStorageUtility<T extends Persistable>e - object to addStorageFullException - if not enough space availablepublic void close()
IStorageUtilityclose in interface IStorageUtility<T extends Persistable>public void destroy()
IStorageUtilitydestroy in interface IStorageUtility<T extends Persistable>public boolean exists(int id)
IStorageUtilityexists in interface IStorageUtility<T extends Persistable>id - record IDpublic Object getAccessLock()
IStorageUtilitygetAccessLock in interface IStorageUtility<T extends Persistable>public int getNumRecords()
IStorageUtilitygetNumRecords in interface IStorageUtility<T extends Persistable>public int getRecordSize(int id)
IStorageUtilitygetRecordSize in interface IStorageUtility<T extends Persistable>id - record IDpublic int getTotalSize()
IStorageUtilitygetTotalSize in interface IStorageUtility<T extends Persistable>public boolean isEmpty()
IStorageUtilityisEmpty in interface IStorageUtility<T extends Persistable>public IStorageIterator<T> iterate()
IStorageUtilityiterate in interface IStorageUtility<T extends Persistable>public T read(int id)
IStorageUtilityread in interface IStorageUtility<T extends Persistable>id - id of the objectpublic byte[] readBytes(int id)
IStorageUtilityreadBytes in interface IStorageUtility<T extends Persistable>id - id of the objectpublic void remove(int id)
IStorageUtilityremove in interface IStorageUtility<T extends Persistable>id - ID of record to removepublic void remove(Persistable p)
IStorageUtilityremove in interface IStorageUtility<T extends Persistable>p - object to removepublic void removeAll()
removeAll in interface IStorageUtility<T extends Persistable>public List<Integer> removeAll(EntityFilter ef)
removeAll in interface IStorageUtility<T extends Persistable>public void repack()
IStorageUtilityrepack in interface IStorageUtility<T extends Persistable>public void repair()
IStorageUtilityrepair in interface IStorageUtility<T extends Persistable>public void update(int id,
T e)
throws StorageFullException
IStorageUtilityupdate in interface IStorageUtility<T extends Persistable>id - ID of record to updatee - updated objectStorageFullException - if not enough space available to updatepublic void write(Persistable p) throws StorageFullException
IStorageUtilitywrite in interface IStorageUtility<T extends Persistable>p - object to storeStorageFullException - if there is not enough room to store the objectpublic void setReadOnly()
setReadOnly in interface IStorageUtility<T extends Persistable>public void registerIndex(String filterIndex)
IStorageUtilityIndexedregisterIndex in interface IStorageUtilityIndexed<T extends Persistable>Copyright © 2024. All rights reserved.