Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
JobProgressManager | 34 | 0 | - | 0 | 0 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.job.event.status; | |
21 | ||
22 | import java.util.concurrent.Callable; | |
23 | ||
24 | import org.xwiki.component.annotation.Role; | |
25 | import org.xwiki.logging.Message; | |
26 | ||
27 | /** | |
28 | * Helper to manipulate current progress. | |
29 | * | |
30 | * @version $Id: 7c78f6c4d5b7487a2061deab9834f0bb50cb5265 $ | |
31 | * @since 6.1M1 | |
32 | */ | |
33 | @Role | |
34 | public interface JobProgressManager | |
35 | { | |
36 | /** | |
37 | * Push new progression level with unknown number of steps. | |
38 | * | |
39 | * @param source the source to send with the event | |
40 | */ | |
41 | void pushLevelProgress(Object source); | |
42 | ||
43 | /** | |
44 | * Push new progression level. | |
45 | * | |
46 | * @param steps number of steps in this new level | |
47 | * @param source the source to send with the event | |
48 | */ | |
49 | void pushLevelProgress(int steps, Object source); | |
50 | ||
51 | /** | |
52 | * Close the current step and start a new one. | |
53 | * | |
54 | * @param source the source to send with the event | |
55 | * @deprecated since 7.1M2, use {@link #startStep(Object)} instead | |
56 | */ | |
57 | @Deprecated | |
58 | void stepPropress(Object source); | |
59 | ||
60 | /** | |
61 | * Close the current step if any and start a new one with provided name. | |
62 | * | |
63 | * @param source the source to send with the event | |
64 | * @since 7.1M2 | |
65 | */ | |
66 | void startStep(Object source); | |
67 | ||
68 | /** | |
69 | * Close the current step if any and start a new one with provided name. | |
70 | * | |
71 | * @param source the source to send with the event | |
72 | * @param name the name associated to the next step | |
73 | * @since 7.1M2 | |
74 | */ | |
75 | void startStep(Object source, String name); | |
76 | ||
77 | /** | |
78 | * Close the current step if any and start a new one with provided name. | |
79 | * | |
80 | * @param source the source to send with the event | |
81 | * @param translationKey the key used to find the translation of the step message | |
82 | * @param message the default message associated to the step | |
83 | * @param arguments the arguments to insert in the step message | |
84 | * @since 7.1M2 | |
85 | */ | |
86 | void startStep(Object source, String translationKey, String message, Object... arguments); | |
87 | ||
88 | /** | |
89 | * Close the current step if any and start a new one with provided name. | |
90 | * | |
91 | * @param source the source to send with the event | |
92 | * @param message the message associated to the next step | |
93 | * @since 7.1M2 | |
94 | */ | |
95 | void startStep(Object source, Message message); | |
96 | ||
97 | /** | |
98 | * Close the current step. | |
99 | * | |
100 | * @param source the source to send with the event | |
101 | * @since 7.1M2 | |
102 | */ | |
103 | void endStep(Object source); | |
104 | ||
105 | /** | |
106 | * Pop current progression level. | |
107 | * | |
108 | * @param source the source to send with the event | |
109 | */ | |
110 | void popLevelProgress(Object source); | |
111 | ||
112 | /** | |
113 | * Automatically push and pop progression level with unknown number of steps around passed task. | |
114 | * | |
115 | * @param <T> the return type | |
116 | * @param task the task to execute | |
117 | * @param source the source to send with the event | |
118 | * @return computed result | |
119 | * @throws Exception if unable to compute a result | |
120 | * @since 7.1M1 | |
121 | */ | |
122 | <T> T call(Callable<T> task, Object source) throws Exception; | |
123 | ||
124 | /** | |
125 | * Automatically push and pop progression level around passed task. | |
126 | * | |
127 | * @param <T> the return type | |
128 | * @param task the task to execute | |
129 | * @param steps number of steps in this new level | |
130 | * @param source the source to send with the event | |
131 | * @return computed result | |
132 | * @throws Exception if unable to compute a result | |
133 | * @since 7.1M1 | |
134 | */ | |
135 | <T> T call(Callable<T> task, int steps, Object source) throws Exception; | |
136 | } |