Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## schedule
Class ScheduleConfigManager

    java.lang.Object
      schedule.ScheduleConfigManager

    public class ScheduleConfigManager

extends java.lang.Object

This class provides basic means to manage configuration of scheduled actions. It provides functions to read, write modify and load configuration into scheduler. This class is implemented as singleton to avoid collisions and inconsistencies in scheduling of operations. Time required by scheduler to ensure proper timing of tasks must be stored in configuration in following format: dom,dow,hrs,min where dom is day of month, dow is day of week, hrs is hour of execution and min is minute of execution. Same restrictions as to TimeTask parameters apply

See Also:
  `TaskTime`

Field Summary
`static java.lang.String` | `BACKUP`
`static java.lang.String` | `DELETE`

Method Summary
`void` | `addTask(java.lang.String taskName, java.lang.String param, int dayOfMonth, int dayOfWeek, int hour, int minute)` Adds task into configuration.
`void` | `addTask(java.lang.String taskName, java.lang.String param, int dayOfMonth, int dayOfWeek, int hour, int minute, java.util.Date notAfter)`
`void` | `deleteTask(int index)` Deletes task from configuration.
`java.util.ArrayList<TaskContainer>` | `getDetails()` Returns list of containers with configuration parameters of schedulable tasks.
`static ScheduleConfigManager` | `getScheduleConfigManager()` Returns instance of configuration manager.
`static java.lang.String` | `paramToHuman(java.lang.String name, java.lang.String param)` Converts parameters of various tasks into human readable format.
`void` | `parseDocument(org.dom4j.Document document, Scheduler scheduler)` Parses Xml structure for configuration of scheduler in similar manner as both parseFile functions except fact, that configuration is read from Xml and not from file.
`void` | `parseFile(java.io.File configuration, Scheduler scheduler)` Similar to parseFile(Scheduler) function.
`void` | `parseFile(Scheduler scheduler)` Reads configuration from default configuration file and loads it into specified scheduler adding new tasks to those already scheluded.
`ITask` | `parseTask(java.lang.String taskName, java.lang.String parameters, java.lang.String time)` This method parses configuration parameters of single task in configuration.
`void` | `reconfigure(IScheduler scheduler)` This method stops currently running scheduler and replaces configuration it currently holds with configuration stored in manager.
`void` | `saveConfig()` Saves current configuration into default configuration file belonging to scheduler.
`static java.lang.String` | `timeToHuman(java.lang.String time)` Converts concatenated string representation used to store execution time into human readable format.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### BACKUP

    public static final java.lang.String BACKUP

See Also:
  Constant Field Values

### DELETE

    public static final java.lang.String DELETE

See Also:
  Constant Field Values

Method Detail

### getScheduleConfigManager

    public static ScheduleConfigManager getScheduleConfigManager()

  Returns instance of configuration manager.

  Returns:
    Instance of ScheduleConfigManager

### parseFile

    public void parseFile(Scheduler scheduler)
                   throws java.lang.IllegalArgumentException,
                          org.dom4j.DocumentException

  Reads configuration from default configuration file and loads it into specified scheduler adding new tasks to those already scheluded. This scheduler must be reloaded to allow new tasks to be scheduled. If default configuration file doesn't exist, nothing is read.

  Parameters:
    `scheduler` - class capable of scheduling classes implementing ITask interface
  Throws:
    `java.lang.IllegalArgumentException` - when task in configuration is configured with illegal argument
    `org.dom4j.DocumentException` - when XML structure of configuration is incorrect

### parseFile

    public void parseFile(java.io.File configuration,
                          Scheduler scheduler)
                   throws java.lang.IllegalArgumentException,
                          org.dom4j.DocumentException

  Similar to parseFile(Scheduler) function. Allows user to specify which file should be read for configuration.

  Parameters:
    `configuration` - file containing configuration
    `scheduler` - class capable of scheduling classes implementing ITask interface
  Throws:
    `java.lang.IllegalArgumentException` - when task in configuration is configured with illegal argument
    `org.dom4j.DocumentException` - when XML structure of configuration is incorrect

### parseDocument

    public void parseDocument(org.dom4j.Document document,
                              Scheduler scheduler)
                       throws java.lang.IllegalArgumentException,
                              org.dom4j.DocumentException

  Parses Xml structure for configuration of scheduler in similar manner as both parseFile functions except fact, that configuration is read from Xml and not from file.

  Parameters:
    `document` - DOM object containg xml configuration
    `scheduler` - class capable of scheduling classes implementing ITask interface
  Throws:
    `java.lang.IllegalArgumentException` - when task in configuration is configured with illegal argument
    `org.dom4j.DocumentException` - when XML structure of configuration is incorrect

### getDetails

    public java.util.ArrayList<TaskContainer> getDetails()

  Returns list of containers with configuration parameters of schedulable tasks. Any tasks from any configuration file, that has been read from configuration or added is in this list. Only exeptions are tasks, that have been deleted by deleteTask(index) method.

  Returns:
    ArrayList containing instances of ConfigDetailsContainer

### addTask

    public void addTask(java.lang.String taskName,
                        java.lang.String param,
                        int dayOfMonth,
                        int dayOfWeek,
                        int hour,
                        int minute)

  Adds task into configuration.

  Parameters:
    `taskName` - name of task
    `param` - parameters to be passed to task at time of execution
    `dayOfMonth` - day of month to be passed to time iterator
    `dayOfWeek` - day of week to be passed to time iterator
    `hour` - hour to be passed to time iterator
    `minute` - minute to be passed to time iterator

### addTask

    public void addTask(java.lang.String taskName,
                        java.lang.String param,
                        int dayOfMonth,
                        int dayOfWeek,
                        int hour,
                        int minute,
                        java.util.Date notAfter)

### deleteTask

    public void deleteTask(int index)

  Deletes task from configuration. Index of deleted task is same as in list returned by getDetails() method.

  Parameters:
    `index` - of task to be deleted from list of tasks

### reconfigure

    public void reconfigure(IScheduler scheduler)

  This method stops currently running scheduler and replaces configuration it currently holds with configuration stored in manager. Scheduler is then rescheduled so new configuration is used.

  Parameters:
    `scheduler` - Scheduler to be reconfigured

### saveConfig

    public void saveConfig()
                    throws java.io.FileNotFoundException,
                           java.io.IOException

  Saves current configuration into default configuration file belonging to scheduler.

  Throws:
    `java.io.FileNotFoundException` - if default configuration file cannot be created or altered.
    `java.io.IOException` - if problem writing into configuration file.

### parseTask

    public ITask parseTask(java.lang.String taskName,
                           java.lang.String parameters,
                           java.lang.String time)
                    throws org.dom4j.DocumentException,
                           java.lang.IllegalArgumentException

  This method parses configuration parameters of single task in configuration. Type of task to be executed, parameters and execution time are determined and checked so correct instance of ITask can be returned.

  Parameters:
    `taskName` - name of task from configuration
    `parameters` - String representation of parameters according to type of task
    `time` - day of month, day of week, hour and minute separated by commas
  Returns:
    instance of ITask matching passed arguments
  Throws:
    `org.dom4j.DocumentException` - if configuration parameters, i.e value of parameters argument, is not in valid format
    `java.lang.IllegalArgumentException` - if time or task name is in invalid format
  See Also:
    `ITask`

### paramToHuman

    public static java.lang.String paramToHuman(java.lang.String name,
                                                java.lang.String param)

  Converts parameters of various tasks into human readable format.

  Parameters:
    `name` - name of action
    `param` - parameters to parse
  Returns:
    human readable parameters

### timeToHuman

    public static java.lang.String timeToHuman(java.lang.String time)

  Converts concatenated string representation used to store execution time into human readable format.

  Parameters:
    `time` - String containing concatenated time parameters
  Returns:
    String containg human readable description of time

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD