public final class DatabaseSchemaConfigFactory extends Object implements DatabaseSchemaConfig
| Constructor and Description |
|---|
DatabaseSchemaConfigFactory(InputStream is)
Constructor for DatabaseSchemaConfigFactory.
|
| Modifier and Type | Method and Description |
|---|---|
String |
addColumn(List<Table> tables,
String column)
Validate that a column is in the schema, add it's table to a list of tables,
and return the full table.column name of the column.
|
String |
constructJoinExprForTables(List<Table> tables)
Construct a SQL FROM clause joining the given tables to the primary table.
|
Table |
findTableByVisibleColumn(String colName)
Find the table which has a visible column named 'colName'
|
DatabaseSchema |
getDatabaseSchema()
Return the database schema.
|
static DatabaseSchemaConfigFactory |
getInstance()
Return the singleton instance of this factory.
|
List<String> |
getJoinTables(List<Table> tables)
Return the sequence of tables necessary to join the primary table to the
given tables.
|
Table |
getPrimaryTable()
This method is used to find the table that should drive the construction
of the join clauses between all table in the from clause.
|
Lock |
getReadLock() |
Table |
getTableByName(String name)
Find a table using its name as the search key.
|
int |
getTableCount()
Return a count of the number of tables defined.
|
Lock |
getWriteLock() |
static void |
init()
Load the config from the default config file and create the singleton
instance of this factory.
|
static void |
reload()
Reload the config from the default config file
|
static void |
setInstance(DatabaseSchemaConfigFactory instance)
setInstance
|
public DatabaseSchemaConfigFactory(InputStream is) throws IOException
Constructor for DatabaseSchemaConfigFactory.
is - a InputStream object.IOExceptionpublic Lock getReadLock()
public Lock getWriteLock()
public static void init()
throws IOException
IOException - Thrown if the specified config file cannot be readIOException - if any.public static void reload()
throws IOException
IOException - Thrown if the specified config file cannot be read/loadedIOException - if any.public static DatabaseSchemaConfigFactory getInstance()
IllegalStateException - Thrown if the factory has not yet been initialized.public static void setInstance(DatabaseSchemaConfigFactory instance)
setInstance
instance - a DatabaseSchemaConfigFactory object.public DatabaseSchema getDatabaseSchema()
getDatabaseSchema in interface DatabaseSchemaConfigpublic Table getPrimaryTable()
getPrimaryTable in interface DatabaseSchemaConfigpublic Table getTableByName(String name)
getTableByName in interface DatabaseSchemaConfigname - the name of the table to findpublic Table findTableByVisibleColumn(String colName)
findTableByVisibleColumn in interface DatabaseSchemaConfigcolName - a String object.public int getTableCount()
getTableCount in interface DatabaseSchemaConfigpublic List<String> getJoinTables(List<Table> tables)
getJoinTables in interface DatabaseSchemaConfigtables - list of Tables to joinpublic String constructJoinExprForTables(List<Table> tables)
constructJoinExprForTables in interface DatabaseSchemaConfigtables - list of Tables to joinpublic String addColumn(List<Table> tables, String column) throws FilterParseException
addColumn in interface DatabaseSchemaConfigtables - a list of tables to add the column's table tocolumn - the column to addFilterParseException - if the column is not found in the schemaCopyright © 2020. All rights reserved.