Package uk.ac.starlink.ttools.taplint
Class VotLintTapRunner
- java.lang.Object
-
- uk.ac.starlink.ttools.taplint.TapRunner
-
- uk.ac.starlink.ttools.taplint.VotLintTapRunner
-
public abstract class VotLintTapRunner extends TapRunner
TapRunner implementation which uses the VotLint validation classes to check the query's result VOTable.- Since:
- 10 Jun 2011
- Author:
- Mark Taylor
-
-
Field Summary
Fields Modifier and Type Field Description static uk.ac.starlink.table.ValueInfo
OVERFLOW_INFO
Result table parameter set if table was marked overflowed.
-
Constructor Summary
Constructors Modifier Constructor Description protected
VotLintTapRunner(java.lang.String name, boolean doChecks)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static VotLintTapRunner
createAsyncRunner(long pollMillis, boolean doChecks)
Returns a new instance which makes asynchronous queries.static VotLintTapRunner
createGetSyncRunner(boolean doChecks)
Returns a new instance which uses HTTP GET to make synchronous queries.static VotLintTapRunner
createPostSyncRunner(boolean doChecks)
Returns a new instance which uses HTTP POST to make synchronous queries.protected uk.ac.starlink.table.StarTable
executeQuery(Reporter reporter, uk.ac.starlink.vo.TapQuery tq)
Executes a TAP query, performing reporting as appropriate.protected abstract java.net.URLConnection
getResultConnection(Reporter reporter, uk.ac.starlink.vo.TapQuery tq)
Execute a TAP query and return a URL connection giving its result.uk.ac.starlink.votable.VOElement
getResultsResourceElement(Reporter reporter, uk.ac.starlink.votable.VODocument doc)
Returns the RESOURCE element marked with type="results" from a given VODocument, or the best guess at it.boolean
isOverflow(uk.ac.starlink.table.StarTable table)
Indicates if the given table, which must have been retrieved from this object'sreadResultVOTable(uk.ac.starlink.ttools.taplint.Reporter, uk.ac.starlink.votable.VODocument)
method, was marked as an overflow result.uk.ac.starlink.votable.VODocument
readResultDocument(Reporter reporter, java.io.InputStream baseIn)
Reads a TAP result VODocument from an input stream, checking it and reporting messages as required.static uk.ac.starlink.votable.VODocument
readResultDocument(Reporter reporter, java.io.InputStream baseIn, boolean doChecks, uk.ac.starlink.votable.VOTableVersion minVotVersion)
Utility method to read a VODocument from an input stream, checking it and reporting messages as required.java.io.InputStream
readResultInputStream(Reporter reporter, uk.ac.starlink.vo.TapQuery tq)
Returns an input stream which should containing the result VOTable from a TAP query, performing checks and making reports as appropriate on the way.-
Methods inherited from class uk.ac.starlink.ttools.taplint.TapRunner
attemptGetResultTable, getDescription, getResultTable, reportSummary
-
-
-
-
Constructor Detail
-
VotLintTapRunner
protected VotLintTapRunner(java.lang.String name, boolean doChecks)
Constructor.- Parameters:
name
- name for this instancedoChecks
- true to perform various checks on the result VOTable (including linting) and report them, false to be mostly silent and only report serious errors
-
-
Method Detail
-
isOverflow
public boolean isOverflow(uk.ac.starlink.table.StarTable table)
Indicates if the given table, which must have been retrieved from this object'sreadResultVOTable(uk.ac.starlink.ttools.taplint.Reporter, uk.ac.starlink.votable.VODocument)
method, was marked as an overflow result.- Parameters:
table
- TAP result table read by this object- Returns:
- true iff overflow
-
getResultConnection
protected abstract java.net.URLConnection getResultConnection(Reporter reporter, uk.ac.starlink.vo.TapQuery tq) throws java.io.IOException
Execute a TAP query and return a URL connection giving its result.- Parameters:
reporter
- validation message destinationtq
- query- Returns:
- result data source
- Throws:
java.io.IOException
-
executeQuery
protected uk.ac.starlink.table.StarTable executeQuery(Reporter reporter, uk.ac.starlink.vo.TapQuery tq) throws java.io.IOException, org.xml.sax.SAXException
Description copied from class:TapRunner
Executes a TAP query, performing reporting as appropriate. The result may be null, but will normally be either a table or an IOException will result.- Specified by:
executeQuery
in classTapRunner
- Parameters:
reporter
- validation message destinationtq
- query to execute- Returns:
- result table
- Throws:
java.io.IOException
org.xml.sax.SAXException
-
readResultInputStream
public java.io.InputStream readResultInputStream(Reporter reporter, uk.ac.starlink.vo.TapQuery tq) throws java.io.IOException, org.xml.sax.SAXException
Returns an input stream which should containing the result VOTable from a TAP query, performing checks and making reports as appropriate on the way.- Parameters:
reporter
- validation message destinationtq
- query- Returns:
- result input stream
- Throws:
java.io.IOException
org.xml.sax.SAXException
-
readResultDocument
public uk.ac.starlink.votable.VODocument readResultDocument(Reporter reporter, java.io.InputStream baseIn) throws java.io.IOException, org.xml.sax.SAXException
Reads a TAP result VODocument from an input stream, checking it and reporting messages as required.- Parameters:
reporter
- validation message destinationbaseIn
- VOTable input stream- Returns:
- VOTable-aware DOM
- Throws:
java.io.IOException
org.xml.sax.SAXException
-
readResultDocument
public static uk.ac.starlink.votable.VODocument readResultDocument(Reporter reporter, java.io.InputStream baseIn, boolean doChecks, uk.ac.starlink.votable.VOTableVersion minVotVersion) throws java.io.IOException, org.xml.sax.SAXException
Utility method to read a VODocument from an input stream, checking it and reporting messages as required.- Parameters:
reporter
- validation message destinationbaseIn
- VOTable input streamdoChecks
- true to perform various checks on the result VOTable (including linting) and report them, false to be mostly silent and only report serious errorsminVotVersion
- minimum required VOTable version; may be null if any will do- Returns:
- VOTable-aware DOM
- Throws:
java.io.IOException
org.xml.sax.SAXException
-
getResultsResourceElement
public uk.ac.starlink.votable.VOElement getResultsResourceElement(Reporter reporter, uk.ac.starlink.votable.VODocument doc) throws java.io.IOException
Returns the RESOURCE element marked with type="results" from a given VODocument, or the best guess at it.- Parameters:
reporter
- validation message destinationdoc
- TAP result DOM- Throws:
java.io.IOException
-
createPostSyncRunner
public static VotLintTapRunner createPostSyncRunner(boolean doChecks)
Returns a new instance which uses HTTP POST to make synchronous queries.- Parameters:
doChecks
- true for detailed VOTable checking- Returns:
- new TapRunner
-
createGetSyncRunner
public static VotLintTapRunner createGetSyncRunner(boolean doChecks)
Returns a new instance which uses HTTP GET to make synchronous queries.- Parameters:
doChecks
- true for detailed VOTable checking- Returns:
- new TapRunner
-
createAsyncRunner
public static VotLintTapRunner createAsyncRunner(long pollMillis, boolean doChecks)
Returns a new instance which makes asynchronous queries. This instance does not do exhaustive validation.- Parameters:
pollMillis
- polling interval in millisecondsdoChecks
- true for detailed VOTable checking- Returns:
- new TapRunner
-
-