JAL-3878 Add annotation operation and worker to the services.
[jalview.git] / src / jalview / ws2 / slivka / SlivkaWSDiscoverer.java
index b6004fc..cda6702 100644 (file)
@@ -50,10 +50,10 @@ public class SlivkaWSDiscoverer implements WebServiceDiscovererI
       } catch (MalformedURLException e)
       {
         Cache.log.warn("Problem whilst trying to make a URL from '"
-                + Objects.toString(url, "<null>") + "'. "
-                + "This was probably due to malformed comma-separated-list "
-                + "in the " + SLIVKA_HOST_URLS
-                + " entry of ${HOME}/.jalview_properties");
+            + Objects.toString(url, "<null>") + "'. "
+            + "This was probably due to malformed comma-separated-list "
+            + "in the " + SLIVKA_HOST_URLS
+            + " entry of ${HOME}/.jalview_properties");
         Cache.log.debug("Exception occurred while reading url list", e);
       }
     }
@@ -89,7 +89,7 @@ public class SlivkaWSDiscoverer implements WebServiceDiscovererI
     } catch (IOException e)
     {
       Cache.log.error("Slivka could not retrieve services list from " + url,
-              e);
+          e);
       return STATUS_INVALID;
     }
   }
@@ -129,10 +129,10 @@ public class SlivkaWSDiscoverer implements WebServiceDiscovererI
   public CompletableFuture<WebServiceDiscovererI> startDiscoverer()
   {
     CompletableFuture<WebServiceDiscovererI> task = CompletableFuture
-            .supplyAsync(() -> {
-              reloadServices();
-              return SlivkaWSDiscoverer.this;
-            });
+        .supplyAsync(() -> {
+          reloadServices();
+          return SlivkaWSDiscoverer.this;
+        });
     task.thenRun(() -> fireOperationsChanged(getOperations()));
     discoveryTasks.add(task);
     return task;
@@ -142,7 +142,7 @@ public class SlivkaWSDiscoverer implements WebServiceDiscovererI
   {
     Cache.log.info("Reloading Slivka services");
     fireOperationsChanged(Collections.emptyList());
-    ArrayList<Operation> allOperations= new ArrayList<>();
+    ArrayList<Operation> allOperations = new ArrayList<>();
     for (String url : getUrls())
     {
       SlivkaClient client = new SlivkaClient(url);
@@ -163,23 +163,26 @@ public class SlivkaWSDiscoverer implements WebServiceDiscovererI
         {
           String[] path = classifier.split("\\s*::\\s*");
           if (path.length >= 3 && path[0].toLowerCase().equals("operation")
-                  && path[1].toLowerCase().equals("analysis"))
+              && path[1].toLowerCase().equals("analysis"))
           {
             switch (path[path.length - 1].toLowerCase())
             {
             case "rna secondary structure prediction":
-              op = new OperationStub(webService, "Secondary Structure Prediction");
+              op = new AnnotationOperation(webService,
+                  "Secondary Structure Prediction", webService::attachAnnotations);
               op.setInteractive(true);
               op.setAlignmentAnalysis(true);
               op.setProteinOperation(false);
               break;
             case "sequence alignment analysis (conservation)":
-              op = new OperationStub(webService, "Conservation");
+              op = new AnnotationOperation(webService, "Conservation",
+                  webService::attachAnnotations);
               op.setAlignmentAnalysis(true);
               op.setInteractive(true);
               break;
             case "protein sequence analysis":
-              op = new OperationStub(webService, "Protein Disorder");
+              op = new AnnotationOperation(webService, "Protein Disorder",
+                  webService::attachAnnotations);
               break;
             case "multiple sequence alignment":
               op = new AlignmentOperation(webService, webService::getAlignment);
@@ -191,7 +194,8 @@ public class SlivkaWSDiscoverer implements WebServiceDiscovererI
             }
           }
         }
-        if (op != null) {
+        if (op != null)
+        {
           allOperations.add(op);
         }
       }