Class AbstractLegacyTool<T>

java.lang.Object
kieker.tools.common.AbstractLegacyTool<T>
Type Parameters:
T - type of the configuration object to be used
Direct Known Subclasses:
AbstractService

public abstract class AbstractLegacyTool<T> extends Object
Generic legacy tool framework class.
Since:
1.15
Author:
Reiner Jung
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    There was an configuration error.
    protected boolean
    true if help should be displayed.
    protected Configuration
    configuration provided as kieker configuration file.
    protected final org.slf4j.Logger
    logger for all tools.
    static final int
    There was a parameter error.
    static final int
    An runtime error happened.
    protected T
    configuration specified as parameters.
    static final int
    Exit code for successful operation.
    static final int
    Displayed the usage message.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract boolean
    checkConfiguration(Configuration configuration, com.beust.jcommander.JCommander commander)
    Check a given configuration for validity.
    protected abstract boolean
    checkParameters(com.beust.jcommander.JCommander commander)
    Check all given parameters for correct directory and files path, as well as, all other values for fitness.
    protected abstract int
    execute(com.beust.jcommander.JCommander commander, String label)
    Execute the core part of a tool or service.
    protected abstract Path
    Method returning the configuration file handle.
    protected Configuration
    Read a configuration form a file.
    int
    run(String title, String label, String[] args, T configuration)
    Configure and execute the evaluation tool utilizing an external configuration.
    protected abstract void
    Trigger cleanup features of the service.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SUCCESS_EXIT_CODE

      public static final int SUCCESS_EXIT_CODE
      Exit code for successful operation.
      See Also:
    • RUNTIME_ERROR

      public static final int RUNTIME_ERROR
      An runtime error happened.
      See Also:
    • CONFIGURATION_ERROR

      public static final int CONFIGURATION_ERROR
      There was an configuration error.
      See Also:
    • PARAMETER_ERROR

      public static final int PARAMETER_ERROR
      There was a parameter error.
      See Also:
    • USAGE_EXIT_CODE

      public static final int USAGE_EXIT_CODE
      Displayed the usage message.
      See Also:
    • logger

      protected final org.slf4j.Logger logger
      logger for all tools.
    • help

      protected boolean help
      true if help should be displayed.
    • settings

      protected T settings
      configuration specified as parameters.
    • kiekerConfiguration

      protected Configuration kiekerConfiguration
      configuration provided as kieker configuration file.
  • Constructor Details

    • AbstractLegacyTool

      public AbstractLegacyTool()
      Default constructor.
  • Method Details

    • run

      public int run(String title, String label, String[] args, T configuration)
      Configure and execute the evaluation tool utilizing an external configuration.
      Parameters:
      title - start up label for debug messages
      label - label used during execution to indicate the running service
      args - arguments are ignored
      configuration - configuration object
      Returns:
      returns exit code
    • execute

      protected abstract int execute(com.beust.jcommander.JCommander commander, String label) throws ConfigurationException
      Execute the core part of a tool or service.
      Parameters:
      commander - JCommander instance used to display usage information in case of errors
      label - label used during execution to indicate the running service
      Returns:
      returns exit code
      Throws:
      ConfigurationException - on configuration errors occuring at runtime
    • readConfiguration

      protected Configuration readConfiguration()
      Read a configuration form a file.
      Returns:
      returns a complete Kieker configuration
    • getConfigurationPath

      protected abstract Path getConfigurationPath()
      Method returning the configuration file handle.
      Returns:
      returns a file handle in case a configuration file is used, else null
    • checkConfiguration

      protected abstract boolean checkConfiguration(Configuration configuration, com.beust.jcommander.JCommander commander)
      Check a given configuration for validity.
      Parameters:
      configuration - the configuration object with all configuration parameter. Can be null.
      commander - JCommander used to generate usage information.
      Returns:
      true if the configuration is valid.
    • checkParameters

      protected abstract boolean checkParameters(com.beust.jcommander.JCommander commander) throws ConfigurationException
      Check all given parameters for correct directory and files path, as well as, all other values for fitness.
      Parameters:
      commander - the command line interface
      Returns:
      true if all parameter check out, else false
      Throws:
      ConfigurationException - on error
    • shutdownService

      protected abstract void shutdownService()
      Trigger cleanup features of the service.