Class HsqlDbManager
- java.lang.Object
- 
- com.inductiveautomation.ignition.gateway.localdb.hsql.HsqlDbManager
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected intautoBackupCountNumber of auto-backups to keep, if autoBackupsEnabled is trueprotected intautoBackupDelayDelay, in minutes, between checking if an auto-backup is necessary.protected java.io.FileautoBackupDirprotected booleanautoBackupsEnabledWhether or not to use any autobackups.protected GatewayContextcontextprotected CountingDataSourcedatasourceWhen 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 databaseprotected java.io.FiledbDirThe home directory that the database lives inprotected java.lang.StringdbNameThe name of the HSQLDB databaseprotected intdefragDelayDelay, in minutes, between defragmentation.protected intfaultCountNumber of faulted copies to keepprotected LoggerExlogstatic java.lang.StringLOGGER_NAMEprotected booleannewDatabaseFlag that will be set true when this managaer was started up with no database and created an initial one on connect()protected java.lang.StringpasswordThe password for the "sa" user for the database
 - 
Constructor SummaryConstructors Constructor Description HsqlDbManager(GatewayContext context, java.io.File dbDir, java.lang.String dbName, java.lang.String password)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidarchiveDatabaseTo(java.lang.String folderName, boolean clear)java.io.FilebackupDatabase(java.io.File targetFolder, java.lang.String baseFilename)Creates a single-file backup of the internal db in the specified folder.voidcheckpoint()protected java.util.PropertiescreateConnectionProps()TablecreateTable()protected java.lang.Stringdesc()intgetAutoBackupCount()intgetAutoBackupDelay()java.io.FilegetAutoBackupDir()longgetDatabaseSize()Calculates the harddrive footprint of the files that make up this HSQLDB instance.javax.sql.DataSourcegetDataSource()SDrivergetDriver()Returns the driver for the DBManager.intgetFaultCount()InternalDBFlavorgetFlavor()voidinitDriver()booleanisAutoBackupsEnabled()booleanisNewDatabase()booleanisRunning()protected LoggerExnewLogger()protected voidonConnected(javax.sql.DataSource datasource)Called after we have been successfully connected to an HSQLDB database.protected voidonCreateInitial(java.sql.Statement stmt)Called on creation of a new database, after the password has been set.protected voidonShutdown()voidrestoreFromDBBackup(java.io.File dbBackupTarball)Deletes the database files and extracts the tarball into the database home directory.voidsetAutoBackupCount(int autoBackupCount)voidsetAutoBackupDelay(int autoBackupDelay)voidsetAutoBackupDir(java.io.File autoBackupDir)voidsetAutoBackupsEnabled(boolean autoBackupsEnabled)voidsetDefragDelay(int defragDelayMin)voidsetFaultCount(int faultCount)voidshutdown()voidshutdown(boolean compact)voidstartup()
 
- 
- 
- 
Field Detail- 
LOGGER_NAMEpublic static final java.lang.String LOGGER_NAME - See Also:
- Constant Field Values
 
 - 
contextprotected GatewayContext context 
 - 
dbDirprotected java.io.File dbDir The home directory that the database lives in
 - 
autoBackupDirprotected java.io.File autoBackupDir 
 - 
dbNameprotected java.lang.String dbName The name of the HSQLDB database
 - 
faultCountprotected int faultCount Number of faulted copies to keep
 - 
autoBackupCountprotected int autoBackupCount Number of auto-backups to keep, if autoBackupsEnabled is true
 - 
autoBackupDelayprotected int autoBackupDelay Delay, in minutes, between checking if an auto-backup is necessary.
 - 
defragDelayprotected int defragDelay Delay, in minutes, between defragmentation. If 0, defrag checkpoints will not be executed. *
 - 
autoBackupsEnabledprotected boolean autoBackupsEnabled Whether or not to use any autobackups. Note that setting this to false doesn net prevent the creation of autobackups - for that you'd set autoBackupCount to zero.
 - 
passwordprotected java.lang.String password The password for the "sa" user for the database
 - 
datasourceprotected 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
 - 
newDatabaseprotected boolean newDatabase Flag that will be set true when this managaer was started up with no database and created an initial one on connect()
 - 
logprotected LoggerEx log 
 
- 
 - 
Constructor Detail- 
HsqlDbManagerpublic HsqlDbManager(GatewayContext context, java.io.File dbDir, java.lang.String dbName, java.lang.String password) 
 
- 
 - 
Method Detail- 
initDriverpublic void initDriver() throws DBStartupException- Throws:
- DBStartupException
 
 - 
newLoggerprotected LoggerEx newLogger() 
 - 
createConnectionPropsprotected java.util.Properties createConnectionProps() 
 - 
startuppublic void startup() throws DBStartupException- Specified by:
- startupin interface- DBManager
- Throws:
- DBStartupException
 
 - 
archiveDatabaseTopublic void archiveDatabaseTo(java.lang.String folderName, boolean clear) throws java.lang.Exception- Throws:
- java.lang.Exception
 
 - 
getDataSourcepublic javax.sql.DataSource getDataSource() - Specified by:
- getDataSourcein interface- DBManager
 
 - 
checkpointpublic void checkpoint() 
 - 
onCreateInitialprotected void onCreateInitial(java.sql.Statement stmt) throws java.sql.SQLExceptionCalled on creation of a new database, after the password has been set.- Throws:
- java.sql.SQLException
 
 - 
onConnectedprotected void onConnected(javax.sql.DataSource datasource) throws java.sql.SQLExceptionCalled after we have been successfully connected to an HSQLDB database. A CHECKPOINT will be issued after this completes.- Throws:
- java.sql.SQLException
 
 - 
onShutdownprotected void onShutdown() 
 - 
descprotected java.lang.String desc() 
 - 
restoreFromDBBackuppublic void restoreFromDBBackup(java.io.File dbBackupTarball) throws java.io.IOExceptionDeletes the database files and extracts the tarball into the database home directory.- Specified by:
- restoreFromDBBackupin interface- DBManager
- Throws:
- java.io.IOException
 
 - 
backupDatabasepublic java.io.File backupDatabase(java.io.File targetFolder, java.lang.String baseFilename) throws java.io.IOExceptionDescription copied from interface:DBManagerCreates a single-file backup of the internal db in the specified folder. The full path to the backup is returned. The filename should start with the base, but should then be identifiable by the specific db system.- Specified by:
- backupDatabasein interface- DBManager
- Throws:
- java.io.IOException
 
 - 
isNewDatabasepublic boolean isNewDatabase() - Specified by:
- isNewDatabasein interface- DBManager
 
 - 
shutdownpublic void shutdown() 
 - 
getDatabaseSizepublic long getDatabaseSize() Calculates the harddrive footprint of the files that make up this HSQLDB instance.- Specified by:
- getDatabaseSizein interface- DBManager
 
 - 
getAutoBackupDirpublic java.io.File getAutoBackupDir() 
 - 
setAutoBackupDirpublic void setAutoBackupDir(java.io.File autoBackupDir) 
 - 
getFaultCountpublic int getFaultCount() 
 - 
setFaultCountpublic void setFaultCount(int faultCount) - Specified by:
- setFaultCountin interface- DBManager
 
 - 
getAutoBackupCountpublic int getAutoBackupCount() 
 - 
setAutoBackupCountpublic void setAutoBackupCount(int autoBackupCount) - Specified by:
- setAutoBackupCountin interface- DBManager
 
 - 
isAutoBackupsEnabledpublic boolean isAutoBackupsEnabled() 
 - 
setAutoBackupsEnabledpublic void setAutoBackupsEnabled(boolean autoBackupsEnabled) - Specified by:
- setAutoBackupsEnabledin interface- DBManager
 
 - 
getAutoBackupDelaypublic int getAutoBackupDelay() 
 - 
setAutoBackupDelaypublic void setAutoBackupDelay(int autoBackupDelay) - Specified by:
- setAutoBackupDelayin interface- DBManager
 
 - 
setDefragDelaypublic void setDefragDelay(int defragDelayMin) - Specified by:
- setDefragDelayin interface- DBManager
 
 - 
getFlavorpublic InternalDBFlavor getFlavor() 
 - 
getDriverpublic SDriver getDriver() Description copied from interface:DBManagerReturns the driver for the DBManager. Important: the driver holds a session, so a new instance should be created each time.
 - 
createTablepublic Table createTable() - Specified by:
- createTablein interface- DBManager
 
 
- 
 
-