org.eclipse.datatools.connectivity.oda.design.ui.designsession
Class DesignSessionUtil

java.lang.Object
  extended by org.eclipse.datatools.connectivity.oda.design.internal.designsession.DesignSessionUtilBase
      extended by org.eclipse.datatools.connectivity.oda.design.ui.designsession.DesignSessionUtil

public class DesignSessionUtil
extends org.eclipse.datatools.connectivity.oda.design.internal.designsession.DesignSessionUtilBase

An utility class to help an ODA host designer or an ODA driver's customized designer to manipulate ODA Design API objects during an ODA design session.


Method Summary
static ElementNullability convertParameterNullability(int parameterNullability)
          Converts the value of an ODA runtime parameter nullability to corresponding value used in an ODA design-time element definition.
static ElementNullability convertResultColumnNullability(int columnNullability)
          Converts the value of an ODA runtime result set column nullability to corresponding value used in an ODA design-time element definition.
static Properties createDataSetNonPublicProperties(java.lang.String odaDataSourceId, java.lang.String odaDataSetId, java.util.Properties utilProps)
          Creates an ODA design property collection for those given data set properties that are not defined in an ODA runtime extension manifest.
static Properties createDataSetPublicProperties(java.lang.String odaDataSourceId, java.lang.String odaDataSetId, java.util.Properties utilProps)
          Creates an ODA design property collection for the data set public properties defined in an ODA runtime extension manifest.
static Properties createDataSourceNonPublicProperties(java.lang.String odaDataSourceId, java.util.Properties utilProps)
          Creates an ODA design property collection for those given data source properties that are not defined in an ODA runtime extension manifest.
static Properties createDataSourcePublicProperties(java.lang.String odaDataSourceId, java.util.Properties utilProps)
          Creates an ODA design property collection for the data source public properties defined in an ODA runtime extension manifest.
static OdaDesignSession createNewDataSetRequestSession(java.lang.String newDataSetName, java.lang.String odaDataSetId, DataSourceDesign dataSourceDesign)
          Creates a new OdaDesignSession instance with a session request that contains a new data set design of the specified name and odaDataSetId, associated with the specified data source design instance.
static DesignSessionRequest createNewDataSourceRequest(java.lang.String odaDataSourceId, java.lang.String newDataSourceName, java.lang.String newDataSourceDisplayName, java.net.URI applResourceBaseURI, java.net.URI designResourceBaseURI)
          A convenience method to create a new DesignSessionRequest instance that contains a new data source design with the specified design attributes.
static Properties createNonPublicProperties(Property[] publicPropDefns, java.util.Properties utilProps)
          Convert given Properties collection that are not defined as public properties in an ODA runtime extension manifest, into an ODA design property collection.
static IConnectionProfile createProfile(DataSourceDesign dataSourceDesign, java.lang.String profileName)
          Creates an ODA connection profile instance from the specified data source design.
static Properties createPublicProperties(Property[] publicPropDefns, java.util.Properties utilProps)
          Convert specified public properties defined in an ODA runtime extension manifest, and corresponding values specified in the given Properties collection into an ODA design property collection.
static java.util.Properties getEffectiveDataSourceProperties(DataSourceDesign dataSourceDesign)
           
static FilterExpressionDefinition getExtensionCustomDefinition(CustomFilterExpression customExpr)
          An utility method to look up the definition of the specified custom filter expression design.
static FilterExpressionDefinition getExtensionCustomDefinition(java.lang.String extensionId, java.lang.String exprId)
          An utility method to look up the definition of the specified custom filter expression declared by the specified extension.
static IConnectionProfile getLinkedProfile(DataSourceDesign dataSourceDesign)
          Returns the connection profile instance externally referenced, i.e.
static java.util.Map getProfileIdentifiers(java.lang.String odaDataSourceId, java.io.File storageFile)
          Returns a collection of identifiers of all connection profile instances for the given ODA data source extension type.
static 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.
static boolean hasValidOdaDesignUIExtension(java.lang.String odaDataSourceId)
          Indicates whether the given ODA data source type has implemented a valid org.eclipse.datatools.connectivity.oda.design.ui.dataSource extension point.
static void setDataSourceResourceIdentifiers(DataSourceDesign dataSourceDesign, java.net.URI applResourceBaseURI, java.net.URI designResourceBaseURI)
          A convenience method to assign the specified resource base URI(s) to the specified data source design.
static DataSetParameters toDataSetParametersDesign(IParameterMetaData pmd)
          Converts the contents of an ODA runtime parameters meta data to an ODA design-time DataSetParameters instance.
static DataSetParameters toDataSetParametersDesign(IParameterMetaData pmd, ParameterMode defaultMode)
          Converts the contents of an ODA runtime parameters meta data to an ODA design-time DataSetParameters instance.
static ElementNullability toElementNullability(int odaNullability)
          Deprecated. As of 3.0.5, replaced by convertResultColumnNullability( int ).
static ParameterMode toParameterModeDesign(int runtimeParamMode)
          Converts the specified ODA runtime parameter mode value to corresponding ODA design-time parameter mode value.
static ParameterMode toParameterModeDesign(int runtimeParamMode, ParameterMode defaultMode)
          Converts the specified ODA runtime parameter mode value to corresponding ODA design-time parameter mode value.
static ResultSetColumns toResultSetColumnsDesign(IResultSetMetaData md)
          Converts the contents of an ODA runtime result set meta data to an ODA design-time ResultSetColumns instance.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createDataSourcePublicProperties

public static Properties createDataSourcePublicProperties(java.lang.String odaDataSourceId,
                                                          java.util.Properties utilProps)
                                                   throws OdaException
Creates an ODA design property collection for the data source public properties defined in an ODA runtime extension manifest. Their corresponding values are specified in the given Properties collection.

Parameters:
odaDataSourceId - an ODA extension data source element ID
utilProps - java.util.properties, such as those collected from a connection profile
Returns:
ODA design public property collection for inclusion in an OdaDesignSession's Data Source Design
Throws:
OdaException

createDataSetPublicProperties

public static Properties createDataSetPublicProperties(java.lang.String odaDataSourceId,
                                                       java.lang.String odaDataSetId,
                                                       java.util.Properties utilProps)
                                                throws OdaException
Creates an ODA design property collection for the data set public properties defined in an ODA runtime extension manifest. Their corresponding values are specified in the given Properties collection.

Parameters:
odaDataSourceId - an ODA extension data source element ID
odaDataSetId - an ODA extension data set element id; may be null if the associated data source extension supports only one type of data set
utilProps - collection of property name and value pairs
Returns:
ODA design public property collection for inclusion in an OdaDesignSession's Data Set Design
Throws:
OdaException

createPublicProperties

public static Properties createPublicProperties(Property[] publicPropDefns,
                                                java.util.Properties utilProps)
Convert specified public properties defined in an ODA runtime extension manifest, and corresponding values specified in the given Properties collection into an ODA design property collection.

Parameters:
publicPropDefns - public properties defined in an ODA runtime extension manifest
utilProps - collection of property name and value pairs
Returns:
converted collection of ODA design public properties

createDataSourceNonPublicProperties

public static Properties createDataSourceNonPublicProperties(java.lang.String odaDataSourceId,
                                                             java.util.Properties utilProps)
                                                      throws OdaException
Creates an ODA design property collection for those given data source properties that are not defined in an ODA runtime extension manifest. These are properties that are not publicly defined. Their corresponding values are collected from the given property collection.

Parameters:
odaDataSourceId - an ODA extension data source element ID
utilProps - a java.util.Properties collection, such as those collected from a connection profile
Returns:
ODA design non-public property collection for inclusion in an OdaDesignSession's Data Source Design
Throws:
OdaException

createDataSetNonPublicProperties

public static Properties createDataSetNonPublicProperties(java.lang.String odaDataSourceId,
                                                          java.lang.String odaDataSetId,
                                                          java.util.Properties utilProps)
                                                   throws OdaException
Creates an ODA design property collection for those given data set properties that are not defined in an ODA runtime extension manifest. These are properties that are not publicly defined. Their corresponding values are collected from the given property collection.

Parameters:
odaDataSourceId - an ODA extension data source element ID
odaDataSetId - an ODA extension data set element id; may be null if the associated data source extension supports only one type of data set
utilProps - a java.util.Properties collection, such as those collected from a connection profile
Returns:
ODA design non-public property collection for inclusion in an OdaDesignSession's Data Source Design
Throws:
OdaException

createNonPublicProperties

public static Properties createNonPublicProperties(Property[] publicPropDefns,
                                                   java.util.Properties utilProps)
Convert given Properties collection that are not defined as public properties in an ODA runtime extension manifest, into an ODA design property collection.

Parameters:
publicPropDefns - public properties defined in an ODA runtime extension manifest
utilProps - a java.util.Properties collection, such as those collected from a connection profile
Returns:
converted collection of ODA design non-public properties

createNewDataSourceRequest

public static DesignSessionRequest createNewDataSourceRequest(java.lang.String odaDataSourceId,
                                                              java.lang.String newDataSourceName,
                                                              java.lang.String newDataSourceDisplayName,
                                                              java.net.URI applResourceBaseURI,
                                                              java.net.URI designResourceBaseURI)
                                                       throws OdaException
A convenience method to create a new DesignSessionRequest instance that contains a new data source design with the specified design attributes.

Parameters:
odaDataSourceId - the ODA data source extension id
newDataSourceName - an unique name to identify the data source design instance
newDataSourceDisplayName - display name of the data source design; may be null
applResourceBaseURI - the base URI of general purpose resources of an ODA consumer application; may be null
designResourceBaseURI - the base URI of design resources of an ODA consumer application; may be null
Returns:
a new DesignSessionRequest instance with the specified data source design attributes
Throws:
OdaException - if specified argument(s) are invalid
Since:
3.0.7

setDataSourceResourceIdentifiers

public static void setDataSourceResourceIdentifiers(DataSourceDesign dataSourceDesign,
                                                    java.net.URI applResourceBaseURI,
                                                    java.net.URI designResourceBaseURI)
A convenience method to assign the specified resource base URI(s) to the specified data source design.

Parameters:
dataSourceDesign - a data source design instance
applResourceBaseURI - the base URI of general purpose resources of an ODA consumer application; may be null
designResourceBaseURI - the base URI of design resources of an ODA consumer application; may be null
Throws:
java.lang.NullPointerException - if dataSourceDesign argument is null
Since:
3.0.7

createNewDataSetRequestSession

public static OdaDesignSession createNewDataSetRequestSession(java.lang.String newDataSetName,
                                                              java.lang.String odaDataSetId,
                                                              DataSourceDesign dataSourceDesign)
                                                       throws OdaException
Creates a new OdaDesignSession instance with a session request that contains a new data set design of the specified name and odaDataSetId, associated with the specified data source design instance.

Parameters:
newDataSetName - a unique name that identifies a data set design instance
odaDataSetId - an ODA data set element id; may be null if the associated data source extension supports only one type of data set
dataSourceDesign - the associated data source design instance
Returns:
a new OdaDesignSession instance with a session request of the specified design attributes
Throws:
OdaException - if specified arguments are invalid

getLinkedProfile

public static IConnectionProfile getLinkedProfile(DataSourceDesign dataSourceDesign)
                                           throws OdaException
Returns the connection profile instance externally referenced, i.e. linked, by the given data source design.

Parameters:
dataSourceDesign -
Returns:
linked connection profile instance, or null if no external profile is referenced
Throws:
OdaException - if referenced connection profile is not found

createProfile

public static IConnectionProfile createProfile(DataSourceDesign dataSourceDesign,
                                               java.lang.String profileName)
                                        throws OdaException
Creates an ODA connection profile instance from the specified data source design.

Parameters:
dataSourceDesign - a data source design
profileName - the name of the new profile; may be null or empty to use the same name as that of the specified data source design
Returns:
a new instance of IConnectionProfile that persists in the DTP profile cache
Throws:
OdaException
Since:
3.2 (DTP 1.7)

getEffectiveDataSourceProperties

public static java.util.Properties getEffectiveDataSourceProperties(DataSourceDesign dataSourceDesign)
                                                             throws OdaException
Throws:
OdaException

hasValidOdaDesignUIExtension

public static boolean hasValidOdaDesignUIExtension(java.lang.String odaDataSourceId)
Indicates whether the given ODA data source type has implemented a valid org.eclipse.datatools.connectivity.oda.design.ui.dataSource extension point.

Parameters:
odaDataSourceId - an ODA data source extension type's element id
Returns:
true if specified ODA data source has implemented a valid ODA designer extension; false otherwise

getProfileIdentifiers

public static java.util.Map getProfileIdentifiers(java.lang.String odaDataSourceId,
                                                  java.io.File storageFile)
                                           throws OdaException
Returns a collection of identifiers of all connection profile instances for the given ODA data source extension type. The profile instances are searched in the given profile storage file. It also caches the matching profiles for subsequent use.

Parameters:
odaDataSourceId - an ODA data source extension type's element id
storageFile - a file that stores profile instances; may be null, which means to use the default DTP profiles storage file
Returns:
a Map containing the instance Id and display name of all existing profiles of the given odaDataSourceId. The connection profiles' instance Id and display name are stored as the key and value strings in the returned Map instance. Returns an empty collection if there are no matching connection profiles found in given storageFile.
Throws:
OdaException - if error in reading from given storageFile, or in processing the found profiles

getProfileIdentifiersByCategory

public static 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 in the given profile storage file. It also caches the matching profiles for subsequent use.

Parameters:
categoryId - the unique id of a connection profile category
storageFile - a file that stores profile instances; may be null, which means to use the default DTP profiles storage file
Returns:
a Map containing the instance Id and display name of all existing profiles of the given odaDataSourceId. The connection profiles' instance Id and display name are stored as the key and value strings in the returned Map instance. Returns an empty collection if there are no matching connection profiles found in given storageFile.
Throws:
OdaException - if error in reading from given storageFile, or in processing the found profiles
Since:
3.0.6

toResultSetColumnsDesign

public static ResultSetColumns toResultSetColumnsDesign(IResultSetMetaData md)
                                                 throws OdaException
Converts the contents of an ODA runtime result set meta data to an ODA design-time ResultSetColumns instance. This may be used by an ODA custom page to populate a data set design instance with its result set meta data definition.

Parameters:
md - ODA runtime result set meta data instance
Returns:
the converted ResultSetColumns instance
Throws:
OdaException

toDataSetParametersDesign

public static DataSetParameters toDataSetParametersDesign(IParameterMetaData pmd)
                                                   throws OdaException
Converts the contents of an ODA runtime parameters meta data to an ODA design-time DataSetParameters instance. This may be used by an ODA custom page to populate a data set design instance with its parameter meta data definitions.

Parameters:
pmd - ODA runtime parameters meta data instance
Returns:
the converted DataSetParameters instance
Throws:
OdaException

toDataSetParametersDesign

public static DataSetParameters toDataSetParametersDesign(IParameterMetaData pmd,
                                                          ParameterMode defaultMode)
                                                   throws OdaException
Converts the contents of an ODA runtime parameters meta data to an ODA design-time DataSetParameters instance. This may be used by an ODA custom page to populate a data set design instance with its parameter meta data definitions.

Parameters:
pmd - ODA runtime parameters meta data instance
defaultMode - default design-time parameter mode to apply if a parameter's mode is not recognized; may be null for no default value
Returns:
the converted DataSetParameters instance
Throws:
OdaException

toParameterModeDesign

public static ParameterMode toParameterModeDesign(int runtimeParamMode)
Converts the specified ODA runtime parameter mode value to corresponding ODA design-time parameter mode value.

Parameters:
runtimeParamMode - an ODA runtime parameter mode value
Returns:
the corresponding ODA design-time parameter mode value

toParameterModeDesign

public static ParameterMode toParameterModeDesign(int runtimeParamMode,
                                                  ParameterMode defaultMode)
Converts the specified ODA runtime parameter mode value to corresponding ODA design-time parameter mode value.

Parameters:
runtimeParamMode - an ODA runtime parameter mode value
defaultMode - default design-time parameter mode to apply if specified runtimeParamMode is not recognized; may be null for no default value
Returns:
the corresponding ODA design-time parameter mode value

toElementNullability

public static ElementNullability toElementNullability(int odaNullability)
Deprecated. As of 3.0.5, replaced by convertResultColumnNullability( int ).

Converts the value of an ODA runtime (result set column) nullability to corresponding value used in an ODA design-time definition.

Parameters:
odaNullability - an ODA runtime nullability constant
Returns:
corresponding constant for use in an ODA design-time definition

convertResultColumnNullability

public static ElementNullability convertResultColumnNullability(int columnNullability)
Converts the value of an ODA runtime result set column nullability to corresponding value used in an ODA design-time element definition.

Parameters:
columnNullability - an ODA IResultSetMetaData nullability constant
Returns:
corresponding constant for use in an ODA design-time definition

convertParameterNullability

public static ElementNullability convertParameterNullability(int parameterNullability)
Converts the value of an ODA runtime parameter nullability to corresponding value used in an ODA design-time element definition.

Parameters:
parameterNullability - an ODA IParameterMetaData nullability constant
Returns:
corresponding constant for use in an ODA design-time definition

getExtensionCustomDefinition

public static FilterExpressionDefinition getExtensionCustomDefinition(CustomFilterExpression customExpr)
An utility method to look up the definition of the specified custom filter expression design.

Parameters:
customExpr - a custom filter expression specified in a data set design's filter specification
Returns:
an instance of FilterExpressionDefinition, or null if no matching definition is found
Since:
3.2 (DTP 1.7)

getExtensionCustomDefinition

public static FilterExpressionDefinition getExtensionCustomDefinition(java.lang.String extensionId,
                                                                      java.lang.String exprId)
An utility method to look up the definition of the specified custom filter expression declared by the specified extension.

Parameters:
extensionId - unique id of an extension that implements the ODA dynamicResultSet extension point
exprId - id of a custom filter expression
Returns:
an instance of FilterExpressionDefinition, or null if no matching definition is found
Since:
3.2 (DTP 1.7)