1 /*
2 * Copyright 2006-2007 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.springframework.batch.admin.service;
17
18 import java.util.Collection;
19 import java.util.List;
20
21 import org.springframework.batch.core.JobExecution;
22 import org.springframework.batch.core.repository.dao.JobExecutionDao;
23
24 /**
25 * @author Dave Syer
26 *
27 */
28 public interface SearchableJobExecutionDao extends JobExecutionDao {
29
30 /**
31 * @return the total number of {@link JobExecution} instances
32 */
33 int countJobExecutions();
34
35 /**
36 * Get the {@link JobExecution JobExecutions} for a specific job name in
37 * reverse order of creation (so normally of execution).
38 *
39 * @param jobName the name of the job
40 * @param start the start index of the instances
41 * @param count the maximum number of instances to return
42 * @return the {@link JobExecution} instances requested
43 */
44 List<JobExecution> getJobExecutions(String jobName, int start, int count);
45
46 /**
47 * Get the {@link JobExecution JobExecutions} in reverse order of creation
48 * (so normally of execution).
49 *
50 * @param start the start index of the instances
51 * @param count the maximum number of instances to return
52 * @return the {@link JobExecution} instances requested
53 */
54 List<JobExecution> getJobExecutions(int start, int count);
55
56 /**
57 * @param jobName the name of a job
58 * @return the number of {@link JobExecution JobExecutions} belonging to
59 * this job
60 */
61 int countJobExecutions(String jobName);
62
63 /**
64 * Find all the running executions (status less than STOPPING).
65 *
66 * @return all the {@link JobExecution} instances that are currently running
67 */
68 Collection<JobExecution> getRunningJobExecutions();
69
70 }