| Summary: | [API] Need a way to access connection info for a table via public interfaces | ||
|---|---|---|---|
| Product: | [Tools] Data Tools | Reporter: | Josh Knauer <joshua.knauer> |
| Component: | Connectivity | Assignee: | Brian Fitzpatrick <bfitzpat> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P1 | CC: | francis.lui, joshua.knauer, sean.johnson |
| Version: | 0.7 | ||
| Target Milestone: | 1.0RC0 | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
|
Description
Josh Knauer
Address this issue for 1.0. More specifically we need a way get the following things: 1) Database name 2) JDBC driver class name 3) JDBC URL 4) Username 5) Password 6) java.sql.Connection instance setting priority to p2. need to consult pmc regarding public api changes. currently, there is no plan to refactor any of the SQM plug-ins until after callisto, so these issues may need to be addressed through documentation. Estimate 1 day Creating a utility class in sqm.core - org.eclipse.datatools.connectivity.sqm.core.util.ConnectionInfoUtils
This class provides the following helper methods, each passed a Database object. This should serve the needs of this requirement until such time as the ConnectionInfo and DatabaseConnectionRegistry APIs are refactored and made public (if this is done). If we need to add additional properties to expose via this utility class, we can do so, but I limited it to the list of properties provided in the bug description.
public static String getDatabaseName ( Database database ) {
public static String getJDBCDriverClassName ( Database database ) {
public static String getJDBCURL ( Database database ) {
public static String getUserName ( Database database ) {
public static String getPassword ( Database database ) {
public static Connection getSharedSQLConnectionInstance ( Database database ) {
If we need to, we can change the design slightly to make it less resource intensive (each call currently makes a call to get the ConnectionInfo object from the DatabaseConnectionRegistry and then serves up the info requested) by caching the ConnectionInfo object internally to the utility class. However, I chose not to do that for fear that stale information would be cached if users didn't reset it properly. If speed becomes an issue, we can revisit this.
At the request of the component lead, I have removed the ConnectionInfoUtils class and made public interfaces available for ConnectionFilter, ConnectionInfo, and the DatabaseConnectionRegistry utility. This refactoring should provide the information that was required by the bug initially. Sorry for any confusion this causes. Changing back to Fixed with the new changes Hey Brian, there are a couple of places that need to be updated. Primarily, the id for the ConnectionInfo connection factory should be updated to new public name (org.eclipse.datatools.connectivity.sqm.core.connection.ConnectionInfo). We need to update references in the plugin.xml files (mostly filter settings). We also need to coordinate with the SQL dev team as there are a number of references in their project. Post a note to the dev list or ping Hui or Hung. Let me know if you need anything. Rob Per comments from Rob, I have made and delivered some further changes to address BZ 130209, which has to do with refactoring the ConnectionInfo class. These new changes involve changing the factory ID from org.eclipse.datatools.connectivity.sqm.internal.core.connection.ConnectionInfo to org.eclipse.datatools.connectivity.sqm.core.connection.ConnectionInfo Hung, based on what Rob said, there are some changes that will need to be made in SQLTools to handle this change. Updated DatabaseConnectionRegistry to use public ConnectionInfo interface and added getConnectionProfile() to the public ConnectionInfo interface. Closed |