org.genepattern.webservice
Class JobResult

java.lang.Object
  extended byorg.genepattern.webservice.JobResult

public class JobResult
extends java.lang.Object

Encapsulates information about a job run on a GenePattern server.


Constructor Summary
JobResult(java.net.URL server, int jobNumber, java.lang.String[] fileNames, boolean stdout, boolean stderr, Parameter[] parameters, java.lang.String lsid)
          Creates a new JobResult instance.
 
Method Summary
 java.io.File downloadFile(java.lang.String fileName, java.lang.String downloadDirectory)
          Downloads the result file from the server to the given download directory.
 java.io.File downloadFile(java.lang.String fileName, java.lang.String downloadDirectory, boolean overwrite)
          Downloads the result file from the server to the given download directory.
 java.io.File[] downloadFiles(java.lang.String downloadDirectory)
          Downloads all the available result files from the server to the given download directory.
 java.io.File[] downloadFiles(java.lang.String downloadDirectory, boolean overwrite)
          Downloads all the available result files from the server to the given download directory.
 int getJobNumber()
          Gets the job number for this job.
 java.lang.String getLSID()
          Gets the LSID of the task that produced this job result.
 java.lang.String[] getOutputFileNames()
          Allocates a new array containing the file names of the output files that this job created excluding the standard output file and the standard error file.
 Parameter[] getParameters()
          Allocates a new array containing the input parameters that this job was invoked with
 java.net.URL getServerURL()
          Gets the url of the server that this job was run on.
 java.net.URL getURL(int creationOrder)
          Returns the url to download the file that was created in the given creation order
 java.net.URL getURL(java.lang.String fileName)
          Returns the url to download the given file name.
 boolean hasStandardError()
          Tests whether this job wrote to the standard error stream.
 boolean hasStandardOut()
          Tests whether this job wrote to the standard output stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JobResult

public JobResult(java.net.URL server,
                 int jobNumber,
                 java.lang.String[] fileNames,
                 boolean stdout,
                 boolean stderr,
                 Parameter[] parameters,
                 java.lang.String lsid)
Creates a new JobResult instance.

Parameters:
server - The server on which this job was run.
jobNumber - The job number of this job.
fileNames - The array of file names that this job created.
stdout - Whether a standard out file was created.
stderr - Whether a standard err file was created.
parameters - The parameters that this job was run with.
lsid - The LSID of the task that produced this job result.
Method Detail

getLSID

public java.lang.String getLSID()
Gets the LSID of the task that produced this job result.

Returns:
The task LSID

getOutputFileNames

public java.lang.String[] getOutputFileNames()
Allocates a new array containing the file names of the output files that this job created excluding the standard output file and the standard error file.

Returns:
The output file names

getParameters

public Parameter[] getParameters()
Allocates a new array containing the input parameters that this job was invoked with

Returns:
The parameters

getURL

public java.net.URL getURL(int creationOrder)
Returns the url to download the file that was created in the given creation order

Parameters:
creationOrder - The file creation order, starting at 0.
Returns:
The url to retrieve the file from.
Throws:
java.lang.IllegalArgumentException - if creationOrder < 0 or creatorOrder >= getOutputFileNames().length

getURL

public java.net.URL getURL(java.lang.String fileName)
Returns the url to download the given file name.

Parameters:
fileName - The file name.
Returns:
The url to retrieve the file from.

hasStandardError

public boolean hasStandardError()
Tests whether this job wrote to the standard error stream.

Returns:
true if this job wrote to the standard error stream; false otherwise.

hasStandardOut

public boolean hasStandardOut()
Tests whether this job wrote to the standard output stream.

Returns:
true if this job wrote to the standard output stream; false otherwise.

downloadFiles

public java.io.File[] downloadFiles(java.lang.String downloadDirectory)
                             throws java.io.IOException
Downloads all the available result files from the server to the given download directory. If the directory already exists and contains files of the same name, it will overwrite the files.

Parameters:
downloadDirectory - The pathname of a directory to create the files. The directory will be created if it does not exist.
Returns:
The array of files.
Throws:
java.io.IOException - If an error occurs while downloading the files.
java.lang.NullPointerException - If the downloadDirectory argument is null

downloadFiles

public java.io.File[] downloadFiles(java.lang.String downloadDirectory,
                                    boolean overwrite)
                             throws java.io.IOException
Downloads all the available result files from the server to the given download directory. If the directory already exists and contains files of the same name, it will overwrite the files if overwrite is true, and if false it will prepend job_#_ to the file name of any preexisting file.

Parameters:
downloadDirectory - The pathname of a directory to create the files. The directory will be created if it does not exist.
overwrite - overwrite existing files if true.
Returns:
The array of files.
Throws:
java.io.IOException - If an error occurs while downloading the files.
java.lang.NullPointerException - If the downloadDirectory argument is null

downloadFile

public java.io.File downloadFile(java.lang.String fileName,
                                 java.lang.String downloadDirectory)
                          throws java.io.IOException
Downloads the result file from the server to the given download directory. The name of the downloaded file will be equal to the given file name. If a file of the same name already exists in the given directory it will be overwritten.

Parameters:
fileName - The file name.
downloadDirectory - The pathname of a directory to create the file. The directory will be created if it does not exist.
Returns:
The file or null if the file does not exist on the server.
Throws:
java.io.IOException - If an error occurs while downloading the file.
java.lang.NullPointerException - If the fileName or downloadDirectory arguments are null

downloadFile

public java.io.File downloadFile(java.lang.String fileName,
                                 java.lang.String downloadDirectory,
                                 boolean overwrite)
                          throws java.io.IOException
Downloads the result file from the server to the given download directory. The name of the downloaded file will be equal to the given file name. If overwrite is fale, if a file already existis of the same name in the given directory then the file will be written with job_#_ prefixing the filename. If a file of this name already exists it will be overwritten.

Parameters:
fileName - The file name.
downloadDirectory - The pathname of a directory to create the file. The directory will be created if it does not exist.
overwrite - overwrite existing files of the same name
Returns:
The file or null if the file does not exist on the server.
Throws:
java.io.IOException - If an error occurs while downloading the file.
java.lang.NullPointerException - If the fileName or downloadDirectory arguments are null

getServerURL

public java.net.URL getServerURL()
Gets the url of the server that this job was run on.

Returns:
The server url.

getJobNumber

public int getJobNumber()
Gets the job number for this job.

Returns:
The job number


Hosted by docs.bugaco.com