Search in sources :

Example 1 with CleanUpTask

use of org.apache.sling.event.impl.jobs.tasks.CleanUpTask in project sling by apache.

the class JobManagerImpl method activate.

/**
     * Activate this component.
     * @param props Configuration properties
     */
@Activate
protected void activate(final BundleContext ctx, final Map<String, Object> props) throws LoginException {
    this.jobScheduler = new org.apache.sling.event.impl.jobs.scheduling.JobSchedulerImpl(this.configuration, this.scheduler, this);
    this.maintenanceTask = new CleanUpTask(this.configuration, this.jobScheduler);
    final Dictionary<String, Object> regProps = new Hashtable<>();
    regProps.put(ResourceChangeListener.PATHS, this.configuration.getScheduledJobsPath(false));
    regProps.put(ResourceChangeListener.CHANGES, new String[] { ResourceChange.ChangeType.ADDED.name(), ResourceChange.ChangeType.CHANGED.name(), ResourceChange.ChangeType.REMOVED.name() });
    regProps.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
    regProps.put(Constants.SERVICE_DESCRIPTION, "Resource change listener for scheduled jobs");
    this.changeListenerReg = ctx.registerService(ResourceChangeListener.class, this.jobScheduler, regProps);
    logger.info("Apache Sling Job Manager started on instance {}", Environment.APPLICATION_ID);
}
Also used : Hashtable(java.util.Hashtable) ResourceChangeListener(org.apache.sling.api.resource.observation.ResourceChangeListener) CleanUpTask(org.apache.sling.event.impl.jobs.tasks.CleanUpTask) JobSchedulerImpl(org.apache.sling.event.impl.jobs.scheduling.JobSchedulerImpl) Activate(org.osgi.service.component.annotations.Activate)

Aggregations

Hashtable (java.util.Hashtable)1 ResourceChangeListener (org.apache.sling.api.resource.observation.ResourceChangeListener)1 JobSchedulerImpl (org.apache.sling.event.impl.jobs.scheduling.JobSchedulerImpl)1 CleanUpTask (org.apache.sling.event.impl.jobs.tasks.CleanUpTask)1 Activate (org.osgi.service.component.annotations.Activate)1