Package uk.ac.starlink.vo
Class MetaNameFixer
java.lang.Object
uk.ac.starlink.vo.MetaNameFixer
Provides methods for fixing up table and column names reported
by TAP services, so that they fit required syntactic constraints.
If the services are operating correctly, the behaviour provided
by this class should not be required.
Concrete instances must implement the abstract
getFixedTableName(java.lang.String, uk.ac.starlink.vo.SchemaMeta)
and getFixedColumnName(java.lang.String)
methods.
The fix*
methods can then be used to fix up table
metadata acquired from some service for use within ADQL queries.
The getOriginal*Name
methods may be required for
subsequent communications with the service (since the original
names are the ones that the service knows about).
- Since:
- 14 May 2015
- Author:
- Mark Taylor
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MetaNameFixer
createAdqlFixer
(AdqlSyntax syntax) Returns a new instance that follows rules for a particular ADQL-like syntax.static MetaNameFixer
Returns a new instance that follows standard ADQL syntax rules.void
fixColumns
(ColumnMeta[] columns) Ensures that the given columns have syntactically acceptable names.void
fixSchemas
(SchemaMeta[] schemas) Ensures that the given schemas and their contained tables and columns have syntactically acceptable names.void
fixTables
(TableMeta[] tables, SchemaMeta schema) Ensures that the given tables and their contained columns have syntactically acceptable names.abstract String
getFixedColumnName
(String cname) Returns a column name which is syntactically acceptable.abstract String
getFixedTableName
(String tname, SchemaMeta schema) Returns a table name which is syntactically acceptable.getOriginalColumnName
(ColumnMeta column) Returns the unfixed name for a given column.getOriginalTableName
(TableMeta table) Returns the unfixed name for a given table.
-
Field Details
-
NONE
Instance which makes no name changes. May be used multiple times.
-
-
Constructor Details
-
MetaNameFixer
protected MetaNameFixer()Constructor.
-
-
Method Details
-
getFixedTableName
Returns a table name which is syntactically acceptable. If the input name is OK, it should be returned unchanged.- Parameters:
tname
- original table nameschema
- schema from which table was acquired- Returns:
- original or fixed table name
-
getFixedColumnName
Returns a column name which is syntactically acceptable. If the input name is OK, it should be returned unchanged.- Parameters:
cname
- original column name- Returns:
- original or fixed column name
-
fixSchemas
Ensures that the given schemas and their contained tables and columns have syntactically acceptable names.- Parameters:
schemas
- schemas to fix up
-
fixTables
Ensures that the given tables and their contained columns have syntactically acceptable names.- Parameters:
tables
- tables to fix upschema
- schema containing the given tables
-
fixColumns
Ensures that the given columns have syntactically acceptable names.- Parameters:
columns
- columns to fix up
-
getOriginalColumnName
Returns the unfixed name for a given column.- Parameters:
column
- column whose name may have been fixed- Returns:
- column name prior to fixing
-
getOriginalTableName
Returns the unfixed name for a given table.- Parameters:
table
- table whose name may have been fixed- Returns:
- table name prior to fixing
-
createDefaultFixer
Returns a new instance that follows standard ADQL syntax rules. Note this instance should not be shared between multiple metadata sets.- Returns:
- new fixer instance
-
createAdqlFixer
Returns a new instance that follows rules for a particular ADQL-like syntax. Note this instance should not be shared between multiple metadata sets.- Parameters:
syntax
- syntax rules- Returns:
- new fixer instance
-