com.massimo.tools.scriptrunner
Class TaskFactory

java.lang.Object
  extended by com.massimo.tools.scriptrunner.TaskFactory

public final class TaskFactory
extends Object

Factory class for Tasks, based on the type or class attributes. If type is set, the class is assumed to be of the form <type>Task. The control sub-package Task implementations are recognized, but all others must be in the work sub-package. Custom tasks can be used by specifying the class attribute, with a value of the full class name, e.g. com.automagicsoftware.tasks.DeleteFileTask Setting the allSerial property changes Parallel tasks into Serial. This is useful for debugging.


Field Summary
static String TYPE_If
           
static String TYPE_OPTIONAL
           
static String TYPE_PARALLEL
           
static String TYPE_POLL
           
static String TYPE_SERIAL
           
static String TYPE_SPAWN
           
 
Method Summary
static Task createTask(Task parent, Element element, Map<String,String> properties)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_If

public static final String TYPE_If
See Also:
Constant Field Values

TYPE_OPTIONAL

public static final String TYPE_OPTIONAL
See Also:
Constant Field Values

TYPE_PARALLEL

public static final String TYPE_PARALLEL
See Also:
Constant Field Values

TYPE_POLL

public static final String TYPE_POLL
See Also:
Constant Field Values

TYPE_SERIAL

public static final String TYPE_SERIAL
See Also:
Constant Field Values

TYPE_SPAWN

public static final String TYPE_SPAWN
See Also:
Constant Field Values
Method Detail

createTask

public static Task createTask(Task parent,
                              Element element,
                              Map<String,String> properties)
                       throws ClassNotFoundException,
                              SecurityException,
                              NoSuchMethodException,
                              IllegalArgumentException,
                              InstantiationException,
                              IllegalAccessException,
                              InvocationTargetException
Parameters:
parent - The parent Task or null for the root Task
element - XML element defining the Task to be created
properties - Inherited properties for this Task
Returns:
Task A Task object as specified by element
Throws:
ClassNotFoundException - if Task class not found
SecurityException - Need to be able to call the current Thread's ClassLoader
NoSuchMethodException - if the constructor signature does not match AbstractTask's constructor AbstractTask.AbstractTask(Task, String, Element, Map)
IllegalArgumentException - if neither Task type nor class is set, or the Task class does not implement Task
InstantiationException - if Task class instantiation fails
IllegalAccessException - if an underlying constructor is inaccessible
InvocationTargetException - if an underlying constructor throws an exception