From 096a4fa3acd09199edc8fcfda2f0ce0532323e6b Mon Sep 17 00:00:00 2001
From: tjc <tjc@ee4ac58c-ac51-4696-9907-e4b3aa274f04>
Date: Fri, 12 Aug 2005 16:01:48 +0000
Subject: [PATCH] set j2ssh for fasta and blast only

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@3387 ee4ac58c-ac51-4696-9907-e4b3aa274f04
---
 uk/ac/sanger/artemis/ExternalProgram.java    |  9 +++++----
 uk/ac/sanger/artemis/j2ssh/SshPSUClient.java | 20 +++++++++++++-------
 2 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/uk/ac/sanger/artemis/ExternalProgram.java b/uk/ac/sanger/artemis/ExternalProgram.java
index 8cceb2035..61779cc39 100644
--- a/uk/ac/sanger/artemis/ExternalProgram.java
+++ b/uk/ac/sanger/artemis/ExternalProgram.java
@@ -4,7 +4,7 @@
  *
  * This file is part of Artemis
  *
- * Copyright(C) 1998-2003  Genome Research Limited
+ * Copyright(C) 1998-2005  Genome Research Limited
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -20,7 +20,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
- * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/ExternalProgram.java,v 1.4 2005-08-12 09:10:25 tjc Exp $
+ * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/ExternalProgram.java,v 1.5 2005-08-12 16:01:48 tjc Exp $
  **/
 
 package uk.ac.sanger.artemis;
@@ -41,7 +41,7 @@ import java.util.Enumeration;
  *  and contains methods for invoking it.
  *
  *  @author Kim Rutherford
- *  @version $Id: ExternalProgram.java,v 1.4 2005-08-12 09:10:25 tjc Exp $
+ *  @version $Id: ExternalProgram.java,v 1.5 2005-08-12 16:01:48 tjc Exp $
  **/
 
 public class ExternalProgram 
@@ -146,7 +146,8 @@ public class ExternalProgram
 //  {
       try 
       {
-        if(System.getProperty("j2ssh") != null)
+        if( System.getProperty("j2ssh") != null &&
+            (getRealName().indexOf("blast") > -1 || getRealName().startsWith("fast")) )
         {
           String [] args = { "-f", file_of_filenames.getPath(),
                              "-cmd", getRealName(),
diff --git a/uk/ac/sanger/artemis/j2ssh/SshPSUClient.java b/uk/ac/sanger/artemis/j2ssh/SshPSUClient.java
index 1fb30ebce..7f56d29d1 100644
--- a/uk/ac/sanger/artemis/j2ssh/SshPSUClient.java
+++ b/uk/ac/sanger/artemis/j2ssh/SshPSUClient.java
@@ -129,6 +129,7 @@ public class SshPSUClient extends Thread
     else if(cmd.equals("fastx") && settings.getProperty("fastx") != null)
       cmd = settings.getProperty("fastx");
 
+    boolean completed = false;
     try
     {
       // Setup a logfile
@@ -265,7 +266,9 @@ public class SshPSUClient extends Thread
             actualCMD = bsub+" -o "+ outputfile +" -e "+ outputfile + ".err " +
                            cmd+" "+db+" "+wdir+filename;
 
-          System.out.println(actualCMD);
+          // run the application
+          if(System.getProperty("debug") != null)
+            System.out.println(actualCMD);
           session.executeCommand(actualCMD);
 
           // Reading from the session InputStream
@@ -307,17 +310,19 @@ public class SshPSUClient extends Thread
             ioe.printStackTrace();
           }
           
-          // stdout
-          System.out.println(stdouth.getOutput());
-          System.out.println(stderrh.getOutput());
-
+          if(System.getProperty("debug") != null)
+          {
+            // stdout & stderr
+            System.out.println(stdouth.getOutput());
+            System.out.println(stderrh.getOutput());
+          }
 
 //        ByteArrayOutputStream os = new ByteArrayOutputStream();
 //        sftp.get(outputfile, os);
 //        System.out.println(os.toString());
 
           sftp.get(outputfile, filepath+".out");
-
+          completed = true; 
           session.close();
         }
 
@@ -335,7 +340,8 @@ public class SshPSUClient extends Thread
     } catch(IOException ioe){}
     finally
     {
-      JOptionPane.showMessageDialog(null,
+      if(completed)
+        JOptionPane.showMessageDialog(null,
             "Finished \n" + program,
             "Process Finished",
             JOptionPane.INFORMATION_MESSAGE);
-- 
GitLab