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