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    @MBeanInfo("remove jobs with matching execution time")
034    public abstract void removeAllJobsAtScheduledTime(@MBeanInfo("time: yyyy-MM-dd hh:mm:ss")String time) throws Exception;
035
036    /**
037     * Remove a job with the matching jobId.  If the method does not find a matching job
038     * then it returns without throwing an error or making any modifications to the job
039     * scheduler store.
040     *
041     * @param jobId
042     *        the Job Id to remove from the scheduler store.
043     *
044     * @throws Exception if an error occurs while attempting to remove the Job.
045     */
046    @MBeanInfo("remove jobs with matching jobId")
047    public abstract void removeJob(@MBeanInfo("jobId")String jobId) throws Exception;
048
049    /**
050     * Remove all the Jobs from the scheduler,
051     *
052     * @throws Exception if an error occurs while purging the store.
053     */
054    @MBeanInfo("remove all scheduled jobs")
055    public abstract void removeAllJobs() throws Exception;
056
057    /**
058     * Remove all the Jobs from the scheduler that are due between the start and finish times.
059     *
060     * @param start
061     *        the starting time to remove jobs from.
062     * @param finish
063     *        the finish time for the remove operation.
064     *
065     * @throws Exception if an error occurs while attempting to remove the jobs.
066     */
067    @MBeanInfo("remove all scheduled jobs between time ranges ")
068    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;
069
070    /**
071     * Get the next time jobs will be fired from this scheduler store.
072     *
073     * @return the time in milliseconds of the next job to execute.
074     *
075     * @throws Exception if an error occurs while accessing the store.
076     */
077    @MBeanInfo("get the next time a job is due to be scheduled ")
078    public abstract String getNextScheduleTime() throws Exception;
079
080    /**
081     * Gets the number of times a scheduled Job has been executed.
082     *
083     * @return the total number of time a scheduled job has executed.
084     *
085     * @throws Exception if an error occurs while querying for the Job.
086     */
087    @MBeanInfo("get the next time a job is due to be scheduled ")
088    public abstract int getExecutionCount(@MBeanInfo("jobId")String jobId) throws Exception;
089
090    /**
091     * Get all the jobs scheduled to run next.
092     *
093     * @return a list of jobs that will be scheduled next
094     *
095     * @throws Exception if an error occurs while reading the scheduler store.
096     */
097    @MBeanInfo("get the next job(s) to be scheduled. Not HTML friendly ")
098    public abstract TabularData getNextScheduleJobs() throws Exception;
099
100    /**
101     * Get all the outstanding Jobs that are scheduled in this scheduler store.
102     *
103     * @return a table of all jobs in this scheduler store.
104     *
105     * @throws Exception if an error occurs while reading the store.
106     */
107    @MBeanInfo("get the scheduled Jobs in the Store. Not HTML friendly ")
108    public abstract TabularData getAllJobs() throws Exception;
109
110    /**
111     * Get all outstanding jobs due to run between start and finish time range.
112     *
113     * @param start
114     *        the starting time range to query the store for jobs.
115     * @param finish
116     *        the ending time of this query for scheduled jobs.
117     *
118     * @return a table of jobs in the range given.
119     *
120     * @throws Exception if an error occurs while querying the scheduler store.
121     */
122    @MBeanInfo("get the scheduled Jobs in the Store within the time range. Not HTML friendly ")
123    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;
124
125}