public final class DatabaseSchemaConfigFactory extends Object implements DatabaseSchemaConfig
Constructor and Description |
---|
DatabaseSchemaConfigFactory() |
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() throws IOException
IOException
public DatabaseSchemaConfigFactory(InputStream is) throws IOException
Constructor for DatabaseSchemaConfigFactory.
is
- a InputStream
object.IOException
public 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 DatabaseSchemaConfig
public Table getPrimaryTable()
getPrimaryTable
in interface DatabaseSchemaConfig
public Table getTableByName(String name)
getTableByName
in interface DatabaseSchemaConfig
name
- the name of the table to findpublic Table findTableByVisibleColumn(String colName)
findTableByVisibleColumn
in interface DatabaseSchemaConfig
colName
- a String
object.public int getTableCount()
getTableCount
in interface DatabaseSchemaConfig
public List<String> getJoinTables(List<Table> tables)
getJoinTables
in interface DatabaseSchemaConfig
tables
- list of Tables to joinpublic String constructJoinExprForTables(List<Table> tables)
constructJoinExprForTables
in interface DatabaseSchemaConfig
tables
- list of Tables to joinpublic String addColumn(List<Table> tables, String column) throws FilterParseException
addColumn
in interface DatabaseSchemaConfig
tables
- a list of tables to add the column's table tocolumn
- the column to addFilterParseException
- if the column is not found in the schemaCopyright © 2021. All rights reserved.