extensions/net.sf.basedb.genepattern/trunk/src/net/sf/basedb/genepattern/wrapper/JobResult.java

Code
Comments
Other
Rev Date Author Line
1115 10 Jun 09 nicklas 1 package net.sf.basedb.genepattern.wrapper;
1115 10 Jun 09 nicklas 2
1115 10 Jun 09 nicklas 3 import java.io.File;
1115 10 Jun 09 nicklas 4 import java.io.IOException;
1115 10 Jun 09 nicklas 5
1115 10 Jun 09 nicklas 6 /**
1115 10 Jun 09 nicklas 7   Wraps information about a completed GenePattern job.
1115 10 Jun 09 nicklas 8   Information is exposed as it is needed by other parts of our code. Use
1115 10 Jun 09 nicklas 9   {@link #getGPJobResult()} to access the underlying {@link 
1115 10 Jun 09 nicklas 10   org.genepattern.webservice.JobResult} instance.
1115 10 Jun 09 nicklas 11   @author Nicklas
1115 10 Jun 09 nicklas 12   @since 1.0
1115 10 Jun 09 nicklas 13 */
1115 10 Jun 09 nicklas 14 public class JobResult 
1115 10 Jun 09 nicklas 15 {
1115 10 Jun 09 nicklas 16   private final org.genepattern.webservice.JobResult gpResult;
1115 10 Jun 09 nicklas 17   
1115 10 Jun 09 nicklas 18   /**
1115 10 Jun 09 nicklas 19     Creates a new wrapper instance.
1115 10 Jun 09 nicklas 20     @param gpResult The underlying job result from the GenePattern server
1115 10 Jun 09 nicklas 21   */
1115 10 Jun 09 nicklas 22   public JobResult(org.genepattern.webservice.JobResult gpResult)
1115 10 Jun 09 nicklas 23   {
1115 10 Jun 09 nicklas 24     this.gpResult = gpResult;
1115 10 Jun 09 nicklas 25   }
1115 10 Jun 09 nicklas 26   
1115 10 Jun 09 nicklas 27   /**
1115 10 Jun 09 nicklas 28     Get the underlying {@link org.genepattern.webservice.JobResult} instance.
1115 10 Jun 09 nicklas 29     Use this method to access functionality that is not exposed by this
1115 10 Jun 09 nicklas 30     class.
1115 10 Jun 09 nicklas 31   */
1115 10 Jun 09 nicklas 32   public org.genepattern.webservice.JobResult getGPJobResult()
1115 10 Jun 09 nicklas 33   {
1115 10 Jun 09 nicklas 34     return gpResult;
1115 10 Jun 09 nicklas 35   }
1115 10 Jun 09 nicklas 36
1115 10 Jun 09 nicklas 37   /**
1115 10 Jun 09 nicklas 38     Has the job generated some error output?
1115 10 Jun 09 nicklas 39   */
1115 10 Jun 09 nicklas 40   public boolean hasStandardError()
1115 10 Jun 09 nicklas 41   {
1115 10 Jun 09 nicklas 42     return getGPJobResult().hasStandardError();
1115 10 Jun 09 nicklas 43   }
1115 10 Jun 09 nicklas 44   
1115 10 Jun 09 nicklas 45   /**
1115 10 Jun 09 nicklas 46     Get all file names that the job produced.
1115 10 Jun 09 nicklas 47     @return An array with the file names
1115 10 Jun 09 nicklas 48   */
1115 10 Jun 09 nicklas 49   public String[] getOutputFileNames()
1115 10 Jun 09 nicklas 50   {
1115 10 Jun 09 nicklas 51     return getGPJobResult().getOutputFileNames();
1115 10 Jun 09 nicklas 52   }
1115 10 Jun 09 nicklas 53   
1115 10 Jun 09 nicklas 54   /**
1115 10 Jun 09 nicklas 55     Download a result file to the local computer.
1115 10 Jun 09 nicklas 56     @param fileName The name of the file to download
1115 10 Jun 09 nicklas 57     @param directory The path to the directory to download the file to
1115 10 Jun 09 nicklas 58     @return A local file reference
1115 10 Jun 09 nicklas 59     @throws IOException If the file can't be downloaded
1115 10 Jun 09 nicklas 60   */
1115 10 Jun 09 nicklas 61   public File downloadFile(String fileName, String directory)
1115 10 Jun 09 nicklas 62     throws IOException
1115 10 Jun 09 nicklas 63   {
1115 10 Jun 09 nicklas 64     return getGPJobResult().downloadFile(fileName, directory, true);
1115 10 Jun 09 nicklas 65   }
1115 10 Jun 09 nicklas 66 }