org.eclipse.datatools.connectivity
Class ProfileManager

java.lang.Object
  extended by org.eclipse.datatools.connectivity.ProfileManager
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable

public class ProfileManager
extends java.lang.Object
implements org.eclipse.core.runtime.IAdaptable

ProfileManger is a singleton class serverd as a helper class for connection profiles access. It also caches connection profiles and only persists to storage when changes made and at Eclipse shutdown.

Author:
shongxum

Constructor Summary
ProfileManager()
           
 
Method Summary
 void addProfile(IConnectionProfile profile)
          Add a connection profile object to the profiles cache.
 void addProfile(IConnectionProfile profile, boolean replaceExisting)
          Add a connection profile object to the profiles cache.
 void addProfileListener(IProfileListener listener)
          Register a listener for proifle operation
 IConnectionProfile copyProfile(IConnectionProfile profile, java.lang.String newName)
          Duplicate a connection profile but won't add it into ProfileManager or IConnectionProfileRepository
 IConnectionProfile createProfile(java.lang.String name, java.lang.String description, java.lang.String providerID, java.util.Properties baseProperties)
          Create connection profile
 IConnectionProfile createProfile(java.lang.String name, java.lang.String description, java.lang.String providerID, java.util.Properties baseProperties, java.lang.String parentProfile)
          Create connection profile
 IConnectionProfile createProfile(java.lang.String name, java.lang.String description, java.lang.String providerID, java.util.Properties baseProperties, java.lang.String parentProfile, boolean autoConnect)
          Create connection profile
 IConnectionProfile createTransientProfile(java.lang.String providerID, java.util.Properties baseProperties)
           
 void deleteProfile(IConnectionProfile profile)
          Delete a connection profile object from the profiles cache
 boolean deleteTransientProfile(IConnectionProfile profile)
          Disconnect and remove the specified transient profile.
 java.lang.String duplicateProfile(IConnectionProfile profile)
          Duplicate a connection profile
 java.lang.Object getAdapter(java.lang.Class adapter)
           
 ICategory getCategory(java.lang.String catID)
          Get category by name
static ProfileManager getInstance()
           
 IConnectionProfile getProfileByFullPath(java.lang.String path)
          Return the profile for a given path (typically REPOSITORY::PROFILE or PROFILE)
 IConnectionProfile getProfileByInstanceID(java.lang.String id)
          Get connection profile by instance ID
 IConnectionProfile getProfileByName(java.lang.String name)
          Get connection profile by name
 IConnectionProfile[] getProfileByProviderID(java.lang.String ID)
          Get connection profiles by connection profile(cp) provider ID associated with each cp
 java.lang.String getProfilePath(IConnectionProfile profile)
          Return the path for a given profile (typically REPOSITORY::PROFILE or PROFILE)
 IConnectionProfile[] getProfiles()
          Get all connection profiles persisted in workspace
 IConnectionProfile[] getProfiles(boolean searchRepositories)
          Get all connection profiles persisted in workspace
 IConnectionProfile[] getProfilesByCategory(java.lang.String catID)
          Get connection profiles by category
 ICategory[] getRootCategories()
          Get root categories whose parent category is null
 boolean isTransientProfile(IConnectionProfile profile)
          Indicates whether the specified connection profile is of a transient type.
 void modifyProfile(IConnectionProfile profile)
          Modify an existing connection profile
 void modifyProfile(IConnectionProfile profile, java.lang.String newName, java.lang.String newDesc)
          Modify an existing connection profile, plus it's name and description We don't expose a setName and setDescription in IConnectionProfile, so instead we expose this api for that same purpose.
 void modifyProfile(IConnectionProfile profile, java.lang.String newName, java.lang.String newDesc, java.lang.Boolean autoConnect)
          Modify an existing connection profile, plus it's name and description We don't expose a setName and setDescription in IConnectionProfile, so instead we expose this api for that same purpose.
 void removeProfileListener(IProfileListener listener)
          Remove the listener for profile operation
 java.lang.String[] tokenize(java.lang.String input, java.lang.String delim)
           
 java.lang.String unTokenize(java.lang.String[] tokens)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProfileManager

public ProfileManager()
Method Detail

getInstance

public static ProfileManager getInstance()

getProfiles

public IConnectionProfile[] getProfiles()
Get all connection profiles persisted in workspace

Returns:
connection profiles

getProfiles

public IConnectionProfile[] getProfiles(boolean searchRepositories)
Get all connection profiles persisted in workspace

Parameters:
searchRepositories -
Returns:
connection profiles

getCategory

public ICategory getCategory(java.lang.String catID)
Get category by name

Parameters:
catID -
Returns:
ICategory

getRootCategories

public ICategory[] getRootCategories()
Get root categories whose parent category is null

Returns:
ICategory[]

getProfilesByCategory

public IConnectionProfile[] getProfilesByCategory(java.lang.String catID)
Get connection profiles by category

Parameters:
catID -
Returns:
IConnectionProfile[]

getProfileByName

public IConnectionProfile getProfileByName(java.lang.String name)
Get connection profile by name

Parameters:
name -
Returns:
IConnectionProfile

getProfileByInstanceID

public IConnectionProfile getProfileByInstanceID(java.lang.String id)
Get connection profile by instance ID

Parameters:
id -
Returns:
IConnectionProfile

getProfileByProviderID

public IConnectionProfile[] getProfileByProviderID(java.lang.String ID)
Get connection profiles by connection profile(cp) provider ID associated with each cp

Parameters:
ID -
Returns:
IConnectionProfile[]

getProfilePath

public java.lang.String getProfilePath(IConnectionProfile profile)
Return the path for a given profile (typically REPOSITORY::PROFILE or PROFILE)

Parameters:
profile -
Returns:

getProfileByFullPath

public IConnectionProfile getProfileByFullPath(java.lang.String path)
Return the profile for a given path (typically REPOSITORY::PROFILE or PROFILE)

Parameters:
path -
Returns:

createTransientProfile

public IConnectionProfile createTransientProfile(java.lang.String providerID,
                                                 java.util.Properties baseProperties)
                                          throws ConnectionProfileException
Throws:
ConnectionProfileException

deleteTransientProfile

public boolean deleteTransientProfile(IConnectionProfile profile)
Disconnect and remove the specified transient profile. This is for optional use by a client that wants to clean up before the connectivity bundle is shutdown.

Parameters:
profile - a transient connection profile instance created by #createTransientProfile(String, String, String, Properties)
Returns:
true if the specified profile is found and deleted; false otherwise
Since:
DTP 1.7.2

isTransientProfile

public boolean isTransientProfile(IConnectionProfile profile)
Indicates whether the specified connection profile is of a transient type.

Parameters:
profile - a connection profile instance
Returns:
true if the specified profile is transient; false otherwise
Since:
DTP 1.7.2

createProfile

public IConnectionProfile createProfile(java.lang.String name,
                                        java.lang.String description,
                                        java.lang.String providerID,
                                        java.util.Properties baseProperties)
                                 throws ConnectionProfileException
Create connection profile

Parameters:
name -
description -
providerID -
baseProperties -
Throws:
ConnectionProfileException

createProfile

public IConnectionProfile createProfile(java.lang.String name,
                                        java.lang.String description,
                                        java.lang.String providerID,
                                        java.util.Properties baseProperties,
                                        java.lang.String parentProfile)
                                 throws ConnectionProfileException
Create connection profile

Parameters:
name -
description -
providerID -
baseProperties -
parentProfile -
Throws:
ConnectionProfileException

createProfile

public IConnectionProfile createProfile(java.lang.String name,
                                        java.lang.String description,
                                        java.lang.String providerID,
                                        java.util.Properties baseProperties,
                                        java.lang.String parentProfile,
                                        boolean autoConnect)
                                 throws ConnectionProfileException
Create connection profile

Parameters:
name -
description -
providerID -
baseProperties -
parentProfile -
autoConnect -
Throws:
ConnectionProfileException

duplicateProfile

public java.lang.String duplicateProfile(IConnectionProfile profile)
                                  throws ConnectionProfileException
Duplicate a connection profile

Parameters:
profile -
Throws:
ConnectionProfileException

copyProfile

public IConnectionProfile copyProfile(IConnectionProfile profile,
                                      java.lang.String newName)
                               throws ConnectionProfileException
Duplicate a connection profile but won't add it into ProfileManager or IConnectionProfileRepository

Parameters:
profile -
newName -
Returns:
IConnectionProfile
Throws:
ConnectionProfileException

addProfile

public void addProfile(IConnectionProfile profile)
                throws ConnectionProfileException
Add a connection profile object to the profiles cache. Throws ConnectionProfileException if the new profile's name already exists in cache.

Parameters:
profile -
Throws:
ConnectionProfileException

addProfile

public void addProfile(IConnectionProfile profile,
                       boolean replaceExisting)
                throws ConnectionProfileException
Add a connection profile object to the profiles cache. If the new profile's name already exists in cache, replace the cached profile with the given profile provided the replaceExisting flag is true; otherwise, throws ConnectionProfileException.

Parameters:
profile -
replaceExisting -
Throws:
ConnectionProfileException

deleteProfile

public void deleteProfile(IConnectionProfile profile)
                   throws ConnectionProfileException
Delete a connection profile object from the profiles cache

Parameters:
profile -
Throws:
ConnectionProfileException

modifyProfile

public void modifyProfile(IConnectionProfile profile)
                   throws ConnectionProfileException
Modify an existing connection profile

Parameters:
profile -
Throws:
ConnectionProfileException

modifyProfile

public void modifyProfile(IConnectionProfile profile,
                          java.lang.String newName,
                          java.lang.String newDesc)
                   throws ConnectionProfileException
Modify an existing connection profile, plus it's name and description We don't expose a setName and setDescription in IConnectionProfile, so instead we expose this api for that same purpose.

Parameters:
profile -
Throws:
ConnectionProfileException

modifyProfile

public void modifyProfile(IConnectionProfile profile,
                          java.lang.String newName,
                          java.lang.String newDesc,
                          java.lang.Boolean autoConnect)
                   throws ConnectionProfileException
Modify an existing connection profile, plus it's name and description We don't expose a setName and setDescription in IConnectionProfile, so instead we expose this api for that same purpose.

Parameters:
profile -
Throws:
ConnectionProfileException

addProfileListener

public void addProfileListener(IProfileListener listener)
Register a listener for proifle operation

Parameters:
listener -

removeProfileListener

public void removeProfileListener(IProfileListener listener)
Remove the listener for profile operation

Parameters:
listener -

getAdapter

public java.lang.Object getAdapter(java.lang.Class adapter)
Specified by:
getAdapter in interface org.eclipse.core.runtime.IAdaptable

tokenize

public java.lang.String[] tokenize(java.lang.String input,
                                   java.lang.String delim)

unTokenize

public java.lang.String unTokenize(java.lang.String[] tokens)