Package uk.ac.starlink.vo
Class MetaNameFixer
- java.lang.Object
-
- uk.ac.starlink.vo.MetaNameFixer
-
public abstract class MetaNameFixer extends java.lang.Object
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)
andgetFixedColumnName(java.lang.String)
methods. Thefix*
methods can then be used to fix up table metadata acquired from some service for use within ADQL queries. ThegetOriginal*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 Modifier and Type Field Description static MetaNameFixer
NONE
Instance which makes no name changes.
-
Constructor Summary
Constructors Modifier Constructor Description protected
MetaNameFixer()
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static MetaNameFixer
createAdqlFixer(AdqlSyntax syntax)
Returns a new instance that follows rules for a particular ADQL-like syntax.static MetaNameFixer
createDefaultFixer()
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 java.lang.String
getFixedColumnName(java.lang.String cname)
Returns a column name which is syntactically acceptable.abstract java.lang.String
getFixedTableName(java.lang.String tname, SchemaMeta schema)
Returns a table name which is syntactically acceptable.java.lang.String
getOriginalColumnName(ColumnMeta column)
Returns the unfixed name for a given column.java.lang.String
getOriginalTableName(TableMeta table)
Returns the unfixed name for a given table.
-
-
-
Field Detail
-
NONE
public static MetaNameFixer NONE
Instance which makes no name changes. May be used multiple times.
-
-
Method Detail
-
getFixedTableName
public abstract java.lang.String getFixedTableName(java.lang.String tname, SchemaMeta schema)
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
public abstract java.lang.String getFixedColumnName(java.lang.String cname)
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
public void fixSchemas(SchemaMeta[] schemas)
Ensures that the given schemas and their contained tables and columns have syntactically acceptable names.- Parameters:
schemas
- schemas to fix up
-
fixTables
public void fixTables(TableMeta[] tables, SchemaMeta schema)
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
public void fixColumns(ColumnMeta[] columns)
Ensures that the given columns have syntactically acceptable names.- Parameters:
columns
- columns to fix up
-
getOriginalColumnName
public java.lang.String getOriginalColumnName(ColumnMeta column)
Returns the unfixed name for a given column.- Parameters:
column
- column whose name may have been fixed- Returns:
- column name prior to fixing
-
getOriginalTableName
public java.lang.String getOriginalTableName(TableMeta table)
Returns the unfixed name for a given table.- Parameters:
table
- table whose name may have been fixed- Returns:
- table name prior to fixing
-
createDefaultFixer
public static MetaNameFixer 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
public static MetaNameFixer createAdqlFixer(AdqlSyntax syntax)
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
-
-