|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectde.unikassel.android.sdcframework.persistence.AbstractDatabaseCommand<T>
T - the result type of the commandpublic abstract class AbstractDatabaseCommand<T>
Abstract base class for database commands. It does allow homogeneous command
execution using a database adapter, as well as a basic handling of open
errors and exceptions.
Any extending concrete command class has to implement the abstract protected
applyCommand(DatabaseAdapter) method, to implement the concrete
command behavior on an open database.
| Field Summary | |
|---|---|
private int |
dbOpenRetryCount
The count of retries if we fail to open the database |
static int |
DEFAULT_DB_OPEN_RETRY_COUNT
The default value for the count of repeated tries to open the database |
private boolean |
openReadOnly
The database open access flag |
private T |
result
The command execution result |
| Constructor Summary | |
|---|---|
AbstractDatabaseCommand(boolean openReadOnly)
Constructor |
|
AbstractDatabaseCommand(boolean openReadOnly,
int dbOpenRetryCount)
Constructor |
|
| Method Summary | |
|---|---|
protected abstract T |
applyCommand(DatabaseAdapter dbAdapter)
Method to apply the basic database command operation. |
boolean |
execute(DatabaseAdapter dbAdapter)
Method to execute the command |
int |
getDbOpenRetryCount()
Getter for the dbOpenRetryCount |
T |
getResult()
Getter for the result |
protected void |
internalExecute(DatabaseAdapter dbAdapter)
Internal method to execute the command and store the result |
boolean |
isOpenReadOnly()
Getter for the openReadOnly flag |
private void |
onSQLException(SQLException e)
SQLException handler |
private boolean |
openDatabase(DatabaseAdapter dbAdapter)
Method to open the database |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_DB_OPEN_RETRY_COUNT
private final int dbOpenRetryCount
private final boolean openReadOnly
private T result
| Constructor Detail |
|---|
public AbstractDatabaseCommand(boolean openReadOnly,
int dbOpenRetryCount)
openReadOnly - flag if database can be open read only to execute the commanddbOpenRetryCount - retry count for database open commandpublic AbstractDatabaseCommand(boolean openReadOnly)
openReadOnly - flag if database can be open read only to execute the command| Method Detail |
|---|
public final T getResult()
DatabaseCommand
getResult in interface DatabaseCommand<T>public final int getDbOpenRetryCount()
public final boolean isOpenReadOnly()
protected final void internalExecute(DatabaseAdapter dbAdapter)
throws SQLiteFullException
dbAdapter - the database adapter to use for execution
SQLiteFullException - if command execution fails due to the fact that the database is
fullprivate boolean openDatabase(DatabaseAdapter dbAdapter)
dbAdapter - the database adapter result success true if successful
public boolean execute(DatabaseAdapter dbAdapter)
throws SQLiteFullException
DatabaseCommand
execute in interface DatabaseCommand<T>dbAdapter - the database adapter to use for execution
SQLiteFullException - if command execution fails due to the fact that the database is
fullprotected abstract T applyCommand(DatabaseAdapter dbAdapter)
dbAdapter - the database adapter to use
private void onSQLException(SQLException e)
e - the exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||