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    void registerSchedule(Schedule schedule, Map<String, Serializable> parameters);
040
041    /**
042     * UnRegisters a schedule.
043     *
044     * @param scheduleId the schedule id
045     * @return true if schedule has been successfully removed.
046     */
047    boolean unregisterSchedule(String scheduleId);
048
049    /**
050     * UnRegisters a schedule.
051     *
052     * @param schedule to be unregistered
053     * @return true if schedule has been successfully removed.
054     */
055    boolean unregisterSchedule(Schedule schedule);
056
057    /**
058     * Checks if the framework has fully started.
059     * <p>
060     * Used to delay job execution until the framework has fully started.
061     *
062     * @return {@code true} if the framework has started
063     * @since 5.6
064     */
065    boolean hasApplicationStarted();
066
067}