org.eclipse.datatools.connectivity.oda.profile
Class OdaProfileExplorer

java.lang.Object
  extended by org.eclipse.datatools.connectivity.oda.profile.OdaProfileExplorer

public class OdaProfileExplorer
extends java.lang.Object

The ODA Profile Explorer is a singleton class that provides the services to explore ODA connection profile instances and their main content. The OdaProfileExplorer singleton instance is retrieved using the getInstance() method.


Method Summary
 IConnectionProfile createTransientProfile(java.lang.String odaDataSourceId, java.util.Properties profileProperties)
          Creates a new transient profile instance based on the specified data source profile id and connection properties.
static OdaProfileExplorer getInstance()
          Static method to return the singleton instance.
 IConnectionProfile getProfile(java.lang.String profileInstanceId)
          Deprecated. As of DTP 1.6, replaced by getProfileById(String, File)
 IConnectionProfile getProfileById(java.lang.String profileInstanceId, java.io.File storageFile)
          Finds and returns the profile instance in given storage file that matches the given profile's static instance id.
 IConnectionProfile getProfileByName(java.util.Properties dataSourceDesignProps, java.lang.Object appContext)
          Find and returns the connection profile instance whose name is specified in the specified connection properties.
 IConnectionProfile getProfileByName(java.lang.String profileName, java.io.File storageFile)
          Finds and returns the profile instance in given storage file that matches the given profile instance name.
 java.util.Map getProfileIdentifiersByCategory(java.lang.String categoryId, java.io.File storageFile)
          Returns a collection of identifiers of all connection profile instances under the specified profile category id.
 java.util.Map getProfileIdentifiersByOdaProviderId(java.lang.String odaDataSourceId, java.io.File storageFile)
          Returns a collection of identifiers of all connection profile instances of the given ODA data source extension type.
 java.util.Map<java.lang.String,java.lang.String> getProfileIdsAndNamesByCategory(java.lang.String categoryId, java.io.File storageFile)
          Returns a collection of instance id and name of all connection profile instances under the specified profile category id.
 java.util.Properties getProfileProperties(java.lang.String profileInstanceId)
          Deprecated. As of DTP 1.6, replaced by getProfileProperties(String, File)
 java.util.Properties getProfileProperties(java.lang.String profileInstanceId, java.io.File storageFile)
          Returns the profile properties with values collected in the specified connection profile instance in the storageFile.
 java.util.Map getProfiles(java.lang.String odaDataSourceId)
          Deprecated. As of DTP 1.6, replaced by getProfileIdentifiersByOdaProviderId(String, File)
 java.util.Map getProfiles(java.lang.String odaDataSourceId, java.io.File storageFile)
          Deprecated. As of DTP 1.6, replaced by getProfileIdentifiersByOdaProviderId(String, File)
static boolean isProfileNameUsed(java.lang.String profileName)
          Verifies if the specified connection profile name is already used among those profile instances that are cached and managed by the DTP Connection Profile Manager.
 void refresh()
          Refresh the profile explorer, which allows it to get the latest profile instances in a profile storage file.
static void releaseInstance()
          Singleton instance release method.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static OdaProfileExplorer getInstance()
Static method to return the singleton instance.

Returns:

releaseInstance

public static void releaseInstance()
Singleton instance release method.


refresh

public void refresh()
Refresh the profile explorer, which allows it to get the latest profile instances in a profile storage file.

Since:
DTP 1.6

getProfiles

public java.util.Map getProfiles(java.lang.String odaDataSourceId)
                          throws OdaException
Deprecated. As of DTP 1.6, replaced by getProfileIdentifiersByOdaProviderId(String, File)

Returns a collection of identifiers of all connection profile instances of a given ODA data source extension type. The profile instances are searched in the current profile storage location with default file name. It also caches the matching profiles and saves in the current profile storage file for subsequent use.

Throws:
OdaException

getProfiles

public java.util.Map getProfiles(java.lang.String odaDataSourceId,
                                 java.io.File storageFile)
                          throws OdaException
Deprecated. As of DTP 1.6, replaced by getProfileIdentifiersByOdaProviderId(String, File)

Returns a collection of identifiers of all connection profile instances of a given ODA data source extension type. The profile instances are searched in the given profile storage file. It also caches the matching profiles and saves in the current profile storage file for subsequent use.

Throws:
OdaException

getProfileIdentifiersByOdaProviderId

public java.util.Map getProfileIdentifiersByOdaProviderId(java.lang.String odaDataSourceId,
                                                          java.io.File storageFile)
                                                   throws OdaException
Returns a collection of identifiers of all connection profile instances of the given ODA data source extension type. The profile instances are searched from the specified profile storage file.

Parameters:
odaDataSourceId - the unique id of the data source element in an ODA data source extension.
storageFile - a file that stores profile instances; may be null, which will use the default store path of the Connectivity plugin
Returns:
a Map containing the instance Id (as key) and description (as value) of all existing profiles of given odaDataSourceId; may be an empty collection if there are no matching connection profiles found in specified store.
Throws:
OdaException - if unable to read from the given storageFile
Since:
DTP 1.6

getProfileIdentifiersByCategory

public java.util.Map getProfileIdentifiersByCategory(java.lang.String categoryId,
                                                     java.io.File storageFile)
                                              throws OdaException
Returns a collection of identifiers of all connection profile instances under the specified profile category id. The profile instances are searched from the specified profile storage file.

Parameters:
categoryId - the unique id of a connection profile category
storageFile - a file that stores profile instances; may be null, which will use the default store path of the Connectivity plugin
Returns:
a Map containing the instance Id (as key) and description (as value) of all existing profiles of given odaDataSourceId; may be an empty collection if there are no matching connection profiles found in specified store.
Throws:
OdaException - if unable to read from the given storageFile
Since:
DTP 1.6

getProfileIdsAndNamesByCategory

public java.util.Map<java.lang.String,java.lang.String> getProfileIdsAndNamesByCategory(java.lang.String categoryId,
                                                                                        java.io.File storageFile)
                                                                                 throws OdaException
Returns a collection of instance id and name of all connection profile instances under the specified profile category id. The profile instances are searched from the specified profile storage file.

Parameters:
categoryId - the unique id of a connection profile category
storageFile - a file that stores profile instances; may be null, which will use the default store path of the Connectivity plugin
Returns:
a Map containing the instance Id (as key), and name (as value) of all existing profiles of given odaDataSourceId; may be an empty collection if there are no matching connection profiles found in specified store.
Throws:
OdaException - if unable to read from the given storageFile
Since:
3.2.2 (DTP 1.7.2)

getProfileProperties

public java.util.Properties getProfileProperties(java.lang.String profileInstanceId)
Deprecated. As of DTP 1.6, replaced by getProfileProperties(String, File)

Returns the profile properties with values collected in a connection profile instance.

Parameters:
profileInstanceId - the instance id of a connection profile
Returns:
the properties of a connection profile instance
Throws:
java.lang.IllegalArgumentException - if instance is not found.

getProfileProperties

public java.util.Properties getProfileProperties(java.lang.String profileInstanceId,
                                                 java.io.File storageFile)
Returns the profile properties with values collected in the specified connection profile instance in the storageFile.

Parameters:
profileInstanceId - the unique static id of a connection profile instance
storageFile - a file that stores profile instances; may be null, which would use the default store of the Connectivity plugin
Returns:
the properties of a connection profile instance
Throws:
java.lang.IllegalArgumentException - if connection profile instance is not found.
Since:
DTP 1.6

getProfile

public IConnectionProfile getProfile(java.lang.String profileInstanceId)
Deprecated. As of DTP 1.6, replaced by getProfileById(String, File)

Returns the profile with given instance id found in ProfileManager cache.

Parameters:
profileInstanceId - the unique instance id of a profile in cache, as found in the collection returned by the getProfiles methods
Returns:
the instance of matching profile
Throws:
java.lang.IllegalArgumentException - if instance is not found.

getProfileById

public IConnectionProfile getProfileById(java.lang.String profileInstanceId,
                                         java.io.File storageFile)
                                  throws OdaException
Finds and returns the profile instance in given storage file that matches the given profile's static instance id.

Parameters:
profileInstanceId - the unique static id of a connection profile instance
storageFile - a file that stores profile instances; may be null, which would use the default store of the Connectivity plugin
Returns:
the matching profile instance, or null if not found
Throws:
OdaException
Since:
DTP 1.6

getProfileByName

public IConnectionProfile getProfileByName(java.lang.String profileName,
                                           java.io.File storageFile)
                                    throws OdaException
Finds and returns the profile instance in given storage file that matches the given profile instance name.

Parameters:
profileName - The unique name of a connection profile instance.
storageFile - a file that stores profile instances; may be null, which would use the default store of the Connectivity plugin
Returns:
the matching profile instance, or null if not found
Throws:
OdaException

getProfileByName

public IConnectionProfile getProfileByName(java.util.Properties dataSourceDesignProps,
                                           java.lang.Object appContext)
Find and returns the connection profile instance whose name is specified in the specified connection properties. The profile store file object may be provided in the given context, or its file path is specified in the connection properties.
This method delegates to the default property provider to get the external profile store reference from the specified properties and application context. Clients with custom IPropertyProvider implementation should obtain own profile reference, for use as arguments to getProfileByName(String, File).

Parameters:
dataSourceDesignProps - connection properties specified in a data source design
appContext - an application context Map passed thru to a connection, and which may contain the IPropertyProvider.ODA_CONN_PROP_CONTEXT key and corresponding connection property context object as value. If no such nested context is found, this application context Map is used as the connection property context. Optional; may be null.
Returns:
the matching profile instance, or null if not found
Since:
DTP 1.6
See Also:
getProfileByName(String, File)

isProfileNameUsed

public static boolean isProfileNameUsed(java.lang.String profileName)
Verifies if the specified connection profile name is already used among those profile instances that are cached and managed by the DTP Connection Profile Manager.

Parameters:
profileName - unique identifier of a DTP connection profile
Returns:
true if the name is already used; false otherwise
Since:
3.2 (DTP 1.7)

createTransientProfile

public IConnectionProfile createTransientProfile(java.lang.String odaDataSourceId,
                                                 java.util.Properties profileProperties)
                                          throws OdaException
Creates a new transient profile instance based on the specified data source profile id and connection properties.

Parameters:
odaDataSourceId - an ODA data source id as specified in an oda.dataSource extension
profileProperties - connection properties to be stored as profile properties
Returns:
a new instance of IConnectionProfile that are non persistent
Throws:
OdaException
Since:
3.2.1 (DTP 1.7.2)