import java.util.List;
import java.util.Map;
+import compbio.data.msa.Category;
import uk.ac.dundee.compbio.slivkaclient.RemoteFile;
import uk.ac.dundee.compbio.slivkaclient.SlivkaClient;
import uk.ac.dundee.compbio.slivkaclient.SlivkaService;
public class SlivkaAnnotationServiceInstance extends SlivkaWSInstance implements SequenceAnnotationServiceI
{
public SlivkaAnnotationServiceInstance(SlivkaClient client,
- SlivkaService service, boolean conservation)
+ SlivkaService service, String category)
{
- super(client, service, !conservation ? "Protein sequence analysis"
- : "Alignment Conservation");
- if (conservation)
+ super(client, service, category);
+ if (category == Category.CATEGORY_CONSERVATION)
{
- setAlignAnalysisUI(new AlignAnalysisUIText(getName(),
+ setAlignAnalysisUI(new AlignAnalysisUIText(category,
SlivkaAnnotationServiceInstance.class,
"Slivka.AACons", false, true, true, true, true, 2,
MessageManager.getString("label.aacon_calculations"),
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
+
+import compbio.data.msa.Category;
import uk.ac.dundee.compbio.slivkaclient.SlivkaClient;
import uk.ac.dundee.compbio.slivkaclient.SlivkaService;
}
}
- private final ExecutorService executor = Executors.newSingleThreadExecutor();
+ private final ExecutorService executor = Executors
+ .newSingleThreadExecutor();
+
private Vector<Future<?>> discoveryTasks = new Vector<>();
public CompletableFuture<WSDiscovererI> startDiscoverer()
for (String url : getServiceUrls())
{
- Cache.log.info(url);
- SlivkaClient client;
- client = new SlivkaClient(url);
+ SlivkaClient client = new SlivkaClient(url);
+
+ List<SlivkaService> services;
try
{
- for (SlivkaService service : client.getServices())
+ services = client.getServices();
+ } catch (IOException e)
+ {
+ e.printStackTrace();
+ continue;
+ }
+ for (SlivkaService service : services)
+ {
+ SlivkaWSInstance newInstance = null;
+ for (String classifier : service.classifiers)
{
- SlivkaWSInstance newinstance = null;
- for (String classifier : service.classifiers)
+ String[] path = classifier.split("\\s*::\\s*");
+ if (path.length >= 3 && path[0].toLowerCase().equals("operation")
+ && path[1].toLowerCase().equals("analysis"))
{
- if (classifier.contains("Multiple sequence alignment"))
- {
- newinstance = new SlivkaMsaServiceInstance(client, service);
- }
- if (classifier.contains("Protein sequence analysis")
- && newinstance == null)
+ switch (path[path.length - 1].toLowerCase())
{
- newinstance = new SlivkaAnnotationServiceInstance(client,
- service, false);
- }
- if (classifier
- .contains("Sequence alignment analysis (conservation)"))
- {
- newinstance = new SlivkaAnnotationServiceInstance(client,
- service, true);
+ case "sequence alignment analysis (conservation)":
+ newInstance = new SlivkaAnnotationServiceInstance(client,
+ service, Category.CATEGORY_CONSERVATION);
+ break;
+ case "protein sequence analysis":
+ newInstance = new SlivkaAnnotationServiceInstance(client,
+ service, Category.CATEGORY_DISORDER);
+ break;
+ case "protein secondary structure prediction":
+ newInstance = new SlivkaAnnotationServiceInstance(client,
+ service, "Secondary Structure Prediction");
+ break;
+ case "multiple sequence alignment":
+ newInstance = new SlivkaMsaServiceInstance(client, service,
+ Category.CATEGORY_ALIGNMENT);
+ break;
}
}
- if (newinstance != null)
- {
- instances.add(newinstance);
- }
+ if (newInstance != null)
+ break;
}
- } catch (IOException e)
- {
- e.printStackTrace();
- continue;
+ if (newInstance != null)
+ instances.add(newInstance);
}
}
services = instances;
- notifyServiceListeners(instances);
Cache.log.info("Slivka services reloading finished");
+ notifyServiceListeners(instances);
return instances;
}
} catch (MalformedURLException e)
{
Cache.log.warn("Problem whilst trying to make a URL from '"
- + ((url != null) ? url : "<null>") + "'");
+ + ((url != null) ? url : "<null>") + "'");
Cache.log.warn(
- "This was probably due to a malformed comma separated list"
- + " in the " + SLIVKA_HOST_URLS
- + " entry of $(HOME)/.jalview_properties)");
+ "This was probably due to a malformed comma separated list"
+ + " in the " + SLIVKA_HOST_URLS
+ + " entry of $(HOME)/.jalview_properties)");
Cache.log.debug("Exception was ", e);
}
}