jdbcadmin.core.tools
Class JdbcInspector

java.lang.Object
  extended byjdbcadmin.core.tools.AbstractCnxUser
      extended byjdbcadmin.core.tools.JdbcInspector

public class JdbcInspector
extends AbstractCnxUser

JDBC Introspection class.

Author:
Thomas Recloux (trecloux@norsys.fr)

Field Summary
 
Fields inherited from class jdbcadmin.core.tools.AbstractCnxUser
cnx, conInfos
 
Constructor Summary
JdbcInspector(ConnectionInfo aConInfos, IAccessAuthorization aAuthorizations)
          Constructor wich specify the connection informations and access authorizations.
 
Method Summary
protected  boolean connect()
          If not initialized, creates or retrieves the connection and updates the database meta datas
protected  void disconnect()
          Closes the connection.
 void fillTable(Table aTable)
          Complete a table (columns and primary keys)
 java.util.Collection getCalalogs()
           
 java.util.Collection getColumns(Table aTable)
          Retrieves the table columns.
 Table getFullTable(Schema aSchema, java.lang.String aTableName)
          Retrieve a filled table
 java.util.SortedMap getFullTables(Schema aSchema)
          Retrieves fully filled tables (with columns and primary key)
Key of the map : table names
Tables are sorted by their name
static JdbcInspector getInstance(java.io.InputStream aConfStream)
          Retrieve an instance of the inspector.
 java.util.SortedMap getNakedTables(Schema aSchema)
          Retrieves the naked tables, without their columns Tables are sorted by their name
 java.util.Collection getPrimaryKeys(java.lang.String aTableName)
          Retrieves primary keys for a table.
 java.util.List getSchemas()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcInspector

public JdbcInspector(ConnectionInfo aConInfos,
                     IAccessAuthorization aAuthorizations)
Constructor wich specify the connection informations and access authorizations.

Parameters:
aConInfos - connection informations
aAuthorizations - access authorizations
Method Detail

getInstance

public static JdbcInspector getInstance(java.io.InputStream aConfStream)
                                 throws TechnicalException
Retrieve an instance of the inspector.

Parameters:
aConfStream - Configuration stream
Returns:
the instance
Throws:
TechnicalException - Technical error

getFullTables

public java.util.SortedMap getFullTables(Schema aSchema)
                                  throws TechnicalException
Retrieves fully filled tables (with columns and primary key)
Key of the map : table names
Tables are sorted by their name

Parameters:
aSchema - schema to scan
Returns:
the tables
Throws:
TechnicalException - technical error

getNakedTables

public java.util.SortedMap getNakedTables(Schema aSchema)
                                   throws TechnicalException
Retrieves the naked tables, without their columns Tables are sorted by their name

Parameters:
aSchema - schema to scan
Returns:
the tables
Throws:
TechnicalException - technical error

getColumns

public java.util.Collection getColumns(Table aTable)
                                throws TechnicalException
Retrieves the table columns.

Parameters:
aTable - the table
Returns:
a #java.util.Collection of #jdbcadmin.core.data.Column
Throws:
TechnicalException - Technical error

getPrimaryKeys

public java.util.Collection getPrimaryKeys(java.lang.String aTableName)
                                    throws TechnicalException
Retrieves primary keys for a table.

Parameters:
aTableName - The table name
Returns:
a #java.util.Collection of #java.lang.String
Throws:
TechnicalException - Technical error

getCalalogs

public java.util.Collection getCalalogs()
                                 throws TechnicalException
Returns:
The db catalogs
Throws:
TechnicalException - Technical error

getSchemas

public java.util.List getSchemas()
                          throws TechnicalException
Returns:
Sorted schema list
Throws:
TechnicalException - Technical error

fillTable

public void fillTable(Table aTable)
               throws TechnicalException
Complete a table (columns and primary keys)

Parameters:
aTable - the table to fill
Throws:
TechnicalException - technical error

getFullTable

public Table getFullTable(Schema aSchema,
                          java.lang.String aTableName)
                   throws TechnicalException
Retrieve a filled table

Parameters:
aSchema - the schema to scan
aTableName - name of the table
Returns:
the filled table
Throws:
TechnicalException - technical error

connect

protected boolean connect()
                   throws TechnicalException
If not initialized, creates or retrieves the connection and updates the database meta datas

Overrides:
connect in class AbstractCnxUser
Returns:
true if the connection had to be created/retrieved (in this case, the calling method must call disconnect()), false otherwise
Throws:
TechnicalException - error connecting to db.

disconnect

protected void disconnect()
Closes the connection.

Overrides:
disconnect in class AbstractCnxUser


Copyright © 2004-2005 Norsys. All Rights Reserved.