From f811ff979b60f39b17489063f5aa8716362e7c24 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Mon, 7 Oct 2019 09:06:16 +0100 Subject: [PATCH] JAL-3066 hack to instantiate the correct client according to slivka service annotation. NEEDS ROBUST TESTING! --- src/jalview/ws/slivkaws/SlivkaWSDiscoverer.java | 38 +++++++++++++++++------ 1 file changed, 28 insertions(+), 10 deletions(-) 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; -- 1.7.10.2