org.treesched
Class ScheduleFactory

java.lang.Object
  extended byorg.treesched.ScheduleFactory

public class ScheduleFactory
extends java.lang.Object

Create a schedule from a name. Useful for building shcedules from configuration files.


Method Summary
 void addFactoryDefinition(java.lang.String objName, java.lang.Class objClass)
          Adds a new schedule class definition to the factory.
 void addFile(java.io.File file)
          Add a property file of class definitions to the factory.
 void addProperties(java.util.Properties props)
          Add a property set of class definitions to the factory.
 void addResource(java.lang.String classDefFileName)
          Add a resource properties file of class definitions to the factory.
 void checkTaskClass(java.lang.Class theClass)
          Checks whether or not a class is suitable for being a schedule.
 Schedule createSchedule(java.lang.String name)
          The factory method.
static ScheduleFactory getInstance()
          Get the singleton instance of the factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ScheduleFactory getInstance()
Get the singleton instance of the factory.

Returns:
the ScheduleFactory instance.

addResource

public void addResource(java.lang.String classDefFileName)
Add a resource properties file of class definitions to the factory.

Parameters:
classDefFileName - A property file of class names.

addFile

public void addFile(java.io.File file)
Add a property file of class definitions to the factory.

Parameters:
file - A property file.

addProperties

public void addProperties(java.util.Properties props)
Add a property set of class definitions to the factory.

Parameters:
props - Property class definitions.

addFactoryDefinition

public void addFactoryDefinition(java.lang.String objName,
                                 java.lang.Class objClass)
                          throws ScheduleFactoryException
Adds a new schedule class definition to the factory.

Throws:
ScheduleFactoryException - if the class is unsuitable for being a schedule.

checkTaskClass

public void checkTaskClass(java.lang.Class theClass)
                    throws ScheduleFactoryException
Checks whether or not a class is suitable for being a schedule.

Parameters:
theClass - The class to be checked. Must not be null.
Throws:
ScheduleFactoryException - if the class is unsuitable for being an Ant task. An error level message is logged before this exception is thrown.

createSchedule

public Schedule createSchedule(java.lang.String name)
                        throws ScheduleFactoryException
The factory method.

Parameters:
name - The name of the scheudle.
Returns:
The schedule.
Throws:
ScheduleFactoryException - If the schedule couldn't be created.