Package adams.db
Class AbstractDatabaseObjectWithOptionHandling
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.db.AbstractDatabaseObjectWithOptionHandling
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,PasswordSupporter,SizeOfHandler,DatabaseConnectionEstablisher,DatabaseConnectionHandler,DatabaseConnectionParameterHandler,DatabaseConnectionProvider,DatabaseConnectionUser,Serializable
public abstract class AbstractDatabaseObjectWithOptionHandling extends AbstractOptionHandler implements DatabaseConnectionHandler, DatabaseConnectionEstablisher, DatabaseConnectionParameterHandler
Abstract ancestor for classes that need to be able to change the database connection with commandline parameters.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractDatabaseConnectionm_dbcdatabase connection.protected booleanm_NoDatabaseConnectwhether to suppress connecting to the database.protected BasePasswordm_Passwordthe password of the database user.protected Stringm_URLthe JDBC URL to connect to.protected Stringm_Userthe database user to use for connecting.-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractDatabaseObjectWithOptionHandling()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected AbstractDatabaseConnectioncreateDatabaseConnection()Returns a new database connection object.voiddefineOptions()Adds options to the internal list of options.voidestablishDatabaseConnection()Establishes the database connection.AbstractDatabaseConnectiongetDatabaseConnection()Returns the current database connection.booleangetNoDatabaseConnect()Returns whether the database connection is suppressed or not.BasePasswordgetPassword()Returns the password of the database user.StringgetURL()Returns the database URL being used.StringgetUser()Returns the database user used for connecting.protected voidinitialize()initializes member variables.StringnoDatabaseConnectTipText()Returns the tip text for this property.StringpasswordTipText()Returns the tip text for this property.voidsetDatabaseConnection(AbstractDatabaseConnection value)Sets the database connection to use.voidsetNoDatabaseConnect(boolean value)Sets whether to suppress a database connection or not.voidsetPassword(BasePassword value)Sets the password of the database user.voidsetURL(String value)Sets the database URL.voidsetUser(String value)Sets the database user to use for connecting.StringURLTipText()Returns the tip text for this property.StringuserTipText()Returns the tip text for this property.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_dbc
protected transient AbstractDatabaseConnection m_dbc
database connection.
-
m_URL
protected String m_URL
the JDBC URL to connect to.
-
m_User
protected String m_User
the database user to use for connecting.
-
m_Password
protected BasePassword m_Password
the password of the database user.
-
m_NoDatabaseConnect
protected boolean m_NoDatabaseConnect
whether to suppress connecting to the database.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
initialize
protected void initialize()
initializes member variables.- Overrides:
initializein classAbstractOptionHandler
-
setDatabaseConnection
public void setDatabaseConnection(AbstractDatabaseConnection value)
Sets the database connection to use.- Specified by:
setDatabaseConnectionin interfaceDatabaseConnectionHandler- Parameters:
value- the database connection
-
getDatabaseConnection
public AbstractDatabaseConnection getDatabaseConnection()
Returns the current database connection.- Specified by:
getDatabaseConnectionin interfaceDatabaseConnectionProvider- Returns:
- the database connection
-
setURL
public void setURL(String value)
Sets the database URL.- Specified by:
setURLin interfaceDatabaseConnectionParameterHandler- Parameters:
value- the URL
-
getURL
public String getURL()
Returns the database URL being used.- Specified by:
getURLin interfaceDatabaseConnectionParameterHandler- Returns:
- the URL
-
URLTipText
public String URLTipText()
Returns the tip text for this property.- Specified by:
URLTipTextin interfaceDatabaseConnectionParameterHandler- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setUser
public void setUser(String value)
Sets the database user to use for connecting.- Specified by:
setUserin interfaceDatabaseConnectionParameterHandler- Parameters:
value- the user
-
getUser
public String getUser()
Returns the database user used for connecting.- Specified by:
getUserin interfaceDatabaseConnectionParameterHandler- Returns:
- the user
-
userTipText
public String userTipText()
Returns the tip text for this property.- Specified by:
userTipTextin interfaceDatabaseConnectionParameterHandler- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setPassword
public void setPassword(BasePassword value)
Sets the password of the database user.- Specified by:
setPasswordin interfaceDatabaseConnectionParameterHandler- Specified by:
setPasswordin interfacePasswordSupporter- Parameters:
value- the password
-
getPassword
public BasePassword getPassword()
Returns the password of the database user.- Specified by:
getPasswordin interfaceDatabaseConnectionParameterHandler- Specified by:
getPasswordin interfacePasswordSupporter- Returns:
- the password
-
passwordTipText
public String passwordTipText()
Returns the tip text for this property.- Specified by:
passwordTipTextin interfaceDatabaseConnectionParameterHandler- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setNoDatabaseConnect
public void setNoDatabaseConnect(boolean value)
Sets whether to suppress a database connection or not.- Parameters:
value- if true then no database connection will be established when establishDatabaseConnection() is called- See Also:
establishDatabaseConnection()
-
getNoDatabaseConnect
public boolean getNoDatabaseConnect()
Returns whether the database connection is suppressed or not.- Returns:
- true if no database connection is established when calling establishDatabaseConnection()
- See Also:
establishDatabaseConnection()
-
noDatabaseConnectTipText
public String noDatabaseConnectTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
createDatabaseConnection
protected AbstractDatabaseConnection createDatabaseConnection()
Returns a new database connection object.- Returns:
- the database connection object
-
establishDatabaseConnection
public void establishDatabaseConnection()
Establishes the database connection.- Specified by:
establishDatabaseConnectionin interfaceDatabaseConnectionEstablisher
-
-