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