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 AbstractDatabaseConnection
m_dbc
database connection.protected boolean
m_NoDatabaseConnect
whether to suppress connecting to the database.protected BasePassword
m_Password
the password of the database user.protected String
m_URL
the JDBC URL to connect to.protected String
m_User
the 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 AbstractDatabaseConnection
createDatabaseConnection()
Returns a new database connection object.void
defineOptions()
Adds options to the internal list of options.void
establishDatabaseConnection()
Establishes the database connection.AbstractDatabaseConnection
getDatabaseConnection()
Returns the current database connection.boolean
getNoDatabaseConnect()
Returns whether the database connection is suppressed or not.BasePassword
getPassword()
Returns the password of the database user.String
getURL()
Returns the database URL being used.String
getUser()
Returns the database user used for connecting.protected void
initialize()
initializes member variables.String
noDatabaseConnectTipText()
Returns the tip text for this property.String
passwordTipText()
Returns the tip text for this property.void
setDatabaseConnection(AbstractDatabaseConnection value)
Sets the database connection to use.void
setNoDatabaseConnect(boolean value)
Sets whether to suppress a database connection or not.void
setPassword(BasePassword value)
Sets the password of the database user.void
setURL(String value)
Sets the database URL.void
setUser(String value)
Sets the database user to use for connecting.String
URLTipText()
Returns the tip text for this property.String
userTipText()
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:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
initialize
protected void initialize()
initializes member variables.- Overrides:
initialize
in classAbstractOptionHandler
-
setDatabaseConnection
public void setDatabaseConnection(AbstractDatabaseConnection value)
Sets the database connection to use.- Specified by:
setDatabaseConnection
in interfaceDatabaseConnectionHandler
- Parameters:
value
- the database connection
-
getDatabaseConnection
public AbstractDatabaseConnection getDatabaseConnection()
Returns the current database connection.- Specified by:
getDatabaseConnection
in interfaceDatabaseConnectionProvider
- Returns:
- the database connection
-
setURL
public void setURL(String value)
Sets the database URL.- Specified by:
setURL
in interfaceDatabaseConnectionParameterHandler
- Parameters:
value
- the URL
-
getURL
public String getURL()
Returns the database URL being used.- Specified by:
getURL
in interfaceDatabaseConnectionParameterHandler
- Returns:
- the URL
-
URLTipText
public String URLTipText()
Returns the tip text for this property.- Specified by:
URLTipText
in 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:
setUser
in interfaceDatabaseConnectionParameterHandler
- Parameters:
value
- the user
-
getUser
public String getUser()
Returns the database user used for connecting.- Specified by:
getUser
in interfaceDatabaseConnectionParameterHandler
- Returns:
- the user
-
userTipText
public String userTipText()
Returns the tip text for this property.- Specified by:
userTipText
in 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:
setPassword
in interfaceDatabaseConnectionParameterHandler
- Specified by:
setPassword
in interfacePasswordSupporter
- Parameters:
value
- the password
-
getPassword
public BasePassword getPassword()
Returns the password of the database user.- Specified by:
getPassword
in interfaceDatabaseConnectionParameterHandler
- Specified by:
getPassword
in interfacePasswordSupporter
- Returns:
- the password
-
passwordTipText
public String passwordTipText()
Returns the tip text for this property.- Specified by:
passwordTipText
in 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:
establishDatabaseConnection
in interfaceDatabaseConnectionEstablisher
-
-