net.chaosserver.bilbo.task
Class BaseTask

java.lang.Object
  |
  +--net.chaosserver.bilbo.task.BaseTask
All Implemented Interfaces:
Task
Direct Known Subclasses:
CompositeTask, LicenseTask, RecursiveTask

public abstract class BaseTask
extends Object
implements Task

Base task that provides the template design pattern for concrete implementations.

Since:
Bilbo 2.0

Field Summary
protected  Settings settings
          Holds the settings object.
 
Constructor Summary
BaseTask()
           
 
Method Summary
 void execute()
          Main task method.
protected abstract  void executeSpecific()
          Abstract implementation.
protected  String getHelpResource()
          Gets the help resource location.
protected  Settings getSettings()
          Getter for the settings object.
 void parseTaskArguments(String argumentString)
          Empty implementation
 void printHelp()
          Prints the usage notes out for the concrete task.
 void setSettings(Settings settings)
          Setter for the settings object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

settings

protected Settings settings
Holds the settings object.

Constructor Detail

BaseTask

public BaseTask()
Method Detail

setSettings

public void setSettings(Settings settings)
Setter for the settings object.

Specified by:
setSettings in interface Task
Parameters:
settings - the settings object

getSettings

protected Settings getSettings()
Getter for the settings object.

Returns:
the settings object

execute

public void execute()
             throws TaskException
Main task method. Calls printHelp or executeSpecific.

Specified by:
execute in interface Task
Throws:
TaskException - indicates generic error

parseTaskArguments

public void parseTaskArguments(String argumentString)
                        throws BadTaskCommandArgumentsException
Empty implementation

Specified by:
parseTaskArguments in interface Task
Parameters:
argumentString - the task specific argument string
Throws:
BadTaskCommandArgumentsException - if the argument string is invalid

executeSpecific

protected abstract void executeSpecific()
                                 throws TaskException
Abstract implementation. This should be overriden by concrete tasks to supply implementation.

Throws:
TaskException - indicates a generic error

printHelp

public void printHelp()
               throws TaskException
Prints the usage notes out for the concrete task.

The concrete task should place it's usage notes in a file named help.txt inside its package. If no file is found, then the default usage notes will be displayed.

Throws:
TaskException - if there is an error printing the usage notes

getHelpResource

protected String getHelpResource()
Gets the help resource location.

This appends "help.txt" to the package location.

Returns:
help resource location


Copyright © 20030415