|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--com.syncbuilder.storage.DatabaseBase
A foundation for all implementations of databases.
DatabaseBase is assisted by DatabaseImpl, which provides the neccessary knowledge to treat databases from different applications properly. This is a delegation-/bridge pattern.
DatabaseImpl,
DeviceDatabase,
MemoryDatabase,
Database| Field Summary | |
protected Char4 |
_creator
|
protected DatabaseImpl |
_dbimpl
|
protected int |
_dbmode
|
protected java.lang.String |
_dbname
|
| Constructor Summary | |
DatabaseBase()
|
|
| Method Summary | |
abstract void |
close()
Closes the database. |
AppBlock |
createAppBlock()
|
Pref |
createPref(int id)
|
Pref |
createPref(int id,
int version,
boolean backed_up)
|
Record |
createRecord()
Create a new Record with an unspecified RecordID (0). |
Record |
createRecord(byte[] contents,
RecordID id,
int index,
int attr,
int cat)
Create a new Record with the specified RecordID, index, attributes, and category. |
Record |
createRecord(RecordID id)
Create a new Record with the specified RecordID. |
Resource |
createResource()
|
Resource |
createResource(byte[] contents,
Char4 type,
int id,
int index)
|
Resource |
createResource(Char4 type,
int id)
|
SortBlock |
createSortBlock()
|
abstract void |
deleteAllRecords()
Delete ALL records in the database. |
abstract void |
deleteAllResources()
Delete ALL resources. |
abstract void |
deleteCategory(int category)
Delete all records from a specified category |
abstract void |
deleteRecord(RecordID uid)
Delete the record with the specified UID from the database. |
abstract void |
deleteResource(Char4 type,
int id)
|
protected void |
finalize()
|
abstract AppBlock |
getAppBlock()
|
abstract DBInfo |
getDBInfo()
Return meta-information about the Database Caution! |
abstract Record |
getNextModifiedRecord()
|
abstract Record |
getNextModifiedRecord(int category)
|
abstract Record |
getNextRecord(int category)
|
Pref |
getPref(int id)
|
abstract Pref |
getPref(int id,
boolean backed_up)
Get one of the preferences which are associated with the same app as the database. |
abstract Record |
getRecord(int index)
|
abstract Record |
getRecord(RecordID uid)
|
abstract int |
getRecordCount()
Return the number of records in the Database |
RecordID[] |
getRecordIDs()
Return the UIDs of all records in the DB, in an unsorted fashion. |
RecordID[] |
getRecordIDs(boolean sort)
Return the UIDs of all records in the DB. |
RecordID[] |
getRecordIDs(boolean sort,
int start)
Return the UIDs of selected records in the DB. |
abstract RecordID[] |
getRecordIDs(boolean sort,
int start,
int max)
Return the UIDs of selected records in the DB. |
abstract Resource |
getResource(Char4 type,
int id)
|
abstract Resource |
getResource(int index)
|
abstract SortBlock |
getSortBlock()
|
abstract void |
moveCategory(int from,
int to)
|
abstract void |
moveRecord(int from,
int to)
Move a record from one position to another. |
abstract void |
purgeRecords()
Deletes all records which are marked as archived or deleted |
abstract void |
putRecord(Record record)
Writes a record to the database. |
abstract void |
putResource(Resource resource)
|
abstract void |
resetFlags()
For record databases, reset all dirty flags. |
abstract void |
resetNext()
Resets the "next record" index to the beginning |
abstract void |
setAppBlock(AppBlock appblock)
|
abstract void |
setPref(Pref pref)
Store a Pref which is associated with the same app as the database to the database. |
abstract void |
setSortBlock(SortBlock sortblock)
|
| Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
protected DatabaseImpl _dbimpl
protected Char4 _creator
protected java.lang.String _dbname
protected int _dbmode
| Constructor Detail |
public DatabaseBase()
| Method Detail |
public abstract AppBlock getAppBlock()
throws DatabaseException
public abstract void setAppBlock(AppBlock appblock)
throws DatabaseException
public AppBlock createAppBlock()
public abstract SortBlock getSortBlock()
throws DatabaseException
public abstract void setSortBlock(SortBlock sortblock)
throws DatabaseException
public SortBlock createSortBlock()
public abstract Record getRecord(int index)
throws DatabaseException
public abstract Record getRecord(RecordID uid)
throws DatabaseException
public abstract Record getNextRecord(int category)
throws DatabaseException
public abstract Record getNextModifiedRecord()
throws DatabaseException
public abstract Record getNextModifiedRecord(int category)
throws DatabaseException
public abstract void resetNext()
throws DatabaseException
public abstract void putRecord(Record record)
throws DatabaseException
public Record createRecord()
public Record createRecord(RecordID id)
public Record createRecord(byte[] contents,
RecordID id,
int index,
int attr,
int cat)
public abstract void deleteRecord(RecordID uid)
throws DatabaseException
uid - the UID (not the index!) of the record
public abstract void deleteAllRecords()
throws DatabaseException
public abstract void deleteCategory(int category)
throws DatabaseException
category - the category
public abstract void moveCategory(int from,
int to)
throws DatabaseException
public RecordID[] getRecordIDs()
throws DatabaseException
public RecordID[] getRecordIDs(boolean sort)
throws DatabaseException
public RecordID[] getRecordIDs(boolean sort,
int start)
throws DatabaseException
public abstract RecordID[] getRecordIDs(boolean sort,
int start,
int max)
throws DatabaseException
public abstract void purgeRecords()
throws DatabaseException
public abstract void moveRecord(int from,
int to)
throws DatabaseException
Caution: The DL protocol has no official means to accomplish this! This method therefore uses some undocumented magic (RPC), which is broken when being used with Network HotSync, and may be even more broken with future devices!!!
public Resource createResource()
public Resource createResource(Char4 type,
int id)
public Resource createResource(byte[] contents,
Char4 type,
int id,
int index)
public abstract Resource getResource(int index)
throws DatabaseException
public abstract Resource getResource(Char4 type,
int id)
throws DatabaseException
public abstract void putResource(Resource resource)
throws DatabaseException
public abstract void deleteResource(Char4 type,
int id)
throws DatabaseException
public abstract void deleteAllResources()
throws DatabaseException
public Pref getPref(int id)
throws DatabaseException,
NoCreatorException
public abstract Pref getPref(int id,
boolean backed_up)
throws DatabaseException,
NoCreatorException
public abstract void setPref(Pref pref)
throws DatabaseException
public Pref createPref(int id)
public Pref createPref(int id,
int version,
boolean backed_up)
public abstract void close()
throws DatabaseException
public abstract void resetFlags()
throws DatabaseException
public abstract int getRecordCount()
throws DatabaseException
public abstract DBInfo getDBInfo()
throws DatabaseException
protected void finalize()
throws DatabaseException
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||