dk.netarkivet.common.tools
Interface SimpleCmdlineTool


public interface SimpleCmdlineTool

A very abstracted interface for simple command line tools. Allows for setup, teardown, argument checking, usage listing and (of course) running.


Method Summary
 boolean checkArgs(java.lang.String... args)
          Check (command line) arguments.
 java.lang.String listParameters()
          Describes the parameters that this tool accepts.
 void run(java.lang.String... args)
          Run the tool.
 void setUp(java.lang.String... args)
          Create any resource which may requires an explicit teardown.
 void tearDown()
          Teardown any resource which requires an explicit teardown.
 

Method Detail

checkArgs

boolean checkArgs(java.lang.String... args)
Check (command line) arguments.

Parameters:
args - Usually the command line arguments passed directly from a public static void main(String[] args) method.
Returns:
True, if parameters are usable. False if not.

setUp

void setUp(java.lang.String... args)
Create any resource which may requires an explicit teardown. Implement teardown in the teardown method.

Parameters:
args - Usually the command line arguments passed directly from a public static void main(String[] args) method.

tearDown

void tearDown()
Teardown any resource which requires an explicit teardown. Implement creation of these in the setup method. Note that not all objects may be created in case of an exception during setup, so check for null!!!


run

void run(java.lang.String... args)
Run the tool. Any resources that can be managed without reliable teardown may be created here.

Parameters:
args - Usually the command line arguments passed directly from a public static void main(String[] args) method.

listParameters

java.lang.String listParameters()
Describes the parameters that this tool accepts.

Returns:
The parameter description in a String object.