uk.ac.starlink.vo
Class DalQuery

java.lang.Object
  extended by uk.ac.starlink.vo.DalQuery

public class DalQuery
extends Object

Represents a particular query to a DAL-like service. DAL refers to the the Data Access Layer family of protocols defined by the IVOA.

Since:
2 Feb 2009
Author:
Mark Taylor (Starlink)

Constructor Summary
DalQuery(RegResource resource, RegCapabilityInterface capability, String serviceType, double raPos, double decPos, double size)
          Constructs a DAL query based on a resource from a registry.
DalQuery(String baseURL, String serviceType, double raPos, double decPos, double size)
          Constructs a DAL query based on a service URL.
 
Method Summary
 void addArgument(String name, String value)
          Adds an argument to the query.
 String doubleToString(double value)
          Encodes a floating point value as a string for use in a DAL query.
 StarTable execute(StarTableFactory tfact)
          Executes this query synchronously, returning a StarTable which represents the results.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DalQuery

public DalQuery(RegResource resource,
                RegCapabilityInterface capability,
                String serviceType,
                double raPos,
                double decPos,
                double size)
Constructs a DAL query based on a resource from a registry.

Parameters:
resource - resource describing the DAL service
capability - DAL capability from resource
serviceType - short name for service type; informative, used for error messages etc
raPos - right ascension of ROI center in degrees
decPos - declination of ROI center in degrees
size - ROI size in degrees

DalQuery

public DalQuery(String baseURL,
                String serviceType,
                double raPos,
                double decPos,
                double size)
Constructs a DAL query based on a service URL.

Parameters:
baseURL - URL forming basis of CGI query for the DAL service
serviceType - short name for service type; informative, used for error messages etc
raPos - right ascension of ROI center in degrees
decPos - declination of ROI center in degrees
size - size in degrees
Method Detail

addArgument

public void addArgument(String name,
                        String value)
Adds an argument to the query. No validation is performed to check it is one of the ones that the DAL service knows about.

Parameters:
name - service argument name
value - argument value

execute

public StarTable execute(StarTableFactory tfact)
                  throws IOException
Executes this query synchronously, returning a StarTable which represents the results. If the query resulted in a QUERY_STATUS of ERROR, or if the returned VOTable document is not comprehensible according to the DAL rules, an IOException will be thrown.

Parameters:
tfact - factory which may be used to influence how the table is built
Throws:
IOException - in absence of good data

toString

public String toString()
Overrides:
toString in class Object

doubleToString

public String doubleToString(double value)
Encodes a floating point value as a string for use in a DAL query. There ought to be a definition within the DAL protocols of how to do this. At time of writing there is not, so the current implementation defers to the ad-hoc implementation in CgiQuery.formatDouble(double), which avoids exponential notation except for very large/small values.

Parameters:
value - numeric value
Returns:
string equivalent


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.