#
Open Data Access

###### Identifier:

org.eclipse.datatools.connectivity.oda.dataSource

###### Since:

3.0

###### Description:

This extension point is used to support the extension of design-time and run-time data source access by a data application. Each extension must implement the Open Data Access (ODA) Java runtime interfaces defined in the org.eclipse.datatools.connectivity.oda package.

###### Configuration Markup:

<!ELEMENT extension (dataSource , dataSet+)>

<!ATTLIST extension

point CDATA #REQUIRED

id CDATA #IMPLIED

name CDATA #IMPLIED>

<!ELEMENT dataSource (traceLogging? , properties? , relationship?)>

<!ATTLIST dataSource

id CDATA #REQUIRED

odaVersion CDATA "3.0"

defaultDisplayName CDATA #IMPLIED

driverClass CDATA #REQUIRED

setThreadContextClassLoader (true | false) "false">

The definition of a type of ODA data source extension for use at design-time and run-time.

- id - A fully qualified ID that uniquely identifies this ODA data source extension within an ODA consumer application's environment. If a data source designer extension (that implements org.eclipse.datatools.connectivity.oda.design.ui.dataSource extension point) is available for this ODA driver, the value of this attribute must match that of the designer extension's id attribute in its data source element.
- odaVersion - Version of the ODA interfaces for which this driver is developed. This element is required and should take the format of Major.Minor or Major.Minor.Service (e.g. 3.0 or 2.0.1).
- defaultDisplayName - The display name of the ODA data source extension. Its value can be localized by using the plugin.properties mechanism. Default to the extension id if no display name is specified. It can be used by an ODA consumer application's designer tool in displaying a list of ODA data source extensions, when they do not have a corresponding data source editor (data source UI extension point).
- driverClass - Concrete class that implements the org.eclipse.datatools.connectivity.oda.IDriver interface. This is the entry point of the ODA runtime driver. The same driver may support multiple data source extensions.
- setThreadContextClassLoader - If true, the consumer of the ODA runtime extension plug-in should set the thread context class loader to the one used to load this driver before calling any ODA interface method. Any data source plug-in extension with this flag set to true would take precedence, and is applied to all data source extensions implemented by this plug-in.
  If the thread context class loader being set is the OSGi class loader that was used to load this ODA runtime plugin, it is not designed to be used by a plugin to in turn load additional classes. If further class loading is needed, it is up to individual ODA runtime plugin implementation to provide its own URLClassLoader, and switch thread context class loader as appropriate.

<!ELEMENT dataSet (dataTypeMapping+ , properties? , relationship?)>

<!ATTLIST dataSet

id CDATA #REQUIRED

defaultDisplayName CDATA #IMPLIED>

The definition of a type of data set supported by the dataSource extension.

- id - A fully qualified ID that uniquely identifies this ODA data set definition within an ODA consumer application's environment.
- defaultDisplayName - The display name of the ODA data set definition. Its value can be localized by using the plugin.properties mechanism. Default to its id if no display name is specified.

<!ELEMENT dataTypeMapping (alternativeOdaDataType*)>

<!ATTLIST dataTypeMapping

nativeDataType CDATA #IMPLIED

nativeDataTypeCode CDATA #REQUIRED

odaScalarDataType (Date|Double|Integer|String|Time|Timestamp|Decimal|Blob|Clob) "String">

A data types mapping from a data provider's native data type to one or more ODA data types. Each native data type must be mapped to a primary ODA scalar data type. The driver can optionally provide a list of alternate ODA data types to which it is capable of converting a native data type. This data type mapping facilitates all ODA consumers to map from the same set of ODA data types to its own application-specific data types.

- nativeDataType - Native data type name (a string). Used for information only.
- nativeDataTypeCode - Native data type code (an integer). Its value must match one of the data type codes returned in the driver's ODA interface implementation.
- odaScalarDataType - The primary ODA scalar data type which the native type maps to. Supported ODA data types are: Date, Double, Integer, String, Time, Timestamp, Decimal, Blob and Clob.

<!ELEMENT alternativeOdaDataType EMPTY>

<!ATTLIST alternativeOdaDataType

odaScalarDataType (Date|Double|Integer|String|Time|Timestamp|Decimal|Blob|Clob) >

Provide an alternative mapping to an ODA scalar data type.

- odaScalarDataType - The ODA scalar data type to which the native type may be converted by the driver.

<!ELEMENT traceLogging EMPTY>

<!ATTLIST traceLogging

logLevel CDATA "WARNING"

logFileNamePrefix CDATA #IMPLIED

logDirectory CDATA #IMPLIED

logFormatterClass CDATA #IMPLIED>

Configures the ODA run-time driver's trace logging settings for the data source extension. The configured values are passed through to the driver's implementation of the `IDriver.setLogConfiguration` method.
It is up to individual ODA driver on how to honor any of these trace logging attributes as appropriate.
Note: The trace logging configuration specified in the plug-in PDE .options file would take precedence over those configured in this element, if the debug tracing flag is set to "true".
The ODA plug-in's PDE tracing options, listed below for cross reference, match the attributes of this element.
<plug-in Id>/debug = true/false
<plug-in Id>/traceLogging/logLevel
<plug-in Id>/traceLogging/logFileNamePrefix
<plug-in Id>/traceLogging/logDirectory
<plug-in Id>/traceLogging/logFormatterClass

- logLevel - The name or numeric value for the driver's log level.
  The log levels' names and corresponding numeric values are:
  "SEVERE" = 1000; "WARNING" = 900; "INFO" = 800; "CONFIG" = 700; "FINE" = 500; "FINER" = 400; "FINEST" = 300; "ALL" = 0; "OFF" = 1001 or higher .
- logFileNamePrefix - A string prefix for driver's log file name.
- logDirectory - Directory for log file.
- logFormatterClass - The class name of a concrete log formatter, suitable for use by the driver-specific logging utility.

<!ELEMENT property (choice*)>

<!ATTLIST property

name CDATA #REQUIRED

defaultDisplayName CDATA #IMPLIED

type (string|choice) "string"

canInherit (true | false) "true"

defaultValue CDATA #IMPLIED

isEncryptable (true | false) "false"

allowsEmptyValueAsNull (true | false) "true">

A property whose value can be edited at design-time using an ODA consumer application's designer tool. Its value is then passed to the ODA runtime driver during run-time.

- name - Unique name of the property.
- defaultDisplayName - The default display name. Its value can be localized by using the plugin.properties mechanism.
- type - Type of the property. The property type could be one of the values listed in the Restriction enumerations.
- canInherit - Reserved.
- defaultValue - Default value of the property, if no property value is set.
- isEncryptable - A flag indicating whether this property value is encryptable. Setting it to "true" indicates to an ODA consumer application that this property's value should be encrypted.
- allowsEmptyValueAsNull - A flag that indicates whether an empty value of this property can be treated as a null value. Default value is true. This attribute setting applies when an ODA consumer passes the property's value to this ODA runtime driver. This optional attribute may be used to accommodate the case where a property value's input control does not provide the means to specify a null value.

<!ELEMENT propertyGroup (property+)>

<!ATTLIST propertyGroup

name CDATA #REQUIRED

defaultDisplayName CDATA #IMPLIED>

A grouping of one or more properties in an ODA consumer application's designer tool. The group attributes are for display only. All properties listed under a propertyGroup are handled as scalar properties at run-time.

- name -
- defaultDisplayName - The default display name. Its value can be localized by using the plugin.properties mechanism.

<!ELEMENT propertyVisibility EMPTY>

<!ATTLIST propertyVisibility

name CDATA #REQUIRED

visibility (change|lock|hide) >

Used to set the visibility level of the named property when it is shown in the property sheet of an ODA consumer application's designer tool.

- name - The name of a property that is defined either by this data source extension or is a system-defined property.
- visibility - The valid options are: change, hide, lock.

<!ELEMENT choice EMPTY>

<!ATTLIST choice

name CDATA #REQUIRED

value CDATA #IMPLIED

defaultDisplayName CDATA #IMPLIED>

Choice of property values.

- name - Name of the choice
- value - Value to be used, if the given choice is selected.
- defaultDisplayName - The default display name. Its value can be localized by using the plugin.properties mechanism.

<!ELEMENT properties (property* , propertyGroup* , propertyVisibility*)>

A collection of property definitions in a data source extension or its supported data set definitions.

<!ELEMENT relationship EMPTY>

<!ATTLIST relationship

type (replacedBy)

relatedId CDATA #REQUIRED>

An optional element to specify the relationship of this element.

- type - The type of relationship that this extension's dataSource or dataSet element has with the relatedId element. Valid value(s) are:
  * "replacedBy" - this dataSource/dataSet is deprecated and replaced by that of relatedId. This setting is for consumption by an ODA host, and does not automatically affect the behavior of the ODA framework. It is up to an ODA host to apply as appropriate, e.g. to migrate its reference of a deprecated extension, and to control which ODA extension to use at runtime.
  * (Additional types are TBD.)
- relatedId - The fully qualified ID of the related ODA data source or data set element. Its value must match that of the corresponding dataSource.id or dataSet.id attribute defined in another ODA driver's org.eclipse.datatools.connectivity.oda.dataSource extension.

###### Examples:

       <extension
             point="org.eclipse.datatools.connectivity.oda.dataSource">
          <dataSource
                odaVersion="3.0"
                driverClass="org.eclipse.datatools.connectivity.oda.flatfile.FlatFileDriver"
                defaultDisplayName="Flat File Data Source"
                id="org.eclipse.datatools.connectivity.oda.flatfile"
                setThreadContextClassLoader="false">
             <properties>
             <propertyGroup
                   defaultDisplayName="Connection Properties"
                   name="connectionProperties">
                <property
                      type="string"
                      defaultDisplayName="Home Folder"
                      canInherit="true"
                      name="HOME"/>
                <property
                      type="string"
                      defaultDisplayName="Character Set"
                      canInherit="true"
                      name="CHARSET"/>
                <property
                      type="string"
                      canInherit="true"
                      defaultDisplayName="Includes Data Type (Yes/No)"
                      name="INCLTYPELINE"/>
             </propertyGroup>
             </properties>
          </dataSource>
          <dataSet
                defaultDisplayName="Flat File Data Set"
                id="org.eclipse.datatools.connectivity.oda.flatfile.dataSet">
                <dataTypeMapping
                      nativeDataType="BIT"
                      nativeDataTypeCode="-7"
                      odaScalarDataType="Integer"/>
                <dataTypeMapping
                      nativeDataType="TINYINT"
                      nativeDataTypeCode="-6"
                      odaScalarDataType="Integer"/>
                <dataTypeMapping
                      nativeDataType="SMALLINT"
                      nativeDataTypeCode="5"
                      odaScalarDataType="Integer"/>
                <dataTypeMapping
                      nativeDataType="INTEGER"
                      nativeDataTypeCode="4"
                      odaScalarDataType="Integer"/>
                <dataTypeMapping
                      nativeDataType="BIGINT"
                      nativeDataTypeCode="-5"
                      odaScalarDataType="Decimal"/>
                <dataTypeMapping
                      nativeDataType="FLOAT"
                      nativeDataTypeCode="6"
                      odaScalarDataType="Double"/>
                <dataTypeMapping
                      nativeDataType="REAL"
                      nativeDataTypeCode="7"
                      odaScalarDataType="Double"/>
                <dataTypeMapping
                      nativeDataType="DOUBLE"
                      nativeDataTypeCode="8"
                      odaScalarDataType="Double"/>
                <dataTypeMapping
                      nativeDataType="NUMERIC"
                      nativeDataTypeCode="2"
                      odaScalarDataType="Decimal"/>
                <dataTypeMapping
                      nativeDataType="DECIMAL"
                      nativeDataTypeCode="3"
                      odaScalarDataType="Decimal"/>
                <dataTypeMapping
                      nativeDataType="CHAR"
                      nativeDataTypeCode="1"
                      odaScalarDataType="String"/>
                <dataTypeMapping
                      nativeDataType="VARCHAR"
                      nativeDataTypeCode="12"
                      odaScalarDataType="String"/>
                <dataTypeMapping
                      nativeDataType="LONGVARCHAR"
                      nativeDataTypeCode="-1"
                      odaScalarDataType="String"/>
                <dataTypeMapping
                      nativeDataType="DATE"
                      nativeDataTypeCode="91"
                      odaScalarDataType="Date"/>
                <dataTypeMapping
                      nativeDataType="TIME"
                      nativeDataTypeCode="92"
                      odaScalarDataType="Time"/>
                <dataTypeMapping
                      nativeDataType="TIMESTAMP"
                      nativeDataTypeCode="93"
                      odaScalarDataType="Timestamp"/>
                <dataTypeMapping
                      nativeDataType="BINARY"
                      nativeDataTypeCode="-2"
                      odaScalarDataType="String"/>
                <dataTypeMapping
                      nativeDataType="VARBINARY"
                      nativeDataTypeCode="-3"
                      odaScalarDataType="String"/>
                <dataTypeMapping
                      nativeDataType="LONGVARBINARY"
                      nativeDataTypeCode="-4"
                      odaScalarDataType="String"/>
                <dataTypeMapping
                      nativeDataType="BOOLEAN"
                      nativeDataTypeCode="16"
                      odaScalarDataType="Integer"/>
                <dataTypeMapping
                      nativeDataType="BLOB"
                      nativeDataTypeCode="2004"
                      odaScalarDataType="String"/>
                <dataTypeMapping
                      nativeDataType="CLOB"
                      nativeDataTypeCode="2005"
                      odaScalarDataType="String"/>
          </dataSet>
       </extension>

###### API Information:

The data source extension's driver must implement the interfaces defined in the org.eclipse.datatools.connectivity.oda package. See the package's JavaDoc documentation and API interfaces for more information.

###### Supplied Implementation:

The plug-in org.eclipse.datatools.connectivity.oda.flatfile, supplied with the Eclipse DTP Connectivity source, provides an example for implementing a simple ODA run-time extension.
In addition, a set of default implementation of the main ODA runtime interfaces are provided in the org.eclipse.datatools.connectivity.oda.impl package. These classes assume the behavior of a simple ODA driver, and have labeled TODO tasks for a driver developer to implement data source specific behavior. These concrete classes are provided for use as templates or base classes to aid in the development of an ODA custom driver. Their use is purely optional.

Copyright (c) 2004-2006 Actuate Corporation. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html