X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=webservices%2Fcompbio%2Fws%2Fclient%2FServices.java;h=a0c1f56ae3f61ad4feef1369b009e0b11ae64eb9;hb=3644426ec0e9e9ceb798bd426085d8d9dd8dbb56;hp=21b8bbc8ad7dda21fb0209c1da64ad8c7097e382;hpb=535359a3d592ee41bda72e7356f0181f6cee9d07;p=jabaws.git diff --git a/webservices/compbio/ws/client/Services.java b/webservices/compbio/ws/client/Services.java index 21b8bbc..a0c1f56 100644 --- a/webservices/compbio/ws/client/Services.java +++ b/webservices/compbio/ws/client/Services.java @@ -18,35 +18,88 @@ package compbio.ws.client; +import java.net.URL; + +import javax.xml.namespace.QName; +import javax.xml.ws.Service; + +import compbio.data.msa.JABAService; +import compbio.data.msa.MsaWS; +import compbio.data.msa.SequenceAnnotation; + /** - * List of web services currently supported by JABAWS version 1 + * List of web services currently supported by JABAWS version 2 * */ public enum Services { - MafftWS, MuscleWS, ClustalWS, TcoffeeWS, ProbconsWS; + MafftWS, MuscleWS, ClustalWS, TcoffeeWS, ProbconsWS, AAConWS, JronnWS, DisemblWS, GlobPlotWS; - public static Services getService(String servName) { - servName = servName.trim().toLowerCase(); - if (servName.equalsIgnoreCase(MafftWS.toString())) { - return MafftWS; + public static Services getService(String servName) { + servName = servName.trim().toLowerCase(); + if (servName.equalsIgnoreCase(MafftWS.toString())) { + return MafftWS; + } + if (servName.equalsIgnoreCase(ClustalWS.toString())) { + return ClustalWS; + } + if (servName.equalsIgnoreCase(TcoffeeWS.toString())) { + return TcoffeeWS; + } + if (servName.equalsIgnoreCase(MuscleWS.toString())) { + return MuscleWS; + } + if (servName.equalsIgnoreCase(ProbconsWS.toString())) { + return ProbconsWS; + } + if (servName.equalsIgnoreCase(AAConWS.toString())) { + return AAConWS; + } + if (servName.equalsIgnoreCase(JronnWS.toString())) { + return JronnWS; + } + if (servName.equalsIgnoreCase(DisemblWS.toString())) { + return DisemblWS; + } + if (servName.equalsIgnoreCase(GlobPlotWS.toString())) { + return GlobPlotWS; + } + return null; } - if (servName.equalsIgnoreCase(ClustalWS.toString())) { - return ClustalWS; - } - if (servName.equalsIgnoreCase(TcoffeeWS.toString())) { - return TcoffeeWS; - } - if (servName.equalsIgnoreCase(MuscleWS.toString())) { - return MuscleWS; + + Service getService(URL url, String sqname) { + QName qname = new QName(sqname, this.toString()); + return Service.create(url, qname); } - if (servName.equalsIgnoreCase(ProbconsWS.toString())) { - return ProbconsWS; + + Class getServiceType() { + switch (this) { + // deliberate leaking + case AAConWS : + case JronnWS : + case DisemblWS : + case GlobPlotWS : + + return SequenceAnnotation.class; + + // deliberate leaking + case ClustalWS : + case MafftWS : + case MuscleWS : + case ProbconsWS : + case TcoffeeWS : + + return MsaWS.class; + default : + throw new RuntimeException("Unrecognised Web Service Type " + + this + " - Should never happened!"); + } } - return null; - } - public static Services getService(Class wsImplClass) { - return getService(wsImplClass.getSimpleName()); - } + JABAService getInterface(Service service) { + assert service != null; + QName portName = new QName(service.getServiceName().getNamespaceURI(), + this.toString() + "Port"); + return service.getPort(portName, this.getServiceType()); + } } \ No newline at end of file