Modifier and Type | Field and Description |
---|---|
protected int |
autoBackupCount
Number of auto-backups to keep, if autoBackupsEnabled is true
|
protected int |
autoBackupDelay
Delay, in minutes, between checking if an auto-backup is necessary.
|
protected java.io.File |
autoBackupDir |
protected boolean |
autoBackupsEnabled
Whether or not to use any autobackups.
|
protected GatewayContext |
context |
protected CountingDataSource |
datasource
When this manager is connected, this will be a non-null reference to a javax.sql.DataSource that can be used to
get connections to the database
|
protected java.io.File |
dbDir
The home directory that the database lives in
|
protected java.lang.String |
dbName
The name of the HSQLDB database
|
protected int |
defragDelay
Delay, in minutes, between defragmentation.
|
protected int |
faultCount
Number of faulted copies to keep
|
protected LoggerEx |
log |
static java.lang.String |
LOGGER_NAME |
protected boolean |
newDatabase
Flag that will be set true when this managaer was started up with no database and created an initial one on
connect()
|
protected java.lang.String |
password
The password for the "sa" user for the database
|
Constructor and Description |
---|
HsqlDbManager(GatewayContext context,
java.io.File dbDir,
java.lang.String dbName,
java.lang.String password) |
Modifier and Type | Method and Description |
---|---|
void |
archiveDatabaseTo(java.lang.String folderName,
boolean clear) |
java.io.File |
backupDatabase(java.io.File targetFolder,
java.lang.String baseFilename)
Creates a single-file backup of the internal db in the specified folder.
|
void |
checkpoint() |
protected java.util.Properties |
createConnectionProps() |
Table |
createTable() |
protected java.lang.String |
desc() |
int |
getAutoBackupCount() |
int |
getAutoBackupDelay() |
java.io.File |
getAutoBackupDir() |
long |
getDatabaseSize()
Calculates the harddrive footprint of the files that make up this HSQLDB instance.
|
javax.sql.DataSource |
getDataSource() |
SDriver |
getDriver()
Returns the driver for the DBManager.
|
int |
getFaultCount() |
InternalDBFlavor |
getFlavor() |
void |
initDriver() |
boolean |
isAutoBackupsEnabled() |
boolean |
isNewDatabase() |
boolean |
isRunning() |
protected LoggerEx |
newLogger() |
protected void |
onConnected(javax.sql.DataSource datasource)
Called after we have been successfully connected to an HSQLDB database.
|
protected void |
onCreateInitial(java.sql.Statement stmt)
Called on creation of a new database, after the password has been set.
|
protected void |
onShutdown() |
void |
restoreFromDBBackup(java.io.File dbBackupTarball)
Deletes the database files and extracts the tarball into the database home directory.
|
void |
setAutoBackupCount(int autoBackupCount) |
void |
setAutoBackupDelay(int autoBackupDelay) |
void |
setAutoBackupDir(java.io.File autoBackupDir) |
void |
setAutoBackupsEnabled(boolean autoBackupsEnabled) |
void |
setDefragDelay(int defragDelayMin) |
void |
setFaultCount(int faultCount) |
void |
shutdown() |
void |
shutdown(boolean compact) |
void |
startup() |
public static final java.lang.String LOGGER_NAME
protected GatewayContext context
protected java.io.File dbDir
protected java.io.File autoBackupDir
protected java.lang.String dbName
protected int faultCount
protected int autoBackupCount
protected int autoBackupDelay
protected int defragDelay
protected boolean autoBackupsEnabled
protected java.lang.String password
protected CountingDataSource datasource
protected boolean newDatabase
protected LoggerEx log
public HsqlDbManager(GatewayContext context, java.io.File dbDir, java.lang.String dbName, java.lang.String password)
public void initDriver() throws DBStartupException
DBStartupException
protected LoggerEx newLogger()
protected java.util.Properties createConnectionProps()
public void startup() throws DBStartupException
startup
in interface DBManager
DBStartupException
public void archiveDatabaseTo(java.lang.String folderName, boolean clear) throws java.lang.Exception
java.lang.Exception
public javax.sql.DataSource getDataSource()
getDataSource
in interface DBManager
public void checkpoint()
protected void onCreateInitial(java.sql.Statement stmt) throws java.sql.SQLException
java.sql.SQLException
protected void onConnected(javax.sql.DataSource datasource) throws java.sql.SQLException
java.sql.SQLException
protected void onShutdown()
protected java.lang.String desc()
public void restoreFromDBBackup(java.io.File dbBackupTarball) throws java.io.IOException
restoreFromDBBackup
in interface DBManager
java.io.IOException
public java.io.File backupDatabase(java.io.File targetFolder, java.lang.String baseFilename) throws java.io.IOException
DBManager
backupDatabase
in interface DBManager
java.io.IOException
public boolean isNewDatabase()
isNewDatabase
in interface DBManager
public void shutdown()
public long getDatabaseSize()
getDatabaseSize
in interface DBManager
public java.io.File getAutoBackupDir()
public void setAutoBackupDir(java.io.File autoBackupDir)
public int getFaultCount()
public void setFaultCount(int faultCount)
setFaultCount
in interface DBManager
public int getAutoBackupCount()
public void setAutoBackupCount(int autoBackupCount)
setAutoBackupCount
in interface DBManager
public boolean isAutoBackupsEnabled()
public void setAutoBackupsEnabled(boolean autoBackupsEnabled)
setAutoBackupsEnabled
in interface DBManager
public int getAutoBackupDelay()
public void setAutoBackupDelay(int autoBackupDelay)
setAutoBackupDelay
in interface DBManager
public void setDefragDelay(int defragDelayMin)
setDefragDelay
in interface DBManager
public InternalDBFlavor getFlavor()
public SDriver getDriver()
DBManager
public Table createTable()
createTable
in interface DBManager