Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
JobStatus | 36 | 1 | 0% | 1 | 2 | ||
JobStatus.State | 43 | 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.Date; | |
23 | import java.util.List; | |
24 | ||
25 | import org.xwiki.job.Request; | |
26 | import org.xwiki.logging.LogLevel; | |
27 | import org.xwiki.logging.LogQueue; | |
28 | import org.xwiki.logging.event.LogEvent; | |
29 | ||
30 | /** | |
31 | * Describe the current status of a job. | |
32 | * | |
33 | * @version $Id: 9b2417b1d849e0a24cdc2ea071040b081a8f711a $ | |
34 | * @since 4.0M1 | |
35 | */ | |
36 | public interface JobStatus | |
37 | { | |
38 | /** | |
39 | * Job status. | |
40 | * | |
41 | * @version $Id: 9b2417b1d849e0a24cdc2ea071040b081a8f711a $ | |
42 | */ | |
43 | enum State | |
44 | { | |
45 | /** | |
46 | * Default status, generally mean that the task has not been started yet. | |
47 | */ | |
48 | NONE, | |
49 | ||
50 | /** | |
51 | * The job is running. | |
52 | */ | |
53 | RUNNING, | |
54 | ||
55 | /** | |
56 | * The job is waiting. | |
57 | */ | |
58 | WAITING, | |
59 | ||
60 | /** | |
61 | * The job is done. | |
62 | */ | |
63 | FINISHED | |
64 | } | |
65 | ||
66 | /** | |
67 | * @return the general state of the job | |
68 | */ | |
69 | State getState(); | |
70 | ||
71 | /** | |
72 | * @return the {@link Throwable} on which the job stopped | |
73 | * @since 8.1RC1 | |
74 | */ | |
75 | 0 | default Throwable getError() |
76 | { | |
77 | 0 | return null; |
78 | } | |
79 | ||
80 | /** | |
81 | * @return the job request provided when starting it | |
82 | */ | |
83 | Request getRequest(); | |
84 | ||
85 | /** | |
86 | * @return the log sent during job execution | |
87 | */ | |
88 | LogQueue getLog(); | |
89 | ||
90 | /** | |
91 | * @return progress information about the job (percent, etc.) | |
92 | */ | |
93 | JobProgress getProgress(); | |
94 | ||
95 | /** | |
96 | * @param question the question to ask as a Java bean | |
97 | * @throws InterruptedException if the current thread is interrupted | |
98 | * @since 4.0M2 | |
99 | */ | |
100 | void ask(Object question) throws InterruptedException; | |
101 | ||
102 | /** | |
103 | * @return the question | |
104 | * @since 4.0M2 | |
105 | */ | |
106 | Object getQuestion(); | |
107 | ||
108 | /** | |
109 | * Indicate that the question has been answered. | |
110 | * | |
111 | * @since 4.0M2 | |
112 | */ | |
113 | void answered(); | |
114 | ||
115 | /** | |
116 | * @return the date and time when the job has been started | |
117 | */ | |
118 | Date getStartDate(); | |
119 | ||
120 | /** | |
121 | * @return the date and time when the job finished | |
122 | */ | |
123 | Date getEndDate(); | |
124 | ||
125 | // Deprecated | |
126 | ||
127 | /** | |
128 | * @param level the level of the log | |
129 | * @return the log sent with the provided level | |
130 | * @deprecated since 4.1RC1 use {@link LogQueue#getLogs(LogLevel)} instead | |
131 | */ | |
132 | @Deprecated | |
133 | List<LogEvent> getLog(LogLevel level); | |
134 | } |