Ontimize 5.2072EN

com.ontimize.util.quartz
Class DefaultQuartzManager

java.lang.Object
  extended bycom.ontimize.util.quartz.DefaultQuartzManager
All Implemented Interfaces:
QuartzManager

public class DefaultQuartzManager
extends java.lang.Object
implements QuartzManager


Nested Class Summary
static class DefaultQuartzManager.JobName
           
 
Method Summary
 void addTask(java.util.Properties taskProperties)
          Insert a new task in the quartz scheduler
 void addTask(java.lang.String propertiesFile)
          Insert a new task in the quartz scheduler.
 void addTask(java.lang.String taskName, java.lang.String taskGroup, java.lang.String taskClassName, java.lang.String triggerName, java.lang.String triggerGroup, java.util.Date startTime, java.util.Date endTime, int repeatCount, long repeatInterval, java.util.Map actionParametersMap, java.util.Map queryParametersMap)
          Insert a new task in the quartz scheduler
 void addTask(java.lang.String taskName, java.lang.String taskGroup, java.lang.String taskClassName, java.lang.String cronName, java.lang.String cronGroup, java.lang.String cronExpression, java.util.Date endTime)
          Insert a new task in the quartz scheduler.
 void addTask(java.lang.String taskName, java.lang.String taskGroup, java.lang.String taskClassName, java.lang.String cronName, java.lang.String cronGroup, java.lang.String cronExpression, java.util.Date endTime, java.util.Map actionParametersMap, java.util.Map queryParametersMap)
          Insert a new task in the Quartz scheduler.
static QuartzManager getQuartzManager()
          Gets the reference to the QuarzManager
 EntityReferenceLocator getReferenceLocator()
           
 org.quartz.Scheduler getScheduler()
          Gets the scheduler that contains the programmed tasks
 java.lang.String[] getTaskGroupNames()
           
static void initializeManager(EntityReferenceLocator referenceLocator)
          Initializes the class with the default configuration parameters
static void initializeManager(EntityReferenceLocator referenceLocator, java.util.Properties properties)
          Initializes the class using the properties in the configuration file
 java.util.List listTask()
           
 boolean pauseTrigger(java.lang.String cronName, java.lang.String cronGroup)
          Pauses temporally the execution of a thread
 boolean removeTask(java.lang.String taskName, java.lang.String taskGroup)
          Remove an existing task of the scheduler
 boolean resumeTrigger(java.lang.String cronName, java.lang.String cronGroup)
          Restart the execution of a thread in pause
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

initializeManager

public static void initializeManager(EntityReferenceLocator referenceLocator)
Initializes the class with the default configuration parameters

Parameters:
referenceLocator -

initializeManager

public static void initializeManager(EntityReferenceLocator referenceLocator,
                                     java.util.Properties properties)
Initializes the class using the properties in the configuration file

Parameters:
referenceLocator -
properties - Configuration file

getQuartzManager

public static QuartzManager getQuartzManager()
Gets the reference to the QuarzManager

Returns:

addTask

public void addTask(java.lang.String taskName,
                    java.lang.String taskGroup,
                    java.lang.String taskClassName,
                    java.lang.String cronName,
                    java.lang.String cronGroup,
                    java.lang.String cronExpression,
                    java.util.Date endTime,
                    java.util.Map actionParametersMap,
                    java.util.Map queryParametersMap)
Description copied from interface: QuartzManager
Insert a new task in the Quartz scheduler.

Specified by:
addTask in interface QuartzManager
Parameters:
taskName - The name of the task, it must be unique in the scheduler
taskGroup - The name of the tasks group to add the task in. This parameter can be null
taskClassName - Name of the class that executes the task. This class must implement the interface Task
cronName - Name of the thread that will execute the task. This name must be unique in the quartz scheduler
cronGroup - Name of the group of threads to add the thread in the previous parameter. This parameter can be null
cronExpression - Expression to configure the temporal timing to execute the task. This is a string with 7 values separated by ';'. This 7 parameters are:
seconds (0-59), minutes (0-59), hours (0-23), month day (1-31), month (1-12 or JAN-DEC), week day (1-7 or SUN-SAT), year (optional between 1970 and 2099).
endTime - Date to stop or finish the task execution
actionParametersMap - Parameters used to execute the task
queryParametersMap - Parameters used to execute a query to get some data to know if the task must be executed or not

addTask

public void addTask(java.lang.String taskName,
                    java.lang.String taskGroup,
                    java.lang.String taskClassName,
                    java.lang.String cronName,
                    java.lang.String cronGroup,
                    java.lang.String cronExpression,
                    java.util.Date endTime)
Description copied from interface: QuartzManager
Insert a new task in the quartz scheduler.

Specified by:
addTask in interface QuartzManager
Parameters:
taskName - Name of the task, it must be unique in the scheduler
taskGroup - The name of the tasks group to add the task in. This parameter can be null
taskClassName - Name of the class that executes the task. This class must implement the interface Task
cronName - Name of the thread that will execute the task. This name must be unique in the quartz scheduler
cronGroup - Name of the group of threads to add the thread in the previous parameter. This parameter can be null
cronExpression - Expression to configure the temporal timing to execute the task. This is a string with 7 values separated by ';'. This 7 parameters are:
seconds (0-59), minutes (0-59), hours (0-23), month day (1-31), month (1-12 or JAN-DEC), week day (1-7 or SUN-SAT), year (optional between 1970 and 2099).
endTime - Date to stop or finish the task execution

addTask

public void addTask(java.lang.String taskName,
                    java.lang.String taskGroup,
                    java.lang.String taskClassName,
                    java.lang.String triggerName,
                    java.lang.String triggerGroup,
                    java.util.Date startTime,
                    java.util.Date endTime,
                    int repeatCount,
                    long repeatInterval,
                    java.util.Map actionParametersMap,
                    java.util.Map queryParametersMap)
Description copied from interface: QuartzManager
Insert a new task in the quartz scheduler

Specified by:
addTask in interface QuartzManager
Parameters:
taskName - The name of the task, it must be unique in the scheduler
taskGroup - The name of the tasks group to add the task in. This parameter can be null
taskClassName - Name of the class that executes the task. This class must implement the interface Task
triggerName - Name of the thread that will execute the task. This name must be unique in the quartz scheduler
triggerGroup - Name of the group of threads to add the thread in the previous parameter. This parameter can be null
startTime - Date to start the task execution
endTime - Date to stop or finish the execution of the task
repeatCount - Number of times to execute the task
repeatInterval - Time between to executions of the task
actionParametersMap - Parameters used to execute the task
queryParametersMap - Parameters used to execute a query to get some data to know if the task must be executed or not

addTask

public void addTask(java.util.Properties taskProperties)
Description copied from interface: QuartzManager
Insert a new task in the quartz scheduler

Specified by:
addTask in interface QuartzManager
Parameters:
taskProperties - Properties file to configure the task. It must contain:
Task name, task group, thread name, name of the thread group, timing configuration expression and name of the class to execute
The names of this properties are in the interface Task

addTask

public void addTask(java.lang.String propertiesFile)
Description copied from interface: QuartzManager
Insert a new task in the quartz scheduler.

Specified by:
addTask in interface QuartzManager
Parameters:
propertiesFile - Path of the configuration properties file with the task parameters
See Also:
QuartzManager.addTask(Properties)

removeTask

public boolean removeTask(java.lang.String taskName,
                          java.lang.String taskGroup)
Description copied from interface: QuartzManager
Remove an existing task of the scheduler

Specified by:
removeTask in interface QuartzManager
Parameters:
taskName - Name of the task to remove
taskGroup - name of the group of tasks that contains the task
Returns:
True if the task is removed successfully or false when some error happens

pauseTrigger

public boolean pauseTrigger(java.lang.String cronName,
                            java.lang.String cronGroup)
Pauses temporally the execution of a thread

Parameters:
cronName - Name of the thread
cronGroup - Name of the group of thread
Returns:
true if the the pause process was successfully, and false in other case

resumeTrigger

public boolean resumeTrigger(java.lang.String cronName,
                             java.lang.String cronGroup)
Restart the execution of a thread in pause

Parameters:
cronName - Name of the thread
cronGroup - Name of the group of thread
Returns:
true if the thread was restarted successfully

getTaskGroupNames

public java.lang.String[] getTaskGroupNames()

getReferenceLocator

public EntityReferenceLocator getReferenceLocator()
Specified by:
getReferenceLocator in interface QuartzManager

getScheduler

public org.quartz.Scheduler getScheduler()
Gets the scheduler that contains the programmed tasks

Returns:

listTask

public java.util.List listTask()

Ontimize