com.chaosserver.bilbo.task
Class TaskFactory

java.lang.Object
  |
  +--com.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
static TaskFactory self
          Self reference for singleton.
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

public static TaskFactory self
Self reference for singleton.


SYNC

public static String SYNC
Sync object for instance.


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
Throws:
NoSuchTaskException - if there is not task for the task name given
TaskCreationException - if there is an error instantiating the task


Copyright © 20020228