public class TapQuery
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
static uk.ac.starlink.votable.DataFormat |
DFLT_UPLOAD_SER |
Default VOTable serialization format for uploading VOTables
to a TAP service.
|
Constructor | Description |
---|---|
TapQuery(java.net.URL serviceUrl,
java.lang.String adql,
java.util.Map<java.lang.String,java.lang.String> extraParams) |
Convenience constructor that uses a URL rather than an EndpointSet.
|
TapQuery(EndpointSet endpointSet,
java.lang.String adql,
java.util.Map<java.lang.String,java.lang.String> extraParams) |
Constructs a query with no uploaded tables.
|
TapQuery(EndpointSet endpointSet,
java.lang.String adql,
java.util.Map<java.lang.String,java.lang.String> extraParams,
java.util.Map<java.lang.String,uk.ac.starlink.table.StarTable> uploadMap,
long uploadLimit,
uk.ac.starlink.votable.VOTableWriter vowriter) |
Constructs a query with uploaded tables.
|
Modifier and Type | Method | Description |
---|---|---|
java.net.HttpURLConnection |
createSyncConnection(uk.ac.starlink.util.ContentCoding coding) |
Opens a URL connection for the result of synchronously executing
this query.
|
uk.ac.starlink.table.StarTable |
executeSync(uk.ac.starlink.table.StoragePolicy storage,
uk.ac.starlink.util.ContentCoding coding) |
Executes this query synchronously and returns the resulting table.
|
boolean |
executeSync(uk.ac.starlink.table.TableSink sink,
uk.ac.starlink.util.ContentCoding coding) |
Executes this query synchronously and streams the resulting table
to a table sink.
|
static java.net.URLConnection |
followRedirects(java.net.URLConnection conn) |
Takes a URLConnection and repeatedly follows 303 redirects
until a non-303 status is achieved.
|
java.lang.String |
getAdql() |
Returns the text of the ADQL query for this object.
|
EndpointSet |
getEndpointSet() |
Returns the endpoints of TAP services
to which this query will be submitted.
|
static uk.ac.starlink.table.StarTable |
getResult(UwsJob uwsJob,
uk.ac.starlink.util.ContentCoding coding,
uk.ac.starlink.table.StoragePolicy storage) |
Reads and returns the table that resulted from a successful TAP query,
represented by a given UWS job.
|
java.util.Map<java.lang.String,HttpStreamParam> |
getStreamParams() |
Returns the map of streamed parameters to be passed to the TAP service.
|
java.util.Map<java.lang.String,java.lang.String> |
getStringParams() |
Returns the map of string parameters to be passed to the TAP service.
|
static java.io.InputStream |
getVOTableStream(java.net.URLConnection conn,
uk.ac.starlink.util.ContentCoding coding) |
Gets an input stream from a URL connection that should contain
a VOTable.
|
static uk.ac.starlink.table.StarTable |
readResultVOTable(java.net.URLConnection conn,
uk.ac.starlink.util.ContentCoding coding,
uk.ac.starlink.table.StoragePolicy storage) |
Reads a VOTable which may represent a successful result or an error.
|
static <T> T |
scalarQuery(EndpointSet endpointSet,
java.lang.String adql,
java.lang.Class<T> clazz) |
Utility method to obtain a single-cell table as the result of a
synchronous TAP query.
|
static boolean |
streamResultVOTable(java.net.URLConnection conn,
uk.ac.starlink.util.ContentCoding coding,
uk.ac.starlink.table.TableSink sink) |
Streams a VOTable document which may represent a successful result
or an error.
|
UwsJob |
submitAsync() |
Submits this query asynchronously and returns the corresponding UWS job.
|
static uk.ac.starlink.table.StarTable |
waitForResult(UwsJob uwsJob,
uk.ac.starlink.util.ContentCoding coding,
uk.ac.starlink.table.StoragePolicy storage,
long pollMillis) |
Blocks until the TAP query represented by a given UWS job has completed,
then returns a table based on the result.
|
static java.net.URL |
waitForResultUrl(UwsJob uwsJob,
long pollMillis) |
Blocks until the TAP query represented by a given UWS job has completed,
then returns the URL from which the successful result can be obtained.
|
public static final uk.ac.starlink.votable.DataFormat DFLT_UPLOAD_SER
DataFormat.TABLEDATA
.
BINARY would be more efficient and ought to be OK,
but at time of writing at least CADC, and under some circumstances
other services, work properly with TABLEDATA but not BINARY
uploaded tables, so for now conform to the lowest common denominator.public TapQuery(EndpointSet endpointSet, java.lang.String adql, java.util.Map<java.lang.String,java.lang.String> extraParams)
endpointSet
- locations of TAP service endpointsadql
- text of ADQL queryextraParams
- key->value map for optional parameters;
if any of these match the names of standard
parameters (upper case) the standard values will
be overwritten, so use with care (may be null)public TapQuery(EndpointSet endpointSet, java.lang.String adql, java.util.Map<java.lang.String,java.lang.String> extraParams, java.util.Map<java.lang.String,uk.ac.starlink.table.StarTable> uploadMap, long uploadLimit, uk.ac.starlink.votable.VOTableWriter vowriter) throws java.io.IOException
endpointSet
- locations of TAP service endpointsadql
- text of ADQL queryextraParams
- key->value map for optional parameters;
if any of these match the names of standard
parameters (upper case) the standard values will
be overwritten, so use with care (may be null)uploadMap
- name->table map of tables to be uploaded to
the service for the query (may be null)uploadLimit
- maximum number of bytes that may be uploaded;
if negative, no limit is applied,
ignored if uploadMap
null or emptyvowriter
- serializer for producing content of uploaded tables;
ignored if uploadMap
null or empty,
if null a default value is usedjava.io.IOException
- if upload tables exceed the upload limitpublic TapQuery(java.net.URL serviceUrl, java.lang.String adql, java.util.Map<java.lang.String,java.lang.String> extraParams)
Endpoints.createDefaultTapEndpointSet(java.lang.String)
and then invokes one of the other constructors.
This form is mildly deprecated, it is preferred to create your own EndpointSet as above and submit that to one of the other constructors instead. It's present because other classes rely on it, but there is no intention to add URL-based constructors corresponding to the other EndpointSet-based forms.
serviceUrl
- base URL of TAP serviceadql
- text of ADQL queryextraParams
- key->value map for optional parameters;
if any of these match the names of standard
parameters (upper case) the standard values will
be overwritten, so use with care (may be null)public java.lang.String getAdql()
public EndpointSet getEndpointSet()
public java.util.Map<java.lang.String,java.lang.String> getStringParams()
public java.util.Map<java.lang.String,HttpStreamParam> getStreamParams()
public uk.ac.starlink.table.StarTable executeSync(uk.ac.starlink.table.StoragePolicy storage, uk.ac.starlink.util.ContentCoding coding) throws java.io.IOException
storage
- storage policy for caching table datacoding
- configures HTTP compressionjava.io.IOException
public boolean executeSync(uk.ac.starlink.table.TableSink sink, uk.ac.starlink.util.ContentCoding coding) throws java.io.IOException, org.xml.sax.SAXException
sink
- table destinationcoding
- configures HTTP compressionjava.io.IOException
org.xml.sax.SAXException
public java.net.HttpURLConnection createSyncConnection(uk.ac.starlink.util.ContentCoding coding) throws java.io.IOException
coding
- HTTP content-coding policy
result should be interpreted with same codingjava.io.IOException
public UwsJob submitAsync() throws java.io.IOException
java.io.IOException
public static java.net.URL waitForResultUrl(UwsJob uwsJob, long pollMillis) throws java.io.IOException, java.lang.InterruptedException
uwsJob
- started UWS job representing an async TAP querypollMillis
- polling interval in millisecondsjava.io.IOException
java.lang.InterruptedException
public static uk.ac.starlink.table.StarTable waitForResult(UwsJob uwsJob, uk.ac.starlink.util.ContentCoding coding, uk.ac.starlink.table.StoragePolicy storage, long pollMillis) throws java.io.IOException, java.lang.InterruptedException
uwsJob
- started UWS job representing an async TAP querycoding
- configures HTTP compressionstorage
- storage policy for caching table datapollMillis
- polling interval in millisecondsjava.io.IOException
java.lang.InterruptedException
public static uk.ac.starlink.table.StarTable getResult(UwsJob uwsJob, uk.ac.starlink.util.ContentCoding coding, uk.ac.starlink.table.StoragePolicy storage) throws java.io.IOException
uwsJob
- successfully completed UWS job representing
an async TAP querycoding
- configures HTTP compressionstorage
- storage policy for caching table datajava.io.IOException
public static <T> T scalarQuery(EndpointSet endpointSet, java.lang.String adql, java.lang.Class<T> clazz) throws java.io.IOException
endpointSet
- locations of TAP servicesadql
- query stringclazz
- class of required valuejava.io.IOException
- if required result cannot be gotpublic static uk.ac.starlink.table.StarTable readResultVOTable(java.net.URLConnection conn, uk.ac.starlink.util.ContentCoding coding, uk.ac.starlink.table.StoragePolicy storage) throws java.io.IOException
conn
- connection to table resourcecoding
- HTTP content coding policy used to prepare connectionstorage
- storage policyjava.io.IOException
public static boolean streamResultVOTable(java.net.URLConnection conn, uk.ac.starlink.util.ContentCoding coding, uk.ac.starlink.table.TableSink sink) throws java.io.IOException, org.xml.sax.SAXException
conn
- connection to table resourcecoding
- HTTP content coding policy used to prepare connectionsink
- destination for table result of succesful queryjava.io.IOException
org.xml.sax.SAXException
public static java.io.InputStream getVOTableStream(java.net.URLConnection conn, uk.ac.starlink.util.ContentCoding coding) throws java.io.IOException
conn
- connection to result of TAP service callcoding
- HTTP content coding policy used to prepare connectionjava.io.IOException
public static java.net.URLConnection followRedirects(java.net.URLConnection conn) throws java.io.IOException
conn
- initial URL connectionhconn
)java.io.IOException
Copyright © 2018 Central Laboratory of the Research Councils. All Rights Reserved.