DisEMBL and GlobProt web services further work
[jabaws.git] / webservices / compbio / ws / client / Services.java
index 95a0a89..a0c1f56 100644 (file)
@@ -23,16 +23,16 @@ import java.net.URL;
 import javax.xml.namespace.QName;\r
 import javax.xml.ws.Service;\r
 \r
-import compbio.data.msa.Annotation;\r
 import compbio.data.msa.JABAService;\r
 import compbio.data.msa.MsaWS;\r
+import compbio.data.msa.SequenceAnnotation;\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;\r
+       MafftWS, MuscleWS, ClustalWS, TcoffeeWS, ProbconsWS, AAConWS, JronnWS, DisemblWS, GlobPlotWS;\r
 \r
        public static Services getService(String servName) {\r
                servName = servName.trim().toLowerCase();\r
@@ -54,6 +54,15 @@ public enum Services {
                if (servName.equalsIgnoreCase(AAConWS.toString())) {\r
                        return AAConWS;\r
                }\r
+               if (servName.equalsIgnoreCase(JronnWS.toString())) {\r
+                       return JronnWS;\r
+               }\r
+               if (servName.equalsIgnoreCase(DisemblWS.toString())) {\r
+                       return DisemblWS;\r
+               }\r
+               if (servName.equalsIgnoreCase(GlobPlotWS.toString())) {\r
+                       return GlobPlotWS;\r
+               }\r
                return null;\r
        }\r
 \r
@@ -62,16 +71,15 @@ public enum Services {
                return Service.create(url, qname);\r
        }\r
 \r
-       JABAService getInterface(Service service) {\r
-               assert service != null;\r
-\r
-               QName portName = new QName(service.getServiceName().getNamespaceURI(),\r
-                               this.toString() + "Port");\r
-\r
+       Class<? extends JABAService> getServiceType() {\r
                switch (this) {\r
+                       // deliberate leaking\r
                        case AAConWS :\r
+                       case JronnWS :\r
+                       case DisemblWS :\r
+                       case GlobPlotWS :\r
 \r
-                               return service.getPort(portName, Annotation.class);\r
+                               return SequenceAnnotation.class;\r
 \r
                                // deliberate leaking\r
                        case ClustalWS :\r
@@ -79,13 +87,19 @@ public enum Services {
                        case MuscleWS :\r
                        case ProbconsWS :\r
                        case TcoffeeWS :\r
-                               // TODO remove\r
-                               System.out.println("Qname from serv: " + portName);\r
-\r
-                               return service.getPort(portName, MsaWS.class);\r
 \r
+                               return MsaWS.class;\r
                        default :\r
-                               throw new RuntimeException("Should never happened!");\r
+                               throw new RuntimeException("Unrecognised Web Service Type "\r
+                                               + this + " - Should never happened!");\r
                }\r
        }\r
+\r
+       JABAService getInterface(Service service) {\r
+               assert service != null;\r
+\r
+               QName portName = new QName(service.getServiceName().getNamespaceURI(),\r
+                               this.toString() + "Port");\r
+               return service.getPort(portName, this.getServiceType());\r
+       }\r
 }
\ No newline at end of file