net.chaosserver.bilbo.task
Class TaskFactory

java.lang.Object
  |
  +--net.chaosserver.bilbo.task.TaskFactory

public class TaskFactory
extends Object

Factory class to produce instance of Task objects for task names.

Since:
Bilbo 2.0

Field Summary
protected static TaskFactory self
          Self reference for singleton.
protected static String SYNC
          Sync object for instance.
protected  Map taskMap
          Holds the map of task name to task class names.
 
Constructor Summary
protected TaskFactory()
          Default constructor.
 
Method Summary
 Task createTask(String taskName, Settings settings)
          Creates a new instance of the task object associated with the taskName given.
static TaskFactory getInstance()
          Gets the singleton instance of the TaskFactory.
protected  Map getTaskMap()
          Getter for the taskMap property.
protected  void loadTaskMap()
          Loads the taskMap property from file.
protected  void setTaskMap(Map taskMap)
          Setter for the taskMap property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

self

protected static TaskFactory self
Self reference for singleton.


SYNC

protected static final String SYNC
Sync object for instance.

See Also:
Constant Field Values

taskMap

protected Map taskMap
Holds the map of task name to task class names.

Constructor Detail

TaskFactory

protected TaskFactory()
Default constructor.

Method Detail

getInstance

public static TaskFactory getInstance()
Gets the singleton instance of the TaskFactory.

Returns:
the singleton instance of the TaskFactory

getTaskMap

protected Map getTaskMap()
Getter for the taskMap property.

Returns:
the taskMap property

setTaskMap

protected void setTaskMap(Map taskMap)
Setter for the taskMap property.

Parameters:
taskMap - the taskMap property

loadTaskMap

protected void loadTaskMap()
Loads the taskMap property from file.


createTask

public Task createTask(String taskName,
                       Settings settings)
                throws NoSuchTaskException,
                       TaskCreationException
Creates a new instance of the task object associated with the taskName given.

Parameters:
taskName - the name of the task object to create
settings - the settings of this instance of the program
Returns:
the task for the given task name
Throws:
NoSuchTaskException - if there is not task for the task name given
TaskCreationException - if there is an error instantiating the task


Copyright © 20030415