2 * Jalview - A Sequence Alignment Editor and Viewer
3 * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 import jalview.datamodel.*;
35 public class MsaWSClient
39 * server is a WSDL2Java generated stub for an archetypal MsaWSI service.
41 ext.vamsas.MuscleWS server;
42 AlignFrame alignFrame;
46 * Creates a new MsaWSClient object that uses a service
47 * given by an externally retrieved ServiceHandle
49 * @param sh service handle of type AbstractName(MsaWS)
50 * @param altitle DOCUMENT ME!
51 * @param msa DOCUMENT ME!
52 * @param submitGaps DOCUMENT ME!
53 * @param preserveOrder DOCUMENT ME!
56 public MsaWSClient(ext.vamsas.ServiceHandle sh, String altitle,
57 jalview.datamodel.AlignmentView msa,
58 boolean submitGaps, boolean preserveOrder,
60 AlignFrame _alignFrame)
63 alignFrame = _alignFrame;
64 if (!sh.getAbstractName().equals("MsaWS"))
66 JOptionPane.showMessageDialog(Desktop.desktop,
67 "The Service called \n" + sh.getName() +
68 "\nis not a \nMultiple Sequence Alignment Service !",
69 "Internal Jalview Error",
70 JOptionPane.WARNING_MESSAGE);
75 if ((wsInfo = setWebService(sh))==null)
77 JOptionPane.showMessageDialog(Desktop.desktop,
78 "The Multiple Sequence Alignment Service named " +
80 " is unknown", "Internal Jalview Error",
81 JOptionPane.WARNING_MESSAGE);
85 startMsaWSClient(altitle, msa, submitGaps, preserveOrder, seqdataset);
90 private void startMsaWSClient(String altitle, AlignmentView msa,
91 boolean submitGaps, boolean preserveOrder, Alignment seqdataset)
93 if (!locateWebService())
98 wsInfo.setProgressText( ( (submitGaps) ? "Re-alignment" : "Alignment") +
99 " of " + altitle + "\nJob details\n");
100 String jobtitle = WebServiceName.toLowerCase();
101 if (jobtitle.endsWith("alignment")) {
103 && (!jobtitle.endsWith("realignment")
104 || jobtitle.indexOf("profile")==-1)) {
105 int pos=jobtitle.indexOf("alignment");
106 jobtitle = WebServiceName.substring(0, pos) + "re-alignment of "+altitle;
108 jobtitle = WebServiceName+" of "+altitle;
111 jobtitle = WebServiceName+(submitGaps? " re" : " ") +"alignment of "+altitle;
114 MsaWSThread msathread = new MsaWSThread(server, WsURL, wsInfo, alignFrame,
118 submitGaps, preserveOrder, seqdataset);
119 wsInfo.setthisService(msathread);
124 * Initializes the server field with a valid service implementation.
126 * @return true if service was located.
128 private boolean locateWebService()
130 // TODO: MuscleWS transmuted to generic MsaWS client
131 MuscleWSServiceLocator loc = new MuscleWSServiceLocator(); // Default
135 this.server = (MuscleWS) loc.getMuscleWS(new java.net.URL(WsURL));
136 ( (MuscleWSSoapBindingStub)this.server).setTimeout(60000); // One minute timeout
140 wsInfo.setProgressText("Serious! " + WebServiceName +
141 " Service location failed\nfor URL :" + WsURL +
144 wsInfo.setStatus(WebserviceInfo.ERROR);
145 ex.printStackTrace();
150 loc.getEngine().setOption("axis", "1");
155 protected String getServiceActionKey()
160 protected String getServiceActionDescription()
162 return "Multiple Sequence Alignment";