1 /* Copyright (c) 2011 Peter Troshin
\r
3 * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0
\r
5 * This library is free software; you can redistribute it and/or modify it under the terms of the
\r
6 * Apache License version 2 as published by the Apache Software Foundation
\r
8 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
\r
9 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache
\r
10 * License for more details.
\r
12 * A copy of the license is in apache_license.txt. It is also available here:
\r
13 * @see: http://www.apache.org/licenses/LICENSE-2.0.txt
\r
15 * Any republication or derived work distributed in source code form
\r
16 * must include this copyright and license notice.
\r
19 package compbio.ws.client;
\r
21 import java.net.URL;
\r
22 import java.util.Set;
\r
24 import javax.xml.namespace.QName;
\r
25 import javax.xml.ws.Service;
\r
27 import compbio.data.msa.JABAService;
\r
28 import compbio.data.msa.MsaWS;
\r
29 import compbio.data.msa.SequenceAnnotation;
\r
32 * List of web services currently supported by JABAWS version 2
\r
35 public enum Services {
\r
37 * Make sure this class has NO references to runners or engines as it is a
\r
38 * part of minimal client package. Such things should go into ServicesUtil
\r
40 MafftWS, MuscleWS, ClustalWS, ClustalOWS, TcoffeeWS, ProbconsWS, AAConWS, JronnWS, DisemblWS, GlobPlotWS, IUPredWS;
\r
42 public static Services getService(String servName) {
\r
43 servName = servName.trim().toLowerCase();
\r
44 for (Services service : Services.values()) {
\r
45 if (service.toString().equalsIgnoreCase(servName)) {
\r
52 Service getService(URL url, String sqname) {
\r
53 QName qname = new QName(sqname, this.toString());
\r
54 return Service.create(url, qname);
\r
57 public static String toString(Set<Services> services) {
\r
58 if (services == null || services.isEmpty()) {
\r
62 String delim = ", ";
\r
63 for (Services serv : services) {
\r
64 value += serv.toString() + delim;
\r
66 value = value.substring(0, value.length() - delim.length());
\r
70 Class<? extends JABAService> getServiceType() {
\r
72 // deliberate leaking
\r
78 return SequenceAnnotation.class;
\r
80 // deliberate leaking
\r
90 throw new RuntimeException("Unrecognised Web Service Type "
\r
91 + this + " - Should never happened!");
\r
95 JABAService getInterface(Service service) {
\r
96 assert service != null;
\r
98 QName portName = new QName(service.getServiceName().getNamespaceURI(),
\r
99 this.toString() + "Port");
\r
100 return service.getPort(portName, this.getServiceType());
\r