001/*
002 * (C) Copyright 2007-2010 Nuxeo SA (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 Guillaume
018 */
019package org.nuxeo.ecm.core.scheduler;
020
021import java.io.Serializable;
022import java.util.Map;
023
024/**
025 * Scheduler service.
026 */
027public interface SchedulerService {
028
029    /**
030     * Registers a schedule.
031     *
032     * @param schedule the schedule
033     */
034    void registerSchedule(Schedule schedule);
035
036    /**
037     * Registers a schedule. Add all parameters to eventContext.
038     *
039     * @param schedule
040     * @param parameters
041     */
042    void registerSchedule(Schedule schedule, Map<String, Serializable> parameters);
043
044    /**
045     * UnRegisters a schedule.
046     *
047     * @param scheduleId the schedule id
048     * @return true if schedule has been successfully removed.
049     */
050    boolean unregisterSchedule(String scheduleId);
051
052    /**
053     * UnRegisters a schedule.
054     *
055     * @param schedule to be unregistered
056     * @return true if schedule has been successfully removed.
057     */
058    boolean unregisterSchedule(Schedule schedule);
059
060    /**
061     * Checks if the framework has fully started.
062     * <p>
063     * Used to delay job execution until the framework has fully started.
064     *
065     * @return {@code true} if the framework has started
066     * @since 5.6
067     */
068    boolean hasApplicationStarted();
069
070}