From b99697b7d731bccdc7272923072d20541e437675 Mon Sep 17 00:00:00 2001 From: kjvdheide Date: Fri, 2 Feb 2018 00:08:18 +0000 Subject: [PATCH] JAL-2890 added job results wrapper --- src/jalview/ext/cipres/CipresJob.java | 6 +- src/jalview/ext/cipres/CipresJobResults.java | 109 ++++++++++++++++++++++++++ test/jalview/ext/cipres/CipresJobTest.java | 1 + 3 files changed, 113 insertions(+), 3 deletions(-) create mode 100644 src/jalview/ext/cipres/CipresJobResults.java diff --git a/src/jalview/ext/cipres/CipresJob.java b/src/jalview/ext/cipres/CipresJob.java index 5a3092c..668a83c 100644 --- a/src/jalview/ext/cipres/CipresJob.java +++ b/src/jalview/ext/cipres/CipresJob.java @@ -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 index 0000000..1043677 --- /dev/null +++ b/src/jalview/ext/cipres/CipresJobResults.java @@ -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 listResults(boolean finalResults) + throws CiCipresException + { + return job.listResults(finalResults); + } + + public void getNewickTree(boolean finalResults) + throws CiCipresException { + Collection 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 getMetadata() + { + return job.getMetadata(); + } + + /** + * @see CiJob#getClientJobID() + * + */ + public String getClientJobID() + { + return job.getClientJobID(); + } + + /** + * + * @see CiJob#getClientJobName() + */ + public String getClientJobName() + { + return job.getClientJobName(); + } + +} diff --git a/test/jalview/ext/cipres/CipresJobTest.java b/test/jalview/ext/cipres/CipresJobTest.java index a1cd2df..8146607 100644 --- a/test/jalview/ext/cipres/CipresJobTest.java +++ b/test/jalview/ext/cipres/CipresJobTest.java @@ -65,6 +65,7 @@ public class CipresJobTest testJob.addMetadata("statusEmail", "false"); testJob.addMetadata("clientJobName", "test_job"); testJob.submitJob(); + assertTrue(testJob.areParamsValidated()); } } -- 1.7.10.2