Fix problem with unknown services ("forward" compatibility)
authorSasha Sherstnev <a.sherstnev@dundee.ac.uk>
Tue, 10 Sep 2013 15:05:08 +0000 (16:05 +0100)
committerSasha Sherstnev <a.sherstnev@dundee.ac.uk>
Tue, 10 Sep 2013 15:05:08 +0000 (16:05 +0100)
webservices/compbio/ws/client/CmdHelper.java
webservices/compbio/ws/client/Constraints.java
webservices/compbio/ws/client/Jws2Client.java
webservices/compbio/ws/client/Services.java

index 1175230..c82f193 100644 (file)
@@ -19,6 +19,7 @@ package compbio.ws.client;
 import static compbio.ws.client.Constraints.hostkey;\r
 import static compbio.ws.client.Constraints.limitList;\r
 import static compbio.ws.client.Constraints.listServices;\r
+import static compbio.ws.client.Constraints.listServicesOld;\r
 import static compbio.ws.client.Constraints.paramList;\r
 import static compbio.ws.client.Constraints.presetList;\r
 import static compbio.ws.client.Constraints.presetkey;\r
@@ -56,7 +57,7 @@ class CmdHelper {
         * @return\r
         */\r
        static boolean listServices(String[] cmd) {\r
-               return keyFound(cmd, listServices);\r
+               return (keyFound(cmd, listServices) || keyFound(cmd, listServicesOld));\r
        }\r
 \r
        /**\r
index 1c4283d..2454424 100644 (file)
@@ -26,6 +26,7 @@ class Constraints {
        final static String servicekey = "-s";\r
 \r
        final static String listServices = "-list";\r
+       final static String listServicesOld = "-list_services";\r
        final static String testKey = "-test";\r
 \r
        // Actions\r
index 96343db..0aa02c5 100644 (file)
@@ -67,7 +67,7 @@ import compbio.util.FileUtil;
  */\r
 public class Jws2Client {\r
 \r
-       /*\r
+       /**\r
         * Use java.util.Logger instead of log4j logger to reduce the size of the client package\r
         */\r
        private static final Logger log = Logger.getLogger(Jws2Client.class.getCanonicalName());\r
@@ -300,11 +300,13 @@ public class Jws2Client {
                        return;\r
                }\r
                if (!func_services.isEmpty()) {\r
-                       String mess = "\n\rAvailable services: ";\r
+                       System.out.println("There are " + func_services.size() + " services at " + hostname + ":");\r
+                       String mess = "\n\rThe list:\n";\r
                        System.out.println(mess + Services.toString(func_services));\r
                }\r
                if (!nonfunc_services.isEmpty()) {\r
-                       String mess = "Non-available services (internal tests failed): ";\r
+                       System.out.println("There are " + nonfunc_services.size() + " non-available services at " + hostname + ":");\r
+                       String mess = "The list (internal tests failed): ";\r
                        System.out.println(mess + Services.toString(nonfunc_services));\r
                }\r
        }\r
index a4e101d..741f6d5 100644 (file)
@@ -58,14 +58,16 @@ public enum Services {
 \r
        public static String toString(Set<Services> services) {\r
                if (services == null || services.isEmpty()) {\r
-                       return "";\r
+                       return "No known services...\n";\r
                }\r
                String value = "";\r
-               String delim = ", ";\r
                for (Services serv : services) {\r
-                       value += serv.toString() + delim;\r
+                       if (null != serv) {\r
+                               value += serv + "\n";\r
+                       } else {\r
+                               value += "Unknown Service\n";\r
+                       }\r
                }\r
-               value = value.substring(0, value.length() - delim.length());\r
                return value;\r
        }\r
 \r