Package adams.flow.core
Class ActorUsage
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.core.ActorUsage
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,Serializable
public class ActorUsage extends AbstractOptionHandler
Traverses directories and loads all flows that it can locate for examination. Generates a spreadsheet containing two columns:
1. actor class
2. all flow files that use this actor
Valid options are:
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-dir <adams.core.io.PlaceholderDirectory> [-dir ...] (property: directories) The directories to traverse. default:
-recursive <boolean> (property: recursive) If enabled, the directories are traversed recursively. default: false
-no-path <boolean> (property: noPath) If enabled, the path is omitted in the generated spreadsheet. default: false
-writer <adams.data.io.output.SpreadSheetWriter> (property: writer) The writer for storing the spreadsheet. default: adams.data.io.output.CsvSpreadSheetWriter
-output <adams.core.io.PlaceholderFile> (property: output) The file to write the spreadsheet to with the specified writer, ignored if pointing to a directory. default: ${CWD}
- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected PlaceholderDirectory[]
m_Directories
the directories to traverse.protected boolean
m_NoPath
whether to omit the path from the flow name.protected PlaceholderFile
m_Output
the output file.protected boolean
m_Recursive
whether to traverse the directories recursively.protected SpreadSheetWriter
m_Writer
the spreadsheet writer for writing the output.-
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 ActorUsage()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SpreadSheet
analyzeFlows(List<String> flows)
Analyzes all the flows.void
defineOptions()
Adds options to the internal list of options.String
directoriesTipText()
Returns the tip text for this property.SpreadSheet
execute()
Generates the actor usage spreadsheet and saves it if possible.protected SpreadSheetWriter
getDefaultWriter()
Returns the default writer.PlaceholderDirectory[]
getDirectories()
Returns the directories to traverse.boolean
getNoPath()
Returns whether to omit the path of the flow in the spreadsheet.PlaceholderFile
getOutput()
Returns the output file.boolean
getRecursive()
Returns whether to traverse the directories recursively.SpreadSheetWriter
getWriter()
Returns the writer in use.String
globalInfo()
Returns a string describing the object.protected List<String>
locateFlows()
Locates all the flows.static void
main(String[] args)
Executes the class.String
noPathTipText()
Returns the tip text for this property.String
outputTipText()
Returns the tip text for this property.String
recursiveTipText()
Returns the tip text for this property.void
setDirectories(PlaceholderDirectory[] value)
Sets the directories to traverse.void
setNoPath(boolean value)
Sets whether to omit the path of the flow in the spreadsheet.void
setOutput(PlaceholderFile value)
Sets the output file.void
setRecursive(boolean value)
Sets whether to traverse the directories recursively.void
setWriter(SpreadSheetWriter value)
Sets the writer to use.String
writerTipText()
Returns the tip text for this property.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, 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_Directories
protected PlaceholderDirectory[] m_Directories
the directories to traverse.
-
m_Recursive
protected boolean m_Recursive
whether to traverse the directories recursively.
-
m_NoPath
protected boolean m_NoPath
whether to omit the path from the flow name.
-
m_Writer
protected SpreadSheetWriter m_Writer
the spreadsheet writer for writing the output.
-
m_Output
protected PlaceholderFile m_Output
the output file.
-
-
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
-
setDirectories
public void setDirectories(PlaceholderDirectory[] value)
Sets the directories to traverse.- Parameters:
value
- the directories
-
getDirectories
public PlaceholderDirectory[] getDirectories()
Returns the directories to traverse.- Returns:
- the directories
-
directoriesTipText
public String directoriesTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setRecursive
public void setRecursive(boolean value)
Sets whether to traverse the directories recursively.- Parameters:
value
- true if recursive
-
getRecursive
public boolean getRecursive()
Returns whether to traverse the directories recursively.- Returns:
- true if recursive
-
recursiveTipText
public String recursiveTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setNoPath
public void setNoPath(boolean value)
Sets whether to omit the path of the flow in the spreadsheet.- Parameters:
value
- true if to omit the path
-
getNoPath
public boolean getNoPath()
Returns whether to omit the path of the flow in the spreadsheet.- Returns:
- true if to omit the path
-
noPathTipText
public String noPathTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getDefaultWriter
protected SpreadSheetWriter getDefaultWriter()
Returns the default writer.- Returns:
- the default writer
-
setWriter
public void setWriter(SpreadSheetWriter value)
Sets the writer to use.- Parameters:
value
- the writer to use
-
getWriter
public SpreadSheetWriter getWriter()
Returns the writer in use.- Returns:
- the writer in use
-
writerTipText
public String writerTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setOutput
public void setOutput(PlaceholderFile value)
Sets the output file.- Parameters:
value
- the file
-
getOutput
public PlaceholderFile getOutput()
Returns the output file.- Returns:
- the file
-
outputTipText
public String outputTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
analyzeFlows
protected SpreadSheet analyzeFlows(List<String> flows)
Analyzes all the flows.- Parameters:
flows
- the flow files to analyze- Returns:
- the generated overview
-
execute
public SpreadSheet execute()
Generates the actor usage spreadsheet and saves it if possible.- Returns:
- the generated spreadsheet
-
-