2 * Jalview - A Sequence Alignment Editor and Viewer
3 * Copyright (C) 2007 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
24 import jalview.datamodel.*;
33 public class MsaWSClient
37 * server is a WSDL2Java generated stub for an archetypal MsaWSI service.
39 ext.vamsas.MuscleWS server;
40 AlignFrame alignFrame;
43 * Creates a new MsaWSClient object that uses a service
44 * given by an externally retrieved ServiceHandle
46 * @param sh service handle of type AbstractName(MsaWS)
47 * @param altitle DOCUMENT ME!
48 * @param msa DOCUMENT ME!
49 * @param submitGaps DOCUMENT ME!
50 * @param preserveOrder DOCUMENT ME!
53 public MsaWSClient(ext.vamsas.ServiceHandle sh, String altitle,
54 jalview.datamodel.AlignmentView msa,
55 boolean submitGaps, boolean preserveOrder,
57 AlignFrame _alignFrame)
60 alignFrame = _alignFrame;
61 if (!sh.getAbstractName().equals("MsaWS"))
63 JOptionPane.showMessageDialog(Desktop.desktop,
64 "The Service called \n" + sh.getName() +
65 "\nis not a \nMultiple Sequence Alignment Service !",
66 "Internal Jalview Error",
67 JOptionPane.WARNING_MESSAGE);
72 if ( (wsInfo = setWebService(sh)) == null)
74 JOptionPane.showMessageDialog(Desktop.desktop,
75 "The Multiple Sequence Alignment Service named " +
77 " is unknown", "Internal Jalview Error",
78 JOptionPane.WARNING_MESSAGE);
82 startMsaWSClient(altitle, msa, submitGaps, preserveOrder, seqdataset);
86 private void startMsaWSClient(String altitle, AlignmentView msa,
87 boolean submitGaps, boolean preserveOrder,
90 if (!locateWebService())
95 wsInfo.setProgressText( ( (submitGaps) ? "Re-alignment" : "Alignment") +
96 " of " + altitle + "\nJob details\n");
97 String jobtitle = WebServiceName.toLowerCase();
98 if (jobtitle.endsWith("alignment"))
101 && (!jobtitle.endsWith("realignment")
102 || jobtitle.indexOf("profile") == -1))
104 int pos = jobtitle.indexOf("alignment");
105 jobtitle = WebServiceName.substring(0, pos) + "re-alignment of " +
110 jobtitle = WebServiceName + " of " + altitle;
115 jobtitle = WebServiceName + (submitGaps ? " re" : " ") + "alignment of " +
119 MsaWSThread msathread = new MsaWSThread(server, WsURL, wsInfo, alignFrame,
123 submitGaps, preserveOrder,
125 wsInfo.setthisService(msathread);
130 * Initializes the server field with a valid service implementation.
132 * @return true if service was located.
134 private boolean locateWebService()
136 // TODO: MuscleWS transmuted to generic MsaWS client
137 MuscleWSServiceLocator loc = new MuscleWSServiceLocator(); // Default
141 this.server = (MuscleWS) loc.getMuscleWS(new java.net.URL(WsURL));
142 ( (MuscleWSSoapBindingStub)this.server).setTimeout(60000); // One minute timeout
146 wsInfo.setProgressText("Serious! " + WebServiceName +
147 " Service location failed\nfor URL :" + WsURL +
150 wsInfo.setStatus(WebserviceInfo.ERROR);
151 ex.printStackTrace();
156 loc.getEngine().setOption("axis", "1");
161 protected String getServiceActionKey()
166 protected String getServiceActionDescription()
168 return "Multiple Sequence Alignment";