|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.cruxframework.crux.core.client.db.AbstractDatabase
public abstract class AbstractDatabase
CRUX INTERNAL CLASS. DO NOT USE IT DIRECTLY. Base class for Crux databases. Use the interface Database to define your databases
| Field Summary | |
|---|---|
protected DatabaseErrorHandler |
errorHandler
|
protected static Logger |
logger
|
protected DBMessages |
messages
|
protected String |
name
|
protected int |
version
|
| Constructor Summary | |
|---|---|
AbstractDatabase()
|
|
| Method Summary | ||
|---|---|---|
|
add(List<V> objects,
String objectStoreName,
DatabaseCallback callback)
Insert all objects into its associated objectStore. |
|
|
add(V[] objects,
String objectStoreName,
DatabaseCallback callback)
Insert all objects into its associated objectStore. |
|
protected abstract Transaction |
createTransaction(String[] storeNames,
Transaction.Mode mode)
|
|
|
delete(KeyRange<K> keys,
String objectStoreName,
DatabaseCallback callback)
Remove all objects in the given range from its associated objectStore. |
|
|
delete(K key,
String objectStoreName,
DatabaseCallback callback)
Remove the object associated with the given key from its associated objectStore. |
|
protected abstract void |
doOpen(DatabaseCallback callback)
|
|
|
get(K key,
String objectStoreName,
DatabaseRetrieveCallback<V> callback)
Retrieve the object associated with the given key from its associated objectStore. |
|
String |
getName()
Retrieve the database name. |
|
Transaction |
getTransaction(String[] storeNames,
Transaction.Mode mode)
Create a new transaction targeting the given objectStores. |
|
Transaction |
getTransaction(String[] storeNames,
Transaction.Mode mode,
Transaction.TransactionCallback callback)
Create a new transaction targeting the given objectStores. |
|
int |
getVersion()
Retrieve the database version. |
|
void |
open(DatabaseCallback callback)
Open the database. |
|
|
put(List<V> objects,
String objectStoreName,
DatabaseCallback callback)
Update all received objects into its associated objectStore. |
|
|
put(V[] objects,
String objectStoreName,
DatabaseCallback callback)
Update all received objects into its associated objectStore. |
|
void |
setDefaultErrorHandler(DatabaseErrorHandler errorHandler)
Sets an error handler to be called to handle uncaught errors. |
|
void |
setName(String newName)
Change the database name. |
|
void |
setVersion(int newVersion)
Change the database version. |
|
void |
useIndexedDB()
Forces Crux to use Indexed DB implementation for its database. |
|
void |
useWebSQL()
Forces Crux to use WEB SQL implementation for its database. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.cruxframework.crux.core.client.db.Database |
|---|
close, delete, isOpen, isSupported |
| Field Detail |
|---|
protected static Logger logger
protected DBMessages messages
protected DatabaseErrorHandler errorHandler
protected String name
protected int version
| Constructor Detail |
|---|
public AbstractDatabase()
| Method Detail |
|---|
public String getName()
Database@DatabaseDef annotation
getName in interface Database
public void setName(String newName)
throws DatabaseException
Database
setName in interface DatabasenewName - new database name
DatabaseExceptionpublic int getVersion()
Database@DatabaseDef annotation
getVersion in interface Database
public void setVersion(int newVersion)
throws DatabaseException
Database
setVersion in interface DatabasenewVersion - new database version
DatabaseExceptionpublic void open(DatabaseCallback callback)
Database
open in interface Databasecallback - called when operation is completed
public Transaction getTransaction(String[] storeNames,
Transaction.Mode mode)
Database
getTransaction in interface DatabasestoreNames - stores referenced by the transaction. You can not use any object store inside your transaction if it is not listed here.mode - transaction mode. See Mode for available modes
public Transaction getTransaction(String[] storeNames,
Transaction.Mode mode,
Transaction.TransactionCallback callback)
Database
getTransaction in interface DatabasestoreNames - stores referenced by the transaction. You can not use any object store inside your transaction if it is not listed here.mode - transaction mode. See Mode for available modescallback - called when operation is completed
public <V> void add(V[] objects,
String objectStoreName,
DatabaseCallback callback)
DatabaseDatabaseException is threw
add in interface DatabaseV - object typeobjects - objects to be insertedobjectStoreName - object store name, where objects will be insertedcallback - called when operation is completed
public <V> void add(List<V> objects,
String objectStoreName,
DatabaseCallback callback)
DatabaseDatabaseException is threw
add in interface DatabaseV - object typeobjects - objects to be insertedobjectStoreName - object store name, where objects will be insertedcallback - called when operation is completed
public <V> void put(V[] objects,
String objectStoreName,
DatabaseCallback callback)
DatabaseDatabaseException is threw
put in interface DatabaseV - object typeobjects - objects to be savedobjectStoreName - object store name, where objects will be savedcallback - called when operation is completed
public <V> void put(List<V> objects,
String objectStoreName,
DatabaseCallback callback)
DatabaseDatabaseException is threw
put in interface DatabaseV - object typeobjects - objects to be savedobjectStoreName - object store name, where objects will be savedcallback - called when operation is completed
public <K,V> void get(K key,
String objectStoreName,
DatabaseRetrieveCallback<V> callback)
DatabaseDatabaseException is threw
get in interface DatabaseK - key typeV - object typekey - object keyobjectStoreName - object store name, where objects will be loaded fromcallback - called when operation is completed
public <K> void delete(K key,
String objectStoreName,
DatabaseCallback callback)
DatabaseDatabaseException is threw
delete in interface DatabaseK - key typekey - object keyobjectStoreName - object store name, where objects will be loaded fromcallback - called when operation is completed
public <K> void delete(KeyRange<K> keys,
String objectStoreName,
DatabaseCallback callback)
DatabaseDatabaseException is threw
delete in interface DatabaseK - key typekeys - object key rangeobjectStoreName - object store name, where objects will be loaded fromcallback - called when operation is completedpublic void setDefaultErrorHandler(DatabaseErrorHandler errorHandler)
Database
setDefaultErrorHandler in interface DatabaseerrorHandler - the error handlerpublic void useIndexedDB()
Database
useIndexedDB in interface Databasepublic void useWebSQL()
Database
useWebSQL in interface Databaseprotected abstract void doOpen(DatabaseCallback callback)
protected abstract Transaction createTransaction(String[] storeNames,
Transaction.Mode mode)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||