From: Jim Procter Date: Mon, 7 Oct 2019 08:06:16 +0000 (+0100) Subject: JAL-3066 hack to instantiate the correct client according to slivka service annotatio... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=f811ff979b60f39b17489063f5aa8716362e7c24;p=jalview.git JAL-3066 hack to instantiate the correct client according to slivka service annotation. NEEDS ROBUST TESTING! --- diff --git a/src/jalview/ws/slivkaws/SlivkaWSDiscoverer.java b/src/jalview/ws/slivkaws/SlivkaWSDiscoverer.java index 7720b11..f8ac60f 100644 --- a/src/jalview/ws/slivkaws/SlivkaWSDiscoverer.java +++ b/src/jalview/ws/slivkaws/SlivkaWSDiscoverer.java @@ -44,30 +44,48 @@ public class SlivkaWSDiscoverer implements Runnable, WSMenuEntryProviderI return instance; } + /** + * TODO: tests needed for logic for determining type of each discovered + * service. Then reimplement this routine ! + * + * @return (MSA instances, one AAUI type instance, and the remaining all + * sequence analysis instances taking 1 sequence only) + */ List getServiceInstances() { List instances = new ArrayList<>(); for (SlivkaService service : services) { + ServiceWithParameters newinstance = null; for (String classifier : service.classifiers) { if (classifier.contains("Multiple sequence alignment")) { - instances - .add(new SlivkaMsaServiceInstance(slivkaClient, service)); + // MSA services always overwrite + newinstance = new SlivkaMsaServiceInstance(slivkaClient, service); } - else if (classifier.contains("Protein sequence analysis")) + if (classifier.contains("Protein sequence analysis")) { - instances.add(new SlivkaAnnotationServiceInstance(slivkaClient, - service, false)); - } - else if (classifier + if (newinstance == null) + { + newinstance = (new SlivkaAnnotationServiceInstance( + slivkaClient, + + service, false)); + } + } + + if (classifier .contains("Sequence alignment analysis (conservation)")) { - instances.add(new SlivkaAnnotationServiceInstance(slivkaClient, - service, true)); + // always overwrite other instances + newinstance = new SlivkaAnnotationServiceInstance(slivkaClient, + service, true); } - + } + if (newinstance != null) + { + instances.add(newinstance); } } return instances;