Class HsqlDbManager
java.lang.Object
com.inductiveautomation.ignition.gateway.localdb.hsql.HsqlDbManager
- All Implemented Interfaces:
- DBManager
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected intNumber of auto-backups to keep, if autoBackupsEnabled is trueprotected intDelay, in minutes, between checking if an auto-backup is necessary.protected Fileprotected booleanWhether or not to use any autobackups.protected GatewayContextprotected CountingDataSourceWhen 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 FileThe home directory that the database lives inprotected StringThe name of the HSQLDB databaseprotected intDelay, in minutes, between defragmentation.protected intNumber of faulted copies to keepprotected LoggerExstatic final Stringprotected booleanFlag that will be set true when this managaer was started up with no database and created an initial one on connect()protected StringThe password for the "sa" user for the database
- 
Constructor SummaryConstructorsConstructorDescriptionHsqlDbManager(GatewayContext context, File dbDir, String dbName, String password) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidarchiveDatabaseTo(String folderName, boolean clear) backupDatabase(File targetFolder, String baseFilename) Creates a single-file backup of the internal db in the specified folder.voidprotected Propertiesprotected Stringdesc()intintlongCalculates the harddrive footprint of the files that make up this HSQLDB instance.Returns the driver for the DBManager.intvoidbooleanbooleanbooleanprotected LoggerExprotected voidonConnected(DataSource datasource) Called after we have been successfully connected to an HSQLDB database.protected voidonCreateInitial(Statement stmt) Called on creation of a new database, after the password has been set.protected voidvoidrestoreFromDBBackup(File dbBackupTarball) Deletes the database files and extracts the tarball into the database home directory.voidsetAutoBackupCount(int autoBackupCount) voidsetAutoBackupDelay(int autoBackupDelay) voidsetAutoBackupDir(File autoBackupDir) voidsetAutoBackupsEnabled(boolean autoBackupsEnabled) voidsetDefragDelay(int defragDelayMin) voidsetFaultCount(int faultCount) voidshutdown()voidshutdown(boolean compact) voidstartup()
- 
Field Details- 
LOGGER_NAME- See Also:
 
- 
context
- 
dbDirThe home directory that the database lives in
- 
autoBackupDir
- 
dbNameThe name of the HSQLDB database
- 
faultCountprotected int faultCountNumber of faulted copies to keep
- 
autoBackupCountprotected int autoBackupCountNumber of auto-backups to keep, if autoBackupsEnabled is true
- 
autoBackupDelayprotected int autoBackupDelayDelay, in minutes, between checking if an auto-backup is necessary.
- 
defragDelayprotected int defragDelayDelay, in minutes, between defragmentation. If 0, defrag checkpoints will not be executed. *
- 
autoBackupsEnabledprotected boolean autoBackupsEnabledWhether 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.
- 
passwordThe password for the "sa" user for the database
- 
datasourceWhen 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 newDatabaseFlag that will be set true when this managaer was started up with no database and created an initial one on connect()
- 
log
 
- 
- 
Constructor Details- 
HsqlDbManager
 
- 
- 
Method Details- 
initDriver- Throws:
- DBStartupException
 
- 
newLogger
- 
createConnectionProps
- 
startup- Specified by:
- startupin interface- DBManager
- Throws:
- DBStartupException
 
- 
archiveDatabaseTo- Throws:
- Exception
 
- 
getDataSource- Specified by:
- getDataSourcein interface- DBManager
 
- 
checkpointpublic void checkpoint()
- 
onCreateInitialCalled on creation of a new database, after the password has been set.- Throws:
- SQLException
 
- 
onConnectedCalled after we have been successfully connected to an HSQLDB database. A CHECKPOINT will be issued after this completes.- Throws:
- SQLException
 
- 
onShutdownprotected void onShutdown()
- 
desc
- 
restoreFromDBBackupDeletes the database files and extracts the tarball into the database home directory.- Specified by:
- restoreFromDBBackupin interface- DBManager
- Throws:
- IOException
 
- 
backupDatabaseDescription 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:
- IOException
 
- 
isRunningpublic boolean isRunning()
- 
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
 
- 
shutdownpublic void shutdown(boolean compact) 
- 
getAutoBackupDir
- 
setAutoBackupDir
- 
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
 
- 
getFlavor
- 
getDriverDescription copied from interface:DBManagerReturns the driver for the DBManager. Important: the driver holds a session, so a new instance should be created each time.
- 
createTable- Specified by:
- createTablein interface- DBManager
 
 
-