net.sourceforge.basher.impl
Class TaskManagerImpl

java.lang.Object
  extended by net.sourceforge.basher.impl.TaskManagerImpl
All Implemented Interfaces:
EventListener, BasherEventListener, TaskManager

public class TaskManagerImpl
extends Object
implements TaskManager, BasherEventListener

Version:
1.0
Author:
Johan Lindquist

Constructor Summary
TaskManagerImpl()
           
 
Method Summary
 TaskContribution addTask(Class taskClass, TaskContribution... followers)
          Adds a task class to the task manager.
 TaskContribution addTask(Object taskInstance, TaskContribution... followers)
          Adds a task instance.
 void addTask(TaskContribution taskContribution)
          Adds a task to the system in the form of task contribution.
 void basherEvent(BasherEvent basherEvent)
           
 TaskExecutionContext getNextTaskExecutionContext()
          Retrieves the next task available.
 int getNumberOfTasks()
          Retrives the count of the currently registered tasks.
 TaskContribution getTaskByName(String name)
          Retrieves the task identified by the specified name.
 Set<TaskContribution> getTasks()
          Retrieves all active tasks with the task manager.
 void initializeService()
           
 void removeTaskExecutionContext(UUID identifier)
          Removes the specified task execution context from the list of active tasks.
 void setEventManager(EventManager eventManager)
           
 void setLog(org.apache.commons.logging.Log logger)
           
 void setModuleDescriptorTaskContributions(List<ModuleDescriptorTaskContribution> moduleDescriptorTaskContributions)
           
 void setRandomizer(Randomizer randomizer)
           
 void setTaskConfigurationExtractor(TaskConfigurationExtractor taskConfigurationExtractor)
           
 void setTaskCreator(TaskCreator taskCreator)
           
 void setTaskDecorator(TaskDecorator taskDecorator)
           
 void setTaskProviders(List<TaskProvider> taskProviders)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskManagerImpl

public TaskManagerImpl()
Method Detail

setTaskConfigurationExtractor

public void setTaskConfigurationExtractor(TaskConfigurationExtractor taskConfigurationExtractor)

setTaskCreator

public void setTaskCreator(TaskCreator taskCreator)

setTaskDecorator

public void setTaskDecorator(TaskDecorator taskDecorator)

setEventManager

public void setEventManager(EventManager eventManager)

setLog

public void setLog(org.apache.commons.logging.Log logger)

setRandomizer

public void setRandomizer(Randomizer randomizer)

setTaskProviders

public void setTaskProviders(List<TaskProvider> taskProviders)

addTask

public void addTask(TaskContribution taskContribution)
Description copied from interface: TaskManager
Adds a task to the system in the form of task contribution.

Specified by:
addTask in interface TaskManager
Parameters:
taskContribution - The task contribution to add

addTask

public TaskContribution addTask(Class taskClass,
                                TaskContribution... followers)
Description copied from interface: TaskManager
Adds a task class to the task manager. The class does not necessarily have to implement Task to the task manager but must provide an empty constructor (but not necessarily public).

Specified by:
addTask in interface TaskManager
Parameters:
taskClass - The task class to add. This class must either be annotated or expose a public method named executeTask which will be used for task execution. If not annotated, the class may also expose any of the methods defined in Task to control the settings used during invocation.
followers - Followers which will be added to the task instance.
Returns:
The task created from adding the specified task instance

addTask

public TaskContribution addTask(Object taskInstance,
                                TaskContribution... followers)
Description copied from interface: TaskManager
Adds a task instance. The instance does not necessarily have to implement Task to the task manager.

Specified by:
addTask in interface TaskManager
Parameters:
taskInstance - The task instance to add. The instance must either be annotated or expose a public method named executeTask which will be used for task execution
followers - Followers which will be added to the task instance.
Returns:
The task created from adding the specified task instance

getNextTaskExecutionContext

public TaskExecutionContext getNextTaskExecutionContext()
Description copied from interface: TaskManager
Retrieves the next task available.

Specified by:
getNextTaskExecutionContext in interface TaskManager
Returns:
A task instance or null of no tasks are available

getTasks

public Set<TaskContribution> getTasks()
Description copied from interface: TaskManager
Retrieves all active tasks with the task manager.

Specified by:
getTasks in interface TaskManager
Returns:
A list of Task instances.

getTaskByName

public TaskContribution getTaskByName(String name)
Description copied from interface: TaskManager
Retrieves the task identified by the specified name. This will search both active and removed task lists.

Specified by:
getTaskByName in interface TaskManager
Parameters:
name - The name of the task to retrieve.
Returns:
The specified task or null if it can not be found

removeTaskExecutionContext

public void removeTaskExecutionContext(UUID identifier)
Description copied from interface: TaskManager
Removes the specified task execution context from the list of active tasks.

Specified by:
removeTaskExecutionContext in interface TaskManager
Parameters:
identifier - The identifier of the task execution context to remove

getNumberOfTasks

public int getNumberOfTasks()
Description copied from interface: TaskManager
Retrives the count of the currently registered tasks.

Specified by:
getNumberOfTasks in interface TaskManager
Returns:
The number of tasks currently registered.

setModuleDescriptorTaskContributions

public void setModuleDescriptorTaskContributions(List<ModuleDescriptorTaskContribution> moduleDescriptorTaskContributions)

initializeService

public void initializeService()

basherEvent

public void basherEvent(BasherEvent basherEvent)
Specified by:
basherEvent in interface BasherEventListener


Copyright © 2006-2010 Basher Team. All Rights Reserved.