View Javadoc

1   package org.apache.turbine.services.schedule;
2   
3   
4   /*
5    * Licensed to the Apache Software Foundation (ASF) under one
6    * or more contributor license agreements.  See the NOTICE file
7    * distributed with this work for additional information
8    * regarding copyright ownership.  The ASF licenses this file
9    * to you under the Apache License, Version 2.0 (the
10   * "License"); you may not use this file except in compliance
11   * with the License.  You may obtain a copy of the License at
12   *
13   *   http://www.apache.org/licenses/LICENSE-2.0
14   *
15   * Unless required by applicable law or agreed to in writing,
16   * software distributed under the License is distributed on an
17   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18   * KIND, either express or implied.  See the License for the
19   * specific language governing permissions and limitations
20   * under the License.
21   */
22  
23  
24  import java.util.List;
25  
26  import org.apache.turbine.services.Service;
27  import org.apache.turbine.util.TurbineException;
28  
29  /**
30   * ScheduleService interface.
31   *
32   * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
33   * @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
34   * @version $Id: ScheduleService.java 1066938 2011-02-03 20:14:53Z ludwig $
35   */
36  public interface ScheduleService
37          extends Service
38  {
39      /** Name of service */
40      String SERVICE_NAME = "SchedulerService";
41  
42      /** TR.props key for intially activating the scheduler thread */
43      String INTIALLY_ACTIVE = "enabled";
44  
45      /** TR.props key for the logger */
46      String LOGGER_NAME = "scheduler";
47  
48      /**
49       * Get a specific Job from Storage.
50       *
51       * @param oid The int id for the job.
52       * @return A JobEntry.
53       * @exception TurbineException could not retreive job
54       */
55      JobEntry getJob(int oid)
56              throws TurbineException;
57  
58      /**
59       * Add a new job to the queue.
60       *
61       * @param je A JobEntry with the job to add.
62       * @throws TurbineException job could not be added
63       */
64      void addJob(JobEntry je)
65              throws TurbineException;
66  
67      /**
68       * Modify a Job.
69       *
70       * @param je A JobEntry with the job to modify
71       * @throws TurbineException job could not be updated
72       */
73      void updateJob(JobEntry je)
74              throws TurbineException;
75  
76      /**
77       * Remove a job from the queue.
78       *
79       * @param je A JobEntry with the job to remove.
80       * @exception TurbineException job could not be removed
81       */
82      void removeJob(JobEntry je)
83              throws TurbineException;
84  
85      /**
86       * List jobs in the queue.  This is used by the scheduler UI.
87       *
88       * @return A List of jobs.
89       */
90      List<JobEntry> listJobs();
91  
92      /**
93       * Determines if the scheduler service is currently active.
94       *
95       * @return Status of the scheduler service.
96       */
97      boolean isEnabled();
98  
99      /**
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 }