public abstract class AbstractDataSource extends Object implements AutoCloseable
Base class for data source
| Modifier and Type | Class and Description |
|---|---|
static interface |
AbstractDataSource.AbstractTransaction<E extends BindDaoFactory>
Interface for database transactions.
|
| Modifier and Type | Field and Description |
|---|---|
String |
name
|
protected DataSourceOptions |
options |
protected android.database.sqlite.SQLiteOpenHelper |
sqliteHelper |
protected ThreadLocal<com.abubusoft.kripton.android.sqlite.AbstractDataSource.TypeStatus> |
status |
protected int |
version
database version
|
protected boolean |
versionChanged
if true, database was update during this application run
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractDataSource(String name,
int version,
DataSourceOptions options) |
| Modifier and Type | Method and Description |
|---|---|
protected List<SQLiteUpdateTask> |
buildTaskList(int previousVersion,
int currentVersion) |
void |
close() |
protected void |
createHelper(DataSourceOptions options) |
android.database.sqlite.SQLiteDatabase |
database()
Return database object or runtimeexception if no database is opened.
|
protected SQLiteUpdateTask |
findPopulateTaskList(int currentVersion) |
int |
getVersion() |
boolean |
isOpen()
return true if database is already opened.
|
boolean |
isUpgradedVersion() |
abstract void |
onConfigure(android.database.sqlite.SQLiteDatabase database) |
abstract void |
onCreate(android.database.sqlite.SQLiteDatabase database) |
void |
onDowngrade(android.database.sqlite.SQLiteDatabase db,
int oldVersion,
int newVersion) |
void |
onUpgrade(android.database.sqlite.SQLiteDatabase db,
int oldVersion,
int newVersion) |
android.database.sqlite.SQLiteDatabase |
openReadOnlyDatabase()
Open a read only database.
|
android.database.sqlite.SQLiteDatabase |
openWritableDatabase()
open a writable database.
|
void |
setOptions(DataSourceOptions options)
Define options for data source.
|
public final String name
protected DataSourceOptions options
protected android.database.sqlite.SQLiteOpenHelper sqliteHelper
protected ThreadLocal<com.abubusoft.kripton.android.sqlite.AbstractDataSource.TypeStatus> status
protected boolean versionChanged
protected int version
database version
protected AbstractDataSource(String name, int version, DataSourceOptions options)
public int getVersion()
public void close()
close in interface AutoCloseableprotected SQLiteUpdateTask findPopulateTaskList(int currentVersion)
protected List<SQLiteUpdateTask> buildTaskList(int previousVersion, int currentVersion)
protected void createHelper(DataSourceOptions options)
public android.database.sqlite.SQLiteDatabase database()
Return database object or runtimeexception if no database is opened.
public boolean isOpen()
return true if database is already opened.
public boolean isUpgradedVersion()
public abstract void onConfigure(android.database.sqlite.SQLiteDatabase database)
public abstract void onCreate(android.database.sqlite.SQLiteDatabase database)
public void onDowngrade(android.database.sqlite.SQLiteDatabase db,
int oldVersion,
int newVersion)
public void onUpgrade(android.database.sqlite.SQLiteDatabase db,
int oldVersion,
int newVersion)
public android.database.sqlite.SQLiteDatabase openReadOnlyDatabase()
Open a read only database.
public android.database.sqlite.SQLiteDatabase openWritableDatabase()
open a writable database.
public void setOptions(DataSourceOptions options)
options - optionsCopyright © 2017. All rights reserved.