public abstract class DbConsumer extends AutocloseConsumer implements Closeable
| Modifier and Type | Field and Description |
|---|---|
static int |
BENCHMARK_ROUNDS |
static int |
CLASSNAME |
static int |
GC_AVG |
static int |
GC_INVOCATIONS |
static int |
GC_STDDEV |
static int |
GC_TIME |
static int |
NAME |
static int |
ROUND_AVG |
static int |
ROUND_STDDEV |
static int |
RUN_ID |
static int |
TIME_BENCHMARK |
static int |
TIME_WARMUP |
static int |
WARMUP_ROUNDS |
| Constructor and Description |
|---|
DbConsumer(File chartsDir,
String customKeyValue)
Creates a new DbConsumer.
|
| Modifier and Type | Method and Description |
|---|---|
void |
accept(Result result)
Accept a single benchmark result.
|
protected void |
checkSchema()
Check database schema and create it if needed.
|
void |
close()
Close the database connection and finalize transaction.
|
protected abstract Connection |
createConnection()
Instantiates the database connection.
|
protected abstract String |
getAddCustomKeySql()
Gets the SQL for adding a custom key.
|
File |
getChartsDir()
Gets the charts directory.
|
Connection |
getConnection()
Gets the connection, instantiating it if necessary.
|
protected abstract String |
getCreateDbVersionSql()
Gets the SQL for creating the DB Version table.
|
protected abstract String |
getCreateRunsSql()
Gets the SQL for creating the runs table.
|
protected abstract String |
getCreateTestsSql()
Gets the SQL for creating the tests table.
|
String |
getCustomKeyValue()
Gets the custom key value.
|
DbVersions |
getDbVersion()
Retrieve DB version.
|
static File |
getDefaultChartsDir()
Gets the default charts directory
|
static String |
getDefaultCustomKey()
Gets the default custom key.
|
String |
getHistoryHtmlTemplate()
Gets the history HTML template.
|
abstract String |
getMethodChartPropertiesQuery()
Gets the SQL for obtaining method chart properties.
|
abstract String |
getMethodChartResultsQuery()
Gets the SQL for obtaining method chart results.
|
String |
getMethodHtmlTemplate()
Gets the method HTML template.
|
protected abstract String |
getNewRunSql()
Gets the SQL for inserting into the runs table.
|
protected static String |
getResource(Class<?> c,
String resourceName)
Read a given resource from classpath and return UTF-8 decoded string.
|
int |
getRunId()
Gets the run ID, lazy-loading it if it was not already read.
|
protected abstract String |
getTestInsertSql()
Gets the SQL for inserting into the test table.
|
protected PreparedStatement |
getTestInsertStatement()
Lazy-loads the test insert statement.
|
void |
rollback()
Rollback all performed operations on request.
|
addAutoclose, removeAutoclosepublic static final int RUN_ID
public static final int CLASSNAME
public static final int NAME
public static final int BENCHMARK_ROUNDS
public static final int WARMUP_ROUNDS
public static final int ROUND_AVG
public static final int ROUND_STDDEV
public static final int GC_AVG
public static final int GC_STDDEV
public static final int GC_INVOCATIONS
public static final int GC_TIME
public static final int TIME_BENCHMARK
public static final int TIME_WARMUP
public void accept(Result result)
accept in interface IResultsConsumerpublic void close()
close in interface Closeableclose in interface AutoCloseablepublic void rollback()
public DbVersions getDbVersion() throws SQLException
SQLExceptionprotected static String getResource(Class<?> c, String resourceName)
public static String getDefaultCustomKey()
public static File getDefaultChartsDir()
protected void checkSchema()
throws SQLException
SQLExceptionpublic Connection getConnection() throws SQLException
SQLExceptionpublic String getCustomKeyValue()
public File getChartsDir()
public String getHistoryHtmlTemplate()
public String getMethodHtmlTemplate()
public int getRunId()
throws SQLException
SQLException - if the run ID cannot be determinedprotected PreparedStatement getTestInsertStatement() throws SQLException
SQLException - if the test insert statement cannot be createdpublic abstract String getMethodChartPropertiesQuery()
public abstract String getMethodChartResultsQuery()
protected abstract String getCreateTestsSql()
protected abstract String getTestInsertSql()
protected abstract String getCreateRunsSql()
protected abstract String getNewRunSql()
protected abstract String getCreateDbVersionSql()
protected abstract String getAddCustomKeySql()
protected abstract Connection createConnection() throws SQLException
SQLException - if the database connection cannot be createdCopyright © 2016 SciJava. All rights reserved.