use of com.abubusoft.kripton.android.sqlite.DataSourceOptions in project kripton by xcesco.
the class BindPersonDataSource method instance.
/**
* <p>Retrieve instance.</p>
*/
public static BindPersonDataSource instance() {
BindPersonDataSource result = instance;
if (result == null) {
synchronized (mutex) {
result = instance;
if (result == null) {
DataSourceOptions options = DataSourceOptions.builder().inMemory(false).log(true).build();
instance = result = new BindPersonDataSource(options);
SQLiteDatabase database = instance.openWritableDatabase();
try {
} catch (Throwable e) {
Logger.error(e.getMessage());
e.printStackTrace();
} finally {
instance.close();
}
}
}
}
return result;
}
use of com.abubusoft.kripton.android.sqlite.DataSourceOptions in project kripton by xcesco.
the class BindSampleDataSource method instance.
/**
* <p>Retrieve instance.</p>
*/
public static BindSampleDataSource instance() {
BindSampleDataSource result = instance;
if (result == null) {
synchronized (mutex) {
result = instance;
if (result == null) {
DataSourceOptions options = DataSourceOptions.builder().populator(new SamplePopulator()).inMemory(false).log(true).addUpdateTask(1, new SampleUpdate02()).build();
instance = result = new BindSampleDataSource(options);
SQLiteDatabase database = instance.openWritableDatabase();
try {
// force database DDL run
if (options.populator != null && instance.justCreated) {
// run populator
options.populator.execute(database);
}
} catch (Throwable e) {
Logger.error(e.getMessage());
e.printStackTrace();
} finally {
instance.close();
}
}
}
}
return result;
}
use of com.abubusoft.kripton.android.sqlite.DataSourceOptions in project kripton by xcesco.
the class BindAppWithConfigDataSource method instance.
/**
* <p>Retrieve instance.</p>
*/
public static BindAppWithConfigDataSource instance() {
BindAppWithConfigDataSource result = instance;
if (result == null) {
synchronized (mutex) {
result = instance;
if (result == null) {
DataSourceOptions options = DataSourceOptions.builder().cursorFactory(new PersonCursorFactory()).databaseLifecycleHandler(new PersonLifecycleHandler()).populator(new PersonPopulator()).inMemory(false).log(true).addUpdateTask(2, new PersonUpdateTask()).build();
instance = result = new BindAppWithConfigDataSource(options);
SQLiteDatabase database = instance.openWritableDatabase();
try {
// force database DDL run
if (options.populator != null && instance.justCreated) {
// run populator
options.populator.execute(database);
}
} catch (Throwable e) {
Logger.error(e.getMessage());
e.printStackTrace();
} finally {
instance.close();
}
}
}
}
return result;
}
use of com.abubusoft.kripton.android.sqlite.DataSourceOptions in project kripton by xcesco.
the class BindPerson2DataSource method instance.
/**
* <p>Retrieve instance.</p>
*/
public static BindPerson2DataSource instance() {
BindPerson2DataSource result = instance;
if (result == null) {
synchronized (mutex) {
result = instance;
if (result == null) {
DataSourceOptions options = DataSourceOptions.builder().inMemory(false).log(true).build();
instance = result = new BindPerson2DataSource(options);
SQLiteDatabase database = instance.openWritableDatabase();
try {
} catch (Throwable e) {
Logger.error(e.getMessage());
e.printStackTrace();
} finally {
instance.close();
}
}
}
}
return result;
}
use of com.abubusoft.kripton.android.sqlite.DataSourceOptions in project kripton by xcesco.
the class BindPerson2DataSource method instance.
/**
* <p>Retrieve instance.</p>
*/
public static BindPerson2DataSource instance() {
BindPerson2DataSource result = instance;
if (result == null) {
synchronized (mutex) {
result = instance;
if (result == null) {
DataSourceOptions options = DataSourceOptions.builder().inMemory(false).log(true).build();
instance = result = new BindPerson2DataSource(options);
SQLiteDatabase database = instance.openWritableDatabase();
try {
} catch (Throwable e) {
Logger.error(e.getMessage());
e.printStackTrace();
} finally {
instance.close();
}
}
}
}
return result;
}
Aggregations