|
|||||||||||
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 |
DATABASE_CATEGORY_ID
|
static java.lang.String |
DATABASENAME
|
static java.lang.String |
DRIVER_DATABASE_CATEGORY_ID
|
static java.lang.String |
DRIVER_DB_VENDOR_NAME
|
static java.lang.String |
DRIVER_DB_VERSION
|
static java.lang.String |
DRIVERCLASS
|
static java.lang.String |
DRIVERDEFINITIONID
|
static java.lang.String |
PROFILE_DB_VENDOR_NAME
|
static java.lang.String |
PROFILE_DB_VERSION
|
static java.lang.String |
PROFILE_DB_VERSION_TYPE
|
static java.lang.String |
PROP_DB_CONN_PROPS
|
static java.lang.String |
PWD
|
static int |
SQLMODEL_MODE_NONE
SQL Model operation mode indicating no SQL model is involved. |
static int |
SQLMODEL_MODE_OFFLINE
SQL Model operation mode indicating a local resource is used to load SQL models. |
static int |
SQLMODEL_MODE_ONLINE
SQL Model operation mode indicating a connection is established to data server and the SQL model reflects the data server metadata. |
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 |
connectProfile(java.lang.String profileName)
Connects the connection profile and returns the shared connection. |
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 Database |
getDatabase(DatabaseIdentifier databaseIdentifier,
boolean connect)
Returns the SQL model Database object identified by
databaseIdentifier . |
static DatabaseDefinition |
getDatabaseDefinition(DatabaseVendorDefinitionId id)
Returns the associated DatabaseVendorDefinition object from the given connection profile. |
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)
Shortcut to #getDatabaseList(profileName, true) TODO This method is remained for backward compatibility. |
static java.util.List |
getDatabaseList(java.lang.String profileName,
boolean connect)
Returns database name list from the connection profile name, only connect when required. |
static DatabaseVendorDefinitionId |
getDatabaseVendorDefinitionId(IConnectionProfile profile)
|
static DatabaseVendorDefinitionId |
getDatabaseVendorDefinitionId(IConnectionProfile profile,
boolean getCacheInfo,
boolean normalize)
Returns a DatabaseVendorDefinitionId object which identifies the data server type. |
static DatabaseVendorDefinitionId |
getDatabaseVendorDefinitionId(java.lang.String profileName)
Given the connection profile name, return a DatabaseVendorDefinitionId object which identifies the data server type that profileName points to. |
static DatabaseVendorDefinitionId |
getDatabaseVendorDefinitionId(java.lang.String profileName,
boolean getCacheInfo,
boolean normalize)
|
static java.sql.Connection |
getOrCreateReusableConnection(DatabaseIdentifier databaseIdentifier)
Gets the shared connection from the connection profile. |
static java.lang.String |
getPassword(IConnectionProfile profile)
Gets the password defined in the IConnectionProfile object. |
static java.lang.String |
getProductVersion(java.lang.String profileName)
Returns the real version info by pinging the server if it's not cached in connection profile yet. |
static IConnectionProfile |
getProfile(java.lang.String name)
Returns a IConnectionProfile object by the name. |
static java.lang.String |
getProfileDatabaseName(java.lang.String profileName)
Get profile's database name, if no database name in profile then return "" |
static IConnectionProfile[] |
getProfiles()
Get the profiles which are supported by DMP. |
static java.lang.String |
getProfileUserName(DatabaseIdentifier databaseIdentifier,
boolean createConnection)
Returns the database user name that matches the user name defined in DatabaseIdentifier. |
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 ServerIdentifier |
getServerIdentifier(DatabaseIdentifier databaseIdentifier)
Construct a ServerIdentifier from a connection profile. |
static int |
getSQLModelMode(SQLObject object)
Given an instance of SQLObject , returns the SQL model operation mode. |
static int |
getSQLModelMode(java.lang.String profileName)
Given a connection profile name, returns the SQL model operation mode. |
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(ConnectProfile connectProfile)
This method is used to verify if this profile is database profile. |
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. |
static boolean |
isSupportedProfile(IConnectionProfile profile)
This method is used to verify if this profile is supported by DMP. |
static boolean |
profileExist(java.lang.String name)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String PROFILE_DB_VERSION_TYPE
public static final java.lang.String PROFILE_DB_VERSION
public static final java.lang.String PROFILE_DB_VENDOR_NAME
public static final java.lang.String DRIVER_DB_VERSION
public static final java.lang.String DRIVER_DB_VENDOR_NAME
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
public static final java.lang.String DRIVER_DATABASE_CATEGORY_ID
public static final java.lang.String DATABASE_CATEGORY_ID
public static final java.lang.String PROP_DB_CONN_PROPS
public static final int SQLMODEL_MODE_NONE
public static final int SQLMODEL_MODE_ONLINE
public static final int SQLMODEL_MODE_OFFLINE
Constructor Detail |
public ProfileUtil()
Method Detail |
public static int getSQLModelMode(SQLObject object)
SQLObject
, returns the SQL model operation mode.
object
-
public static int getSQLModelMode(java.lang.String profileName)
profileName
-
public static DatabaseDefinition getDatabaseDefinition(java.lang.String profileName)
public static DatabaseDefinition getDatabaseDefinition(DatabaseVendorDefinitionId id)
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 boolean profileExist(java.lang.String name)
public static DatabaseVendorDefinitionId getDatabaseVendorDefinitionId(java.lang.String profileName)
profileName
-
public static DatabaseVendorDefinitionId getDatabaseVendorDefinitionId(IConnectionProfile profile)
public static DatabaseVendorDefinitionId getDatabaseVendorDefinitionId(java.lang.String profileName, boolean getCacheInfo, boolean normalize)
public static DatabaseVendorDefinitionId getDatabaseVendorDefinitionId(IConnectionProfile profile, boolean getCacheInfo, boolean normalize)
profile
- connection profilegetCacheInfo
- normalize
- whether needs to normalize the DatabaseVendorDefinitionId to conform with the database definition declaration
public static ServerIdentifier getServerIdentifier(DatabaseIdentifier databaseIdentifier)
public static java.lang.String getProductVersion(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
.
Shortcut to #getDatabase(databaseIdentifier, true)
TODO This method is remained for backward compatibility. Callers of this API should revisit whether connect should be automatically performed.
Database
objectpublic static Database getDatabase(DatabaseIdentifier databaseIdentifier, boolean connect)
Database
object identified by
databaseIdentifier
.
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 getOrCreateReusableConnection(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 connectProfile(java.lang.String profileName)
profileName
-
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 java.util.List getDatabaseList(java.lang.String profileName)
profileName
- connection profile name
public static java.util.List getDatabaseList(java.lang.String profileName, boolean connect)
profileName
- connection profile name
public static java.lang.String[] getSupportedDatabaseProfiles()
public static java.lang.String getProfileUserName(DatabaseIdentifier databaseIdentifier, boolean createConnection)
databaseIdentifier
- createConnection
- whether need to create connection if none existspublic static boolean isSupportedProfile(IConnectionProfile profile)
profile
-
public static boolean isDatabaseProfile(IConnectionProfile connectionProfile)
public static boolean isDatabaseProfile(ConnectProfile connectProfile)
connectProfile
-
public static boolean isDatabaseProfile(java.lang.String profileName)
profileName
-
public static java.lang.String getProfileDatabaseName(java.lang.String profileName)
profileName
-
public static IConnectionProfile[] getProfiles()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |