There is a need to schedule events and tasks within the server. We will use Quartz to do this.
Quartz is a neat embeddable scheduler that we can use to trigger events.
ApacheDS needs to schedule certain jobs for execution periodically. Mitosis needs it to purge the replication log and to delete old tomestoned entries. Furthermore mitosis needs a scheduler to manage sophisticated replication schedules for replication groups.
Besides these needs, administrators will want to schedule certain tasks within the server as well. For example the server can be backed up using a trigger to offline then backup the server. We also need it for mandating password policy.
A single Quartz Scheduler would be started on ApacheDS core system startup with some configurable number of threads. This way the scheduler based capabilities are available even when networking is not enabled. Once started the scheduler would need to be shutdown on system shutdown.
Access to the Scheduler for the DirectoryService can be made through the DirectoryServiceConfiguration. All interceptor would have access to the Scheduler. A custom Quartz JobStore or a Quartz Plugin can be implemented to store jobs on disk as LDAP entries.
With LDAP entries for storing jobs and triggers we're going to need a custom schema for scheduling information. The rest of this section defines the attributes and objectClasses that will be needed.
A JobDetail has the following attributes:
All triggers have the following attributes:
A trigger has the following attributes if simple:
A trigger has the following attributes if it is periodic using the quartz cron notation:
There are 3 challenges we face with LDAP based jobs and triggers:
A custom interceptor can be used to detect writes involving trigger/job entries. However this is perhaps overkill. We do not need to do anything before these write operations. All actions to load and unload jobs from the Scheduler can occur after the write has occurred. In this case, the Scheduler can depend on the event service for notifications.
The Scheduler needs to take various parameters which control it's behavior. These parameters should be added to a configuration entry for the scheduler in the ou=system area. Changes to this entry should automatically reconfigure the Scheduler.
The currently running jobs should also be displayed under the configuration entry for the scheduler within the ou=system area of the server.
See Quartz Schema