Package dk.netarkivet.common.tools
Class ToolRunnerBase
- java.lang.Object
-
- dk.netarkivet.common.tools.ToolRunnerBase
-
- Direct Known Subclasses:
ArcMerge
,ArcWrap
,CreateCDXMetadataFile
,GetFile
,GetRecord
,JMXProxy
,ReestablishAdminDatabase
,RunBatch
public abstract class ToolRunnerBase extends java.lang.Object
A simple class that manages and runs an implementation of SimpleCmdlineTool. The class contains an abstract factory method, which will create the actual implementation when specialized. This could also have been done with generics, but this is the traditional implementation.
-
-
Constructor Summary
Constructors Constructor Description ToolRunnerBase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract SimpleCmdlineTool
makeMyTool()
Factory method.void
runTheTool(java.lang.String... args)
Passes (command line) parameters to the tool.protected void
showMessage(java.lang.String msg)
A template method implementing default behaviour for showing a message (send to stderr).
-
-
-
Constructor Detail
-
ToolRunnerBase
public ToolRunnerBase()
-
-
Method Detail
-
makeMyTool
protected abstract SimpleCmdlineTool makeMyTool()
Factory method. Creates and returns the intended specific implementation of a command line tool.- Returns:
- An implementation of the SimpleCmdlineTool interface.
-
showMessage
protected void showMessage(java.lang.String msg)
A template method implementing default behaviour for showing a message (send to stderr). Can be overridden to ensure logging.- Parameters:
msg
- The message to display
-
runTheTool
public void runTheTool(java.lang.String... args)
Passes (command line) parameters to the tool. If an error occured (internalRunTool returned false), exit with failure.- Parameters:
args
- Usually a straight passing of the command line parameters from a "main" method.
-
-