| 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.Desktop; |
| 24 |
|
import jalview.util.MessageManager; |
| 25 |
|
import jalview.ws.api.JalviewServiceEndpointProviderI; |
| 26 |
|
import jalview.ws.api.ServiceWithParameters; |
| 27 |
|
import jalview.ws.jws2.JabaParamStore; |
| 28 |
|
import jalview.ws.params.ParamDatastoreI; |
| 29 |
|
import jalview.ws.params.ParamManager; |
| 30 |
|
|
| 31 |
|
import java.io.Closeable; |
| 32 |
|
import java.net.URL; |
| 33 |
|
|
| 34 |
|
import compbio.data.msa.JABAService; |
| 35 |
|
import compbio.data.msa.MsaWS; |
| 36 |
|
import compbio.data.msa.SequenceAnnotation; |
| 37 |
|
import compbio.metadata.PresetManager; |
| 38 |
|
import compbio.metadata.RunnerConfig; |
| 39 |
|
|
| |
|
| 0% |
Uncovered Elements: 104 (104) |
Complexity: 34 |
Complexity Density: 0.61 |
|
| 40 |
|
public class Jws2Instance extends ServiceWithParameters |
| 41 |
|
implements JalviewServiceEndpointProviderI, AutoCloseable |
| 42 |
|
{ |
| 43 |
|
|
| 44 |
|
public JABAService service; |
| 45 |
|
|
| 46 |
|
|
| 47 |
|
|
| 48 |
|
@param |
| 49 |
|
|
| 50 |
|
@param |
| 51 |
|
|
| 52 |
|
@param |
| 53 |
|
|
| 54 |
|
|
| 55 |
|
@param |
| 56 |
|
|
| 57 |
|
@param |
| 58 |
|
|
| 59 |
|
|
| |
|
| 0% |
Uncovered Elements: 28 (28) |
Complexity: 8 |
Complexity Density: 0.5 |
|
| 60 |
0 |
public Jws2Instance(String hosturl, String serviceType, String action,... |
| 61 |
|
String description, JABAService service) |
| 62 |
|
{ |
| 63 |
0 |
super(action, action, serviceType, description, hosturl); |
| 64 |
0 |
this.service = service; |
| 65 |
0 |
if (service instanceof MsaWS<?>) |
| 66 |
|
{ |
| 67 |
0 |
style = ServiceClient.MSAWSCLIENT; |
| 68 |
|
} |
| 69 |
0 |
else if (service instanceof SequenceAnnotation<?>) |
| 70 |
|
{ |
| 71 |
0 |
style = ServiceClient.SEQUENCEANNOTATIONWSCLIENT; |
| 72 |
|
} |
| 73 |
|
|
| 74 |
0 |
int p = description.indexOf("MORE INFORMATION:"); |
| 75 |
0 |
if (p > -1) |
| 76 |
|
{ |
| 77 |
0 |
String docUrl = description.substring(description.indexOf("http", p)) |
| 78 |
|
.trim(); |
| 79 |
0 |
if (docUrl.indexOf('\n') > -1) |
| 80 |
|
{ |
| 81 |
0 |
docUrl = docUrl.substring(0, docUrl.indexOf("\n")).trim(); |
| 82 |
|
} |
| 83 |
0 |
if (docUrl.length() > 0) |
| 84 |
|
{ |
| 85 |
0 |
try |
| 86 |
|
{ |
| 87 |
0 |
URL url = new URL(docUrl); |
| 88 |
0 |
if (url != null) |
| 89 |
|
{ |
| 90 |
0 |
setDocumentationUrl(docUrl); |
| 91 |
|
} |
| 92 |
|
} catch (Exception x) |
| 93 |
|
{ |
| 94 |
|
|
| 95 |
|
} |
| 96 |
|
} |
| 97 |
|
|
| 98 |
|
} |
| 99 |
|
} |
| 100 |
|
|
| 101 |
|
PresetManager presets = null; |
| 102 |
|
|
| 103 |
|
public JabaParamStore paramStore = null; |
| 104 |
|
|
| 105 |
|
|
| 106 |
|
|
| 107 |
|
|
| 108 |
|
|
| 109 |
|
@return |
| 110 |
|
|
| |
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 5 |
Complexity Density: 0.62 |
|
| 111 |
0 |
public PresetManager getPresets()... |
| 112 |
|
{ |
| 113 |
0 |
if (presets == null) |
| 114 |
|
{ |
| 115 |
0 |
try |
| 116 |
|
{ |
| 117 |
0 |
if (service instanceof MsaWS<?>) |
| 118 |
|
{ |
| 119 |
0 |
presets = ((MsaWS) service).getPresets(); |
| 120 |
|
|
| 121 |
|
} |
| 122 |
0 |
if (service instanceof SequenceAnnotation<?>) |
| 123 |
|
{ |
| 124 |
0 |
presets = ((SequenceAnnotation) service).getPresets(); |
| 125 |
|
} |
| 126 |
|
} catch (Exception ex) |
| 127 |
|
{ |
| 128 |
0 |
jalview.bin.Console |
| 129 |
|
.errPrintln("Exception when retrieving presets for service " |
| 130 |
|
+ getServiceType() + " at " + getHostURL()); |
| 131 |
|
} |
| 132 |
|
} |
| 133 |
0 |
return presets; |
| 134 |
|
} |
| 135 |
|
|
| 136 |
|
|
| 137 |
|
|
| 138 |
|
|
| 139 |
|
|
| 140 |
|
@return |
| 141 |
|
|
| |
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
| 142 |
0 |
public RunnerConfig getRunnerConfig()... |
| 143 |
|
{ |
| 144 |
0 |
if (service instanceof MsaWS<?>) |
| 145 |
|
{ |
| 146 |
0 |
return ((MsaWS) service).getRunnerOptions(); |
| 147 |
|
} |
| 148 |
0 |
if (service instanceof SequenceAnnotation<?>) |
| 149 |
|
{ |
| 150 |
0 |
return ((SequenceAnnotation) service).getRunnerOptions(); |
| 151 |
|
} |
| 152 |
0 |
throw new Error(MessageManager.formatMessage( |
| 153 |
|
"error.implementation_error_runner_config_not_available", |
| 154 |
|
new String[] |
| 155 |
|
{ getServiceType(), service.getClass().toString() })); |
| 156 |
|
} |
| 157 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
| 158 |
0 |
@Override... |
| 159 |
|
public void close() |
| 160 |
|
{ |
| 161 |
0 |
if (service != null) |
| 162 |
|
{ |
| 163 |
0 |
try |
| 164 |
|
{ |
| 165 |
0 |
((Closeable) service).close(); |
| 166 |
|
} catch (Throwable t) |
| 167 |
|
{ |
| 168 |
|
|
| 169 |
|
} |
| 170 |
|
} |
| 171 |
|
|
| 172 |
|
} |
| 173 |
|
|
| |
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
| 174 |
0 |
@Override... |
| 175 |
|
public ParamDatastoreI getParamStore() |
| 176 |
|
{ |
| 177 |
0 |
if (paramStore == null) |
| 178 |
|
{ |
| 179 |
0 |
try |
| 180 |
|
{ |
| 181 |
0 |
paramStore = new JabaParamStore(this, |
| 182 |
0 |
(Desktop.getInstance() != null ? Desktop.getUserParameterStore() |
| 183 |
|
: null)); |
| 184 |
|
} catch (Exception ex) |
| 185 |
|
{ |
| 186 |
0 |
jalview.bin.Console.errPrintln( |
| 187 |
|
"Unexpected exception creating JabaParamStore."); |
| 188 |
0 |
ex.printStackTrace(); |
| 189 |
|
} |
| 190 |
|
|
| 191 |
|
} |
| 192 |
0 |
return paramStore; |
| 193 |
|
} |
| 194 |
|
|
| 195 |
|
private boolean hasParams = false, lookedForParams = false; |
| 196 |
|
|
| |
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 3 |
Complexity Density: 0.6 |
|
| 197 |
0 |
@Override... |
| 198 |
|
public boolean hasParameters() |
| 199 |
|
{ |
| 200 |
0 |
if (!lookedForParams) |
| 201 |
|
{ |
| 202 |
0 |
lookedForParams = true; |
| 203 |
0 |
try |
| 204 |
|
{ |
| 205 |
0 |
hasParams = (getRunnerConfig().getArguments().size() > 0); |
| 206 |
|
} catch (Exception e) |
| 207 |
|
{ |
| 208 |
|
|
| 209 |
|
} |
| 210 |
|
} |
| 211 |
0 |
return hasParams; |
| 212 |
|
} |
| 213 |
|
|
| 214 |
|
|
| 215 |
|
|
| 216 |
|
|
| 217 |
|
@param |
| 218 |
|
|
| 219 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
| 220 |
0 |
@Override... |
| 221 |
|
public void initParamStore(ParamManager userParameterStore) |
| 222 |
|
{ |
| 223 |
0 |
if (paramStore == null) |
| 224 |
|
{ |
| 225 |
0 |
paramStore = new JabaParamStore(this, userParameterStore); |
| 226 |
|
} |
| 227 |
|
} |
| 228 |
|
|
| 229 |
|
|
| 230 |
|
|
| 231 |
|
|
| 232 |
|
@return |
| 233 |
|
|
| |
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 6 |
Complexity Density: 0.55 |
|
| 234 |
0 |
@Override... |
| 235 |
|
public Object getEndpoint() |
| 236 |
|
{ |
| 237 |
0 |
if (service instanceof MsaWS<?>) |
| 238 |
|
{ |
| 239 |
0 |
if (aaui != null) |
| 240 |
|
{ |
| 241 |
0 |
throw new Error( |
| 242 |
|
"JABAWS MsaWS based instant calculation not implemented."); |
| 243 |
|
|
| 244 |
|
} |
| 245 |
|
else |
| 246 |
|
{ |
| 247 |
0 |
return new JabawsMsaInstance(this); |
| 248 |
|
} |
| 249 |
|
} |
| 250 |
|
else |
| 251 |
|
{ |
| 252 |
0 |
if (service instanceof compbio.data.msa.SequenceAnnotation) |
| 253 |
|
{ |
| 254 |
0 |
if (aaui != null) |
| 255 |
|
{ |
| 256 |
0 |
try |
| 257 |
|
{ |
| 258 |
|
|
| 259 |
0 |
return aaui.getClient().getConstructor(getClass()) |
| 260 |
|
.newInstance(this); |
| 261 |
|
} catch (Throwable t) |
| 262 |
|
{ |
| 263 |
0 |
throw new Error("Implementation Error in web service framework", |
| 264 |
|
t); |
| 265 |
|
} |
| 266 |
|
} |
| 267 |
0 |
return new AADisorderClient(this); |
| 268 |
|
} |
| 269 |
0 |
return null; |
| 270 |
|
} |
| 271 |
|
} |
| 272 |
|
} |