JAL-2890 added job results wrapper
authorkjvdheide <kjvanderheide@dundee.ac.uk>
Fri, 2 Feb 2018 00:08:18 +0000 (00:08 +0000)
committerkjvdheide <kjvanderheide@dundee.ac.uk>
Fri, 2 Feb 2018 00:08:18 +0000 (00:08 +0000)
src/jalview/ext/cipres/CipresJob.java
src/jalview/ext/cipres/CipresJobResults.java [new file with mode: 0644]
test/jalview/ext/cipres/CipresJobTest.java

index 5a3092c..668a83c 100644 (file)
@@ -55,9 +55,6 @@ public class CipresJob
   }
 
 
-
-
-
   /**
    * Specifies a parameter about the input data for a CIPRES job with its value,
    * for example the "infile_" parameter for the MSA file to calculate a tree
@@ -225,6 +222,7 @@ public class CipresJob
     return submittedJob;
   }
 
+
   public boolean areParamsValidated()
   {
     return paramsValidated;
@@ -245,4 +243,6 @@ public class CipresJob
     return metadata;
   }
 
+
+
 }
diff --git a/src/jalview/ext/cipres/CipresJobResults.java b/src/jalview/ext/cipres/CipresJobResults.java
new file mode 100644 (file)
index 0000000..1043677
--- /dev/null
@@ -0,0 +1,109 @@
+package jalview.ext.cipres;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
+
+import org.ngbw.directclient.CiCipresException;
+import org.ngbw.directclient.CiJob;
+import org.ngbw.directclient.CiResultFile;
+
+public class CipresJobResults
+{
+  private final CiJob job;
+
+  protected CipresJobResults(CiJob jobResults)
+  {
+    job = jobResults;
+  }
+
+  public void show(boolean message)
+  {
+    job.show(message);
+  }
+
+  public CipresJobResults update() throws CiCipresException
+  {
+    return new CipresJobResults(job.update());
+  }
+
+  public void delete() throws CiCipresException
+  {
+    job.delete();
+  }
+
+  protected Collection<CiResultFile> listResults(boolean finalResults)
+          throws CiCipresException
+  {
+    return job.listResults(finalResults);
+  }
+
+  public void getNewickTree(boolean finalResults)
+          throws CiCipresException      {
+    Collection<CiResultFile> results = job.listResults(finalResults);
+
+    for (CiResultFile result : results)
+    {
+      System.out.println(result.getName());
+
+    }
+  
+  }
+
+  public void downloadResults(File location, boolean finalResults)
+          throws CiCipresException, IOException
+  {
+    job.downloadResults(location, finalResults);
+  }
+
+  public boolean isDone()
+  {
+    return job.isDone();
+  }
+
+  public boolean isError()
+  {
+    return job.isError();
+  }
+
+  public String getJobHandle()
+  {
+    return job.getJobHandle();
+  }
+
+  public Date getDateSubmitted()
+  {
+    return job.getDateSubmitted();
+  }
+
+  public String getJobStage()
+  {
+    return job.getJobStage();
+  }
+
+  public Map<String, String> getMetadata()
+  {
+    return job.getMetadata();
+  }
+
+  /**
+   * @see CiJob#getClientJobID()
+   * 
+   */
+  public String getClientJobID()
+  {
+    return job.getClientJobID();
+  }
+
+  /**
+   * 
+   * @see CiJob#getClientJobName()
+   */
+  public String getClientJobName()
+  {
+    return job.getClientJobName();
+  }
+
+}
index a1cd2df..8146607 100644 (file)
@@ -65,6 +65,7 @@ public class CipresJobTest
     testJob.addMetadata("statusEmail", "false");
     testJob.addMetadata("clientJobName", "test_job");
     testJob.submitJob();
+    assertTrue(testJob.areParamsValidated());
 
   }
 }