|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--danger.app.DataStore
| Field Summary | |
static boolean |
DEBUG_AUTO_SYNC
|
static boolean |
DEBUG_AUTO_SYNC_UID
|
static int |
kAutoSyncWaitForConfirm
|
static int |
kRecordFlagMask
|
static int |
kRecordModified
System Record flags |
| Constructor Summary | |
protected |
DataStore()
DataStores may not be directly created or destroyed |
| Method Summary | |
int |
addRecord(byte[] data)
Add a new record with flags=0, return its number |
int |
addRecord(byte[] data,
int flags)
Add a new record, return its number |
int |
addRecord(byte[] data,
int flags,
int uid)
Add a new record, return its number |
static void |
allowAutoSyncToService(boolean flag)
|
boolean |
autoSync()
|
protected void |
autoSync(boolean flag)
|
void |
autoSyncFromServiceDone()
resolve the positive and negative UIDs |
static boolean |
autoSyncToService()
|
protected void |
autoSyncWaitForConfirm(int n,
boolean flag)
Check if the nth record needs to be confirmed for autosync |
int |
binarySearch(java.util.Comparator inComparator,
byte[] inKey)
|
int |
binarySearch(int inUID)
|
protected int |
binarySearchFaster(java.util.Comparator inComparator,
byte[] inKey)
|
protected int |
binarySearchFaster(int inUID)
|
static DataStore |
createDataStore(java.lang.String name)
|
static DataStore |
createDataStore(java.lang.String name,
boolean autoSync)
|
static DataStore |
createDataStore(java.lang.String name,
boolean autoSync,
boolean isFullName)
Create a new DataStore by name. |
static DataStore |
createSharedDataStore(java.lang.String name)
Create a new shared DataStore by name. |
static DataStore |
createSharedDataStore(java.lang.String name,
boolean autoSync)
|
static void |
discardAllOnReboot()
|
void |
discardOnReboot(boolean flag)
|
void |
doneResolvingConflict()
|
static void |
dumpList()
|
static DataStore |
findDataStore(java.lang.String name)
Locate a DataStore by name. |
static DataStore |
findDataStore(java.lang.String name,
boolean isFullPath)
Locate a DataStore by name. |
static DataStore |
findSharedDataStore(java.lang.String name)
Locate a shared DataStore by name. |
int |
getByteSize()
|
int |
getBytesUsed()
|
java.lang.String |
getFullName()
Returns the full name of the database (which will be slightly different than the name an app uses to find the database) |
int |
getLastModified()
Get the time the database was last modified. |
int |
getLastSynced()
Obtain the time the database was last synced. |
int |
getRecordCount()
Obtain the number of records in the datastore |
byte[] |
getRecordData(int n)
obtain the byte array containing the data of record #n or null if record n is out of range or empty |
byte[] |
getRecordDataByUID(int uid)
|
int |
getRecordFlags(int n)
Obtain the flags of record n or 0 if n is an invalid number |
int |
getRecordIndexByUID(int uid)
|
byte[][] |
getRecords()
obtain an array of byte arrays for all records |
int |
getRecordUID(int n)
Obtain the uid for the nth record |
int |
getVersion()
|
int |
insertRecord(byte[] data,
int index)
Insert a new record |
int |
insertRecord(byte[] data,
int index,
int flags)
Insert a new record |
int |
insertRecordSorted(java.util.Comparator inComparator,
byte[] inItem)
|
int |
insertRecordSorted(int inUID,
byte[] inItem)
|
boolean |
isRecordDirty(int n)
Check if the nth record is dirty |
static void |
processBackingStoreResponse(danger.io.BackingStoreTransaction bt)
|
static void |
recoverDataStores()
only used during system startup |
void |
removeAllRecords()
Remove all records. |
void |
removeRecord(int n)
Remove record #n, causes records after that to renumber |
void |
removeRecordByUID(int uid)
|
void |
removeRecordWithoutAutoSync(int n)
|
protected void |
requestAutoSync()
|
void |
setAutoSyncNotifyee(Listener inNotifyee)
|
void |
setRecordData(int n,
byte[] data)
Replace the data of record #n with the provided byte array. |
void |
setRecordData(int n,
byte[] data,
boolean makeDirty)
Replace the data of record #n with the provided byte array. |
void |
setRecordDataByUID(int uid,
byte[] data)
|
void |
setRecordDataByUID(int uid,
byte[] data,
boolean makeDirty)
|
void |
setRecordDirty(int n,
boolean flag)
set nth record's dirty bit |
void |
setRecordFlags(int n,
int flags)
Replace the flags of record #n with the provided int. |
void |
setRecordFlagsByUID(int uid,
int flags)
Replace the flags of record #n with the provided int. |
void |
setRecordUID(int n,
int uid)
set the nth record's uid |
void |
setVersion(int inVersion)
|
void |
sort(java.util.Comparator comparator)
|
void |
sortByUID()
|
void |
swapRecords(int this_rec,
int that_rec)
Exchange the data and flags of this_rec with that_rec. |
void |
updateLastModified()
Set Last Modified time to current system time |
void |
updateLastSynced()
Set Last Synced time to current system time |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int kRecordModified
public static final int kAutoSyncWaitForConfirm
public static final int kRecordFlagMask
public static final boolean DEBUG_AUTO_SYNC
public static final boolean DEBUG_AUTO_SYNC_UID
| Constructor Detail |
protected DataStore()
| Method Detail |
public static DataStore createDataStore(java.lang.String name,
boolean autoSync,
boolean isFullName)
public static void dumpList()
public static void discardAllOnReboot()
public static DataStore createDataStore(java.lang.String name)
public static DataStore createDataStore(java.lang.String name,
boolean autoSync)
public static DataStore createSharedDataStore(java.lang.String name)
public static DataStore createSharedDataStore(java.lang.String name,
boolean autoSync)
public static void recoverDataStores()
public static DataStore findDataStore(java.lang.String name)
public static DataStore findDataStore(java.lang.String name,
boolean isFullPath)
name - A string that specifies the datastore name.isFullPath - A boolean that specifies whether the datastore name is the full path.public static DataStore findSharedDataStore(java.lang.String name)
public void setVersion(int inVersion)
public int getVersion()
public static boolean autoSyncToService()
public static void processBackingStoreResponse(danger.io.BackingStoreTransaction bt)
public int getRecordCount()
public int getLastModified()
public int getLastSynced()
public java.lang.String getFullName()
public void updateLastModified()
public void updateLastSynced()
public void discardOnReboot(boolean flag)
public boolean autoSync()
protected void autoSync(boolean flag)
protected void requestAutoSync()
public int addRecord(byte[] data)
public int addRecord(byte[] data,
int flags)
public int addRecord(byte[] data,
int flags,
int uid)
public int insertRecord(byte[] data,
int index)
public int insertRecord(byte[] data,
int index,
int flags)
public void removeRecord(int n)
public void removeRecordWithoutAutoSync(int n)
public void removeRecordByUID(int uid)
public void removeAllRecords()
public byte[][] getRecords()
public byte[] getRecordData(int n)
public int getRecordIndexByUID(int uid)
public byte[] getRecordDataByUID(int uid)
public int getRecordFlags(int n)
public boolean isRecordDirty(int n)
public int getRecordUID(int n)
public void setRecordData(int n,
byte[] data)
public void setRecordData(int n,
byte[] data,
boolean makeDirty)
public void setRecordDataByUID(int uid,
byte[] data)
public void setRecordDataByUID(int uid,
byte[] data,
boolean makeDirty)
public void setRecordFlags(int n,
int flags)
public void setRecordFlagsByUID(int uid,
int flags)
public void setRecordDirty(int n,
boolean flag)
protected void autoSyncWaitForConfirm(int n,
boolean flag)
public void setRecordUID(int n,
int uid)
public void sort(java.util.Comparator comparator)
public void sortByUID()
public int insertRecordSorted(java.util.Comparator inComparator,
byte[] inItem)
public int insertRecordSorted(int inUID,
byte[] inItem)
public int binarySearch(int inUID)
public int binarySearch(java.util.Comparator inComparator,
byte[] inKey)
protected int binarySearchFaster(java.util.Comparator inComparator,
byte[] inKey)
protected int binarySearchFaster(int inUID)
public void swapRecords(int this_rec,
int that_rec)
public void autoSyncFromServiceDone()
public void doneResolvingConflict()
public void setAutoSyncNotifyee(Listener inNotifyee)
public static void allowAutoSyncToService(boolean flag)
public int getByteSize()
public int getBytesUsed()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||