X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fjalview%2Fws%2Fjws1%2FMsaWSThread.java;h=be21de7aecb3841b07f0e3a32d6403f023eb8277;hb=0673686a4ceda776a64350afd35ecff18e74e575;hp=9ff3df68efb0f647a83f7f1f1a01059cd086e3b3;hpb=45a459924135e0a79f469c7fff66536f785be9c4;p=jalview.git
diff --git a/src/jalview/ws/jws1/MsaWSThread.java b/src/jalview/ws/jws1/MsaWSThread.java
index 9ff3df6..be21de7 100644
--- a/src/jalview/ws/jws1/MsaWSThread.java
+++ b/src/jalview/ws/jws1/MsaWSThread.java
@@ -1,53 +1,45 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview 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 3 of the License, or (at your option) any later version.
- *
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
* Jalview 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 Jalview. If not, see
- * Title: - *
- * - *- * Description: - *
- * - *- * Copyright: Copyright (c) 2004 - *
- * - *- * Company: Dundee University - *
- * - * @author not attributable - * @version 1.0 - */ class MsaWSThread extends JWS1Thread implements WSClientI { boolean submitGaps = false; // pass sequences including gaps to alignment @@ -80,7 +72,7 @@ class MsaWSThread extends JWS1Thread implements WSClientI subjobComplete = true; result = new MsaResult(); result.setFinished(true); - result.setStatus("Job never ran - input returned to user."); + result.setStatus(MessageManager.getString("label.job_never_ran")); } } @@ -104,7 +96,8 @@ class MsaWSThread extends JWS1Thread implements WSClientI if (minlen < 0) { throw new Error( - "Implementation error: minlen must be zero or more."); + MessageManager + .getString("error.implementation_error_minlen_must_be_greater_zero")); } for (int i = 0; i < seqs.length; i++) { @@ -123,8 +116,8 @@ class MsaWSThread extends JWS1Thread implements WSClientI // for // any // subjob - SeqNames.put(newname, jalview.analysis.SeqsetUtils - .SeqCharacterHash(seqs[i])); + SeqNames.put(newname, + jalview.analysis.SeqsetUtils.SeqCharacterHash(seqs[i])); if (valid && seqs[i].getEnd() - seqs[i].getStart() > minlen - 1) { seqarray[n] = new vamsas.objects.simple.Sequence(); @@ -139,11 +132,10 @@ class MsaWSThread extends JWS1Thread implements WSClientI if (seqs[i].getEnd() >= seqs[i].getStart()) { empty = (submitGaps) ? seqs[i].getSequenceAsString() : AlignSeq - .extractGaps(jalview.util.Comparison.GapChars, seqs[i] - .getSequenceAsString()); + .extractGaps(jalview.util.Comparison.GapChars, + seqs[i].getSequenceAsString()); } - emptySeqs.add(new String[] - { newname, empty }); + emptySeqs.add(new String[] { newname, empty }); } } this.seqs = new vamsas.objects.simple.SequenceSet(); @@ -262,8 +254,7 @@ class MsaWSThread extends JWS1Thread implements WSClientI jalview.analysis.AlignmentSorter.recoverOrder(alseqs); // account for any missing sequences jalview.analysis.SeqsetUtils.deuniquify(SeqNames, alseqs); - return new Object[] - { alseqs, msaorder }; + return new Object[] { alseqs, msaorder }; } return null; } @@ -360,9 +351,8 @@ class MsaWSThread extends JWS1Thread implements WSClientI } if (njobs > 0) { - wsinfo - .setProgressName("region " + jobs[j].getJobnum(), - jobs[j].getJobnum()); + wsinfo.setProgressName("region " + jobs[j].getJobnum(), + jobs[j].getJobnum()); } wsinfo.setProgressText(jobs[j].getJobnum(), OutputHeader); } @@ -416,7 +406,8 @@ class MsaWSThread extends JWS1Thread implements WSClientI cancelledMessage += ("\nProblems cancelling the job : Exception received...\n" + exc + "\n"); Cache.log.warn( - "Exception whilst cancelling " + jobs[job].getJobId(), exc); + "Exception whilst cancelling " + jobs[job].getJobId(), + exc); } wsInfo.setProgressText(jobs[job].getJobnum(), OutputHeader + cancelledMessage + "\n"); @@ -433,9 +424,8 @@ class MsaWSThread extends JWS1Thread implements WSClientI { if (!jobComplete) { - wsInfo - .setProgressText(OutputHeader - + "Server cannot cancel this job because it has not been submitted properly. just close the window.\n"); + wsInfo.setProgressText(OutputHeader + + "Server cannot cancel this job because it has not been submitted properly. just close the window.\n"); } } } @@ -449,8 +439,9 @@ class MsaWSThread extends JWS1Thread implements WSClientI { if (!(job instanceof MsaWSJob)) { - throw new Error("StartJob(MsaWSJob) called on a WSJobInstance " - + job.getClass()); + throw new Error(MessageManager.formatMessage( + "error.implementation_error_msawbjob_called", + new String[] { job.getClass().toString() })); } MsaWSJob j = (MsaWSJob) job; if (j.isSubmitted()) @@ -468,7 +459,8 @@ class MsaWSThread extends JWS1Thread implements WSClientI j.setSubmitted(true); j.result = new MsaResult(); j.result.setFinished(true); - j.result.setStatus("Empty Alignment Job"); + j.result.setStatus(MessageManager + .getString("label.empty_alignment_job")); ((MsaResult) j.result).setMsa(null); } try @@ -486,10 +478,9 @@ class MsaWSThread extends JWS1Thread implements WSClientI { if (jobsubmit == null) { - throw new Exception( - "Server at " - + WsUrl - + " returned null object, it probably cannot be contacted. Try again later ?"); + throw new Exception(MessageManager.formatMessage( + "exception.web_service_returned_null_try_later", + new String[] { WsUrl })); } throw new Exception(jobsubmit.getJobId()); @@ -505,13 +496,10 @@ class MsaWSThread extends JWS1Thread implements WSClientI + e.toString() + "\n"); j.setAllowedServerExceptions(0); wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR); - wsInfo.setStatus(j.getJobnum(), WebserviceInfo.STATE_STOPPED_SERVERERROR); - wsInfo - .appendProgressText( - j.getJobnum(), - "Failed to submit sequences for alignment.\n" - + "It is most likely that there is a problem with the server.\n" - + "Just close the window\n"); + wsInfo.setStatus(j.getJobnum(), + WebserviceInfo.STATE_STOPPED_SERVERERROR); + wsInfo.appendProgressText(j.getJobnum(), MessageManager + .getString("info.failed_to_submit_sequences_for_alignment")); // e.printStackTrace(); // TODO: JBPNote DEBUG } @@ -526,8 +514,8 @@ class MsaWSThread extends JWS1Thread implements WSClientI for (int i = 0, j = seqs.length; i < j; i++) { - msa[i] = new jalview.datamodel.Sequence(seqs[i].getId(), seqs[i] - .getSeq()); + msa[i] = new jalview.datamodel.Sequence(seqs[i].getId(), + seqs[i].getSeq()); } return msa; @@ -546,27 +534,28 @@ class MsaWSThread extends JWS1Thread implements WSClientI && jobs[j].hasResults()) { results++; - //if (Cache.log.isDebugEnabled()) - // { - // System.out.println("Job lob for job "+jobs[j].getJobId()+":"+jobs[j].getJobnum()); - // System.out.println(jobs[j].getStatus()); - // } + // if (Cache.log.isDebugEnabled()) + // { + // System.out.println("Job lob for job "+jobs[j].getJobId()+":"+jobs[j].getJobnum()); + // System.out.println(jobs[j].getStatus()); + // } - vamsas.objects.simple.Alignment valign = ((MsaResult)((MsaWSJob) jobs[j]).result) + vamsas.objects.simple.Alignment valign = ((MsaResult) ((MsaWSJob) jobs[j]).result) .getMsa(); if (valign != null) { - wsInfo.appendProgressText(jobs[j].getJobnum(), - "\nAlignment Object Method Notes\n"); + wsInfo.appendProgressText(jobs[j].getJobnum(), MessageManager + .getString("info.alignment_object_method_notes")); String[] lines = valign.getMethod(); for (int line = 0; line < lines.length; line++) { - wsInfo.appendProgressText(jobs[j].getJobnum(), lines[line] + "\n"); + wsInfo.appendProgressText(jobs[j].getJobnum(), lines[line] + + "\n"); } // JBPNote The returned files from a webservice could be // hidden behind icons in the monitor window that, // when clicked, pop up their corresponding data - + } } } @@ -695,8 +684,8 @@ class MsaWSThread extends JWS1Thread implements WSClientI } for (int i = 0, l = alorders.size(); i < l; i++) { - af.addSortByOrderMenuItem(WebServiceName - + ((String) names.get(i)) + " Ordering", + af.addSortByOrderMenuItem( + WebServiceName + ((String) names.get(i)) + " Ordering", (AlignmentOrder) alorders.get(i)); } }