edu.harvard.cfa.vo.tapclient.tap
Class Job

java.lang.Object
  extended by edu.harvard.cfa.vo.tapclient.tap.Job
Direct Known Subclasses:
AsyncJob, SyncJob

public abstract class Job
extends java.lang.Object

This object provides an implementation of common aspects of the AsyncJob and SyncJob. Two implementations are provided, AsyncJob and SyncJob, which excercise the TAP asynchronous and synchronous data query interfaces respectively.


Field Summary
protected  java.util.Map<java.lang.String,java.net.URI> inlineContent
           
protected  java.util.Map<java.lang.String,java.lang.String> parameters
           
 
Constructor Summary
protected Job()
          Creates a Job object.
 
Method Summary
 void addInlineUpload(java.lang.String tableName, java.net.URI uri)
          Adds to the TAP UPLOAD parameter.
 void addUpload(java.lang.String tableName, java.net.URI uri)
          Adds to the TAP UPLOAD parameter.
 void setFormat(java.lang.String newValue)
          Sets the format of this job.
 void setInlineUpload(java.lang.String tableName, java.net.URI uri)
          Sets the TAP UPLOAD parameter.
 void setLang(java.lang.String newValue)
          Sets the lang of this job.
 void setMaxRec(int newValue)
          Sets the maximum number of records of this job.
 void setParameter(java.lang.String name, int value)
          Sets the named parameter equal to the value.
abstract  void setParameter(java.lang.String name, java.lang.String value)
          Sets the named parameter equal to the value.
 void setQuery(java.lang.String newValue)
          Sets the query of this job.
 void setRunId(java.lang.String newValue)
          Sets the run id of this job.
 void setUpload(java.lang.String tableName, java.net.URI uri)
          Sets the TAP UPLOAD parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parameters

protected java.util.Map<java.lang.String,java.lang.String> parameters

inlineContent

protected java.util.Map<java.lang.String,java.net.URI> inlineContent
Constructor Detail

Job

protected Job()
Creates a Job object. For use by subclasses.

Method Detail

setParameter

public abstract void setParameter(java.lang.String name,
                                  java.lang.String value)
Sets the named parameter equal to the value.

Parameters:
name - of the parameter
value - of the parameter

setParameter

public void setParameter(java.lang.String name,
                         int value)
Sets the named parameter equal to the value.

Parameters:
name - of the parameter
value - of the parameter

setFormat

public void setFormat(java.lang.String newValue)
Sets the format of this job. The value is sent to the TAP service when #run or #update is called.

Parameters:
newValue - the format

setLang

public void setLang(java.lang.String newValue)
Sets the lang of this job. The value is sent to the TAP service when #run or #update is called.

Parameters:
newValue - the lang

setMaxRec

public void setMaxRec(int newValue)
Sets the maximum number of records of this job. The value is sent to the TAP service when #run or #update is called.

Parameters:
newValue - the maximum number of records

setQuery

public void setQuery(java.lang.String newValue)
Sets the query of this job. The value is sent to the TAP service when #run or #update is called.

Parameters:
newValue - the query

setRunId

public void setRunId(java.lang.String newValue)
Sets the run id of this job. The value is sent to the TAP service when #run or #update is called.

Parameters:
newValue - the run id

setUpload

public void setUpload(java.lang.String tableName,
                      java.net.URI uri)
Sets the TAP UPLOAD parameter. This method allows a single table to be specified for upload. This method assumes the URI will be resolved by the TAP service.
     job = new SyncJob(service);
     job.setParameter("QUERY", "select count(*) from service_schema.service_table t1, TAP_UPLOAD.usrtbl t2 where contains(point('ICRS-GEO', t1.ra, t1.dec), circle('ICRS-GEO', t2.ra, t2.dec, t2.radius)) = 1");
      // TAP service will call the VO cone search service.
      URI uri = new URI("http://cda.cfa.harvard.edu/cscvo/coneSearch?RA=188.97&DEC=26.36&SR=1.0");
    job.setUpload("usrtbl", uri);
     job.run();


addUpload

public void addUpload(java.lang.String tableName,
                      java.net.URI uri)
Adds to the TAP UPLOAD parameter. This method allows multiple tables to be specified for upload. This method assumes the URI will be resolved by the TAP service.


setInlineUpload

public void setInlineUpload(java.lang.String tableName,
                            java.net.URI uri)
Sets the TAP UPLOAD parameter. This method allows a single table to be uploaded. This method assumes the URI will be resolved by this object and sent as inline content in the query request.
     job = new SyncJob(service);
     job.setParameter("QUERY", "select count(*) from service_schema.service_table t1, TAP_UPLOAD.usrtbl t2 where contains(point('ICRS-GEO', t1.ra, t1.dec), circle('ICRS-GEO', t2.ra, t2.dec, t2.radius)) = 1");
     // User's local data to send inline with query request
     File file = new File("myvotable.xml");
     job.setInlineUploadParameter("usrtbl", file.toURI());
     job.run();
     


addInlineUpload

public void addInlineUpload(java.lang.String tableName,
                            java.net.URI uri)
Adds to the TAP UPLOAD parameter. This method allows multiple tables to be uploaded. This method assumes the URI will be resolved by this object and sent as inline content in the query request.