JAL-3878 Code reformatting.
[jalview.git] / src / jalview / ws2 / slivka / SlivkaWSDiscoverer.java
index fe5c040..98ce079 100644 (file)
@@ -37,7 +37,8 @@ public class SlivkaWSDiscoverer implements WebServiceDiscoverer
   }
 
   @Override
-  public List<String> getUrls() {
+  public List<String> getUrls()
+  {
     String surls = Cache.getDefault(SLIVKA_HOST_URLS, DEFAULT_URL);
     String urls[] = surls.split(",");
     ArrayList<String> valid = new ArrayList<>(urls.length);
@@ -47,13 +48,13 @@ public class SlivkaWSDiscoverer implements WebServiceDiscoverer
       {
         new URL(url);
         valid.add(url);
-      }
-      catch (MalformedURLException e)
+      } 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");
+        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");
         Cache.log.debug("Exception occurred while reading url list", e);
       }
     }
@@ -61,53 +62,63 @@ public class SlivkaWSDiscoverer implements WebServiceDiscoverer
   }
 
   @Override
-  public void setUrls(List<String> wsUrls) {
+  public void setUrls(List<String> wsUrls)
+  {
     if (wsUrls != null && !wsUrls.isEmpty())
     {
       Cache.setProperty(SLIVKA_HOST_URLS, String.join(",", wsUrls));
     }
-    else {
+    else
+    {
       Cache.removeProperty(SLIVKA_HOST_URLS);
     }
   }
 
   @Override
-  public boolean testUrl(URL url) {
+  public boolean testUrl(URL url)
+  {
     return getStatusForUrl(url.toString()) == STATUS_OK;
   }
 
   @Override
-  public int getStatusForUrl(String url) {
+  public int getStatusForUrl(String url)
+  {
     try
     {
       List<?> services = new SlivkaClient(url).getServices();
       return services.isEmpty() ? STATUS_NO_SERVICES : STATUS_OK;
-    }
-    catch (IOException e)
+    } catch (IOException e)
     {
-      Cache.log.error("Slivka could not retrieve services list from " + url, e);
+      Cache.log.error("Slivka could not retrieve services list from " + url,
+              e);
       return STATUS_INVALID;
     }
   }
 
-  public List<WebServiceI> getServices() {
+  public List<WebServiceI> getServices()
+  {
     return Collections.unmodifiableList(services);
   }
 
-  public boolean hasServices() {
+  public boolean hasServices()
+  {
     return !isRunning() && services.size() > 0;
   }
 
-  public boolean isRunning() {
-    for (Future<?> task : discoveryTasks) {
-      if (!task.isDone()) {
+  public boolean isRunning()
+  {
+    for (Future<?> task : discoveryTasks)
+    {
+      if (!task.isDone())
+      {
         return false;
       }
     }
     return true;
   }
 
-  public boolean isDone() {
+  public boolean isDone()
+  {
     return !isRunning() && discoveryTasks.size() > 0;
   }
 
@@ -130,17 +141,22 @@ public class SlivkaWSDiscoverer implements WebServiceDiscoverer
     Cache.log.info("Reloading Slivka services");
     fireServicesChanged(Collections.emptyList());
     ArrayList<WebServiceI> allServices = new ArrayList<>();
-    for (String url : getUrls()) {
+    for (String url : getUrls())
+    {
       SlivkaClient client = new SlivkaClient(url);
       List<SlivkaService> services;
-      try {
+      try
+      {
         services = client.getServices();
-      } catch (IOException e) {
+      } catch (IOException e)
+      {
         Cache.log.error("Unable to fetch services from " + url, e);
         continue;
       }
-      for (SlivkaService service : services) {
-        SlivkaWebService instance = new SlivkaWebService(client, service, service.getName());
+      for (SlivkaService service : services)
+      {
+        SlivkaWebService instance = new SlivkaWebService(client, service,
+                service.getName());
         for (String classifier : service.classifiers)
         {
           String[] path = classifier.split("\\s*::\\s*");
@@ -148,7 +164,8 @@ public class SlivkaWSDiscoverer implements WebServiceDiscoverer
                   && path[1].toLowerCase().equals("analysis"))
           {
             Operation op = null;
-            switch (path[path.length - 1].toLowerCase()) {
+            switch (path[path.length - 1].toLowerCase())
+            {
             case "multiple sequence alignment":
               op = new AlignmentOperation(instance, instance::getAlignment);
             }
@@ -156,7 +173,8 @@ public class SlivkaWSDiscoverer implements WebServiceDiscoverer
               instance.addOperation(op);
           }
         }
-        if (instance.operations.size() > 0) {
+        if (instance.operations.size() > 0)
+        {
           allServices.add(instance);
         }
       }
@@ -168,7 +186,8 @@ public class SlivkaWSDiscoverer implements WebServiceDiscoverer
   }
 
   @Override
-  public String getErrorMessages() {
+  public String getErrorMessages()
+  {
     return "";
   }