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.analysis.AlignSeq;
\r
25 import jalview.datamodel.*;
\r
27 import jalview.gui.*;
\r
31 import javax.swing.*;
\r
37 * @version $Revision$
\r
39 public class MsaWSClient
\r
43 * server is a WSDL2Java generated stub for an archetypal MsaWSI service.
\r
45 ext.vamsas.MuscleWS server;
\r
46 AlignFrame alignFrame;
\r
50 * Creates a new MsaWSClient object that uses a service
\r
51 * given by an externally retrieved ServiceHandle
\r
53 * @param sh service handle of type AbstractName(MsaWS)
\r
54 * @param altitle DOCUMENT ME!
\r
55 * @param msa DOCUMENT ME!
\r
56 * @param submitGaps DOCUMENT ME!
\r
57 * @param preserveOrder DOCUMENT ME!
\r
60 public MsaWSClient(ext.vamsas.ServiceHandle sh, String altitle,
\r
61 jalview.datamodel.AlignmentView msa,
\r
62 boolean submitGaps, boolean preserveOrder,
\r
63 Alignment seqdataset,
\r
64 AlignFrame _alignFrame)
\r
67 alignFrame = _alignFrame;
\r
68 if (!sh.getAbstractName().equals("MsaWS"))
\r
70 JOptionPane.showMessageDialog(Desktop.desktop,
\r
71 "The Service called \n" + sh.getName() +
\r
72 "\nis not a \nMultiple Sequence Alignment Service !",
\r
73 "Internal Jalview Error",
\r
74 JOptionPane.WARNING_MESSAGE);
\r
79 if ((wsInfo = setWebService(sh))==null)
\r
81 JOptionPane.showMessageDialog(Desktop.desktop,
\r
82 "The Multiple Sequence Alignment Service named " +
\r
84 " is unknown", "Internal Jalview Error",
\r
85 JOptionPane.WARNING_MESSAGE);
\r
89 startMsaWSClient(altitle, msa, submitGaps, preserveOrder, seqdataset);
\r
94 private void startMsaWSClient(String altitle, AlignmentView msa,
\r
95 boolean submitGaps, boolean preserveOrder, Alignment seqdataset)
\r
97 if (!locateWebService())
\r
102 wsInfo.setProgressText( ( (submitGaps) ? "Re-alignment" : "Alignment") +
\r
103 " of " + altitle + "\nJob details\n");
\r
105 MsaWSThread musclethread = new MsaWSThread(server, WsURL, wsInfo, alignFrame,
\r
107 WebServiceName+" alignment of " + altitle,
\r
109 submitGaps, preserveOrder, seqdataset);
\r
110 wsInfo.setthisService(musclethread);
\r
111 musclethread.start();
\r
115 * Initializes the server field with a valid service implementation.
\r
117 * @return true if service was located.
\r
119 private boolean locateWebService()
\r
121 // TODO: MuscleWS transmuted to generic MsaWS client
\r
122 MuscleWSServiceLocator loc = new MuscleWSServiceLocator(); // Default
\r
126 this.server = (MuscleWS) loc.getMuscleWS(new java.net.URL(WsURL));
\r
127 ( (MuscleWSSoapBindingStub)this.server).setTimeout(60000); // One minute timeout
\r
129 catch (Exception ex)
\r
131 wsInfo.setProgressText("Serious! " + WebServiceName +
\r
132 " Service location failed\nfor URL :" + WsURL +
\r
135 wsInfo.setStatus(WebserviceInfo.ERROR);
\r
136 ex.printStackTrace();
\r
141 loc.getEngine().setOption("axis", "1");
\r
146 protected String getServiceActionKey()
\r
151 protected String getServiceActionDescription()
\r
153 return "Multiple Sequence Alignment";
\r