Class 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 Detail

      • 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.
    • Constructor Detail

      • ActorUsage

        public ActorUsage()
    • Method Detail

      • 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.
      • locateFlows

        protected List<String> locateFlows()
        Locates all the flows.
        Returns:
        the flow files
      • 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
      • main

        public static void main​(String[] args)
                         throws Exception
        Executes the class.
        Parameters:
        args - the command-line options, use "-help" for listing the help
        Throws:
        Exception - if setting of environment class fails or other problem arises