1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package gnu.hylafax.job;
25
26
27 import java.util.StringTokenizer;
28
29 /***
30 * This class contains the information available on a job notification.
31 * @author $Author: sjardine $
32 * @version $Id: SendEvent.java,v 1.2 2006/02/20 04:52:10 sjardine Exp $
33 */
34 public class SendEvent extends Event {
35
36 /*** The job was completed successfully */
37 public final static String REASON_DONE = "done";
38
39 /*** The job was not completed */
40 public final static String REASON_FAILED = "failed";
41
42 /*** The job was rejected */
43 public final static String REASON_REJECTED = "rejected";
44
45 /*** The job is blocked by other concurrent jobs */
46 public final static String REASON_BLOCKED = "blocked";
47
48 /*** The job is being requeued for another attempt */
49 public final static String REASON_REQUEUED = "requeued";
50
51 /*** The job was removed from the queue */
52 public final static String REASON_REMOVED = "removed";
53
54 /*** The job was removed from the queue */
55 public final static String REASON_KILLED = "killed";
56
57 /*** The job could not be sent before kill timer expired */
58 public final static String REASON_TIMEDOUT = "timedout";
59
60 /*** The job document conversion failed */
61 public final static String REASON_FORMATFAILED = "format_failed";
62
63 /*** The document conversion program could not be found */
64 public final static String REASON_NOFORMATTER = "no_formatter";
65
66 /*** The remote side rejected a document poll */
67 public final static String REASON_POLLREJECTED = "poll_rejected";
68
69 /*** There was no document available for polling */
70 public final static String REASON_POLLNODOCUMENT = "poll_no_document";
71
72 /*** The document poll failed */
73 public final static String REASON_POLLFAILED = "poll_failed";
74
75 private String reason;
76
77 private long jobTime = -1;
78
79 private String nextAttempt = null;
80
81 private long jobid = -1;
82
83 public void setJobId(long jid) {
84 jobid = jid;
85 }
86
87 public long getJobId() {
88 return jobid;
89 }
90
91 public String getReason() {
92 return reason;
93 }
94
95 public void setReason(String r) {
96 reason = r;
97 }
98
99 public long getElapsedTime() {
100 return jobTime;
101 }
102
103 public void setElapsedTime(long time) {
104 jobTime = time;
105 }
106
107 /***
108 * set the job elapsed time.
109 * @param time the elapsed time value in "mm:ss" format
110 */
111 public void setElapsedTime(String time) {
112 jobTime = -1;
113 if (time != null && !time.trim().equals("")) {
114 StringTokenizer st = new StringTokenizer(time.trim(), ":");
115 short minutes = Short.parseShort(st.nextToken());
116 short seconds = Short.parseShort(st.nextToken());
117 jobTime = (minutes * 60) + seconds;
118 }
119 }
120
121 public void setNextAttempt(String seconds) {
122 nextAttempt = seconds;
123 }
124
125 public String getNextAttempt() {
126 return nextAttempt;
127 }
128
129 }
130