dalclient
Class DALQuery

java.lang.Object
  extended bydalclient.DALQuery
Direct Known Subclasses:
ConeQuery, SiapQuery

public class DALQuery
extends java.lang.Object

Generic DAL query. Provides methods to build up and execute a query against a predefined service connection context.


Method Summary
 void addParameter(java.lang.String name, java.lang.String value)
          Add a query parameter=value pair to the connection context.
 void executeCSV()
          Execute the query and write the result to stdout in CSV format.
 void executeCSV(java.io.PrintStream out)
          Execute query and write to the given output stream in CSV format.
 void executeCSV(java.lang.String fname)
          Execute the query and write the result to the named file in CSV format.
 java.io.InputStream executeRaw()
          Execute query and return a binary input stream to read raw results.
 java.io.InputStream executeRaw(int serviceIndex)
          Query the specified service and return a raw i/o stream to the query results.
 edu.jhu.pha.ivoa.VOTWrap.VOTable executeVOTable()
          Execute query and return a VOTable.
 edu.jhu.pha.ivoa.VOTWrap.VOTable executeVOTable(int serviceIndex)
          Query the specified service and return a VOTable.
 java.lang.String getQueryString(int serviceIndex)
          Get the current query URL as a string for the given service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addParameter

public void addParameter(java.lang.String name,
                         java.lang.String value)
Add a query parameter=value pair to the connection context.

Parameters:
name - The parameter name.
value - The parameter value.

executeCSV

public void executeCSV()
                throws java.lang.Exception
Execute the query and write the result to stdout in CSV format.

Throws:
java.lang.Exception

executeCSV

public void executeCSV(java.lang.String fname)
                throws java.lang.Exception
Execute the query and write the result to the named file in CSV format.

Parameters:
fname - The name of the file to be created.
Throws:
java.lang.Exception

executeCSV

public void executeCSV(java.io.PrintStream out)
                throws java.lang.Exception
Execute query and write to the given output stream in CSV format. At the level of a generic DAL query we do not support queries to multiple services as the tables returned may differ.

Parameters:
out - The output stream to be used
Throws:
java.lang.Exception

executeVOTable

public edu.jhu.pha.ivoa.VOTWrap.VOTable executeVOTable()
                                                throws java.lang.Exception
Execute query and return a VOTable.

Throws:
java.lang.Exception

executeVOTable

public edu.jhu.pha.ivoa.VOTWrap.VOTable executeVOTable(int serviceIndex)
                                                throws java.lang.Exception
Query the specified service and return a VOTable.

Parameters:
serviceIndex - The index of the service to be queried
Throws:
java.lang.Exception

executeRaw

public java.io.InputStream executeRaw()
                               throws java.lang.Exception
Execute query and return a binary input stream to read raw results. Note multiple service connections are not supported at this level. By default only the first service specified is queried.

Throws:
java.lang.Exception

executeRaw

public java.io.InputStream executeRaw(int serviceIndex)
                               throws java.lang.Exception
Query the specified service and return a raw i/o stream to the query results.

Parameters:
serviceIndex - The index of the service to be queried
Throws:
java.lang.Exception

getQueryString

public java.lang.String getQueryString(int serviceIndex)
Get the current query URL as a string for the given service.

Parameters:
serviceIndex - The index of the service to be queried