|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.datatools.sqltools.core.profile.ProfileUtil
Utility class for IConnectionProfile
in connectivity layer. Encapsulating all the code to processing
IConnectionProfile
object can reduce the maintainence effort and make it easy for consumers in the SQL
Dev Tools to use.
Field Summary | |
static java.lang.String |
DATABASENAME
|
static java.lang.String |
DRIVERCLASS
|
static java.lang.String |
DRIVERDEFINITIONID
|
static java.lang.String |
PWD
|
static java.lang.String |
UID
|
static java.lang.String |
URL
|
Constructor Summary | |
ProfileUtil()
|
Method Summary | |
static void |
closeConnection(java.lang.String profileName,
java.lang.String dbName,
java.sql.Connection conn)
Closes the given connection object. |
static java.sql.Connection |
createConnection(IConnectionProfile profile,
java.lang.String dbName)
Returns a connection from the connection layer |
static java.sql.Connection |
createConnection(java.lang.String profileName,
java.lang.String dbName)
Returns a connection from the connection layer |
static java.lang.String |
getConnectionProfileId(java.lang.String profileName)
Gets the connection profile provider id by the profile name. |
static Database |
getDatabase(DatabaseIdentifier databaseIdentifier)
Returns the SQL model Database object identified by
databaseIdentifier . |
static DatabaseDefinition |
getDatabaseDefinition(java.lang.String profileName)
Returns the associated DatabaseVendorDefinition object from the given connection profile. |
static java.util.List |
getDatabaseList(java.lang.String profileName)
Retrieves the database name list located at the server identified by profileName. |
static DatabaseVendorDefinitionId |
getDatabaseVendorDefinitionId(java.lang.String profileName)
Given the connection profile name, return a DataVendorIdentifier object which identifies the data server type that profileName points to. |
static java.lang.String |
getPassword(IConnectionProfile profile)
Gets the password defined in the IConnectionProfile object. |
static IConnectionProfile |
getProfile(java.lang.String name)
Returns a IConnectionProfile object by the name. |
static java.sql.Connection |
getReusableConnection(DatabaseIdentifier databaseIdentifier)
Gets the shared connection from the connection profile TODO Now this method delegates to IConnectionProfile, which doesn't manage a connection for each database. |
static java.lang.String[] |
getSupportedDatabaseProfiles()
Returns all the connection profiles belonging to the database category. |
static java.lang.String |
getUserName(IConnectionProfile profile)
Gets the user name defined in the IConnectionProfile object. |
static boolean |
isDatabaseProfile(IConnectionProfile connectionProfile)
This method is used to verify if this profile is database profile. |
static boolean |
isDatabaseProfile(java.lang.String profileName)
This method is used to verify if this profile is database profile. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String UID
public static final java.lang.String PWD
public static final java.lang.String DRIVERDEFINITIONID
public static final java.lang.String DATABASENAME
public static final java.lang.String URL
public static final java.lang.String DRIVERCLASS
Constructor Detail |
public ProfileUtil()
Method Detail |
public static DatabaseDefinition getDatabaseDefinition(java.lang.String profileName)
public static IConnectionProfile getProfile(java.lang.String name) throws NoSuchProfileException
IConnectionProfile
object by the name.
name
- connection profile name
IConnectionProfile
NoSuchProfileException
- when no connection profile identified by the given name can be foundpublic static DatabaseVendorDefinitionId getDatabaseVendorDefinitionId(java.lang.String profileName)
profileName
-
public static java.lang.String getUserName(IConnectionProfile profile)
IConnectionProfile
object.
profile
- the IConnectionProfile
public static java.lang.String getPassword(IConnectionProfile profile)
IConnectionProfile
object.
profile
- the IConnectionProfile
public static java.lang.String getConnectionProfileId(java.lang.String profileName) throws NoSuchProfileException
profileName
- connection profile name
NoSuchProfileException
public static Database getDatabase(DatabaseIdentifier databaseIdentifier)
Database
object identified by
databaseIdentifier
.
Note: this method can only return one Database object for one connection profile. This problem should be addressed in multiple database environment, such as ASE.
Database
objectpublic static java.sql.Connection getReusableConnection(DatabaseIdentifier databaseIdentifier) throws java.sql.SQLException, NoSuchProfileException
databaseIdentifier
- database identifier used to locate the connection profile
java.sql.SQLException
NoSuchProfileException
public static java.sql.Connection createConnection(java.lang.String profileName, java.lang.String dbName)
profileName
- dbName
-
createConnection(IConnectionProfile, String)
public static java.sql.Connection createConnection(IConnectionProfile profile, java.lang.String dbName)
profile
- dbName
-
public static void closeConnection(java.lang.String profileName, java.lang.String dbName, java.sql.Connection conn)
profileName
- dbName
- conn
- public static boolean isDatabaseProfile(IConnectionProfile connectionProfile)
public static boolean isDatabaseProfile(java.lang.String profileName)
profileName
-
public static java.util.List getDatabaseList(java.lang.String profileName)
profileName
- connection profile name
public static java.lang.String[] getSupportedDatabaseProfiles()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |