Package kieker.tools.common
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 intCONFIGURATION_ERRORThere was an configuration error.protected booleanhelptrue if help should be displayed.protected ConfigurationkiekerConfigurationconfiguration provided as kieker configuration file.protected org.slf4j.Loggerloggerlogger for all tools.static intPARAMETER_ERRORThere was a parameter error.static intRUNTIME_ERRORAn runtime error happened.protected Tsettingsconfiguration specified as parameters.static intSUCCESS_EXIT_CODEExit code for successful operation.static intUSAGE_EXIT_CODEDisplayed the usage message. -
Constructor Summary
Constructors Constructor Description AbstractLegacyTool()Default constructor. -
Method Summary
Modifier and Type Method Description protected abstract booleancheckConfiguration(Configuration configuration, com.beust.jcommander.JCommander commander)Check a given configuration for validity.protected abstract booleancheckParameters(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 intexecute(com.beust.jcommander.JCommander commander, java.lang.String label)Execute the core part of a tool or service.protected abstract java.nio.file.PathgetConfigurationPath()Method returning the configuration file handle.protected ConfigurationreadConfiguration()Read a configuration form a file.intrun(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 voidshutdownService()Trigger cleanup features of the service.
-
Field Details
-
SUCCESS_EXIT_CODE
public static final int SUCCESS_EXIT_CODEExit code for successful operation.- See Also:
- Constant Field Values
-
RUNTIME_ERROR
public static final int RUNTIME_ERRORAn runtime error happened.- See Also:
- Constant Field Values
-
CONFIGURATION_ERROR
public static final int CONFIGURATION_ERRORThere was an configuration error.- See Also:
- Constant Field Values
-
PARAMETER_ERROR
public static final int PARAMETER_ERRORThere was a parameter error.- See Also:
- Constant Field Values
-
USAGE_EXIT_CODE
public static final int USAGE_EXIT_CODEDisplayed the usage message.- See Also:
- Constant Field Values
-
logger
protected final org.slf4j.Logger loggerlogger for all tools. -
help
protected boolean helptrue if help should be displayed. -
settings
configuration specified as parameters. -
kiekerConfiguration
configuration provided as kieker configuration file.
-
-
Constructor Details
-
AbstractLegacyTool
public AbstractLegacyTool()Default constructor.
-
-
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 messageslabel- label used during execution to indicate the running serviceargs- arguments are ignoredconfiguration- configuration object- Returns:
- returns exit code
-
execute
protected abstract int execute(com.beust.jcommander.JCommander commander, java.lang.String label) throws ConfigurationExceptionExecute the core part of a tool or service.- Parameters:
commander- JCommander instance used to display usage information in case of errorslabel- label used during execution to indicate the running service- Returns:
- returns exit code
- Throws:
ConfigurationException- on configuration errors occuring at runtime
-
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 ConfigurationExceptionCheck 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.
-