001 package org.apache.turbine.services.schedule;
002
003
004 /*
005 * Licensed to the Apache Software Foundation (ASF) under one
006 * or more contributor license agreements. See the NOTICE file
007 * distributed with this work for additional information
008 * regarding copyright ownership. The ASF licenses this file
009 * to you under the Apache License, Version 2.0 (the
010 * "License"); you may not use this file except in compliance
011 * with the License. You may obtain a copy of the License at
012 *
013 * http://www.apache.org/licenses/LICENSE-2.0
014 *
015 * Unless required by applicable law or agreed to in writing,
016 * software distributed under the License is distributed on an
017 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
018 * KIND, either express or implied. See the License for the
019 * specific language governing permissions and limitations
020 * under the License.
021 */
022
023
024 import java.util.List;
025
026 import org.apache.turbine.services.Service;
027 import org.apache.turbine.util.TurbineException;
028
029 /**
030 * ScheduleService interface.
031 *
032 * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
033 * @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
034 * @version $Id: ScheduleService.java 1066938 2011-02-03 20:14:53Z ludwig $
035 */
036 public interface ScheduleService
037 extends Service
038 {
039 /** Name of service */
040 String SERVICE_NAME = "SchedulerService";
041
042 /** TR.props key for intially activating the scheduler thread */
043 String INTIALLY_ACTIVE = "enabled";
044
045 /** TR.props key for the logger */
046 String LOGGER_NAME = "scheduler";
047
048 /**
049 * Get a specific Job from Storage.
050 *
051 * @param oid The int id for the job.
052 * @return A JobEntry.
053 * @exception TurbineException could not retreive job
054 */
055 JobEntry getJob(int oid)
056 throws TurbineException;
057
058 /**
059 * Add a new job to the queue.
060 *
061 * @param je A JobEntry with the job to add.
062 * @throws TurbineException job could not be added
063 */
064 void addJob(JobEntry je)
065 throws TurbineException;
066
067 /**
068 * Modify a Job.
069 *
070 * @param je A JobEntry with the job to modify
071 * @throws TurbineException job could not be updated
072 */
073 void updateJob(JobEntry je)
074 throws TurbineException;
075
076 /**
077 * Remove a job from the queue.
078 *
079 * @param je A JobEntry with the job to remove.
080 * @exception TurbineException job could not be removed
081 */
082 void removeJob(JobEntry je)
083 throws TurbineException;
084
085 /**
086 * List jobs in the queue. This is used by the scheduler UI.
087 *
088 * @return A List of jobs.
089 */
090 List<JobEntry> listJobs();
091
092 /**
093 * Determines if the scheduler service is currently active.
094 *
095 * @return Status of the scheduler service.
096 */
097 boolean isEnabled();
098
099 /**
100 * Starts the scheduler if not already running.
101 */
102 void startScheduler();
103
104 /**
105 * Stops the scheduler if ti is currently running.
106 */
107 void stopScheduler();
108
109 }