001/**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.activemq.broker.jmx;
018
019import javax.management.openmbean.TabularData;
020
021public interface JobSchedulerViewMBean {
022
023    /**
024     * Remove all jobs scheduled to run at this time.  If there are no jobs scheduled
025     * at the given time this methods returns without making any modifications to the
026     * scheduler store.
027     *
028     * @param time
029     *        the string formated time that should be used to remove jobs.
030     *
031     * @throws Exception if an error occurs while performing the remove.
032     *
033     * @deprecated use removeAllJobsAtScheduledTime instead as it is more explicit about what
034     *             the method is actually doing.
035     */
036    @Deprecated
037    @MBeanInfo("remove jobs with matching execution time")
038    public abstract void removeJobAtScheduledTime(@MBeanInfo("time: yyyy-MM-dd hh:mm:ss")String time) throws Exception;
039
040    /**
041     * Remove all jobs scheduled to run at this time.  If there are no jobs scheduled
042     * at the given time this methods returns without making any modifications to the
043     * scheduler store.
044     *
045     * @param time
046     *        the string formated time that should be used to remove jobs.
047     *
048     * @throws Exception if an error occurs while performing the remove.
049     */
050    @MBeanInfo("remove jobs with matching execution time")
051    public abstract void removeAllJobsAtScheduledTime(@MBeanInfo("time: yyyy-MM-dd hh:mm:ss")String time) throws Exception;
052
053    /**
054     * Remove a job with the matching jobId.  If the method does not find a matching job
055     * then it returns without throwing an error or making any modifications to the job
056     * scheduler store.
057     *
058     * @param jobId
059     *        the Job Id to remove from the scheduler store.
060     *
061     * @throws Exception if an error occurs while attempting to remove the Job.
062     */
063    @MBeanInfo("remove jobs with matching jobId")
064    public abstract void removeJob(@MBeanInfo("jobId")String jobId) throws Exception;
065
066    /**
067     * Remove all the Jobs from the scheduler,
068     *
069     * @throws Exception if an error occurs while purging the store.
070     */
071    @MBeanInfo("remove all scheduled jobs")
072    public abstract void removeAllJobs() throws Exception;
073
074    /**
075     * Remove all the Jobs from the scheduler that are due between the start and finish times.
076     *
077     * @param start
078     *        the starting time to remove jobs from.
079     * @param finish
080     *        the finish time for the remove operation.
081     *
082     * @throws Exception if an error occurs while attempting to remove the jobs.
083     */
084    @MBeanInfo("remove all scheduled jobs between time ranges ")
085    public abstract void removeAllJobs(@MBeanInfo("start: yyyy-MM-dd hh:mm:ss")String start,@MBeanInfo("finish: yyyy-MM-dd hh:mm:ss")String finish) throws Exception;
086
087    /**
088     * Get the next time jobs will be fired from this scheduler store.
089     *
090     * @return the time in milliseconds of the next job to execute.
091     *
092     * @throws Exception if an error occurs while accessing the store.
093     */
094    @MBeanInfo("get the next time a job is due to be scheduled ")
095    public abstract String getNextScheduleTime() throws Exception;
096
097    /**
098     * Gets the number of times a scheduled Job has been executed.
099     *
100     * @return the total number of time a scheduled job has executed.
101     *
102     * @throws Exception if an error occurs while querying for the Job.
103     */
104    @MBeanInfo("get the next time a job is due to be scheduled ")
105    public abstract int getExecutionCount(@MBeanInfo("jobId")String jobId) throws Exception;
106
107    /**
108     * Get all the jobs scheduled to run next.
109     *
110     * @return a list of jobs that will be scheduled next
111     *
112     * @throws Exception if an error occurs while reading the scheduler store.
113     */
114    @MBeanInfo("get the next job(s) to be scheduled. Not HTML friendly ")
115    public abstract TabularData getNextScheduleJobs() throws Exception;
116
117    /**
118     * Get all the outstanding Jobs that are scheduled in this scheduler store.
119     *
120     * @return a table of all jobs in this scheduler store.
121     *
122     * @throws Exception if an error occurs while reading the store.
123     */
124    @MBeanInfo("get the scheduled Jobs in the Store. Not HTML friendly ")
125    public abstract TabularData getAllJobs() throws Exception;
126
127    /**
128     * Get all outstanding jobs due to run between start and finish time range.
129     *
130     * @param start
131     *        the starting time range to query the store for jobs.
132     * @param finish
133     *        the ending time of this query for scheduled jobs.
134     *
135     * @return a table of jobs in the range given.
136     *
137     * @throws Exception if an error occurs while querying the scheduler store.
138     */
139    @MBeanInfo("get the scheduled Jobs in the Store within the time range. Not HTML friendly ")
140    public abstract TabularData getAllJobs(@MBeanInfo("start: yyyy-MM-dd hh:mm:ss")String start,@MBeanInfo("finish: yyyy-MM-dd hh:mm:ss")String finish)throws Exception;
141
142}