public class DefaultDBTable extends java.lang.Object implements DBTable
DBTable
.Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
adqlCatalogName |
protected java.lang.String |
adqlName |
protected java.lang.String |
adqlSchemaName |
protected java.util.Map<java.lang.String,DBColumn> |
columns |
protected java.lang.String |
dbCatalogName |
protected java.lang.String |
dbName |
protected java.lang.String |
dbSchemaName |
Constructor and Description |
---|
DefaultDBTable(java.lang.String dbName)
Builds a default
DBTable with the given DB name. |
DefaultDBTable(java.lang.String dbName,
java.lang.String adqlName)
Builds a default
DBTable with the given DB and ADQL names. |
DefaultDBTable(java.lang.String dbCatName,
java.lang.String dbSchemName,
java.lang.String dbName)
Builds default
DBTable with a DB catalog, schema and table names. |
DefaultDBTable(java.lang.String dbCatName,
java.lang.String adqlCatName,
java.lang.String dbSchemName,
java.lang.String adqlSchemName,
java.lang.String dbName,
java.lang.String adqlName)
Builds default
DBTable with the DB and ADQL names for the catalog, schema and table. |
Modifier and Type | Method and Description |
---|---|
void |
addAllColumns(java.util.Collection<DBColumn> colList) |
void |
addColumn(DBColumn column) |
DBTable |
copy(java.lang.String dbName,
java.lang.String adqlName)
Makes a copy of this instance of
DBTable , with the possibility to change the DB and ADQL names. |
java.lang.String |
getADQLCatalogName()
Gets the ADQL name of the catalog which contains this table.
|
java.lang.String |
getADQLName()
Gets the name of this table (without any prefix and double-quotes).
|
java.lang.String |
getADQLSchemaName()
Gets the ADQL name of the schema which contains this table.
|
DBColumn |
getColumn(java.lang.String colName,
boolean byAdqlName)
Case sensitive !
|
java.lang.String |
getDBCatalogName()
Gets the DB name of the catalog which contains this table.
|
java.lang.String |
getDBName()
Gets the name of this table in the "database".
|
java.lang.String |
getDBSchemaName()
Gets the DB name of the schema which contains this table.
|
boolean |
hasColumn(java.lang.String colName,
boolean byAdqlName) |
java.util.Iterator<DBColumn> |
iterator() |
static java.lang.String |
joinTableName(java.lang.String[] nameParts)
Join the last 3 items of the given string array with a dot ('.').
|
void |
setADQLCatalogName(java.lang.String name) |
void |
setADQLName(java.lang.String name) |
void |
setADQLSchemaName(java.lang.String name) |
static java.lang.String[] |
splitTableName(java.lang.String table)
Splits the given table name in 3 parts: catalog, schema, table.
|
protected java.lang.String dbCatalogName
protected java.lang.String dbSchemaName
protected java.lang.String dbName
protected java.lang.String adqlCatalogName
protected java.lang.String adqlSchemaName
protected java.lang.String adqlName
protected java.util.Map<java.lang.String,DBColumn> columns
public DefaultDBTable(java.lang.String dbName)
Builds a default DBTable
with the given DB name.
With this constructor: ADQL name = DB name.
Note: The table name can be prefixed by a schema and a catalog: t1 or schema1.t1 or cat1.schema1.t2
dbName
- Database name (it will be also used as ADQL table name).DefaultDBTable(String, String)
public DefaultDBTable(java.lang.String dbName, java.lang.String adqlName)
Builds a default DBTable
with the given DB and ADQL names.
Note: The table names can be prefixed by a schema and a catalog: t1 or schema1.t1 or cat1.schema1.t2
dbName
- Database name.adqlName
- Name used in ADQL queries.public DefaultDBTable(java.lang.String dbCatName, java.lang.String dbSchemName, java.lang.String dbName)
DBTable
with a DB catalog, schema and table names.dbCatName
- Database catalog name (it will be also used as ADQL catalog name).dbSchemName
- Database schema name (it will be also used as ADQL schema name).dbName
- Database table name (it will be also used as ADQL table name).DefaultDBTable(String, String, String, String, String, String)
public DefaultDBTable(java.lang.String dbCatName, java.lang.String adqlCatName, java.lang.String dbSchemName, java.lang.String adqlSchemName, java.lang.String dbName, java.lang.String adqlName)
DBTable
with the DB and ADQL names for the catalog, schema and table.dbCatName
- Database catalog name.adqlCatName
- Catalog name used in ADQL queries.
If NULL, it will be set to dbCatName.dbSchemName
- Database schema name.adqlSchemName
- Schema name used in ADQL queries.
If NULL, it will be set to dbSchemName.dbName
- Database table name.adqlName
- Table name used in ADQL queries.
If NULL, it will be set to dbName.public final java.lang.String getDBName()
DBTable
public final java.lang.String getDBSchemaName()
DBTable
getDBSchemaName
in interface DBTable
public final java.lang.String getDBCatalogName()
DBTable
getDBCatalogName
in interface DBTable
public final java.lang.String getADQLName()
DBTable
getADQLName
in interface DBTable
public void setADQLName(java.lang.String name)
public final java.lang.String getADQLSchemaName()
DBTable
getADQLSchemaName
in interface DBTable
public void setADQLSchemaName(java.lang.String name)
public final java.lang.String getADQLCatalogName()
DBTable
getADQLCatalogName
in interface DBTable
public void setADQLCatalogName(java.lang.String name)
public DBColumn getColumn(java.lang.String colName, boolean byAdqlName)
Case sensitive !
Research optimized for researches by ADQL name.
getColumn
in interface DBTable
colName
- Name of the column (may be the ADQL or DB name depending of the second parameter).byAdqlName
- true means the given name is the ADQL name of the column and that the research must be done on the ADQL name of columns,
false means the same thing but with the DB name.DBTable.getColumn(java.lang.String, boolean)
public boolean hasColumn(java.lang.String colName, boolean byAdqlName)
public java.util.Iterator<DBColumn> iterator()
iterator
in interface java.lang.Iterable<DBColumn>
public void addColumn(DBColumn column)
public void addAllColumns(java.util.Collection<DBColumn> colList)
public static final java.lang.String[] splitTableName(java.lang.String table)
table
- The table name to split.public static final java.lang.String joinTableName(java.lang.String[] nameParts)
Join the last 3 items of the given string array with a dot ('.'). These three parts should be: [0]=catalog name, [1]=schema name, [2]=table name.
If the array contains less than 3 items, all the given items will be though joined. However, if it contains more than 3 items, only the three last items will be.
A null item will be written as an empty string (string of length 0 ; "").
In the case the first and the third items are not null, but the second is null, the final string will contain in the middle two dots. Example: if the array is {"cat", NULL, "table"}, then the joined string will be: "cat..table".
nameParts
- String items to join.public DBTable copy(java.lang.String dbName, java.lang.String adqlName)
DBTable
Makes a copy of this instance of DBTable
, with the possibility to change the DB and ADQL names.
IMPORTANT:
The given DB and ADQL name may be NULL. If NULL, the copy will contain exactly the same full name (DB and/or ADQL).
And they may be qualified (that's to say: prefixed by the schema name or by the catalog and schema name). It means that it is possible to
change the catalog, schema and table name in the copy.
For instance:
copy
in interface DBTable
dbName
- Its new DB name.
It may be qualified.
It may also be NULL ; if so, the full DB name won't be different in the copy.adqlName
- Its new ADQL name.
It may be qualified.
It may also be NULL ; if so, the full DB name won't be different in the copy.DBTable
.