public abstract class AbstractDatabase extends Object implements Database
Database
, it allows to manage DatabaseListeners
.Modifier and Type | Field and Description |
---|---|
protected org.apache.log4j.Logger |
logger
Deprecated.
(2.10.0) Use
getLogger() instead. |
DB_TYPE_HSQLDB
Constructor and Description |
---|
AbstractDatabase() |
Modifier and Type | Method and Description |
---|---|
void |
addDatabaseListener(DatabaseListener listener) |
void |
close(boolean compact)
Closes the database.
|
void |
close(boolean compact,
boolean cleanup)
Closes the database.
|
protected List<DatabaseListener> |
getDatabaseListeners()
Gets the database listeners added.
|
protected org.apache.logging.log4j.Logger |
getLogger()
Gets the logger.
|
protected void |
notifyListenersDatabaseOpen(Collection<DatabaseListener> listeners,
DatabaseServer databaseServer)
Notifies the given listeners that the given database server was opened.
|
protected void |
notifyListenersDatabaseOpen(DatabaseServer databaseServer)
Notifies the database listeners added that the given database server was opened.
|
void |
removeDatabaseListener(DatabaseListener listener) |
protected void |
removeDatabaseListeners()
Removes all database listeners added.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
deleteSession, discardSession, getDatabaseServer, getTableAlert, getTableContext, getTableHistory, getTableParam, getTableScan, getTableSession, getTableSessionUrl, getTableStructure, getTableTag, getType, open, setTableAlert, setTableScan, setTableSessionUrl, setTableTag
@Deprecated protected final org.apache.log4j.Logger logger
getLogger()
instead.protected org.apache.logging.log4j.Logger getLogger()
null
.protected List<DatabaseListener> getDatabaseListeners()
addDatabaseListener(DatabaseListener)
public void addDatabaseListener(DatabaseListener listener)
addDatabaseListener
in interface Database
public void removeDatabaseListener(DatabaseListener listener)
removeDatabaseListener
in interface Database
public void close(boolean compact)
Database
compact
is true
, the database will be
compacted, compacting the database ensures a minimal space disk usage but it will also take
longer to close. Any necessary cleanups are performed prior to closing the database (the
cleanup removes the temporary HistoryReference
s).
Note: Calling this method has the same effects as calling the method Database.close(boolean, boolean)
with the parameter cleanup
as true
.
close
in interface Database
compact
- true
if the database should be compacted, false
otherwise.HistoryReference
public void close(boolean compact, boolean cleanup)
compact
is true
, the database will be
compacted, compacting the database ensures a minimal space disk usage but it will also take
longer to close. If the parameter cleanup
is true
any necessary cleanups are
performed prior to closing the database (the cleanup removes the temporary HistoryReference
s.)
Also, removes the database listeners added previously.
close
in interface Database
compact
- true
if the database should be compacted, false
otherwise.cleanup
- true
if any necessary cleanups should be performed, false
otherwise.HistoryReference
protected void removeDatabaseListeners()
removeDatabaseListener(DatabaseListener)
protected void notifyListenersDatabaseOpen(Collection<DatabaseListener> listeners, DatabaseServer databaseServer) throws DatabaseException
listeners
- the listeners that will be notifieddatabaseServer
- the database server that was openedDatabaseException
- if an error occurred while notifying the database listeners.protected void notifyListenersDatabaseOpen(DatabaseServer databaseServer) throws DatabaseException
databaseServer
- the database server that was openedDatabaseException
- if an error occurred while notifying the database listeners.