View Javadoc

1   /**
2    * Copyright 2005-2006 the original author or authors.
3    *
4    * Licensed under the Gnu General Pubic License, Version 2.0 (the
5    * "License"); you may not use this file except in compliance with
6    * the License. You may obtain a copy of the License at
7    *
8    *      http://www.opensource.org/licenses/gpl-license.php
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13   * See the Gnu General Public License for more details.
14   */
15  package org.figure8.join.services.scheduling;
16  
17  import org.figure8.join.core.InfrastructureException;
18  import org.figure8.join.core.DuplicateEntityException;
19  
20  import java.util.List;
21  /**
22   * This is the interface defintion of the manager of QuartzCronInfo
23   * and QuartzCronParameterInfo entities.
24   * @author <a href="mailto:jerome.evrard@gmail.com">Jerome Evrard</a>
25   * @version $Revision: 1.3 $
26   */
27  public interface QuartzCronManager{
28     
29     // Static -------------------------------------------------------------------
30     
31     /**
32      * Constant allowing to identify the entity object to whom the job applies.
33      * Tipically, it is used as a kay of the job detail data when job is launched.
34      */
35     public final static String JOB_ENTITY = "jobEntity";
36  
37  
38     // Public -------------------------------------------------------------------
39  
40     /**
41      * Save a QuartzCronInfo within datastore. This method is also responsible
42      * of cron activation/deactivation if necessary (depends on its status).
43      * @param info The QuartzCronInfo instance to save.
44      * @throws DuplicateEntityException if another consumer with same name already exists.
45      * @throws InfrastructureException if wrapped Quartz scheduler cannot schedule the job
46      */
47     public abstract void saveQuartzCronInfo(QuartzCronInfo info) throws DuplicateEntityException,
48             InfrastructureException;
49  
50     /**
51      * Remove a Quartz Cron infos from datastore. This method should also
52      * stop existing scheduled instances before removing the related informations.
53      * @param info The info on a Quartz cron to remove
54      */
55     public abstract void removeQuartzCronInfo(QuartzCronInfo info);
56  
57     /**
58      * Retrieve a QuartzCronInfo instance using its name.
59      * @param name The QuartzCronInfo name to retrieve.
60      * @return The QuartzCronInfo instance found or null if not exists.
61      */
62     public abstract QuartzCronInfo getQuartzCron(String name);
63  
64     /**
65      * Retrieve all QuartzCronInfo instances.
66      * @return The list of QuartzCronInfo in data source.
67      */
68     public abstract List getQuartzCronInfos();
69  
70     /**
71      * Start scheduling of all the already saved Quartz jobs. This method should
72      * be called on startup.
73      * @throws InfrastructureException if wrapped Quartz scheduler cannot schedule the jobs
74      */
75     public abstract void scheduleJobs() throws InfrastructureException;
76  
77     /**
78      * Stop the scheduling of all the registered Quartz jobs. This method should
79      * be clled on shutdown.
80      */
81     public abstract void unscheduleJobs();
82  }