| 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 |
|
|
| |
|
| 78.2% |
Uncovered Elements: 19 (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 |
|
|
| |
|
| 80% |
Uncovered Elements: 3 (15) |
Complexity: 3 |
Complexity Density: 0.27 |
|
| 69 |
340 |
public Jws2Instance(String hosturl, String serviceType, String action,... |
| 70 |
|
String description, JABAService service) |
| 71 |
|
{ |
| 72 |
340 |
super(); |
| 73 |
340 |
this.hosturl = hosturl; |
| 74 |
340 |
this.serviceType = serviceType; |
| 75 |
340 |
this.service = service; |
| 76 |
340 |
this.action = action; |
| 77 |
340 |
this.description = description; |
| 78 |
340 |
int p = description.indexOf("MORE INFORMATION:"); |
| 79 |
340 |
if (p > -1) |
| 80 |
|
{ |
| 81 |
340 |
docUrl = description.substring(description.indexOf("http", p)).trim(); |
| 82 |
340 |
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 |
|
|
| |
|
| 92.9% |
Uncovered Elements: 1 (14) |
Complexity: 5 |
Complexity Density: 0.62 |
|
| 100 |
341 |
public PresetManager getPresets()... |
| 101 |
|
{ |
| 102 |
341 |
if (presets == null) |
| 103 |
|
{ |
| 104 |
340 |
try |
| 105 |
|
{ |
| 106 |
340 |
if (service instanceof MsaWS<?>) |
| 107 |
|
{ |
| 108 |
216 |
presets = ((MsaWS) service).getPresets(); |
| 109 |
|
|
| 110 |
|
} |
| 111 |
340 |
if (service instanceof SequenceAnnotation<?>) |
| 112 |
|
{ |
| 113 |
124 |
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 |
341 |
return presets; |
| 123 |
|
} |
| 124 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 125 |
2757 |
public String getHost()... |
| 126 |
|
{ |
| 127 |
2757 |
return hosturl; |
| 128 |
|
|
| 129 |
|
|
| 130 |
|
|
| 131 |
|
|
| 132 |
|
|
| 133 |
|
|
| 134 |
|
|
| 135 |
|
} |
| 136 |
|
|
| 137 |
|
|
| 138 |
|
@return |
| 139 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 140 |
3633 |
public String getActionText()... |
| 141 |
|
{ |
| 142 |
3633 |
return action + " with " + serviceType; |
| 143 |
|
} |
| 144 |
|
|
| 145 |
|
|
| 146 |
|
|
| 147 |
|
|
| 148 |
|
|
| 149 |
|
@return |
| 150 |
|
|
| |
|
| 77.8% |
Uncovered Elements: 2 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
| 151 |
681 |
public RunnerConfig getRunnerConfig()... |
| 152 |
|
{ |
| 153 |
681 |
if (service instanceof MsaWS<?>) |
| 154 |
|
{ |
| 155 |
433 |
return ((MsaWS) service).getRunnerOptions(); |
| 156 |
|
} |
| 157 |
248 |
if (service instanceof SequenceAnnotation<?>) |
| 158 |
|
{ |
| 159 |
248 |
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 |
|
|
| |
|
| 70% |
Uncovered Elements: 3 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
| 183 |
1539 |
public ParamDatastoreI getParamStore()... |
| 184 |
|
{ |
| 185 |
1539 |
if (paramStore == null) |
| 186 |
|
{ |
| 187 |
341 |
try |
| 188 |
|
{ |
| 189 |
341 |
paramStore = new JabaParamStore(this, |
| 190 |
341 |
(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 |
1539 |
return paramStore; |
| 201 |
|
} |
| 202 |
|
|
| |
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 203 |
682 |
public String getUri()... |
| 204 |
|
{ |
| 205 |
|
|
| 206 |
682 |
return hosturl |
| 207 |
682 |
+ (hosturl.lastIndexOf("/") == (hosturl.length() - 1) ? "" |
| 208 |
|
: "/") |
| 209 |
|
+ serviceType; |
| 210 |
|
} |
| 211 |
|
|
| 212 |
|
private boolean hasParams = false, lookedForParams = false; |
| 213 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 3 |
Complexity Density: 0.6 |
|
| 214 |
1575 |
public boolean hasParameters()... |
| 215 |
|
{ |
| 216 |
1575 |
if (!lookedForParams) |
| 217 |
|
{ |
| 218 |
340 |
lookedForParams = true; |
| 219 |
340 |
try |
| 220 |
|
{ |
| 221 |
340 |
hasParams = (getRunnerConfig().getArguments().size() > 0); |
| 222 |
|
} catch (Exception e) |
| 223 |
|
{ |
| 224 |
|
|
| 225 |
|
} |
| 226 |
|
} |
| 227 |
1575 |
return hasParams; |
| 228 |
|
} |
| 229 |
|
|
| |
|
| 87.5% |
Uncovered Elements: 1 (8) |
Complexity: 3 |
Complexity Density: 0.75 |
|
| 230 |
1321 |
public void attachWSMenuEntry(JMenu atpoint, AlignFrame alignFrame)... |
| 231 |
|
{ |
| 232 |
1321 |
if (service instanceof MsaWS<?>) |
| 233 |
|
{ |
| 234 |
1075 |
new MsaWSClient().attachWSMenuEntry(atpoint, this, alignFrame); |
| 235 |
|
} |
| 236 |
246 |
else if (service instanceof SequenceAnnotation<?>) |
| 237 |
|
{ |
| 238 |
246 |
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 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 250 |
1321 |
public jalview.ws.uimodel.AlignAnalysisUIText getAlignAnalysisUI()... |
| 251 |
|
{ |
| 252 |
1321 |
return aaui; |
| 253 |
|
} |
| 254 |
|
} |