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 java.lang.Object
Generic legacy tool framework class.
Since:
1.15
Author:
Reiner Jung
  • Field Summary

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

    Constructors 
    Constructor Description
    AbstractLegacyTool()
    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, java.lang.String label)
    Execute the core part of a tool or service.
    protected abstract java.nio.file.Path getConfigurationPath()
    Method returning the configuration file handle.
    protected Configuration readConfiguration()
    Read a configuration form a file.
    int run​(java.lang.String title, java.lang.String label, java.lang.String[] args, T configuration)
    Configure and execute the evaluation tool utilizing an external configuration.
    protected abstract void shutdownService()
    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

  • Constructor Details

  • Method Details

    • run

      public int run​(java.lang.String title, java.lang.String label, java.lang.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, java.lang.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 java.nio.file.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.