KickJava   Java API By Example, From Geeks To Geeks.

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


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 javax.management.ObjectName JavaDoc;
25
26 import org.jboss.mx.util.ObjectNameFactory;
27
28 /**
29  * SingleScheduleProvider MBean interface.
30  *
31  * @author <a HREF="mailto:andreas@jboss.org">Andreas Schaefer</a>
32  * @author <a HREF="mailto:dimitris@jboss.org">Dimitris Andreadis</a>
33  * @version $Revision: 43909 $
34  */

35 public interface SingleScheduleProviderMBean extends AbstractScheduleProviderMBean
36 {
37    /** The default ObjectName */
38    ObjectName JavaDoc OBJECT_NAME = ObjectNameFactory.create("jboss:service=SingleScheduleProvider");
39
40    // Attributes ----------------------------------------------------
41

42    /**
43     * The ObjectName of the Schedulable MBean to call
44     */

45    void setTargetName(ObjectName JavaDoc objectName);
46    ObjectName JavaDoc getTargetName();
47
48    /**
49     * The method name to call on the Schedulable MBean. It can optionally
50     * be followed by an opening bracket, list of attributes (see below) and a closing bracket.
51     *
52     * The list of attributes can contain:
53     * <ul>
54     * <li>NOTIFICATION which will be replaced by the timers notification instance (javax.management.Notification)</li>
55     * <li>DATE which will be replaced by the date of the notification call (java.util.Date)</li>
56     * <li>REPETITIONS which will be replaced by the number of remaining repetitions (long)</li>
57     * <li>SCHEDULER_NAME which will be replaced by the Object Name of the Scheduler (javax.management.ObjectName)</li>
58     * <li>any full qualified Class name which the Scheduler will be set a "null" value for it</li>
59     * </ul
60     * <br>
61     * An example could be: "doSomething( NOTIFICATION, REPETITIONS, java.lang.String )"
62     * where the Scheduler will pass the timer's notification instance, the remaining
63     * repetitions as int and a null to the MBean's doSomething() method which must
64     * have the following signature: doSomething(javax.management.Notification, long, java.lang.String).
65     *
66     * @param method Name of the method to be called optional followed by method arguments (see above).
67     * @throws IllegalArgumentException If the given value is not of the right format
68     */

69    void setTargetMethod(String JavaDoc method) throws IllegalArgumentException JavaDoc;
70    String JavaDoc getTargetMethod();
71
72    /**
73     * The Schedule Period between two scheduled call.
74     *
75     * @param period Time between to scheduled calls (after the initial call)
76     * in Milliseconds. This value must be bigger than 0.
77     * @throws IllegalArgumentException If the given value is less or equal than 0
78     */

79    void setPeriod(long period);
80    long getPeriod();
81
82    /**
83     * The date format used to parse date/times
84     * @param dateFormat The date format when empty or null the locale is used to parse dates
85     */

86    void setDateFormat(String JavaDoc dateFormat);
87    String JavaDoc getDateFormat();
88
89    /**
90     * The date/time of the first scheduled call. If the date is in the past
91     * the scheduler tries to find the next available start date.
92     * @param startDate Date when the initial call is scheduled. It can be either:
93     * <ul>
94     * <li> NOW: date will be the current date (new Date()) plus 1 seconds </li>
95     * <li> Date as String able to be parsed by SimpleDateFormat with default format </li>
96     * <li> Date as String parsed using the date format attribute </li>
97     * <li> Milliseconds since 1/1/1970 </li>
98     * </ul>
99     * If the date is in the past the Scheduler will search a start date in the future
100     * with respect to the initial repe- titions and the period between calls. This means
101     * that when you restart the MBean (restarting JBoss etc.) it will start at the next
102     * scheduled time. When no start date is available in the future the Scheduler will not start.
103     * <br>
104     * Example: if you start your Schedulable everyday at Noon and you restart your JBoss server
105     * then it will start at the next Noon (the same if started before Noon or the next day if
106     * start after Noon).
107     */

108    void setStartDate(String JavaDoc startDate);
109    String JavaDoc getStartDate();
110
111    /**
112     * Sets the initial number of scheduled calls.
113     *
114     * @param numberOfCalls Initial Number of scheduled calls. If -1 then the number is unlimited.
115     * @throws IllegalArgumentException If the given value is less or equal than 0
116     */

117    void setRepetitions(long numberOfCalls);
118    long getRepetitions();
119
120 }
121
Popular Tags