com.jfw.scheduler
Class Scheduler

java.lang.Object
  extended by com.jfw.scheduler.Scheduler

public final class Scheduler
extends java.lang.Object

The container of classes in scheduling.
Is a singleton, the instance is returned by method getInstance().


Field Summary
static java.lang.String DESC_KEY
          Key used in scheduleList.
static java.lang.String FREQUENCE_KEY
          Key used in scheduleList.
static java.lang.String ID_KEY
          Key used in scheduleList.
static java.lang.String THREAD_KEY
          Key used in scheduleList.
 
Method Summary
 ScheduleThread add(java.lang.String scheduledBean, java.lang.String frequence, java.lang.String description, java.lang.String id)
          Add a scheduled bean.
 java.util.ArrayList getErrors()
          Get a clone of attribute errors.
static Scheduler getInstance()
          Return attribute instance.
 java.util.Set getScheduleList()
          Get a Set object with keys of scheduleList.
 ScheduleThread getScheduleThread(java.lang.String scheduleBean)
          Get the thread who execute a scheduled bean.
 java.util.HashMap getScheduleThreadAttributes(java.lang.String scheduleBean)
          Get all parameters of a scheduled bean.
 void remove(java.lang.String scheduledBean)
          Remove a scheduled bean from scheduler.
 void removeAll()
          Remove alla scheduled beans from scheduler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FREQUENCE_KEY

public static final java.lang.String FREQUENCE_KEY
Key used in scheduleList.

See Also:
Constant Field Values

DESC_KEY

public static final java.lang.String DESC_KEY
Key used in scheduleList.

See Also:
Constant Field Values

ID_KEY

public static final java.lang.String ID_KEY
Key used in scheduleList.

See Also:
Constant Field Values

THREAD_KEY

public static final java.lang.String THREAD_KEY
Key used in scheduleList.

See Also:
Constant Field Values
Method Detail

getInstance

public static Scheduler getInstance()
Return attribute instance.

Returns:
the only instance of the class.

add

public ScheduleThread add(java.lang.String scheduledBean,
                          java.lang.String frequence,
                          java.lang.String description,
                          java.lang.String id)
Add a scheduled bean. Sceduled beans must be of type ScheduleBean.

Parameters:
scheduledBean - the class name of scheduled bean.
frequence - execution frequence.
description - description of scheduled bean.
id - the id of the scheduled bean.
Returns:
a ScheduleThread object.

remove

public void remove(java.lang.String scheduledBean)
Remove a scheduled bean from scheduler.

Parameters:
scheduledBean - the class name of scheduled bean; is the name of the class plus the id.

removeAll

public void removeAll()
Remove alla scheduled beans from scheduler.


getScheduleList

public java.util.Set getScheduleList()
Get a Set object with keys of scheduleList.

Returns:
a Set object with keys of scheduleList.

getScheduleThreadAttributes

public java.util.HashMap getScheduleThreadAttributes(java.lang.String scheduleBean)
Get all parameters of a scheduled bean.

Returns:
parameters of a scheduled bean. This is the HashMap added in scheduleList.

getScheduleThread

public ScheduleThread getScheduleThread(java.lang.String scheduleBean)
Get the thread who execute a scheduled bean.

Parameters:
scheduleBean - the class name of the scheduled bean.
Returns:
a ScheduleThread object.

getErrors

public java.util.ArrayList getErrors()
Get a clone of attribute errors.

Returns:
a clone of attribute errors.