KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > varia > scheduler > ScheduleManagerMBean


1 /*
2  * JBoss, Home of Professional Open Source
3  * Copyright 2005, JBoss Inc., and individual contributors as indicated
4  * by the @authors tag. See the copyright.txt in the distribution for a
5  * full listing of individual contributors.
6  *
7  * This is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation; either version 2.1 of
10  * the License, or (at your option) any later version.
11  *
12  * This software is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this software; if not, write to the Free
19  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21  */

22 package org.jboss.varia.scheduler;
23
24 import java.util.Date JavaDoc;
25
26 import javax.management.ObjectName JavaDoc;
27
28 import org.jboss.mx.util.ObjectNameFactory;
29 import org.jboss.system.ServiceMBean;
30
31 /**
32  * ScheduleManagerMBean interface.
33  *
34  * @author <a HREF="mailto:andreas@jboss.org">Andreas Schaefer</a>
35  * @author <a HREF="mailto:dimitris@jboss.org">Dimitris Andreadis</a>
36  * @version $Revision: 46255 $
37  */

38 public interface ScheduleManagerMBean extends ServiceMBean
39 {
40    /** The default ObjectName */
41    ObjectName JavaDoc OBJECT_NAME = ObjectNameFactory.create("jboss:service=ScheduleMBean");
42
43    // Attributes ----------------------------------------------------
44

45    /** Whether the scheduler should be started upon MBean start or not */
46    void setStartAtStartup(boolean startAtStartup);
47    boolean isStartAtStartup();
48
49    /** The JMX timer to use for the actual scheduling */
50    void setTimerName(String JavaDoc timerObjectName);
51    String JavaDoc getTimerName();
52    
53    /** The default scheduling to use, fixed-rate or fixed-delay (false, default) */
54    void setFixedRate(boolean fixedRate);
55    boolean getFixedRate();
56    
57    // Operations ----------------------------------------------------
58

59    /**
60     * Starts all the registered Schedules
61     */

62    void startSchedules();
63
64    /**
65     * Stops all the registered Schedules
66     *
67     * @param doItNow currently ignored
68     */

69    void stopSchedules(boolean doItNow);
70
71    /**
72     * Stops and restarts the service
73     */

74    void restartSchedule();
75
76    /**
77     * Register a Schedule Provider to make him available. This method
78     * calls startProviding() on the Provider to indicate that the
79     * Provider can start adding Schedules.
80     *
81     * @param providerObjectName Object Name of the Provider
82     */

83    void registerProvider(String JavaDoc providerObjectName);
84
85    /**
86     * Unregister a Schedule Provider which in turn calls back stopProviding()
87     * to indicate to the Provider that it should remove all the Schedules.
88     *
89     * @param providerObjectName Object Name of the Provider
90     */

91    void unregisterProvider(String JavaDoc providerObjectName);
92
93    /**
94     * Adds a new Schedule to the Scheduler
95     * @param target Object Name of the Target MBean
96     * @param methodName Name of the method to be called
97     * @param methodSignature List of Attributes of the method to be called where ...
98     * @param startDate Date when the schedule is started
99     * @param repetitions Initial Number of repetitions
100     * @return identification of the Schedule used later to remove it if necessary
101     */

102    int addSchedule(ObjectName JavaDoc provider, ObjectName JavaDoc target, String JavaDoc methodName, String JavaDoc[] methodSignature,
103          Date JavaDoc startDate, long period, int repetitions);
104
105    /**
106     * Removes a Schedule so that no notification is sent anymore
107     * @param identification id returned by {@link #addSchedule addSchedule()}.
108     */

109    void removeSchedule(int identification);
110
111 }
112
Popular Tags