All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.dynamicextensionsalfresco.schedule.quartz.QuartzTaskRegistration Maven / Gradle / Ivy

Go to download

Adds an OSGi container to alfresco repository supporting dynamic code reloading, classpath isolation and a bunch of other useful features

There is a newer version: 2.1.4
Show newest version
package com.github.dynamicextensionsalfresco.schedule.quartz;

import com.github.dynamicextensionsalfresco.schedule.TaskConfiguration;
import com.github.dynamicextensionsalfresco.schedule.TaskRegistration;
import com.github.dynamicextensionsalfresco.schedule.TaskSchedulerException;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;

public class QuartzTaskRegistration implements TaskRegistration {

    private final Scheduler scheduler;
    private final String name;
    private final String group;

    public QuartzTaskRegistration(Scheduler scheduler, String name, String group) {
        this.scheduler = scheduler;
        this.name = name;
        this.group = group;
    }

    public QuartzTaskRegistration(Scheduler scheduler, TaskConfiguration config) {
        this(scheduler, config.getName(), config.getGroup());
    }


    @Override
    public void unregister() throws TaskSchedulerException {
        try {
            scheduler.unscheduleJob(this.name, this.group);
        } catch (org.quartz.SchedulerException e) {
            throw new TaskSchedulerException(e);
        }
    }

    @Override
    public void trigger() throws TaskSchedulerException {
        try {
            this.scheduler.triggerJob(this.name, this.group);
        } catch (SchedulerException e) {
            throw new TaskSchedulerException(e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy