uk.ac.starlink.vo
Class AdqlValidator

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

public class AdqlValidator
extends Object

Handles validation of ADQL queries. In the current implementation the heavy lifting is done by Gregory Mantelet's ADQL parser.

Since:
3 Oct 2011
Author:
Mark Taylor

Nested Class Summary
static interface AdqlValidator.ValidatorColumn
          Defines column metadata for table columns known to the validator.
static interface AdqlValidator.ValidatorTable
          Defines table metadata for tables known to the validator.
 
Constructor Summary
AdqlValidator(AdqlValidator.ValidatorTable[] vtables, boolean allowUdfs)
          Constructor.
 
Method Summary
static void main(String[] args)
          Tests parser.
static AdqlValidator.ValidatorTable toValidatorTable(TableMeta tmeta, SchemaMeta smeta)
          Utility method to adapt a TableMeta object into a ValidatorTable.
 void validate(String query)
          Validates an ADQL string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdqlValidator

public AdqlValidator(AdqlValidator.ValidatorTable[] vtables,
                     boolean allowUdfs)
Constructor.

Parameters:
vtables - table metadata for database to be checked against
allowUdfs - whether unknown functions should cause a parse error
Method Detail

validate

public void validate(String query)
              throws Throwable
Validates an ADQL string. Any throwable returned hopefully includes useful information about the location and nature of the parse error, but that depends on the implementation.

Parameters:
query - ADQL query string
Throws:
Throwable - if the string is not valid ADQL

toValidatorTable

public static AdqlValidator.ValidatorTable toValidatorTable(TableMeta tmeta,
                                                            SchemaMeta smeta)
Utility method to adapt a TableMeta object into a ValidatorTable.

Parameters:
tmeta - input table metadata object
smeta - schema metadata object containing the table, or null
Returns:
table metadata object suitable for validation by this class

main

public static void main(String[] args)
                 throws Throwable,
                        IOException,
                        SAXException
Tests parser. Use -h for usage.

Throws:
Throwable
IOException
SAXException


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