Package adams.tools
Class TruncateTables
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,DatabaseConnectionHandler
,DatabaseConnectionProvider
,DatabaseConnectionUser
,Serializable
,Comparable
public class TruncateTables extends AbstractDatabaseTool
Truncates all tables that match a regular expression (matching sense can be inverted).
Valid options are:
-D (property: debug) If set to true, scheme may output additional info to the console.
-regexp <java.lang.String> (property: regExp) The regular expression used for matching the table names. default: .*
-invert (property: invert) If set to true, then the matching sense is inverted.
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_Invert
whether to invert the matching sense.protected BaseRegExp
m_RegExp
the regular expression to match.-
Fields inherited from class adams.tools.AbstractDatabaseTool
m_dbc
-
Fields inherited from class adams.tools.AbstractTool
m_Stopped
-
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 TruncateTables()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
defineOptions()
Adds options to the internal list of options.protected void
doRun()
Attempt to load the file and save to db.protected AbstractDatabaseConnection
getDefaultDatabaseConnection()
Returns the default database connection.boolean
getInvert()
Returns whether to invert the matching sense.BaseRegExp
getRegExp()
Returns the regular expression to match the table names against.String
globalInfo()
Returns a string describing the object.String
invertTipText()
Returns the tip text for this property.String
regExpTipText()
Returns the tip text for this property.void
setInvert(boolean value)
Sets whether to invert the matching sense.void
setRegExp(BaseRegExp value)
Sets the regular expression to match the table names against.-
Methods inherited from class adams.tools.AbstractDatabaseTool
cleanUp, getDatabaseConnection, initialize, setDatabaseConnection
-
Methods inherited from class adams.tools.AbstractTool
compareTo, destroy, equals, forCommandLine, forName, getTools, isStopped, postRun, preRun, run, runTool, stopExecution
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, 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, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_RegExp
protected BaseRegExp m_RegExp
the regular expression to match.
-
m_Invert
protected boolean m_Invert
whether to invert the matching sense.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
getDefaultDatabaseConnection
protected AbstractDatabaseConnection getDefaultDatabaseConnection()
Returns the default database connection.- Specified by:
getDefaultDatabaseConnection
in classAbstractDatabaseTool
- Returns:
- the database connection
-
setRegExp
public void setRegExp(BaseRegExp value)
Sets the regular expression to match the table names against.- Parameters:
value
- the regular expression
-
getRegExp
public BaseRegExp getRegExp()
Returns the regular expression to match the table names against.- Returns:
- the regular expression
-
regExpTipText
public String regExpTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setInvert
public void setInvert(boolean value)
Sets whether to invert the matching sense.- Parameters:
value
- true if inverting matching sense
-
getInvert
public boolean getInvert()
Returns whether to invert the matching sense.- Returns:
- true if matching sense is inverted
-
invertTipText
public String invertTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
doRun
protected void doRun()
Attempt to load the file and save to db. Exit java upon failure- Specified by:
doRun
in classAbstractTool
-
-