Package 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
checkArgs(String... args)
Check (command line) arguments.String
listParameters()
Describes the parameters that this tool accepts.void
run(String... args)
Run the tool.void
setUp(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(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(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(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
String listParameters()
Describes the parameters that this tool accepts.- Returns:
- The parameter description in a String object.
-
-