001/*
002 * (C) Copyright 2007-2010 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Florent Guillaume
016 */
017package org.nuxeo.ecm.core.scheduler;
018
019import java.io.Serializable;
020import java.util.Map;
021
022/**
023 * Scheduler service.
024 */
025public interface SchedulerService {
026
027    /**
028     * Registers a schedule.
029     *
030     * @param schedule the schedule
031     */
032    void registerSchedule(Schedule schedule);
033
034    /**
035     * Registers a schedule. Add all parameters to eventContext.
036     *
037     * @param schedule
038     * @param parameters
039     */
040    void registerSchedule(Schedule schedule, Map<String, Serializable> parameters);
041
042    /**
043     * UnRegisters a schedule.
044     *
045     * @param scheduleId the schedule id
046     * @return true if schedule has been successfully removed.
047     */
048    boolean unregisterSchedule(String scheduleId);
049
050    /**
051     * UnRegisters a schedule.
052     *
053     * @param schedule to be unregistered
054     * @return true if schedule has been successfully removed.
055     */
056    boolean unregisterSchedule(Schedule schedule);
057
058    /**
059     * Checks if the framework has fully started.
060     * <p>
061     * Used to delay job execution until the framework has fully started.
062     *
063     * @return {@code true} if the framework has started
064     * @since 5.6
065     */
066    boolean hasApplicationStarted();
067
068}