Class |
Line # |
Actions |
|||
---|---|---|---|---|---|
JWs2Job | 33 | 10 | 16 |
1 | /* | |
2 | * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) | |
3 | * Copyright (C) $$Year-Rel$$ The Jalview Authors | |
4 | * | |
5 | * This file is part of Jalview. | |
6 | * | |
7 | * Jalview is free software: you can redistribute it and/or | |
8 | * modify it under the terms of the GNU General Public License | |
9 | * as published by the Free Software Foundation, either version 3 | |
10 | * of the License, or (at your option) any later version. | |
11 | * | |
12 | * Jalview is distributed in the hope that it will be useful, but | |
13 | * WITHOUT ANY WARRANTY; without even the implied warranty | |
14 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR | |
15 | * PURPOSE. See the GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with Jalview. If not, see <http://www.gnu.org/licenses/>. | |
19 | * The Jalview Authors are detailed in the 'AUTHORS' file. | |
20 | */ | |
21 | package jalview.ws.jws2; | |
22 | ||
23 | import jalview.ws.AWsJob; | |
24 | ||
25 | import compbio.metadata.JobStatus; | |
26 | ||
27 | /** | |
28 | * job status processing for JWS2 jobs. | |
29 | * | |
30 | * @author JimP | |
31 | * | |
32 | */ | |
33 | public abstract class JWs2Job extends AWsJob | |
34 | { | |
35 | JobStatus status = null; | |
36 | ||
37 | 0 | public void setjobStatus(JobStatus jobStatus) |
38 | { | |
39 | 0 | status = jobStatus; |
40 | // update flags | |
41 | } | |
42 | ||
43 | /* | |
44 | * (non-Javadoc) | |
45 | * | |
46 | * @see jalview.ws.AWsJob#clearResponse() | |
47 | */ | |
48 | 0 | @Override |
49 | public void clearResponse() | |
50 | { | |
51 | 0 | status = null; |
52 | } | |
53 | ||
54 | /* | |
55 | * (non-Javadoc) | |
56 | * | |
57 | * @see jalview.ws.AWsJob#getState() | |
58 | */ | |
59 | 0 | @Override |
60 | public String getState() | |
61 | { | |
62 | 0 | return status == null ? ("Unknown") : status.toString(); |
63 | } | |
64 | ||
65 | /* | |
66 | * (non-Javadoc) | |
67 | * | |
68 | * @see jalview.ws.AWsJob#hasResponse() | |
69 | */ | |
70 | 0 | @Override |
71 | public boolean hasResponse() | |
72 | { | |
73 | // TODO Auto-generated method stub | |
74 | 0 | return status != null; |
75 | } | |
76 | ||
77 | /* | |
78 | * StringBuffer statusBuffer = null; (non-Javadoc) | |
79 | * | |
80 | * @see jalview.ws.AWsJob#getStatus() | |
81 | * | |
82 | * @Override public String getStatus() { return statusBuffer.toString(); } | |
83 | * (non-Javadoc) | |
84 | * | |
85 | * @see jalview.ws.AWsJob#hasStatus() | |
86 | * | |
87 | * @Override public boolean hasStatus() { return statusBuffer!=null; } | |
88 | */ | |
89 | ||
90 | /* | |
91 | * (non-Javadoc) | |
92 | * | |
93 | * @see jalview.ws.AWsJob#isBroken() | |
94 | */ | |
95 | 0 | @Override |
96 | public boolean isBroken() | |
97 | { | |
98 | 0 | return status == null ? false : status.equals(status.UNDEFINED); |
99 | } | |
100 | ||
101 | /* | |
102 | * (non-Javadoc) | |
103 | * | |
104 | * @see jalview.ws.AWsJob#isFailed() | |
105 | */ | |
106 | 0 | @Override |
107 | public boolean isFailed() | |
108 | { | |
109 | 0 | return status == null ? false : status.equals(status.FAILED); |
110 | } | |
111 | ||
112 | /* | |
113 | * (non-Javadoc) | |
114 | * | |
115 | * @see jalview.ws.AWsJob#isFinished() | |
116 | */ | |
117 | 0 | @Override |
118 | public boolean isFinished() | |
119 | { | |
120 | 0 | return status == null ? false : status.equals(status.FINISHED); |
121 | } | |
122 | ||
123 | /* | |
124 | * (non-Javadoc) | |
125 | * | |
126 | * @see jalview.ws.AWsJob#isQueued() | |
127 | */ | |
128 | 0 | @Override |
129 | public boolean isQueued() | |
130 | { | |
131 | 0 | return status == null ? false |
132 | : status.equals(status.SUBMITTED) | |
133 | || status.equals(status.PENDING); | |
134 | } | |
135 | ||
136 | /* | |
137 | * (non-Javadoc) | |
138 | * | |
139 | * @see jalview.ws.AWsJob#isRunning() | |
140 | */ | |
141 | 0 | @Override |
142 | public boolean isRunning() | |
143 | { | |
144 | // TODO Auto-generated method stub | |
145 | 0 | return status != null && (status.equals(status.RUNNING) |
146 | || status.equals(status.STARTED)); | |
147 | } | |
148 | ||
149 | /* | |
150 | * (non-Javadoc) | |
151 | * | |
152 | * @see jalview.ws.AWsJob#isServerError() | |
153 | */ | |
154 | 0 | @Override |
155 | public boolean isServerError() | |
156 | { | |
157 | // server errors are raised as exceptions on the service method calls. | |
158 | 0 | return status == null ? false : false; // status.equals(status.FAILED); |
159 | } | |
160 | ||
161 | } |