An attempt to automatically make binaries executables - not successful but the code...
[jabaws.git] / webservices / compbio / ws / client / Services.java
index 7f06da7..893117f 100644 (file)
@@ -1,6 +1,6 @@
-/* Copyright (c) 2009 Peter Troshin\r
+/* Copyright (c) 2011 Peter Troshin\r
  *  \r
- *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
+ *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0     \r
  * \r
  *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
  *  Apache License version 2 as published by the Apache Software Foundation\r
@@ -19,6 +19,7 @@
 package compbio.ws.client;\r
 \r
 import java.net.URL;\r
+import java.util.Set;\r
 \r
 import javax.xml.namespace.QName;\r
 import javax.xml.ws.Service;\r
@@ -26,14 +27,17 @@ import javax.xml.ws.Service;
 import compbio.data.msa.JABAService;\r
 import compbio.data.msa.MsaWS;\r
 import compbio.data.msa.SequenceAnnotation;\r
-import compbio.engine.client.Executable;\r
 \r
 /**\r
  * List of web services currently supported by JABAWS version 2\r
  * \r
  */\r
 public enum Services {\r
-       MafftWS, MuscleWS, ClustalWS, TcoffeeWS, ProbconsWS, AAConWS, JronnWS, DisemblWS, GlobPlotWS;\r
+       /*\r
+        * Make sure this class has NO references to runners or engines as it is a\r
+        * part of minimal client package. Such things should go into ServicesUtil\r
+        */\r
+       MafftWS, MuscleWS, ClustalWS, ClustalOWS, TcoffeeWS, ProbconsWS, AAConWS, JronnWS, DisemblWS, GlobPlotWS, IUPredWS;\r
 \r
        public static Services getService(String servName) {\r
                servName = servName.trim().toLowerCase();\r
@@ -45,22 +49,24 @@ public enum Services {
                return null;\r
        }\r
 \r
-       public static Services getService(Class<Executable<?>> runnerClassName) {\r
-               assert runnerClassName != null;\r
-               String sname = runnerClassName.getSimpleName().toLowerCase();\r
-               for (Services service : Services.values()) {\r
-                       if (service.toString().toLowerCase().contains(sname)) {\r
-                               return service;\r
-                       }\r
-               }\r
-               return null;\r
-       }\r
-\r
        Service getService(URL url, String sqname) {\r
                QName qname = new QName(sqname, this.toString());\r
                return Service.create(url, qname);\r
        }\r
 \r
+       public static String toString(Set<Services> services) {\r
+               if (services == null || services.isEmpty()) {\r
+                       return "";\r
+               }\r
+               String value = "";\r
+               String delim = ", ";\r
+               for (Services serv : services) {\r
+                       value += serv.toString() + delim;\r
+               }\r
+               value = value.substring(0, value.length() - delim.length());\r
+               return value;\r
+       }\r
+\r
        Class<? extends JABAService> getServiceType() {\r
                switch (this) {\r
                        // deliberate leaking\r
@@ -68,11 +74,12 @@ public enum Services {
                        case JronnWS :\r
                        case DisemblWS :\r
                        case GlobPlotWS :\r
-\r
+                       case IUPredWS :\r
                                return SequenceAnnotation.class;\r
 \r
                                // deliberate leaking\r
                        case ClustalWS :\r
+                       case ClustalOWS :\r
                        case MafftWS :\r
                        case MuscleWS :\r
                        case ProbconsWS :\r