|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fesenmeyer.dbnormalizer.core.DBNormalizerSession
public class DBNormalizerSession
DBNormalizerSession is a class holding all information needed and collected by DBNormalizer during the analysis of one or more tables (for example, a DB Schema). It provides a context, which is used by several classes from DBNormalizer to retrieve or store information.
Field Summary | |
---|---|
private DBConfig |
dbConfig
The DB-configuration data for this session. |
private static DBNormalizerLogger |
logger
The logger for this class. |
private String |
sessionName
The (unique) name of the session. |
private net.sourceforge.squirrel_sql.fw.sql.SQLConnection |
sqlConnection
A SQuirreL-SQL-Connection object which is used for retrieving database information. |
private TreeMap<TableContainer,Set<Table>> |
tables2normalize
A Map containing sets of tables to be normalized. |
Constructor Summary | |
---|---|
DBNormalizerSession()
Class Constructor for creating a session without DB-Configuration. |
|
DBNormalizerSession(DBConfig dbConfig)
Class Constructor for creating a session with DB-Configuration. |
Method Summary | |
---|---|
boolean |
addTable2Normalize(TableContainer tableContainer,
Table table)
Adds a table to the set of tables to be normalized. |
boolean |
addTableContainer2Normalize(TableContainer tableContainer)
Adds a TableContainer to the session. |
void |
addTableInformation(Collection<TableContainerConfig> tableContainerConfigs)
Adds tables to be normalized to this session, based on configuration data. |
private void |
assignFrom(DBConfig dbConfig)
Assign a DB-Configuration to this session. |
void |
closeSession()
Closes the session by closing the connection to the DB. |
private void |
createAndAddTable2Normalize(TableContainer tableContainer,
TableConfig tableConfig,
boolean loadFromDB)
Helper method for creating one table and its FDs based on configuration data and adding this information to the tables2normalize Map. |
private AttributeSetConfig |
createAttributeSetConfig(AttributeStringSet attributes)
|
SessionConfig |
createSessionConfig(String configFileName)
Creates a session configuration from the current state of the session. |
private void |
createTables2normalizeFromConfig(Collection<TableContainerConfig> tableContainerConfigs)
Adds the tables given in the tableContainerConfigs argument (with their FDs) to the tables2normalize map |
private Table |
findTableFromDB(Table table)
Helper Method for retrieving table information from the database. |
Connection |
getConnection()
Gets the SQuirreL-SQL-Connection, if a connection to a DB exists. |
DBConfig |
getDbConfig()
Gets the DB-Configuration used to establish a connection to a DB. |
net.sourceforge.squirrel_sql.fw.sql.SQLConnection |
getSqlConnection()
|
Set<TableContainer> |
getTableContainers2Normalize()
Gets all TableContainers which contain tables which are in the set of tables to be normalized. |
Set<Table> |
getTables2Normalize(TableContainer tableContainer)
Gets all tables which are in the set of tables to be normalized and are contained in the TableContainer specified by argument tableContainer. |
void |
removeTableContainer2Normalize(TableContainer tableContainer)
Removes the TableContainer specified by argument tableContainer and all tables, which are in the set of tables to be normalized and are contained in this tableContainer, from the internal data representation. |
void |
startSession()
Starts the session by creating a connection to the DB specified by the dbConfig member. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static DBNormalizerLogger logger
private String sessionName
private DBConfig dbConfig
private net.sourceforge.squirrel_sql.fw.sql.SQLConnection sqlConnection
private TreeMap<TableContainer,Set<Table>> tables2normalize
Constructor Detail |
---|
public DBNormalizerSession()
public DBNormalizerSession(DBConfig dbConfig) throws DBException
dbConfig
- the DB-Configuration object
DBException
- If an exception occurs when accessing the DB.Method Detail |
---|
public void addTableInformation(Collection<TableContainerConfig> tableContainerConfigs)
tableContainerConfigs
- configuration dataprivate void assignFrom(DBConfig dbConfig) throws DBException
dbConfig
- the DB-Configuration
DBException
- If an exception occurs when accessing the DB.private void createTables2normalizeFromConfig(Collection<TableContainerConfig> tableContainerConfigs)
tables2normalize
map
tableContainerConfigs
- the tableContainer configuration dataprivate void createAndAddTable2Normalize(TableContainer tableContainer, TableConfig tableConfig, boolean loadFromDB)
tables2normalize
Map.
tableContainer
- the tableContainer containing the tabletableConfig
- the configuration data of the tableloadFromDB
- true, if table information (such as attribute names)
should be loaded from a DB; false, otherwise (that means attribute names
must be stored in the configuration)private Table findTableFromDB(Table table)
table
- a table object at least containing name, catalog and schema information
null
, if the table could not be foundpublic void startSession() throws DBException
dbConfig
member. If there is no DB-Configuration
given, the method does nothing.
DBException
- If an exception occurs when connecting to the DB.public void closeSession() throws DBException
DBException
- If an exception occurs when closing the connection.public Connection getConnection()
public DBConfig getDbConfig()
public Set<TableContainer> getTableContainers2Normalize()
public Set<Table> getTables2Normalize(TableContainer tableContainer)
tableContainer
- a TableContainer
public boolean addTableContainer2Normalize(TableContainer tableContainer)
tableContainer
- a TableContainer
public boolean addTable2Normalize(TableContainer tableContainer, Table table)
tableContainer
- the TableContainer the table is contained intable
- the table
public void removeTableContainer2Normalize(TableContainer tableContainer)
tableContainer
- a TableContainerpublic SessionConfig createSessionConfig(String configFileName)
ConfigurationWriter
class.
configFileName
- the file where the session configuration
should be saved
private AttributeSetConfig createAttributeSetConfig(AttributeStringSet attributes)
public net.sourceforge.squirrel_sql.fw.sql.SQLConnection getSqlConnection()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |