View Javadoc

1   /*
2    * Copyright 2010 Capgemini and Contributors
3    *
4    * Licensed under the Apache License, Version 2.0 (the
5    * "License"); 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, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations under
14   * the License.
15   */
16  package net.sf.appstatus.core.batch;
17  
18  import java.util.Date;
19  import java.util.List;
20  
21  /**
22   * Job progress agent monitor.
23   *
24   * @author Guillaume Mary
25   *
26   */
27  public interface IBatch {
28      String STATUS_FAILURE = "failure";
29      String STATUS_RUNNING = "running";
30      String STATUS_SUCCESS = "success";
31      String STATUS_ZOMBIE = "zombie";
32  
33      String getCurrentItem();
34  
35      String getCurrentTask();
36  
37      /**
38       * Retrieve the end date of the job execution.
39       *
40       * @param executionId
41       *            execution's id
42       * @return end date of the job execution
43       */
44      Date getEndDate();
45  
46      /**
47       * Getting the group of batch.
48       *
49       * @return the group
50       */
51      String getGroup();
52  
53      long getItemCount();
54  
55      /**
56       * Retrieve the last messages.
57       *
58       * @param executionId
59       *            execution id
60       * @param nbMessage
61       *            limit the returned messages
62       * @return list of messages
63       */
64      String getLastMessage();
65  
66      Date getLastUpdate();
67  
68      /**
69       * Getting the name of batch.
70       *
71       * @return the name
72       */
73      String getName();
74  
75      /**
76       * Retrieve the current progress status of the job execution.
77       *
78       * @param executionId
79       *            execution id
80       * @return progress value
81       */
82      float getProgressStatus();
83  
84      /**
85       * Return all the rejected items.
86       *
87       * @param executionId
88       *            job execution id
89       * @return all the rejected items
90       */
91      List<String> getRejectedItemsId();
92  
93      /**
94       * Return the starting date of the job execution.
95       *
96       * @param executionId
97       *            job execution id
98       * @return start date
99       */
100     Date getStartDate();
101 
102     /**
103      * Retrieve the status of the batch execution.
104      *
105      * @param executionId
106      *            job execution id.
107      * @return status
108      */
109     String getStatus();
110 
111     /**
112      * Retrieve all the jobs execution monitored by this agent monitor.
113      *
114      * @return list of job execution ids
115      */
116     String getUuid();
117 
118     boolean isSuccess();
119 
120     /**
121      * This method is not intended to be used directly.
122      *
123      * @param monitor
124      */
125     void setProgressMonitor(IBatchProgressMonitor monitor);
126 }