public class TapSchemaInterrogator extends Object
Modifier and Type | Class and Description |
---|---|
static class |
TapSchemaInterrogator.MetaQuerier<T>
Object that can read a certain type of TAP metadata object from
a table of a TAP_SCHEMA database table.
|
Modifier and Type | Field and Description |
---|---|
static TapSchemaInterrogator.MetaQuerier<ColumnMeta> |
COLUMN_QUERIER
Acquires ColumnMeta objects from TAP_SCHEMA.columns.
|
static TapSchemaInterrogator.MetaQuerier<ForeignMeta> |
FKEY_QUERIER
Acquires ForeignMeta objects from TAP_SCHEMA.keys.
|
static TapSchemaInterrogator.MetaQuerier<ForeignMeta.Link> |
LINK_QUERIER
Acquires ForeignMeta.Link objects from TAP_SCHEMA.key_columns.
|
static TapSchemaInterrogator.MetaQuerier<SchemaMeta> |
SCHEMA_QUERIER
Acquires SchemaMeta objects from TAP_SCHEMA.schemas.
|
static TapSchemaInterrogator.MetaQuerier<TableMeta> |
TABLE_QUERIER
Acquires TableMeta objects from TAP_SCHEMA.tables.
|
Constructor and Description |
---|
TapSchemaInterrogator(TapService service,
int maxrec,
ContentCoding coding)
Constructs an interrogator with explicit configuration.
|
Modifier and Type | Method and Description |
---|---|
protected TapQuery |
createTapQuery(String adql)
Constructs a TAP query for a given ADQL string.
|
protected StarTable |
executeQuery(TapQuery tq)
Performs an ADQL TAP query to this interrogator's service.
|
TapService |
getTapService()
Returns the TAP service used by this interrogator.
|
static void |
main(String[] args)
Prints out metadata content of a given TAP service.
|
void |
populateForeignKey(ForeignMeta fmeta,
Map<String,List<ForeignMeta.Link>> lMap)
Fills in link information for a ForeignMeta object.
|
void |
populateSchema(SchemaMeta smeta,
Map<String,List<TableMeta>> tMap)
Fills in table information for a SchemaMeta object.
|
void |
populateTable(TableMeta tmeta,
Map<String,List<ForeignMeta>> fMap,
Map<String,List<ColumnMeta>> cMap)
Fills in foreign key and column information for a TableMeta object,
Any relevant entries are removed from the supplied maps.
|
SchemaMeta[] |
queryMetadata()
This convenience method returns an array of fully filled in
SchemaMeta objects describing the tables available from the service.
|
<T> List<T> |
readList(TapSchemaInterrogator.MetaQuerier<T> mq,
String moreAdql)
Reads a list of metadata items using a given MetaQuerier object.
|
<T> Map<String,List<T>> |
readMap(TapSchemaInterrogator.MetaQuerier<T> mq,
String moreAdql)
Reads a map of metadata items using a given MetaQuerier object.
|
SchemaMeta[] |
readSchemas(boolean populateSchemas,
boolean populateTables,
boolean addOrphanTables)
Reads all schemas.
|
public static final TapSchemaInterrogator.MetaQuerier<ForeignMeta.Link> LINK_QUERIER
public static final TapSchemaInterrogator.MetaQuerier<ForeignMeta> FKEY_QUERIER
public static final TapSchemaInterrogator.MetaQuerier<ColumnMeta> COLUMN_QUERIER
public static final TapSchemaInterrogator.MetaQuerier<TableMeta> TABLE_QUERIER
public static final TapSchemaInterrogator.MetaQuerier<SchemaMeta> SCHEMA_QUERIER
public TapSchemaInterrogator(TapService service, int maxrec, ContentCoding coding)
service
- TAP service descriptionmaxrec
- maximum number of records to retrieve per querycoding
- configures HTTP compressionpublic TapService getTapService()
public SchemaMeta[] queryMetadata() throws IOException
IOException
public SchemaMeta[] readSchemas(boolean populateSchemas, boolean populateTables, boolean addOrphanTables) throws IOException
populateSchemas
- if true, schemas will contain non-null
table listspopulateTables
- if true, tables will contain non-null
column/key lists
(ignored if populateSchemas is false)addOrphanTables
- if true include tables whose schemas are not
explicitly declaredIOException
public <T> Map<String,List<T>> readMap(TapSchemaInterrogator.MetaQuerier<T> mq, String moreAdql) throws IOException
The form of the basic SELECT statement generated by this
call is "SELECT <columns> FROM <table>".
If non-null the text of the moreAdql
parameter
is appended (after a space), so it may be used to qualify the
query further.
mq
- type-specific queriermoreAdql
- additional ADQL text to append after the
FROM clause (for example a WHERE clause);
may be nullIOException
public <T> List<T> readList(TapSchemaInterrogator.MetaQuerier<T> mq, String moreAdql) throws IOException
The form of the basic SELECT statement generated by this
call is "SELECT <columns> FROM <table>".
If non-null the text of the moreAdql
parameter
is appended (after a space), so it may be used to qualify the
query further.
mq
- type-specific queriermoreAdql
- additional ADQL text to append after the
FROM clause (for example a WHERE clause);
may be nullIOException
public void populateForeignKey(ForeignMeta fmeta, Map<String,List<ForeignMeta.Link>> lMap)
fmeta
- unpopulated foreign key itemlMap
- map acquired using LINK_QUERIER
public void populateTable(TableMeta tmeta, Map<String,List<ForeignMeta>> fMap, Map<String,List<ColumnMeta>> cMap)
tmeta
- unpopulated table metadata itemfMap
- map acquired using FKEY_QUERIER
cMap
- map acquired using COLUMN_QUERIER
public void populateSchema(SchemaMeta smeta, Map<String,List<TableMeta>> tMap)
smeta
- unpopulated schema metadata itemtMap
- map acquired using TABLE_QUERIER
protected TapQuery createTapQuery(String adql)
adql
- query textprotected StarTable executeQuery(TapQuery tq) throws IOException
tq
- tap queryIOException
public static void main(String[] args) throws IOException
args
- first element is TAP service URLIOException
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.