dk.netarkivet.common.tools
Class ToolRunnerBase

java.lang.Object
  extended by dk.netarkivet.common.tools.ToolRunnerBase
Direct Known Subclasses:
ArcMerge, ArcWrap, CreateCDXMetadataFile, CreateLogsMetadataFile, 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
ToolRunnerBase()
           
 
Method Summary
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).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.