1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.ws.jws2.jabaws2; |
22 |
|
|
23 |
|
import jalview.gui.AlignFrame; |
24 |
|
import jalview.gui.Desktop; |
25 |
|
import jalview.util.MessageManager; |
26 |
|
import jalview.ws.jws2.JabaParamStore; |
27 |
|
import jalview.ws.jws2.MsaWSClient; |
28 |
|
import jalview.ws.jws2.SequenceAnnotationWSClient; |
29 |
|
import jalview.ws.params.ParamDatastoreI; |
30 |
|
|
31 |
|
import java.io.Closeable; |
32 |
|
|
33 |
|
import javax.swing.JMenu; |
34 |
|
|
35 |
|
import compbio.data.msa.JABAService; |
36 |
|
import compbio.data.msa.MsaWS; |
37 |
|
import compbio.data.msa.SequenceAnnotation; |
38 |
|
import compbio.metadata.PresetManager; |
39 |
|
import compbio.metadata.RunnerConfig; |
40 |
|
|
|
|
| 0% |
Uncovered Elements: 87 (87) |
Complexity: 30 |
Complexity Density: 0.64 |
|
41 |
|
public class Jws2Instance implements AutoCloseable |
42 |
|
{ |
43 |
|
public String hosturl; |
44 |
|
|
45 |
|
public String serviceType; |
46 |
|
|
47 |
|
public String action; |
48 |
|
|
49 |
|
public JABAService service; |
50 |
|
|
51 |
|
public String description; |
52 |
|
|
53 |
|
public String docUrl; |
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
@param |
58 |
|
|
59 |
|
@param |
60 |
|
|
61 |
|
@param |
62 |
|
|
63 |
|
|
64 |
|
@param |
65 |
|
|
66 |
|
@param |
67 |
|
|
68 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 3 |
Complexity Density: 0.27 |
|
69 |
0 |
public Jws2Instance(String hosturl, String serviceType, String action,... |
70 |
|
String description, JABAService service) |
71 |
|
{ |
72 |
0 |
super(); |
73 |
0 |
this.hosturl = hosturl; |
74 |
0 |
this.serviceType = serviceType; |
75 |
0 |
this.service = service; |
76 |
0 |
this.action = action; |
77 |
0 |
this.description = description; |
78 |
0 |
int p = description.indexOf("MORE INFORMATION:"); |
79 |
0 |
if (p > -1) |
80 |
|
{ |
81 |
0 |
docUrl = description.substring(description.indexOf("http", p)).trim(); |
82 |
0 |
if (docUrl.indexOf('\n') > -1) |
83 |
|
{ |
84 |
0 |
docUrl = docUrl.substring(0, docUrl.indexOf("\n")).trim(); |
85 |
|
} |
86 |
|
|
87 |
|
} |
88 |
|
} |
89 |
|
|
90 |
|
PresetManager presets = null; |
91 |
|
|
92 |
|
public JabaParamStore paramStore = null; |
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
@return |
99 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 5 |
Complexity Density: 0.62 |
|
100 |
0 |
public PresetManager getPresets()... |
101 |
|
{ |
102 |
0 |
if (presets == null) |
103 |
|
{ |
104 |
0 |
try |
105 |
|
{ |
106 |
0 |
if (service instanceof MsaWS<?>) |
107 |
|
{ |
108 |
0 |
presets = ((MsaWS) service).getPresets(); |
109 |
|
|
110 |
|
} |
111 |
0 |
if (service instanceof SequenceAnnotation<?>) |
112 |
|
{ |
113 |
0 |
presets = ((SequenceAnnotation) service).getPresets(); |
114 |
|
} |
115 |
|
} catch (Exception ex) |
116 |
|
{ |
117 |
0 |
jalview.bin.Console |
118 |
|
.errPrintln("Exception when retrieving presets for service " |
119 |
|
+ serviceType + " at " + hosturl); |
120 |
|
} |
121 |
|
} |
122 |
0 |
return presets; |
123 |
|
} |
124 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
125 |
0 |
public String getHost()... |
126 |
|
{ |
127 |
0 |
return hosturl; |
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
|
135 |
|
} |
136 |
|
|
137 |
|
|
138 |
|
@return |
139 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
140 |
0 |
public String getActionText()... |
141 |
|
{ |
142 |
0 |
return action + " with " + serviceType; |
143 |
|
} |
144 |
|
|
145 |
|
|
146 |
|
|
147 |
|
|
148 |
|
|
149 |
|
@return |
150 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
151 |
0 |
public RunnerConfig getRunnerConfig()... |
152 |
|
{ |
153 |
0 |
if (service instanceof MsaWS<?>) |
154 |
|
{ |
155 |
0 |
return ((MsaWS) service).getRunnerOptions(); |
156 |
|
} |
157 |
0 |
if (service instanceof SequenceAnnotation<?>) |
158 |
|
{ |
159 |
0 |
return ((SequenceAnnotation) service).getRunnerOptions(); |
160 |
|
} |
161 |
0 |
throw new Error(MessageManager.formatMessage( |
162 |
|
"error.implementation_error_runner_config_not_available", |
163 |
|
new String[] |
164 |
|
{ serviceType, service.getClass().toString() })); |
165 |
|
} |
166 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
167 |
0 |
@Override... |
168 |
|
public void close() |
169 |
|
{ |
170 |
0 |
if (service != null) |
171 |
|
{ |
172 |
0 |
try |
173 |
|
{ |
174 |
0 |
((Closeable) service).close(); |
175 |
|
} catch (Throwable t) |
176 |
|
{ |
177 |
|
|
178 |
|
} |
179 |
|
} |
180 |
|
|
181 |
|
} |
182 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
183 |
0 |
public ParamDatastoreI getParamStore()... |
184 |
|
{ |
185 |
0 |
if (paramStore == null) |
186 |
|
{ |
187 |
0 |
try |
188 |
|
{ |
189 |
0 |
paramStore = new JabaParamStore(this, |
190 |
0 |
(Desktop.instance != null ? Desktop.getUserParameterStore() |
191 |
|
: null)); |
192 |
|
} catch (Exception ex) |
193 |
|
{ |
194 |
0 |
jalview.bin.Console.errPrintln( |
195 |
|
"Unexpected exception creating JabaParamStore."); |
196 |
0 |
ex.printStackTrace(); |
197 |
|
} |
198 |
|
|
199 |
|
} |
200 |
0 |
return paramStore; |
201 |
|
} |
202 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
203 |
0 |
public String getUri()... |
204 |
|
{ |
205 |
|
|
206 |
0 |
return hosturl |
207 |
0 |
+ (hosturl.lastIndexOf("/") == (hosturl.length() - 1) ? "" |
208 |
|
: "/") |
209 |
|
+ serviceType; |
210 |
|
} |
211 |
|
|
212 |
|
private boolean hasParams = false, lookedForParams = false; |
213 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 3 |
Complexity Density: 0.6 |
|
214 |
0 |
public boolean hasParameters()... |
215 |
|
{ |
216 |
0 |
if (!lookedForParams) |
217 |
|
{ |
218 |
0 |
lookedForParams = true; |
219 |
0 |
try |
220 |
|
{ |
221 |
0 |
hasParams = (getRunnerConfig().getArguments().size() > 0); |
222 |
|
} catch (Exception e) |
223 |
|
{ |
224 |
|
|
225 |
|
} |
226 |
|
} |
227 |
0 |
return hasParams; |
228 |
|
} |
229 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 3 |
Complexity Density: 0.75 |
|
230 |
0 |
public void attachWSMenuEntry(JMenu atpoint, AlignFrame alignFrame)... |
231 |
|
{ |
232 |
0 |
if (service instanceof MsaWS<?>) |
233 |
|
{ |
234 |
0 |
new MsaWSClient().attachWSMenuEntry(atpoint, this, alignFrame); |
235 |
|
} |
236 |
0 |
else if (service instanceof SequenceAnnotation<?>) |
237 |
|
{ |
238 |
0 |
new SequenceAnnotationWSClient().attachWSMenuEntry(atpoint, this, |
239 |
|
alignFrame); |
240 |
|
} |
241 |
|
} |
242 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
243 |
0 |
public String getServiceTypeURI()... |
244 |
|
{ |
245 |
0 |
return "java:" + serviceType; |
246 |
|
} |
247 |
|
|
248 |
|
jalview.ws.uimodel.AlignAnalysisUIText aaui; |
249 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
250 |
0 |
public jalview.ws.uimodel.AlignAnalysisUIText getAlignAnalysisUI()... |
251 |
|
{ |
252 |
0 |
return aaui; |
253 |
|
} |
254 |
|
} |