1
2
3
4
5
6
7 package org.astrogrid.status;
8
9 import java.security.Principal;
10 import java.util.Date;
11
12 /***
13 * Defines the things that a task status must be able to return
14 */
15
16 public interface TaskStatus
17 {
18 public final static String INITIALISED = "Initialised";
19 public final static String QUEUED = "Queued";
20 public final static String RUNNING = "Running";
21 public final static String COMPLETE = "Complete";
22 public final static String ERROR = "Error";
23 public final static String ABORTED = "Aborted";
24
25 /*** Returns the ID of the task, that might be used to act on the task */
26 public String getId();
27
28 /*** Returns the time this status was reached */
29 public Date getTimestamp();
30
31 /*** Returns who owns the task */
32 public Principal getOwner();
33
34 /*** Returns one of the above stage constants */
35 public String getStage();
36
37 /*** Returns some indication of the source of the task - undefined, but might
38 * be a URI or the interface used, etc */
39 public String getSource();
40
41 /*** Returns true if the task has finished, whether it has completed successfully or not */
42 public boolean isFinished();
43
44 /*** Some kind of progress indication. */
45 public long getProgress();
46 public long getProgressMax();
47 /*** to go with progress indicators - eg 'getting row ' */
48 public String getProgressText();
49
50 /*** A user description of the state of the current task */
51 public String getMessage();
52
53 /*** A list of messages or some kind of history of the task. For example, for datacenters
54 * this records what SQL was submitted, where the results are going to, etc that are concatinated
55 * as they occur
56 */
57 public String[] getDetails();
58
59 /*** An implementation might use a 'chain' of statuses to record the history of
60 * the task. To get the previous status use this */
61 public TaskStatus getPrevious();
62
63 /*** Implement a convenience routine to get to the first task */
64 public TaskStatus getFirst();
65
66 }
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102