2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
3 * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
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 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
21 * Generic properties for an individual job within a Web Service Client thread.
22 * Derived from jalview web services version 1 statuses, and revised for Jws2.
25 public abstract class AWsJob
27 protected int jobnum = 0;
29 protected String jobId;
32 * @param jobId the jobId to set
34 public void setJobId(String jobId)
40 * has job been cancelled
42 protected boolean cancelled = false;
45 * number of exceptions left before job dies
47 int allowedServerExceptions = 3;
50 * @param allowedServerExceptions the allowedServerExceptions to set
52 public void setAllowedServerExceptions(int allowedServerExceptions)
54 this.allowedServerExceptions = allowedServerExceptions;
58 * has job been submitted to server ? if false, then no state info is
61 protected boolean submitted = false;
64 * @param jobnum the jobnum to set
66 public void setJobnum(int jobnum)
72 * @param submitted the submitted to set
74 public void setSubmitted(boolean submitted)
76 this.submitted = submitted;
80 * @param subjobComplete the subjobComplete to set
82 public void setSubjobComplete(boolean subjobComplete)
84 this.subjobComplete = subjobComplete;
90 public int getJobnum()
98 public String getJobId()
104 * @return the cancelled
106 public boolean isCancelled()
112 * @return the allowedServerExceptions
114 public int getAllowedServerExceptions()
116 return allowedServerExceptions;
120 * @return the submitted
122 public boolean isSubmitted()
128 * @return the subjobComplete
130 public boolean isSubjobComplete()
132 return subjobComplete;
136 * are all sub-jobs complete
138 protected boolean subjobComplete = false;
146 * @return true if job has completed and valid results are available
148 abstract public boolean hasResults();
152 * @return boolean true if job can be submitted.
154 public abstract boolean hasValidInput();
158 * @return true if job is running
160 abstract public boolean isRunning();
164 * @return true if job is queued
166 abstract public boolean isQueued();
170 * @return true if job has finished
172 abstract public boolean isFinished();
176 * @return true if the job failed due to some problem with the input data or
179 abstract public boolean isFailed();
183 * @return true if job failed due to an unhandled technical issue
185 abstract public boolean isBroken();
189 * @return true if there was a problem contacting the server.
191 abstract public boolean isServerError();
195 * @return true if the job has status text.
197 abstract public boolean hasStatus();
201 * @return status text for job to be displayed to user.
203 abstract public String getStatus();
205 abstract public boolean hasResponse();
206 abstract public void clearResponse();
207 abstract public String getState();
209 * generates response using the abstract service flags.
210 * @return a standard state response
212 protected String _defaultState() {