Using and Extending The Data Tools Platform: Brian Fitzpatrick (Sybase) Linda Chan (Actuate) Brian Payton (IBM)
Using and Extending The Data Tools Platform: Brian Fitzpatrick (Sybase) Linda Chan (Actuate) Brian Payton (IBM)
2009 by Actuate, IBM, and Sybase, Inc., made available under the EPL v1.0 | March 23, 2009
Welcome!
Goals for this tutorial:
Get a working knowledge of DTP Tooling
Get a glimpse into how to enable or extend database support for a
particular vendor
Get familiar with some DTP APIs
Use ODA to extend DTP for a non-database data source
See how to expand the SQL Query Model and Parser for a
particular DB
And finally see how DTP is being leveraged in other Eclipse
projects
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
Before we begin
What do you hope to get out of the talk today?
What are your goals? What do you know already about DTP?
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
Beginning DTP
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
Database Development
Database Debug
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
Basic Components
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
Tooling Exercise
Set up a new Derby connection profile and connect to a local database
Connect to the connection profile
Create a new Product table with three columns product_id (varchar),
name (varchar), inventory (number)
Create a new Orders table with three columns order_id (varchar), date
(date/time), product_id (varchar), number_ordered (number)
Import data from the Products.csv and Orders.csv files into your new
tables
In the SQL Scrapbook, create a query (in the text editor or the SQB) to
correlate information from the Product and Orders tables to get a
readable report of what products were ordered on a given date (product
name, date, number ordered)
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
Extending DTP
Now that you have a bit of knowledge about what DTP can do for
you How do you leverage and extend it?
A few possible avenues
Use DTP components in your own applications and simply
leverage whats already there
Extend DTP into new Data Sources and Databases (enabling
new databases, adding custom items to the tree, adding custom
SQL syntax to what DTP already knows, etc.)
Take advantage of DTP APIs to utilize core DTP functionality
under the covers
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
ProfileManager pm = ProfileManager.getInstance();
IConnectionProfile icp = pm.createTransientProfile(providerID, baseProperties );
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
This is how to get the SQL Models root Database node for your connection profile
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
API Exercise
Using the base plug-in provided, in the actions run method, dive
into the connection profile and print a few things to the console
for the Product table in the App schema of our Derby database
MyDatabase.getCatalogs() returns an EList of catalogs. Derby has
a dummy Catalog object, so youll have to get it and then go
deeper ( (Catalog)MyDatabase.getCatalogs().get(0) )
MyCatalog.getSchemas() returns an EList of schemas you can
iterate through until you find APP
Once you find the Schema, MySchema.getTables() returns an
EList of tables you can iterate through until you find Product
MyTable.getColumns() returns an EList of columns
And so on simply work down the hierarchy and show a list of the
columns in the Product table
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
Newsgroup - news://news.eclipse.org/eclipse.dtp
Mailing list http://dev.eclipse.org/mailman/listinfo/dtp-dev
Wiki - http://wiki.eclipse.org/index.php/Data_Tools_Platform_Project
Bugzilla for bug or enhancement requests
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
2009 by Actuate, IBM, and Sybase, Inc., made available under the EPL v1.0 | March 23, 2009
Topics
What is Open Data Access1 (ODA)?
Overview ODA Framework
Enabling non-RDBMS data source with an ODA Data Provider
Demo/Exercise: creating ODA provider plug-ins
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
Application Server
ODA Runtime
Interfaces
Complete
Completecontrol
controlofofdata
dataaccess
accessand
andbranding
branding
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
Design-time
Allows data source-specific user interface to be embedded in any
ODA-compliant consumer application
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
ODA Design
Session model
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
Allows customized data source and query builders to design the slice of
data to access at run-time
Communicates connection information, query and parameter definitions to
an ODA consumer application
Transient Objects
root element: org.eclipse datatools.connectivity.oda.design.OdaDesignSession
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
oda.consumer.helper
Driver Bridge
Driver Bridge
bridgeId oda.dataSource
extension id
driverType driver class name
or first matching interface name
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
Welcomes contribution
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
Resources
ODA Overview document
link on DTP Connectivity home page
http://wiki.eclipse.org/Connectivity
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
2009 by Actuate, IBM, and Sybase, Inc., made available under the EPL v1.0 | March 23, 2009
Agenda
Introduction and background
Characteristics
What is it good for?
Tour of the Query Model and Parser components
Query Model
Query Parser
Parser Factory
Post-parse Processors
SQL Source Writer
Query Model Helpers
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
Characteristics
Deep coverage of SQL DML statements (Query, Insert, Update,
Delete)
But DML only!
Extensible, componentized system
Extension points to register extensions for different databases
Parser grammar inheritance
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
Query Parser
Validate SQL source syntax and generate the query model
Parser Factory
Set of methods used by the parser to generate the model
Post-parse Processors
Validate semantics and modify the model after parsing
Model Helpers
Set of helpful methods to analyze or modify the model
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
Query Model
Represents the essential syntactic structure of a query statement
as an object model
Covers DML statements
SELECT, INSERT, UPDATE, DELETE
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
org.eclipse.datatools.modelbase.sql.xml.query
SQL/XML extension
Depends on:
org.eclipse.datatools.modelbase.sql
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
Query Parser
Parses a SQL DML statement and generates an instance of the
Query Model
Implemented using LPG (LALR Parser Generator) from IBM
Research
Parser is generated from BNF-like grammar files
Like the Query Model, is actually an extendable set of parsers:
base SQL, SQL/XML
Base SQL query grammar derived from ISO SQL 2003
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
Parser Factory
Set of methods used by the parser to create a Query Model
instance
Each parser plug-in has a parser factory class
Used in the action clauses of the LPG grammar file rules
In turn the parser factory methods call model factory methods to
create individual model elements
Model factory code is generated by EMF, parser factory methods are
hand-coded
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
Post-parse Processors
Query Parser provides a mechanism to allow clients to modify a
generated Query Model after the Parser Factory creates it but
before it is returned as a parse result
Post-parse processors are attached to the parser, register what
model elements they are interested in, and after the parse get a
chance to modify the model
Two default post-parse processors are provided:
DataTypeResolver
Tries to determine datatypes of value expressions in the model
using available information
TableReferenceResolver
Replaces place-holder table references in generated model with
table objects from the SQL Model
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DataTypeHelper
JoinHelper
StatementHelper
TableHelper
ValueExpressionHelper
Packaged in org.eclipse.datatools.modelbase.sql.query
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
DTP Adopters
Eclipse Projects
Business Intelligence and Reporting Tools (BIRT)
SQL Query Builder
Database Enablement
Connection Profile Management
Open Data Access
http://www.eclipse.org/birt
Other Adopters
http://www.eclipse.org/datatools/community.php
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0
Legal Notices
Actuate is a registered trademark of Actuate Corporation and/or
its affiliates in the U.S. and certain other countries.
IBM, Rational, Rational Rose, and WebSphere are registered
trademarks of International Business Machines Corporation in
the United States, other countries, or both.
Sybase and Adaptive Server are registered trademarks of
Sybase, Inc. or its subsidiaries.
Java and all Java-based trademarks are trademarks of Sun
Microsystems, Inc. in the United States, other countries, or both.
Other company, product, or service names may be trademarks
or service marks of others.
DTP Tutorial | EclipseCon 2009 | 2009 by Actuate, IBM, and Sybase, Inc.; made available under the EPL v1.0