001/* 002 * (C) Copyright 2007-2018 Nuxeo (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Florent Munch 018 */ 019package org.nuxeo.ecm.core.scheduler; 020 021import java.io.Serializable; 022import java.util.Map; 023 024import org.quartz.Job; 025import org.quartz.JobBuilder; 026import org.quartz.ScheduleBuilder; 027import org.quartz.Trigger; 028import org.quartz.TriggerBuilder; 029 030/** 031 * Factory instantiating the {@link Job} and the {@link Trigger} of a scheduled event. 032 * 033 * @since 10.2 034 */ 035public interface EventJobFactory { 036 /** 037 * Builds the job of the scheduled event. 038 * <p> 039 * Returns a builder to allow extensibility. 040 * 041 * @param schedule Scheduled event contribution. 042 * @param parameters Job parameters (might be {@code null}). 043 * @return An instance of {@link JobBuilder}. 044 */ 045 JobBuilder buildJob(Schedule schedule, Map<String, Serializable> parameters); 046 047 /** 048 * Builds the trigger of the scheduled event. 049 * <p> 050 * Returns a builder to allow extensibility. 051 * 052 * @param schedule Scheduled event contribution. 053 * @return An instance of {@link TriggerBuilder}. 054 */ 055 TriggerBuilder<?> buildTrigger(Schedule schedule); 056 057 /** 058 * Builds the schedule of the trigger (used by {@link #buildTrigger(Schedule)}). 059 * <p> 060 * Returns a builder to allow extensibility. 061 * 062 * @param schedule Scheduled event contribution. 063 * @return An instance of {@link ScheduleBuilder}. 064 */ 065 ScheduleBuilder<?> buildSchedule(Schedule schedule); 066}