Package kieker.tools.common
Class AbstractService<T extends teetime.framework.Configuration,R>
java.lang.Object
kieker.tools.common.AbstractLegacyTool<R>
kieker.tools.common.AbstractService<T,R>
- Type Parameters:
T
- type of the teetime configuration to be usedR
- type of the parameter configuration object
public abstract class AbstractService<T extends teetime.framework.Configuration,R> extends AbstractLegacyTool<R>
Generic tool and service framework class. A specific tool or service must implement the following functions:
protected T createTeetimeConfiguration()
protected boolean checkParameters(final JCommander commander)
protected File getConfigurationFile()
protected boolean checkConfiguration(final Configuration kiekerConfiguration, final JCommander commander)
protected void shutdownService()
public static void main(final String[] args) {
final ExampleMain main = new ExampleMain();
System.exit(main.run("Example Tool", "Log label", args, main));
}
- Since:
- 1.15
- Author:
- Reiner Jung
-
Field Summary
Fields inherited from class kieker.tools.common.AbstractLegacyTool
CONFIGURATION_ERROR, help, kiekerConfiguration, logger, PARAMETER_ERROR, RUNTIME_ERROR, settings, SUCCESS_EXIT_CODE, USAGE_EXIT_CODE
-
Constructor Summary
Constructors Constructor Description AbstractService()
Default constructor. -
Method Summary
Modifier and Type Method Description protected abstract T
createTeetimeConfiguration()
Create and initialize teetime configuration for a service.protected int
execute(com.beust.jcommander.JCommander commander, java.lang.String label)
Execute the tool.Methods inherited from class kieker.tools.common.AbstractLegacyTool
checkConfiguration, checkParameters, getConfigurationPath, readConfiguration, run, shutdownService
-
Constructor Details
-
AbstractService
public AbstractService()Default constructor.
-
-
Method Details
-
execute
protected int execute(com.beust.jcommander.JCommander commander, java.lang.String label) throws ConfigurationExceptionExecute the tool.- Specified by:
execute
in classAbstractLegacyTool<R>
- Parameters:
commander
- command line parter JCommanderlabel
- printed to the debug log about what application is running.- Returns:
- returns exit code
- Throws:
ConfigurationException
- on configuration errors occuring at runtime
-
createTeetimeConfiguration
Create and initialize teetime configuration for a service.- Returns:
- return the newly created service
- Throws:
ConfigurationException
- in case the creation fails
-