X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2FMsaWSClient.java;h=ddd00c3c177af13698ba06d63f64840570a4e450;hb=2763845dada91cdfe266200cf852146c70392ad7;hp=63e60d7c2bcf997cec1729cb93caad2520ea3ee4;hpb=08bde8d252a69d4d6a3b2497f759bd5d6f154a3f;p=jalview.git diff --git a/src/jalview/ws/MsaWSClient.java b/src/jalview/ws/MsaWSClient.java index 63e60d7..ddd00c3 100755 --- a/src/jalview/ws/MsaWSClient.java +++ b/src/jalview/ws/MsaWSClient.java @@ -1,17 +1,17 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1) + * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -29,56 +29,61 @@ import jalview.gui.*; /** * DOCUMENT ME! - * + * * @author $author$ * @version $Revision$ */ -public class MsaWSClient - extends WSClient +public class MsaWSClient extends WSClient { /** * server is a WSDL2Java generated stub for an archetypal MsaWSI service. */ ext.vamsas.MuscleWS server; + AlignFrame alignFrame; /** - * Creates a new MsaWSClient object that uses a service - * given by an externally retrieved ServiceHandle - * - * @param sh service handle of type AbstractName(MsaWS) - * @param altitle DOCUMENT ME! - * @param msa DOCUMENT ME! - * @param submitGaps DOCUMENT ME! - * @param preserveOrder DOCUMENT ME! + * Creates a new MsaWSClient object that uses a service given by an externally + * retrieved ServiceHandle + * + * @param sh + * service handle of type AbstractName(MsaWS) + * @param altitle + * DOCUMENT ME! + * @param msa + * DOCUMENT ME! + * @param submitGaps + * DOCUMENT ME! + * @param preserveOrder + * DOCUMENT ME! */ public MsaWSClient(ext.vamsas.ServiceHandle sh, String altitle, - jalview.datamodel.AlignmentView msa, - boolean submitGaps, boolean preserveOrder, - Alignment seqdataset, - AlignFrame _alignFrame) + jalview.datamodel.AlignmentView msa, boolean submitGaps, + boolean preserveOrder, Alignment seqdataset, + AlignFrame _alignFrame) { super(); alignFrame = _alignFrame; if (!sh.getAbstractName().equals("MsaWS")) { - JOptionPane.showMessageDialog(Desktop.desktop, - "The Service called \n" + sh.getName() + - "\nis not a \nMultiple Sequence Alignment Service !", - "Internal Jalview Error", - JOptionPane.WARNING_MESSAGE); + JOptionPane + .showMessageDialog( + Desktop.desktop, + "The Service called \n" + + sh.getName() + + "\nis not a \nMultiple Sequence Alignment Service !", + "Internal Jalview Error", JOptionPane.WARNING_MESSAGE); return; } - if ( (wsInfo = setWebService(sh)) == null) + if ((wsInfo = setWebService(sh)) == null) { JOptionPane.showMessageDialog(Desktop.desktop, - "The Multiple Sequence Alignment Service named " + - sh.getName() + - " is unknown", "Internal Jalview Error", - JOptionPane.WARNING_MESSAGE); + "The Multiple Sequence Alignment Service named " + + sh.getName() + " is unknown", + "Internal Jalview Error", JOptionPane.WARNING_MESSAGE); return; } @@ -93,26 +98,25 @@ public class MsaWSClient } private void startMsaWSClient(String altitle, AlignmentView msa, - boolean submitGaps, boolean preserveOrder, - Alignment seqdataset) + boolean submitGaps, boolean preserveOrder, Alignment seqdataset) { if (!locateWebService()) { return; } - wsInfo.setProgressText( ( (submitGaps) ? "Re-alignment" : "Alignment") + - " of " + altitle + "\nJob details\n"); + wsInfo.setProgressText(((submitGaps) ? "Re-alignment" : "Alignment") + + " of " + altitle + "\nJob details\n"); String jobtitle = WebServiceName.toLowerCase(); if (jobtitle.endsWith("alignment")) { if (submitGaps - && (!jobtitle.endsWith("realignment") - || jobtitle.indexOf("profile") == -1)) + && (!jobtitle.endsWith("realignment") || jobtitle + .indexOf("profile") == -1)) { int pos = jobtitle.indexOf("alignment"); - jobtitle = WebServiceName.substring(0, pos) + "re-alignment of " + - altitle; + jobtitle = WebServiceName.substring(0, pos) + "re-alignment of " + + altitle; } else { @@ -121,23 +125,20 @@ public class MsaWSClient } else { - jobtitle = WebServiceName + (submitGaps ? " re" : " ") + "alignment of " + - altitle; + jobtitle = WebServiceName + (submitGaps ? " re" : " ") + + "alignment of " + altitle; } - MsaWSThread msathread = new MsaWSThread(server, WsURL, wsInfo, alignFrame, - WebServiceName, - jobtitle, - msa, - submitGaps, preserveOrder, - seqdataset); + MsaWSThread msathread = new MsaWSThread(server, WsURL, wsInfo, + alignFrame, WebServiceName, jobtitle, msa, submitGaps, + preserveOrder, seqdataset); wsInfo.setthisService(msathread); msathread.start(); } /** * Initializes the server field with a valid service implementation. - * + * * @return true if service was located. */ private boolean locateWebService() @@ -148,14 +149,13 @@ public class MsaWSClient try { this.server = (MuscleWS) loc.getMuscleWS(new java.net.URL(WsURL)); - ( (MuscleWSSoapBindingStub)this.server).setTimeout(60000); // One minute timeout - } - catch (Exception ex) + ((MuscleWSSoapBindingStub) this.server).setTimeout(60000); // One minute + // timeout + } catch (Exception ex) { - wsInfo.setProgressText("Serious! " + WebServiceName + - " Service location failed\nfor URL :" + WsURL + - "\n" + - ex.getMessage()); + wsInfo.setProgressText("Serious! " + WebServiceName + + " Service location failed\nfor URL :" + WsURL + "\n" + + ex.getMessage()); wsInfo.setStatus(WebserviceInfo.ERROR); ex.printStackTrace(); @@ -176,16 +176,22 @@ public class MsaWSClient { return "Multiple Sequence Alignment"; } + /** - * look at ourselves and work out if we are a service that can take a profile and align to it + * look at ourselves and work out if we are a service that can take a profile + * and align to it + * * @return true if we can send gapped sequences to the alignment service */ private boolean canSubmitGaps() { - // TODO: query service or extract service handle props to check if we can realign + // TODO: query service or extract service handle props to check if we can + // realign return (WebServiceName.indexOf("lustal") > -1); // cheat! } - public void attachWSMenuEntry(JMenu msawsmenu, final ServiceHandle serviceHandle, final AlignFrame alignFrame) + + public void attachWSMenuEntry(JMenu msawsmenu, + final ServiceHandle serviceHandle, final AlignFrame alignFrame) { setWebService(serviceHandle, true); // headless JMenuItem method = new JMenuItem(WebServiceName); @@ -195,29 +201,28 @@ public class MsaWSClient public void actionPerformed(ActionEvent e) { AlignmentView msa = alignFrame.gatherSequencesForAlignment(); - new jalview.ws.MsaWSClient(serviceHandle, alignFrame.getTitle(), msa, - false, true, - alignFrame.getViewport().getAlignment().getDataset(), - alignFrame); + new jalview.ws.MsaWSClient(serviceHandle, alignFrame.getTitle(), + msa, false, true, alignFrame.getViewport().getAlignment() + .getDataset(), alignFrame); } }); - msawsmenu.add(method); + msawsmenu.add(method); if (canSubmitGaps()) { // We know that ClustalWS can accept partial alignments for refinement. - final JMenuItem methodR = new JMenuItem(serviceHandle.getName()+" Realign"); + final JMenuItem methodR = new JMenuItem(serviceHandle.getName() + + " Realign"); methodR.setToolTipText(WsURL); - methodR.addActionListener(new ActionListener() + methodR.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AlignmentView msa = alignFrame.gatherSequencesForAlignment(); - new jalview.ws.MsaWSClient(serviceHandle, alignFrame.getTitle(), msa, - true, true, - alignFrame.getViewport().getAlignment().getDataset(), - alignFrame); + new jalview.ws.MsaWSClient(serviceHandle, alignFrame.getTitle(), + msa, true, true, alignFrame.getViewport().getAlignment() + .getDataset(), alignFrame); }