Integrating Applications into BIRT iHub Information in this document is subject to change without notice. Examples provided are fictitious. No part of this document may be reproduced or transmitted in any form, or by any means, electronic or mechanical, for any purpose, in whole or in part, without the express written permission of Actuate Corporation.

© 1995 - 2015 by Actuate Corporation. All rights reserved. Printed in the United States of America.

Contains information proprietary to: Actuate Corporation, 951 Mariners Island Boulevard, San Mateo, CA 94404 www.actuate.com

The software described in this manual is provided by Actuate Corporation under an Actuate License agreement. The software may be used only in accordance with the terms of the agreement. Actuate software products are protected by U.S. and International patents and patents pending. For a current list of patents, please see http://www.actuate.com/patents.

Actuate Corporation trademarks and registered trademarks include: Actuate, ActuateOne, the Actuate logo, Archived Data Analytics, BIRT, BIRT 360, BIRT Analytics, The BIRT Company, BIRT Content Services, BIRT Data Analyzer, BIRT for Statements, BIRT iHub, BIRT Metrics Management, BIRT Performance Analytics, Collaborative Reporting Architecture, e.Analysis, e.Report, e.Reporting, e.Spreadsheet, Encyclopedia, Interactive Viewing, OnPerformance, The people behind BIRT, Performancesoft, Performancesoft Track, Performancesoft Views, Report Encyclopedia, Reportlet, X2BIRT, and XML reports.

Actuate products may contain third-party products or technologies. Third-party trademarks or registered trademarks of their respective owners, companies, or organizations include: Mark Adler and Jean-loup Gailly (www.zlib.net): zLib. Adobe Systems Incorporated: Flash Player, Source Sans Pro font. Amazon Web Services, Incorporated: Amazon Web Services SDK. Apache Software Foundation (www.apache.org): Ant, Axis, Axis2, Batik, Batik SVG library, Commons Command Line Interface (CLI), Commons Codec, Commons Lang, Commons Math, Crimson, Derby, Hive driver for Hadoop, Kafka, log4j, Pluto, POI ooxml and ooxml-schema, Portlet, Shindig, Struts, Thrift, Tomcat, Velocity, Xalan, Xerces, Xerces2 Java Parser, Xerces-C++ XML Parser, and XML Beans. Daniel Bruce (www.entypo.com): Entypo Pictogram Suite. Castor (www.castor.org), ExoLab Project (www.exolab.org), and Intalio, Inc. (www.intalio.org): Castor. Alessandro Colantonio: CONCISE Bitmap Library. d3-cloud. Day Management AG: Content Repository for Java. Dygraphs Gallery. Foundation, Inc. (www.eclipse.org): Babel, Data Tools Platform (DTP) ODA, Eclipse SDK, Graphics Editor Framework (GEF), Eclipse Modeling Framework (EMF), , and Eclipse Web Tools Platform (WTP). Bits Per Second, Ltd. and Graphics Server Technologies, L.P.: Graphics Server. Dave Gandy: Font Awesome. Gargoyle Software Inc.: HtmlUnit. GNU Project: GNU Regular Expression. Google Charts. Groovy project (groovy.codehaus.org): Groovy. Guava Libraries: Google Guava. HighSlide: HighCharts. headjs.com: head.js. Hector Project: Cassandra Thrift, Hector. Jason Hsueth and Kenton Varda (code.google.com): Protocole Buffer. H2 Database: H2 database. IDAutomation.com, Inc.: IDAutomation. IDRsolutions Ltd.: JPedal JBIG2. InfoSoft Global (P) Ltd.: FusionCharts, FusionMaps, FusionWidgets, PowerCharts. InfoVis Toolkit. Matt Inger (sourceforge.net): Ant-Contrib. Matt Ingenthron, Eric D. Lambert, and Dustin Sallings (code.google.com): Spymemcached. International Components for Unicode (ICU): ICU library. JCraft, Inc.: JSch. jQuery: jQuery, JQuery Sparklines. Yuri Kanivets (code.google.com): Android Wheel gadget. LEAD Technologies, Inc.: LEADTOOLS. The Legion of the Bouncy Castle: Bouncy Castle Crypto APIs. Bruno Lowagie and Paulo Soares: iText. Membrane SOA Model. MetaStuff: dom4j. Microsoft Corporation (Microsoft Developer Network): CompoundDocument Library. Mozilla: Mozilla XML Parser. MySQL Americas, Inc.: MySQL Connector/J. Netscape Communications Corporation, Inc.: Rhino. NodeJS. nullsoft project: Nullsoft Scriptable Install System. OOPS Consultancy: XMLTask. OpenSSL Project: OpenSSL. Oracle Corporation: Berkeley DB, Java Advanced Imaging, JAXB, Java SE Development Kit (JDK), Jstl, Oracle JDBC driver. PostgreSQL Global Development Group: pgAdmin, PostgreSQL, PostgreSQL JDBC driver. Progress Software Corporation: DataDirect Connect XE for JDBC Salesforce, DataDirect JDBC, DataDirect ODBC. Quality Open Software: Simple Logging Facade for Java (SLF4J), SLF4J API and NOP. Raphael. RequireJS. Rogue Wave Software, Inc.: Rogue Wave Library SourcePro Core, tools.h++. Sencha Inc.: Extjs, Sencha Touch. Shibboleth Consortium: OpenSAML, Shibboleth Identity Provider. Matteo Spinelli: iscroll. StAX Project (stax.codehaus.org): Streaming API for XML (StAX). Sam Stephenson (prototype.conio.net): prototype.js. SWFObject Project (code.google.com): SWFObject. ThimbleWare, Inc.: JMemcached. Twittr: Twitter Bootstrap. VMWare: Hyperic SIGAR. Woodstox Project (woodstox.codehaus.org): Woodstox Fast XML processor (wstx-asl). World Wide Web Consortium (W3C) (MIT, ERCIM, Keio): Flute, JTidy, Simple API for CSS. XFree86 Project, Inc.: (www.xfree86.org): xvfb. ZXing Project (code.google.com): ZXing.

All other brand or product names are trademarks or registered trademarks of their respective owners, companies, or organizations. Document No. 141215-2-430301 September 1, 2015 Contents

About Integrating Applications into BIRT iHub ...... xvii Chapter 1 Overview of Actuate APIs ...... 1 Introducing Actuate APIs ...... 2 API libraries overview ...... 2 Information Delivery API (IDAPI) ...... 2 JavaScript API (JSAPI) ...... 2 Online Archive Driver API ...... 2 API plug-ins overview ...... 3 Report Engine API ...... 3 Design Engine API or model API ...... 3 Chart Engine API ...... 3 BIRT scripting ...... 3 EasyScript ...... 4 Dashboard and gadgets ...... 4 BIRT emitters ...... 4 BIRT data connectors ...... 4 Application extensions overview ...... 4 BIRT Viewer Java Extension ...... 5 Data Object API ...... 5 iHub API ...... 5 iPortal Security Extension (IPSE) ...... 5 Report Server Security Extension (RSSE) ...... 5 REST API ...... 6 Overview of other application development tools ...... 6

Part 1 Understanding and integrating the Eclipse BIRT framework Chapter 2 Understanding the BIRT architecture ...... 3 Understanding BIRT integration ...... 4 The BIRT applications ...... 8 BIRT Report Designer and BIRT RCP Report Designer ...... 8 BIRT Report Viewer ...... 9 BIRT engines and services ...... 9 Design engine ...... 9

i Report engine ...... 9 Generation services ...... 10 Presentation services ...... 10 Chart engine ...... 10 Data engine and services ...... 10 Data services ...... 11 ODA framework ...... 11 Types of BIRT report items ...... 11 Standard report items ...... 11 Custom report items ...... 11 Chart report item ...... 12 The Report Object Model (ROM) ...... 12 Types of BIRT files ...... 12 Report design files ...... 12 Report document files ...... 13 Report library files ...... 13 Report template files ...... 13 About custom Java applications ...... 14 Custom report designer ...... 14 Custom Java report generator ...... 14 Extensions to BIRT ...... 14 Chapter 3 Understanding the Report Object Model ...... 17 Report Object Model (ROM) overview ...... 18 The ROM specification ...... 18 ROM methods ...... 19 ROM properties ...... 19 ROM slots ...... 19 ROM styles ...... 19 The ROM schema ...... 20 The rom.def file ...... 20 ROM elements ...... 25 Primary ROM elements ...... 25 Report item elements ...... 26 Report item types ...... 26 Report item element properties ...... 27 Data report elements ...... 27 Chapter 4 Understanding the BIRT APIs ...... 29 BIRT APIs overview ...... 30 Package hierarchy diagrams ...... 30

ii About the BIRT Report Engine API ...... 31 Creating the ReportEngine instance ...... 32 Using the BIRT Report Engine API ...... 32 EngineConfig class ...... 33 ReportEngine class ...... 33 IReportRunnable interface ...... 34 IReportDocument interface ...... 34 IEngineTask interface ...... 34 IGetParameterDefinitionTask interface ...... 34 IDataExtractionTask interface ...... 35 IRunTask interface ...... 35 IRenderTask interface ...... 35 IRunAndRenderTask interface ...... 35 Report Engine API class hierarchy ...... 35 Report Engine API interface hierarchy ...... 37 About the Design Engine API ...... 39 Using the BIRT Design Engine API ...... 40 DesignConfig class ...... 40 DesignEngine class ...... 40 SessionHandle class ...... 41 ModuleHandle class ...... 41 ReportDesignHandle class ...... 42 LibraryHandle class ...... 42 DesignElementHandle class ...... 43 Individual element handle classes ...... 43 Design Engine API class hierarchy ...... 43 DesignElementHandle hierarchy ...... 45 ReportElementHandle hierarchy ...... 46 ReportItemHandle hierarchy ...... 48 ElementDetailHandle hierarchy ...... 49 StructureHandle hierarchy ...... 49 Design Engine API interface hierarchy ...... 51 About the BIRT Chart Engine API ...... 52 Using the BIRT Chart Engine API ...... 52 Chart Engine API class and interface hierarchy ...... 53 chart.aggregate class and interface hierarchy ...... 53 chart.datafeed class and interface hierarchy ...... 54 chart.device class and interface hierarchy ...... 54 chart.event class and interface hierarchy ...... 55 chart.exception class hierarchy ...... 57 chart.factory class and interface hierarchy ...... 57 chart.log class and interface hierarchy ...... 58 chart.model interface hierarchy ...... 59

iii chart.model.attribute class and interface hierarchy ...... 59 chart.model.component interface hierarchy ...... 64 chart.model.data interface hierarchy ...... 65 chart.model.layout interface hierarchy ...... 66 chart.model.type interface hierarchy ...... 67 chart.render class and interface hierarchy ...... 69 chart.script class and interface hierarchy ...... 69 chart.util class hierarchy ...... 70 Chapter 5 Programming using the BIRT reporting APIs ...... 71 Reporting application overview ...... 72 Choosing POJO or OSGi run-time deployment ...... 72 Building a reporting application ...... 73 About the development environment ...... 75 About plug-ins in BIRT home (OSGi only) ...... 75 About the BIRT libraries ...... 75 About required JDBC drivers ...... 78 Setting up the build path and accessing Javadoc ...... 78 Modifying a report design using the API ...... 79 About the deployment environment ...... 79 Generating reports from an application ...... 79 Setting up the report engine ...... 79 Configuring the BIRT home (OSGi only) ...... 80 Configuring the report engine ...... 80 Setting up a stand-alone or WAR file environment ...... 81 Starting the platform ...... 84 Creating the report engine ...... 85 Using the logging environment to debug an application ...... 85 Opening a source for report generation ...... 86 Understanding an IReportRunnable object ...... 87 Understanding an IReportDocument object ...... 87 Accessing a report parameter ...... 88 Preparing to generate the report ...... 95 Setting the parameter values for running a report design ...... 95 Adding to the report engine’s class path ...... 96 Providing an external object to a report design ...... 97 Generating a binary report document ...... 97 Preparing to render a formatted report ...... 98 Setting up the rendering options ...... 98 Rendering formatted output ...... 102 Accessing the formatted report ...... 104 Checking the status of a running report task ...... 105

iv Cancelling a running report task ...... 105 Programming the structure of a report design ...... 106 About BIRT model API capabilities ...... 107 Opening a report design for editing ...... 108 Configuring the design engine to access a design handle ...... 108 Using an IReportRunnable object to access a design handle ...... 109 Using a report item in a report design ...... 109 Accessing a report item by iterating through a slot ...... 110 Accessing a report item by name ...... 110 Examining a report item ...... 110 Accessing the properties of a report item ...... 111 Modifying a report item in a report design ...... 113 Accessing and setting complex properties ...... 114 Understanding property structure objects ...... 115 Adding a report item to a report design ...... 119 Accessing a data source and data set with the API ...... 120 About data source classes ...... 120 About data set classes ...... 121 Using a data set programmatically ...... 121 Saving a report design ...... 123 Creating a report design ...... 123 Chapter 6 Programming using the BIRT charting API ...... 125 Charting application overview ...... 126 Chart engine contents ...... 126 Environment for a charting application ...... 127 Configuring the chart engine run-time environment ...... 127 Verifying the environment for a charting application ...... 127 Charting API and the chart structure ...... 128 Chart visual components ...... 128 Chart data ...... 129 Static data ...... 129 Dynamic data ...... 129 Using the charting API to create a new chart ...... 130 Modifying chart properties ...... 131 Simple and complex properties ...... 131 Plot properties ...... 132 Legend properties ...... 132 Axes properties ...... 133 Using series ...... 134 Adding a series to a chart ...... 135 Creating a category series ...... 135 Creating an orthogonal series ...... 135

v Setting series properties ...... 136 Associating data with a series ...... 136 Adding a series definition to a chart ...... 137 Setting up the default aggregation for the chart ...... 138 Changing the aggregation for secondary value series ...... 138 Chart event handlers ...... 138 Java chart event handlers ...... 139 JavaScript chart event handlers ...... 139 Using a chart item in a report design ...... 139 Accessing an existing chart item ...... 140 Creating a new chart item ...... 140 Getting a design engine element factory object ...... 142 Setting the chart type and subtype ...... 142 Creating sample data ...... 143 Getting an extended item handle object ...... 144 Setting up the report item as a chart ...... 144 Preparing a data set and data columns ...... 144 Binding the chart to the data set ...... 145 Setting any other report item properties ...... 145 Adding the new chart to the report design ...... 146 Saving the report design after adding the chart ...... 146 Putting it all together ...... 146 Using the BIRT charting API in a Java Swing application ...... 154 Chart programming examples ...... 159 api.data examples ...... 160 DataCharts example ...... 160 GroupOnXSeries example ...... 160 GroupOnYAxis example ...... 160 api.data.autobinding example ...... 161 api.format example ...... 161 api.interactivity examples ...... 161 api.pdf example ...... 161 api.preference example ...... 162 api.processor example ...... 162 api.script examples ...... 162 api.viewer examples ...... 163 Chart3DViewer example ...... 163 CurveFittingViewer example ...... 163 DialChartViewer example ...... 163 SwingChartViewerSelector example ...... 163 SwingLiveChartViewer example ...... 164 SWTChartViewerSelector example ...... 164 builder example ...... 164

vi radar.ui example ...... 164 report.api examples ...... 164 MeterChartExample example ...... 165 SalesReport example ...... 165 StockReport example ...... 165 report.design examples ...... 165 report.design.script examples ...... 165 view example ...... 165

Part 2 Using Actuate BIRT APIs Chapter 7 Using Actuate APIs to access iHub environment information ...... 169 Writing event handlers to retrieve iHub environment information ...... 170 Writing a JavaScript event handler ...... 170 Writing a Java event handler ...... 170 About the serverContext object ...... 171 JavaScript event handler example ...... 172 Java event handler example ...... 173 Debugging event handlers that use the iHub API ...... 174 iHub API reference ...... 175 Chapter 8 Using the BIRT data object API ...... 181 Generating data object elements for BIRT report designs ...... 182 Creating data object data sets for BIRT report designs ...... 183 Creating data object data cubes for BIRT report designs ...... 184 Tutorial 1: Creating a data element using the Design Engine API ...... 184

Part 3 Introduction to the Actuate Information Delivery API Chapter 9 Understanding the Information Delivery API and schema ...... 195 About the Actuate Information Delivery API ...... 196 About web services and WSDL ...... 197 Understanding the elements of the iHub WSDL schema ...... 197 About the definitions element ...... 197 About data type definitions ...... 199 About message definitions ...... 200 About the portType definition ...... 201

vii About the binding definition ...... 201 About the service definition ...... 202 Accessing the Actuate schema using a web browser ...... 203 Chapter 10 Constructing a SOAP message ...... 205 About SOAP messaging ...... 206 Calling an Actuate web service ...... 206 About SOAP message elements ...... 207 Understanding the HTTP header ...... 208 Understanding the SOAP envelope ...... 209 About XML namespace declarations ...... 210 Understanding the SOAP header ...... 211 Understanding the SOAP message body ...... 213 About SOAP Fault messages ...... 215 Chapter 11 Text string limits in Actuate operations ...... 217

Part 4 Using Actuate security Chapter 12 Using Visualization Platform security ...... 223 About Actuate Visualization Platform security ...... 224 Protecting corporate data ...... 224 Protecting corporate data using firewalls ...... 224 Protecting corporate data using proxy servers ...... 225 Understanding the authentication process ...... 225 Creating a custom security adapter ...... 226 Accessing the IPSE Java classes ...... 227 Creating a custom security adapter class ...... 227 Deploying a custom security adapter ...... 228 Creating an upload security adapter ...... 229 Accessing the necessary Java classes ...... 230 Creating a custom security adapter class ...... 231 Deploying an upload security adapter ...... 232 Chapter 13 Using Java Report Server Security Extension and iPortal Security Extension ...... 233 About Java Report Server Security Extension (RSSE) and iPortal Security Extension (IPSE) .234

viii Installing the software required to run the RSSE and IPSE examples ...... 235 Understanding the RSSE example ...... 237 Understanding initialization ...... 237 Understanding user log in ...... 239 Understanding SampleRSSE.json ...... 239 Running the RSSE example ...... 242 Understanding the IPSE example ...... 245 Using the OpenText Directory Services RSSE driver ...... 252 Configuring the OTDS RSSE driver ...... 253 About the OTDS RSSE driver classes ...... 254 Deploying the OTDS RSSE driver ...... 254

Part 5 Archiving BIRT iHub volume content Chapter 14 Aging and archiving volume items ...... 261 Automating report archival and removal ...... 262 About Actuate Online Archive Driver ...... 262 Configuring the Online Archive Driver ...... 262 Understanding aging and archiving rules for items in a volume ...... 267 Understanding precedence in archiving ...... 268 Aging and archiving an item using the Archiving API ...... 268 Setting and updating autoarchive rules ...... 268 Setting default autoarchive rules when creating a folder ...... 270 Setting autoarchive rules when creating a job schedule ...... 270 Updating autoarchive rules for a file or folder ...... 271 Updating autoarchive rules for a job output file ...... 272 Updating the autoarchive rules for a file type in a folder or volume ...... 272 Setting an autoarchive schedule when updating a volume ...... 273 Starting an archive process for a volume ...... 274 Retrieving autoarchive rules for a file or folder ...... 274 Setting job notice expiration for all users ...... 275 Setting job notice expiration for a user ...... 276

Part 6 Using Actuate REST API in an application Chapter 15 Understanding the Actuate REST API ...... 279 Accessing Actuate BIRT iHub content using the Actuate REST API ...... 280 Working with Actuate REST API ...... 280

ix Using the interactive documentation ...... 281 UTF-8 encoding ...... 285 Using a special character in a REST request ...... 285 Using AuthId, Locale, and TargetVolume parameters ...... 287 Using search functionality ...... 287 About privileges ...... 287 About response codes ...... 288 Fetching a large number of items ...... 288 Handling HTTPS requests using the REST API ...... 289 Stopping and starting the REST service ...... 289 Configuring the REST API using constants.js ...... 290 Deploying the iHub REST service ...... 292 Integrating REST API and JSAPI into an application ...... 296 Using REST API resources ...... 297 Actuate REST API summary ...... 297 Actuate REST API syntax ...... 299 Getting authentication credentials ...... 300 Tutorial 2: Logging in to an iHub volume ...... 301 Managing folders ...... 307 Managing files ...... 310 Tutorial 3: Managing files and folders...... 314 Using visualizations ...... 325 Tutorial 4: Viewing a report using JSAPI ...... 330 Managing jobs ...... 342 Extracting data ...... 343 Managing user accounts ...... 344 Managing user groups ...... 346

Part 7 Using Actuate JavaScript API in an application Chapter 16 Creating a custom web page using the Actuate JavaScript API ...... 351 About the Actuate JavaScript API ...... 352 Accessing the Actuate JavaScript API ...... 352 About the DOCTYPE tag ...... 353 About UTF8 character encoding ...... 353 Establishing an HTTP session with an Actuate web application ...... 354 About Actuate JavaScript API security integration ...... 355 Establishing a secure connection to more than one web service ...... 355 Using a login servlet to connect to an Actuate web application ...... 356 Using a custom servlet to connect to an Actuate web application ...... 357

x Unloading authentication information from the session ...... 357 Viewing reports ...... 358 Tutorial 5: Implementing the JSAPI in a web page to display the viewer ...... 360 Controlling viewer user interface features ...... 362 Accessing report content ...... 362 Accessing HTML5 Chart features ...... 363 Using a filter ...... 363 Using a sorter ...... 364 Using dashboards and gadgets ...... 364 Tutorial 6: Implementing the JSAPI in a web page to display a dashboard ...... 366 Tutorial 7: Implementing the JSAPI to catch exceptions with an error callback function . . . . 368 Navigating repository content using ReportExplorer ...... 370 Displaying ReportExplorer ...... 370 Opening files from ReportExplorer ...... 372 Tutorial 8: Displaying repository contents and opening files ...... 375 Using and submitting report parameters ...... 380 Using a parameter component ...... 380 Accessing parameter values from the viewer ...... 382 Tutorial 9: Implementing the JSAPI in a web page to display report parameters ...... 383 Tutorial 10: Changing parameter values and definitions ...... 385 Using session level parameters ...... 390 Understanding the parameter value collection sequence ...... 390 Configuring the session level parameter ...... 390 Understanding the SessionLevelParameter Java class ...... 391 Setting the session level parameter using JSP ...... 392 Getting the application level parameter using JSP ...... 392 Getting the session level parameter from HttpServletRequest ...... 393 Retrieving report content as data ...... 393 Using a data service component ...... 393 Using a result set component ...... 394 Controlling Interactive Viewer user interface features ...... 395 Disabling UI features in a custom web page ...... 398 Tutorial 11: Control the BIRT Interactive Viewer user interface ...... 399 Chapter 17 Creating dynamic report content using the Actuate JavaScript API . . . 405 About Actuate JavaScript API scripting in a BIRT report design ...... 406 Using the Actuate JavaScript API in an HTML button ...... 407 Tutorial 12: Adding scripted chart controls to a BIRT design ...... 408 Tutorial 13: Using HTML buttons to apply filters to a chart ...... 413 Using the Actuate JavaScript API in chart interactive features ...... 418 Tutorial 14: Adding an interactive chart filter to a BIRT report...... 423 Using the Actuate JavaScript API in chart themes ...... 426

xi Tutorial 15: Adding scripted HTML5 Chart controls to a BIRT design ...... 427 Chapter 18 Working with Interactive Crosstabs ...... 433 About cross tabs ...... 434 Tutorial 16: Viewing and pivoting a cross tab ...... 435 About cubes ...... 436 Handling Interactive Crosstabs viewer events ...... 438 Working with dimensions, measures, and levels ...... 438 Adding a dimension with levels ...... 439 Removing a dimension ...... 439 Adding and removing measures ...... 439 Changing measures and dimensions ...... 440 Working with totals ...... 441 Sorting and filtering cross tab data ...... 442 Drilling down within a cross tab ...... 443 Controlling the Interactive Crosstabs viewer user interface ...... 444

Part 8 Accessing BIRT applications using URIs Chapter 19 Actuate application URIs ...... 449 Working with Actuate application URIs ...... 450 Information Console URIs ...... 450 Using a special character in a URI ...... 451 UTF-8 encoding ...... 452 Actuate application URIs overview ...... 453 Actuate application URIs quick reference ...... 453 Common URI parameters ...... 454 Information Console Struts actions ...... 456 Actuate application URIs reference ...... 460 Chapter 20 Actuate Report Studio URIs ...... 489 Accessing Report Studio using a URI ...... 490 Using the Report Studio servlet ...... 490 Using the Report Studio URLs ...... 491 Chapter 21 Actuate BIRT Viewer URIs ...... 493 About the BIRT Viewer servlet ...... 494

xii Using open source BIRT URIs in Actuate BIRT Viewer ...... 494 Accessing the BIRT Viewer using a URI ...... 494

Part 9 Developing a BIRT extension Chapter 22 Extending BIRT ...... 499 Overview of the extension framework ...... 500 Building the BIRT project ...... 500 Installing a working version of BIRT ...... 501 Configuring Eclipse to compile BIRT ...... 501 Downloading and extracting the correct version of the BIRT SDK ...... 502 Importing, building, and testing the BIRT project ...... 502 The structure of a BIRT plug-in ...... 506 The extension point schema definition file ...... 506 The plug-in manifest file ...... 509 The plug-in run-time class ...... 512 Working with the Eclipse PDE ...... 513 Plug-in project properties ...... 515 Understanding the Eclipse PDE Workbench ...... 515 Creating the structure of a plug-in extension ...... 517 Creating the plug-in extension content ...... 520 Building a plug-in extension ...... 526 Generating an Ant build script ...... 529 Testing a plug-in extension ...... 529 Deploying the extension plug-in ...... 530 Creating an update site project ...... 531 Installing available software ...... 533 Downloading the code for the extension examples ...... 534 Chapter 23 Developing a report item extension ...... 537 Understanding a report item extension ...... 538 Developing the sample report item extension ...... 539 Downloading BIRT source code ...... 541 Creating a rotated label report item plug-in project ...... 541 Defining the dependencies for the rotated label report item extension ...... 544 Declaring the report item extensions ...... 545 Creating the plug-in extension content ...... 550 The rotated label report item extension ...... 556 RotatedLabelItemFactoryImpl class ...... 556

xiii RotatedLabelUI class ...... 556 RotatedLabelPresentationImpl class ...... 557 GraphicsUtil class ...... 557 RotatedLabelPageGenerator class ...... 560 RotatedLabelCategoryProviderFactory class ...... 561 RotatedLabelGeneralPage class ...... 562 Deploying and testing the rotated label report item plug-in ...... 564 Deploying a report item extension ...... 564 Launching the rotated label report item plug-in ...... 564 Developing an advanced report item ...... 568 Report item model ...... 568 Report item UI design ...... 572 Report item presentation ...... 576 Improving the report item UI design ...... 581 Image UI provider ...... 581 Figure UI provider ...... 587 Report item builder ...... 592 Context menu ...... 595 Property editor ...... 598 Binding the report item to data ...... 608 Changes in the model definition ...... 609 Changes in the report item presentation ...... 609 Changing the report item UI to support expressions ...... 610 Adding data binding to the builder ...... 610 Adding data binding to the property page ...... 613 Chapter 24 Developing a report rendering extension ...... 617 Understanding a report rendering extension ...... 618 Developing a CSV report rendering extension ...... 618 Creating a CSV report rendering plug-in project ...... 619 Defining the dependencies for the CSV report rendering extension ...... 621 Declaring the emitter extensions ...... 622 The sample CSV report rendering extension ...... 624 The CSV report rendering extension package ...... 625 CSVReportEmitter class ...... 625 CSVTags class ...... 631 CSVWriter class ...... 632 CSVRenderOption class ...... 632 Testing the CSV report rendering plug-in ...... 632 ExecuteCSVReport class ...... 638 Report design XML code ...... 639 Developing an XML report rendering extension ...... 652

xiv Creating an XML report rendering plug-in project ...... 653 Defining the dependencies for the XML report rendering extension ...... 655 Declaring the emitters extension ...... 655 The sample XML report rendering extension ...... 656 The XML report rendering extension package ...... 656 XMLReportEmitter ...... 657 XMLTags class ...... 663 XMLFileWriter class ...... 664 XMLRenderOption class ...... 664 LoadExportSchema class ...... 665 Testing the XML report rendering plug-in ...... 667 Chapter 25 Developing an ODA extension ...... 671 ODA extension overview ...... 672 Understanding an ODA extension ...... 673 Developing the CSV ODA driver extensions ...... 674 About the CSV ODA plug-ins ...... 674 Downloading BIRT source code ...... 675 Implementing the CSV ODA driver plug-in ...... 676 ODA data source extension points ...... 679 dataSource extension point properties ...... 679 ConnectionProfile properties ...... 683 Dependencies for the CSV ODA driver extension ...... 683 The sample CSV ODA driver extension ...... 684 CSVFileDriver class ...... 685 Connection class ...... 686 Query class ...... 686 ResultSet class ...... 689 ResultSetMetaData class ...... 691 DataSetMetaData class ...... 691 Messages class ...... 692 CommonConstants class ...... 692 The CSV ODA user interface extension ...... 693 Creating the CSV ODA user interface plug-in project ...... 693 The ODA data source user interface extensions ...... 696 connectionProfile extension point ...... 698 propertyPages extension point ...... 698 dataSource extension point ...... 699 The sample CSV ODA user interface extension ...... 700 Implementing the ODA data source and data set wizards ...... 700 org.eclipse.birt.report.data.oda.csv.ui.impl package ...... 701 org.eclipse.birt.report.data.oda.csv.ui.wizards package ...... 701

xv Constants class ...... 702 CSVFilePropertyPage class ...... 702 CSVFileSelectionPageHelper class ...... 703 Understanding CSVFileSelectionWizardPage ...... 705 Understanding FileSelectionWizardPage ...... 706 Testing the CSV ODA user interface plug-in ...... 711 Developing a Hibernate ODA extension ...... 717 Creating the Hibernate ODA driver plug-in project ...... 719 The sample Hibernate ODA driver extension ...... 726 HibernateDriver class ...... 727 Connection class ...... 727 DataSetMetaData class ...... 730 Statement class ...... 730 ResultSet class ...... 734 HibernateUtil class ...... 735 Building the Hibernate ODA driver plug-in ...... 739 Developing the Hibernate ODA UI extension ...... 739 The sample Hibernate ODA UI extension ...... 746 HibernatePageHelper class ...... 747 HibernateDataSourceWizard class ...... 750 HibernatePropertyPage class ...... 750 HibernateHqlSelectionPage class ...... 751 Building the Hibernate ODA user interface plug-in ...... 757 Testing the Hibernate ODA user interface plug-in ...... 757 Chapter 26 Developing a data extraction extension ...... 763 Understanding a data extraction extension ...... 764 Developing an XML data extraction extension ...... 766 Creating an XML data extraction plug-in project ...... 766 Defining the dependencies for the XML data extraction extension ...... 769 Specifying the data extraction extension ...... 770 The sample XML data extraction extension ...... 772 Implementing the data extraction interfaces ...... 773 XML document format ...... 774 XMLDataExtractionImpl class ...... 776 Testing the XML data extraction plug-in ...... 783 The report design XML code ...... 786 Index ...... 795

xvi About Integrating Applications into BIRT iHub

Integrating Applications into BIRT iHub provides information about integrating applications using Actuate APIs and URIs into BIRT iHub. The APIs include client-side programming using Actuate JavaScript API and server-side programming using the XML-based Actuate Information Delivery API. This guide includes an introduction to the concepts required to work with the APIs. This guide also provides information about using external security systems to provide user credentials to BIRT iHub. Integrating Applications into BIRT iHub includes the following parts and chapters: ■ About Integrating Applications into BIRT iHub. This chapter provides an overview of this guide. ■ Chapter 1. Overview of Actuate APIs. This chapter lists all the public APIs that Actuate provides. Each API description includes an example of the type of application that uses the API. ■ Part 1. Understanding and integrating the Eclipse BIRT framework. This part introduces the BIRT architecture and the Report Object Model (ROM) and provides background information that helps programmers design or modify reports programmatically, instead of using the graphical tools in a BIRT Designer. This part also describes the public APIs that are available to Java developers, except the extension APIs. ■ Chapter 2. Understanding the BIRT architecture. This chapter provides an architectural overview of BIRT and its components, including the relationships among the BIRT components and BIRT’s relationship to Eclipse and Eclipse frameworks. Architectural diagrams illustrate and clarify the relationships and workflow of the components. The chapter also provides brief overviews of all the major BIRT components. ■ Chapter 3. Understanding the Report Object Model. This chapter provides an overview of the BIRT ROM. ROM is a specification for a set of XML elements that define both the visual and non-visual elements that comprise a report

About Integrating Applications into BIRT iHub xvii design. The ROM specification includes the properties and methods of those elements, and the relationships among the elements. ■ Chapter 4. Understanding the BIRT APIs. This chapter introduces BIRT’s public API, which are the classes and interfaces in three package hierarchies: ■ The Report Engine API, in the org.eclipse.birt.report.engine.api hierarchy, supports developers of custom report generators. ■ The Design Engine API, in the org.eclipse.birt.report.engine.api hierarchy, supports the development of custom report designs. ■ The Chart Engine API, in the org.eclipse.birt.chart hierarchy, is used to develop a custom chart generator. ■ Chapter 5. Programming using the BIRT reporting APIs. This chapter describes the fundamental requirements of a reporting application and lists the BIRT API classes and interfaces that are used to create a reporting application. This chapter describes the tasks that are required of a reporting application and provides an overview of how to build a reporting application. The org.eclipse.birt.report.engine.api package supports the process of generating a report from a report design. The org.eclipse.birt.report.model.api package supports creating new report designs and modifying existing report designs. ■ Chapter 6. Programming using the BIRT charting API. This chapter describes the requirements of a charting application, either in a stand-alone environment or as part of a reporting application. The org.eclipse.birt.chart hierarchy of packages provides the charting functionality in BIRT. By describing the fundamental tasks required of charting applications, this chapter introduces the API classes and interfaces that are used to create a chart. This chapter also describes the chart programming examples in the chart examples plug-in. ■ Part 2. Using Actuate BIRT APIs. This part describes how to use classes in the com.actuate.birt.* public packages to integrate BIRT applications and data objects into BIRT iHub. ■ Chapter 7. Using Actuate APIs to access iHub environment information. This chapter describes how to write event handlers in a report to retrieve BIRT iHub environment information. ■ Chapter 8. Using the BIRT data object API. This chapter describes how to work with BIRT data objects and report designs programmatically. ■ Part 3. Introduction to the Actuate Information Delivery API. This part describes the structure and implementation of the Actuate Information Delivery API and how to pass messages from an application to BIRT iHub using this API. ■ Chapter 9. Understanding the Information Delivery API and schema. This chapter introduces the features of the API and describes the Actuate Web Services Description Language (WSDL) schema.

xviii Integrating Applications into BIRT iHub ■ Chapter 10. Constructing a SOAP message. This chapter discusses the elements of Actuate Simple Object Access Protocol (SOAP) messages. ■ Chapter 11. Text string limits in Actuate operations. This chapter lists the maximum field lengths for text elements in BIRT iHub Information Console and System Console for elements the Actuate Information Delivery API creates. ■ Part 4. Using Actuate security. This part describes two ways to access BIRT iHub using external security to provide user login credentials. ■ Chapter 12. Using Visualization Platform security. This chapter introduces the iPortal Security Extension (IPSE) for accessing the Visualization Platform and explains how to use it. ■ Chapter 13. Using Java Report Server Security Extension and iPortal Security Extension. This chapter describes how to create and install an Actuate iHub Java Report Server Security Extension (RSSE) application as a web service. Using the Java RSSE framework, a developer can create an application that provides external authentication, external registration, and page-level security. ■ Part 5. Archiving BIRT iHub volume content. This part describes how to archive the contents of a BIRT iHub volume. ■ Chapter 14. Aging and archiving volume items. This chapter describes how to automate the archival of items in a BIRT iHub volume, including the use of relevant Information Delivery API (IDAPI) operations. ■ Part 6. Using Actuate REST API in an application. This part describes how to use and deploy the Actuate REST API. Tutorials provide an example of using the REST API in an application. ■ Chapter 15. Understanding the Actuate REST API. This chapter describes the Actuate REST API architecture and usage, including many tutorials. ■ Part 7. Using Actuate JavaScript API in an application. This part describes how to design custom reporting web applications with the Actuate JavaScript API. ■ Chapter 16. Creating a custom web page using the Actuate JavaScript API. This chapter describes the Actuate JavaScript API requirements and common implementations. ■ Chapter 17. Creating dynamic report content using the Actuate JavaScript API. This chapter describes using Actuate JavaScript API code in a BIRT report. ■ Chapter 18. Working with Interactive Crosstabs. This chapter describes how to create, access, view, and modify Interactive Crosstabs. ■ Part 8. Accessing BIRT applications using URIs. This part describes how to access the Information Console, Interactive Viewer, and Report Studio applications using URIs.

About Integrating Applications into BIRT iHub xix ■ Chapter 19. Actuate application URIs. This chapter describes the JavaServer Pages (JSPs) for Information Console and the URIs and parameters to access those pages. ■ Chapter 20. Actuate Report Studio URIs. This chapter describes the servlet for Report Studio and the URI and parameters to access the servlet. ■ Chapter 21. Actuate BIRT Viewer URIs. This chapter describes the servlet for Actuate BIRT Viewer and the URI and parameters to access the servlet. ■ Part 9. Developing a BIRT extension. This part shows Java programmers how to add new functionality to the BIRT framework. ■ Chapter 22. Extending BIRT. This chapter first explains how to download BIRT 4.3.1 source code and build the BIRT project for development. This is an optional task and usually performed when a developer is directly modifying BIRT source code. This chapter then provides an overview of the BIRT extension framework and describes how to use the Eclipse Plug-in Development Environment (PDE) and the BIRT extension points to create, build, and deploy a BIRT extension. ■ Chapter 23. Developing a report item extension. This chapter describes how to develop a report item extension. The rotated label extension example is a plug- in that renders the text of a report item as an image. The extension rotates the image in the report design to display the text at a specified angle. This chapter also describes how to build a rotated text report item plug-in and add the report item to the BIRT Report Designer using the defined extension points. ■ Chapter 24. Developing a report rendering extension. This chapter describes how to develop a report rendering extension using the Eclipse PDE with sample CSV and XML report rendering extensions as the examples. The chapter describes how to extend the emitter interfaces using the defined extension points to build and deploy a customized report rendering plug-in that runs in the BIRT Report Engine environment. ■ Chapter 25. Developing an ODA extension. This chapter describes how to develop several types of DTP ODA extensions. The CSV ODA driver example is a plug-in that reads data from a CSV file. The Hibernate ODA driver example uses Hibernate Query Language (HQL) to provide a SQL-transparent extension that makes the ODA extension portable to all relational databases. This chapter shows how to develop an ODA extension to the BIRT Report Designer 4.3.1 user interface that allows a report designer to select an extended ODA driver. ■ Chapter 26. Developing a data extraction extension. This chapter describes how to develop a report data extraction extension using the Eclipse PDE. The data extraction example exports report data to XML format. The Eclipse PDE provides the basis for the extension.

xx Integrating Applications into BIRT iHub About Integrating Applications into BIRT iHub xxi xxii Integrating Applications into BIRT iHub Chapter 1

Chapter 1Overview of Actuate APIs

This chapter contains the information about Introducing Actuate APIs.

Chapter 1, Overview of Actuate APIs 1 Introducing Actuate APIs Actuate provides software development tools as a collection of APIs that support a developer designing new Actuate applications or extending or customizing existing applications. The APIs are provided as libraries, plug-ins, or application extensions. Each API can be used independently unless there is an explicit prerequisite. For example, the iHub API, an Actuate application extension, is an extension of the BIRT Event Model, an Eclipse BIRT plug-in, and therefore cannot be implemented without the Event Model included in the server application libraries. API libraries overview Actuate APIs libraries are capable of supporting independent applications as well as extending functionality in applications that provide API integration points. Actuate provides: Information Delivery API (IDAPI) Description IDAPI provides libraries for server-side data integration and manipulation using Simple Object Access Protocol (SOAP) messaging. IDAPI messages are defined by a Web Service Definition Language (WSDL) schema file located at http://:8000/wsdl/v11/axis/all. Purpose IDAPI supports the Report Server Security Extension (RSSE). Use IDAPI to perform tasks on a volume, such as file administration, user administration, and running jobs.

JavaScript API (JSAPI) Description JSAPI provides libraries for web and client-side visualizations using the JavaScript programming language. JSAPI is available to iHub web clients using the iportal context in the iportal\jsapi folder. Purpose Use JSAPI in a web page to embed reports, Reportlets, and gadgets in a dashboard and to modify the behavior of the Actuate Viewer. Use JSAPI in a report design to enhance interactivity.

Online Archive Driver API Description Online Archive Driver API provides libraries that are a SOAP-based interface between BIRT iHub and external archive software. Purpose Use Online Archive Driver API for automating the aging and archiving processes for items in a volume

2 Integrating Applications into BIRT iHub API plug-ins overview Eclipse BIRT plug-ins are function-specific libraries for enhancing BIRT applications with additional features such as security, database integration, encryption, and data objects using Eclipse. Most Eclipse BIRT plug-ins are built using the Java programming language, but may support HTML, XML, JavaScript, SQL, or custom command sets. Actuate develops and supports many Eclipse BIRT plug-ins, both open source and commercial. The APIs are available to BIRT Designer Professional as plug-ins in the eclipse\plugins folder and to iHub as JAR files in the BIRT iHub installation in the $ACTUATE_HOME\modules\BIRTiHub\iHub\Jar\BIRT\lib folder. BIRT Designer Professional also provides the JAR files in the iportal\WEB-INF\lib folder in the com.actuate.birt.report.viewer plug-in.

Report Engine API Description A set of open source Java packages that provides access to all the tasks that create a report from a report design or a report document. The org.eclipse.birt.report .engine.api.* packages in the engineapi.jar file contains this API. Purpose Use the Report Engine API to set parameter values, run a report design, and render a report document to one or more output formats.

Design Engine API or model API Description A set of open source Java packages that provides access to the content and structure of a report design, a template, or a library. The org.eclipse.birt.report .model.api.* packages in the modelapi.jar file contain the components of this API. Purpose Use the Design Engine API to modify the structure of an existing report design or to create a completely new report design.

Chart Engine API Description A set of open source Java packages used to create and modify chart elements. This API supports charting in a stand-alone application or, in conjunction with the Report Engine and Design Engine APIs, in a report design. The org.eclipse.birt.chart.* packages in the chartengineapi.jar file contain the components of this API. Purpose Use the Chart Engine API to modify an existing chart element or to create a completely new chart element. Extend the chart element to provide new chart types. BIRT scripting Description A set of Java packages that enables creation of custom code to control various aspects of report creation and interactivity. BIRT scripting supports JavaScript and Java functions. Script handling follows the BIRT Event model. This model

Chapter 1, Overview of Actuate APIs 3 provides support for event registration and triggers initiated from BIRT content or the server environment. The org.eclipse.birt.report.engine.api.script.* packages in the scriptapi.jar file contain this API and model. Purpose Use BIRT scripting in event handlers and in expressions.

EasyScript Description An expression syntax similar to the syntax used in Excel formulas. EasyScript supports formula and data manipulations using its own markup. The com.actuate.script.* plug-ins provide this scripting syntax and user interface. Purpose Use EasyScript to write expressions in BIRT Designer Professional, Interactive Viewer, and Report Studio.

Dashboard and gadgets Description A plug-in that supports arranging data into interactive visualizations that can deployed individually. Dashboards and gadgets use JavaScript to control their functionality. Supported gadgets include Google gadgets that display dynamic web content using HTML and JavaScript. The com.actuate.birt.report.model .api.dashboard package in the modelapi.jar file contains this API. Purpose Use the dashboard and gadgets API to enhance dashboard and gadget functionality.

BIRT emitters Description Plug-ins that support generating content in different formats, such as PDF, HTML, CSV, and so on. The org.eclipse.birt.report.engine.emitter.* and com.actuate.birt.report.engine.emitter.* plug-ins provide the content emitters. Purpose Use the emitter APIs to customize the built-in emitters to change their behavior or to create a new emitter to generate output in an additional format.

BIRT data connectors Description Connectors that implement drivers to establish connections with specific database or other data source types. For example, Actuate provides connectors for Oracle, MySQL, and flat file data source types. You can use database connectors in IDAPI applications, Report Engine applications, Data Objects, or as the basis for custom database connectors. The org.eclipse.birt.report.data.oda.* and com.actuate.data.oda.* plug-ins provide the data connectors. Purpose Use the Open Data Access (ODA) standard to create custom data connectors to access data from additional data sources. Application extensions overview Actuate application extensions provide additional functionality to commercial Actuate products, such as BIRT Viewer or iHub.

4 Integrating Applications into BIRT iHub BIRT Viewer Java Extension Description A commercial implementation of the BIRT Design Engine API that expands the capabilities of the Actuate BIRT Viewer. This API is provided by the com.actuate.birtviewer.extension package in com.actuate.iportal.jar, which is located in the $ACTUATE_HOME\modules\BIRTiHub\iHub\web\iportal \WEB-INF\lib folder. Use the BIRT Viewer Java extension API to implement event handlers that fire when a user views or interacts with the report.

Data Object API Description A Java API extension used to create and alter data objects. The com.actuate.birt .report.model.api package in the modelapi.jar file contains this API extension. Purpose Use the Data Object API to create, alter, and refresh data objects, based on custom conditions or events. iHub API Description An Event Model extension that provides a report with access to the iHub server environment for specific logistical operations. This extension is provided in $ACTUATE_HOME\modules\BIRTiHub\iHub\reportengines\lib\jrem.jar. Purpose Use the iHub API in an event handler in a report design to customize report content based on conditions such as the user credentials, volume, or the web browser used to view the report.

iPortal Security Extension (IPSE) Description An API extension that supports custom security adapters to implement single-sign on and download security features. The iPortalSecurityAdapter class is provided in com.actuate.iportal.jar, which is located in the $ACTUATE_HOME \modules\BIRTiHub\iHub\web\iportal\WEB-INF\lib folder. Purpose Use IPSE to customize and control the user login and authentication process. Report Server Security Extension (RSSE) Description A SOAP-based security module that creates individual security protocols for consumable content, for example by using an existing Lightweight Directory Access Protocol (LDAP) implementation to control access to a volume. RSSE is based on the IDAPI and can implement a highly granular security scheme for all BIRT content. Purpose Use RSSE to implement external authentication or external registration, or to customize page-level security.

Chapter 1, Overview of Actuate APIs 5 REST API Description The REST API is a resource extension installed with BIRT iHub that responds to RESTful requests. The REST API adheres to the REST standard, a strategy for developing web and mobile components that are platform and language independent, require very little time to implement, and that use minimal client and server resources. Purpose Use the REST API to access and manage dynamic data built with Actuate BIRT technology and generate new documents for distribution. Use the REST API to deliver BIRT content and data from BIRT iHub to any mobile or web application. Overview of other application development tools Actuate provides an extension to ANSI Structured Query Language (SQL) syntax, called Actuate SQL. This syntax is supported by Actuate information objects. Information Object Query Builder provides a graphical interface to build queries using Actuate SQL. For a complete description of Actuate SQL syntax, see Designing Information Objects. Actuate reports and dashboards support the use of the Highcharts JavaScript API to customize HTML 5 charts, such as providing interactivity or changing the appearance of an axis, a series, or a data point. For more information about this API, see the Highcharts reference documentation at http://api.highcharts.com/highcharts.

6 Integrating Applications into BIRT iHub Part One1

Part 1Understanding and integrating the Eclipse BIRT framework

■ Understanding the BIRT architecture ■ Understanding the Report Object Model ■ Understanding the BIRT APIs ■ Programming using the BIRT reporting APIs ■ Programming using the BIRT charting API

Chapter 2

Chapter 2Understanding the BIRT architecture

This chapter contains the following topics: ■ Understanding BIRT integration ■ The BIRT applications ■ BIRT engines and services ■ Types of BIRT report items ■ The Report Object Model (ROM) ■ Types of BIRT files ■ About custom Java applications ■ Extensions to BIRT

Chapter 2, Understanding the BIRT architecture 3 Understanding BIRT integration BIRT consists of many related components. This chapter provides an overview of the BIRT architecture, the BIRT components, the Eclipse components upon which BIRT relies, and the relationships that tie them all together. As an Eclipse project, BIRT is tightly integrated with Eclipse frameworks and platforms. Like all Eclipse projects, BIRT is implemented as a set of Eclipse plug- ins. The BIRT plug-ins provide the functionality for all BIRT components, including BIRT applications, the engines that drive the applications, and supporting application programming interfaces (APIs). The BIRT plug-ins also provide the interface mechanism for communicating with several Eclipse frameworks and platforms. The relationships between BIRT and the Eclipse components are most easily viewed as a stack. Each tier in the stack depends upon, uses, and integrates with the tier below it, as shown in Figure 2-1. Figure 2-2 presents the various BIRT components and how they relate to one another. In this diagram, a component in a solid box is a standard BIRT component. A component in a dashed box is a custom component that a Java developer can provide. Some custom components are extensions of BIRT and others are applications that use the BIRT APIs. A component in a dotted box is a standard BIRT component that the containing component uses. For example, because BIRT Report Designer uses the design engine, the design engine appears in a dotted box within the box for BIRT Report Designer. Figure 2-3 shows the relationships among BIRT components as they generate a formatted report from a design. BIRT Report Designer provides drag-and-drop capabilities to design reports quickly. The report designer uses the design engine to produce XML report design files. The BIRT Report Engine consumes these report design files, and then, at run time, fetches the appropriate data using queries defined at design time. A BIRT report for immediate viewing is generated in memory and emitted in the desired output format, which can be Microsoft Excel, non-paginated HTML, paginated HTML, Open Document formats, Adobe PDF, PostScript, Microsoft PowerPoint, or Microsoft Word. To create a persistent report, the report engine transforms and summarizes the data and caches the generated report in an intermediate binary file, the report document file. This caching mechanism enables BIRT to scale to handle large quantities of data.

4 Integrating Applications into BIRT iHub BIRT applications

BIRT designers BIRT run-time application

BIRT Report Designer BIRT Report Viewer

Chart Builder

BIRT RCP Report Designer

BIRT engines and services

Design engine Report engine Chart engine Script engine

Presentation Generation Data services services services

BIRT core component plug-ins

Eclipse frameworks

Data Tools Graphical Eclipse Modeling Framework Framework Framework

Eclipse platforms

Eclipse Tools Platform Eclipse Rich Client Platform

Figure 2-1 BIRT components as plug-ins to the Eclipse platform

Chapter 2, Understanding the BIRT architecture 5 BIRT Report Designer

Tools to create and edit report components and rules, including:

■ Bookmarks ■ Expressions ■ Report layout ■ Charts ■ Highlighting rules ■ Report parameters ■ Cross tabs ■ Hyperlinks ■ Report XML ■ Data filters and groups ■ Library components ■ Scripts ■ Data mapping rules ■ Master pages ■ Styles ■ Data sets and data ■ Properties ■ Tables of content sources ■ Report items

Report outline explorer Data explorer

Report item palette Library outline explorer

Report previewer Data previewer

BIRT Report Viewer Data services

Design engine ODA framework Report Object Model (ROM)

Standard BIRT report items Data source Custom data Report item extensions source

Report library files Report design Report template files (.rptlibrary) (.rptdesign) (.rpttemplate)

Web application Report previewer Custom Java application

BIRT Report Viewer BIRT Report Viewer BIRT Report Engine

Figure 2-2 Task flow among standard BIRT components and custom components

6 Integrating Applications into BIRT iHub Report design (.rptdesign)

BIRT Report Viewer

Report engine

Preparation and generation services

Chart engine Script engine Data services

Data transform services Design engine Report executor Data access service Report items

ODA Framework Report document (.rptdocument) Data source Custom data source

Presentation services

Chart Engine Report renderer Script engine

Emitters

PDF DOC PPT

HTML XLS PostScript

Custom

Report in specified format Figure 2-3 Task flow among BIRT and custom components to generate a report

Chapter 2, Understanding the BIRT architecture 7 BIRT also provides a tightly integrated charting component, which supports including a variety of chart types in reports. The charts are rendered at run time using the charting engine. This charting engine also supports creating chart output separate from a report. Figure 2-4 illustrates this architecture and process flow.

Figure 2-4 BIRT architecture and process flow

The BIRT applications There are three BIRT applications: BIRT Report Designer, BIRT RCP Report Designer, and BIRT Report Viewer. The two report designers are very similar. BIRT Report Designer runs as a set of Eclipse plug-ins and lets you build reports within the Eclipse Workbench. BIRT RCP Report Designer has a simplified report design interface based on Eclipse Rich Client Platform. Although BIRT RCP Report Designer can be used for report development, it is included in this book as a reference implementation to help you develop your own Rich Client Platform applications. BIRT Report Designer and BIRT RCP Report Designer BIRT Report Designer is a graphical report design tool. BIRT Report Designer uses the design engine to generate a report design file based on the report object model (ROM). ROM supports the standard set of BIRT report items and custom report items. BIRT Report Designer also supports the reuse of a report design by saving it as a template. You can also save individual report components in a component library, making those components accessible to other report designs. The primary functional differences between the BIRT RCP Report Designer and BIRT Report Designer are: ■ BIRT RCP Report Designer has no integrated debugger. ■ BIRT RCP Report Designer does not support Java event handlers.

8 Integrating Applications into BIRT iHub Other than these differences, the functionality of the two report designers is identical and any further mention of BIRT Report Designer in this chapter apply equally to BIRT RCP Report Designer. BIRT Report Viewer BIRT provides the BIRT Report Viewer web application that includes all the necessary files to deploy to most J2EE application servers. This web application supports running reports and viewing paginated HTML, with a table of contents and bookmarks, and extracting data to a values file. URLs provide this level of integration. The host application forwards the reporting request to the BIRT Report Viewer and allows the user to interact directly with the report. The BIRT Report Viewer is also available as an Eclipse plug-in. This plug-in is used within the report designer to preview and display a report while it is being developed. Within BIRT Report Designer, it is deployed to and works with the Eclipse Tomcat application server plug-in. As report requests are made, the Eclipse Workbench starts the Tomcat application and launches the BIRT Report Viewer.

BIRT engines and services An engine is a set of Java APIs that provide basic functionality in a specific domain. BIRT contains several engines, for example, the report engine, design engine, and chart engine. These engines provide several different types of services. A service is a set of Java classes that provide functionality using the API provided from different engines. For example, the generation services use the design engine API and report engine API to generate reports and produce report documents respectively. Design engine The design engine contains the APIs used to validate and generate a report design file. BIRT Report Designer and any custom Java application that generates a BIRT report design use the design engine. The generation services also use the design engine when building the report document. The design engine contains APIs that validate the elements and structure of the design file against the ROM specification. Report engine The BIRT report engine enables XML report designs created by the BIRT Report Designer to be used by a J2EE/Java application. To support this functionality, the report engine provides two core services, generation and presentation.

Chapter 2, Understanding the BIRT architecture 9 The report engine provides extensions to support custom report items and custom output formats. The report engine also supports Java application developers who want to integrate powerful report generation and viewing capabilities into their applications without having to build the infrastructure from lower-level Java components. The BIRT Report Engine API supports integrating the run-time part of BIRT into Java applications. The report engine provides the ability to specify parameters for a report, run a report to produce HTML, PDF, DOC, PS, or PPT output and fetch an image or chart.

Generation services The generation service within the report engine connects to the data sources specified in a report design, uses the data engine to retrieve and process the data, creates the report layout, and generates the report document. Report content can be either viewed immediately using the presentation services, or saved for later use. The saved report documents containing snapshot views of data can be retained for use and comparison over time.

Presentation services The presentation services process the report document created by the generation services and render the report to the requested format and the layout specified in the design. The presentation services use the data engine to retrieve and process data from the report document. The presentation services use whichever report emitter they require to generate a report in the requested format. BIRT has several standard emitters, HTML PDF, DOC, PPT, PS, and XLS. BIRT also supports custom emitters that modify these default formats or deliver new formats. Extensions to the presentation engine and services provide display capability for chart report items and custom report items. Chart engine The chart engine contains APIs to generate charts and associate them with data from a data source. BIRT Report Viewer interprets any chart information in a report design and uses the chart engine to generate the chart specified by the design. Use of the chart engine is not restricted to a BIRT application. Any Java application can use chart engine APIs to create and display a chart. Data engine and services The data engine provides services to retrieve and transform data. The data services retrieve data from its source and process the data as specified by the report design. When used by the generation engine, the data services retrieve data from the data source specified in the design. When used by the presentation engine, the data services retrieve data from the report document.

10 Integrating Applications into BIRT iHub Data services The data engine provides two key service types: data access services and data transformation services. The data access services communicate with the ODA framework to retrieve data. The data transformation services perform such operations as sorting, grouping, aggregating, and filtering the data returned by the data access services.

ODA framework BIRT uses the Open Data Access (ODA) framework provided by the Eclipse Data Tools Platform project to manage ODA and native drivers, load drivers, open connections, and manage data requests. The ODA framework contains extension points that support adding a custom ODA driver. Write a custom ODA driver if you have a data source that BIRT does not support and a scripted data source is not desired. Use of a custom ODA driver may require extending not only the data engine but also BIRT Report Designer. A BIRT Report Designer extension is necessary if the data source requires a user interface component to specify the data set and data source properties.

Types of BIRT report items A report item is a visual component of a report, such as a label, a list, or a chart. There are three categories of report items in BIRT: standard report items, custom report items, and the chart report item. Standard report items A report item is a visual component of a report. A report item can be as simple as a label or as complex as a cross tab. Every report item has an icon on the Palette view in BIRT Report Designer. Custom report items Custom report items are either new report items or extensions of existing report items. An example of an extension to a report item is adding a property, such as color. An example of a new report item is the rotated text report item, which is a reference implementation of a report item extension. Creating a new report item and extending an existing report item both involve extending BIRT through the Eclipse plug-in mechanism. Custom items require an extension to one or more of the following components to support the new item:

■ BIRT Report Designer Extending BIRT Report Designer provides user interface components for a report developer to specify properties and other settings for the report item.

Chapter 2, Understanding the BIRT architecture 11 ■ The design engine Extending the design engine validates the report item settings provided by a report developer.

■ The report engine Extending the report engine supports generating and presenting report output for the report item. Chart report item A chart report item is a standard BIRT component implemented as a BIRT extension. The user interface for creating a chart report item is a chart builder that steps the report developer through the process of designing the chart and associating it with the appropriate data columns.

The Report Object Model (ROM) ROM is the model upon which BIRT is based. ROM is a specification for the structure, syntax, and semantics of the report design. The formal expression of ROM is through an XML schema and a semantic definition file. The ROM specification appears in the following plug-in JAR file: $INSTALL_DIR\eclipse\plugins \org.eclipse.birt.report.model_.jar

Types of BIRT files BIRT Report Designer uses four types of files: ■ Report design files ■ Report document files ■ Report library files ■ Report template files The following sections provide a brief overview of each of these file types. Report design files A report design file is an XML file that contains the report design, the complete description of a BIRT report. The report design describes every aspect of a report, including its structure, format, data sources, data sets, JavaScript event handler code, and the names of Java event handlers. BIRT Report Designer creates the report design file and BIRT Report Engine processes it.

12 Integrating Applications into BIRT iHub The file extension of a report design file is rptdesign. Report document files A report document file is a binary file that encapsulates the report design, incorporates the data, and contains additional information, such as data rows, pagination information, and table of contents information. The file extension of a report document file is rptdocument. Report library files A report library file is an XML file that contains reusable and shareable BIRT report components. A report developer uses Resource Explorer in BIRT Report Designer to provide shared access to a library, update a library, and use report elements from a library. A BIRT report library can contain any report element, such as: ■ Data sets and data sources ■ Embedded images ■ Event handler code ■ Styles ■ Visual report items The file extension of a report library file is rptlibrary. Report template files A report template is an XML file that contains a reusable design. A report developer can use a template as a basis for developing a new report. A report developer uses a report template to maintain a consistent style across a set of report designs and for streamlining the report design process. A report template can specify many different elements of a report, including: ■ One or more data sources ■ One or more data sets ■ Part or all of the layout of a report design, including grids, tables, lists, and other report items ■ Grouping, filtering, and data binding definitions ■ Styles ■ Library components

Chapter 2, Understanding the BIRT architecture 13 ■ Master pages ■ Cheat sheets Building BIRT templates is similar to building BIRT reports. The difference lies in converting report items into template report items which act as placeholders. The file extension of a report template file is rpttemplate.

About custom Java applications Java developers can use the BIRT APIs to create a custom report designer or a custom report generator. Custom report designer A custom report designer is a Java application that a Java developer creates to generate a well-formed report design file based on specific requirements. A custom report designer does not necessarily include a user interface. A typical example of a custom report designer is a Java application that dynamically determines the content, structure, or data source for a report, based on business logic. A custom report designer uses the same design engine API as BIRT Report Designer. Custom Java report generator A custom Java report generator performs the same function as the BIRT report generator and is typically integrated into either a web application or a stand-alone Java application. A custom Java report generator uses the Report Engine API to read a report design file and generate a report. A custom Java report generator can use business logic to implement security requirements, control content, and determine the output format.

Extensions to BIRT Through its public APIs and the BIRT extension framework, BIRT enables a Java developer to expand the capabilities of BIRT. BIRT uses Eclipse extensions to enable extending the functionally of the framework. The extension points provided by BIRT support the creation of new graph types, additional data sources, report controls, and emitters for rendering to additional outputs. These extension points appeal to users who have specialized data access and formatting needs. The following list shows some of the possible custom extensions:

14 Integrating Applications into BIRT iHub ■ A custom report item A custom report item is a report item extension. This report item can be an extension, an existing BIRT report item, or a new report item. ■ A custom ODA data source driver A custom ODA data source driver is a custom ODA extension that connects to a data source type other than those that BIRT directly supports. ■ A custom report emitter A custom report emitter generates a report in a format other than HTML or PDF. Later chapters in this book provide fully worked examples of all these types of extensions.

Chapter 2, Understanding the BIRT architecture 15 16 Integrating Applications into BIRT iHub Chapter 3

Chapter 3Understanding the Report Object Model

This chapter contains the following topics: ■ Report Object Model (ROM) overview ■ The ROM specification ■ The ROM schema ■ The rom.def file ■ ROM elements

Chapter 3, Understanding the Report Object Model 17 Report Object Model (ROM) overview This chapter provides an overview of the BIRT Report Object Model (ROM) and the primary elements that comprise the model. ROM defines the rules for constructing a valid report design file in much the same way that HTML defines the rules for constructing a valid web page. ROM, therefore, is the model for the BIRT report design, template, or library file in the same way that HTML is the model for the web page. For information about every component of ROM, see the online help entry Report Object Model (ROM) Definitions Reference in BIRT Programmer Reference.

The ROM specification The ROM specification defines a set of XML elements that describe the visual and non-visual components of a report. The XML file that BIRT Report Designer generates to describe a report design, library, or template consists entirely of ROM elements. Visual components, known as report items, include data items, labels, and tables. ROM also provides the framework for extended report items such as charts and cross tabs. Non-visual components, for example, data cubes, data sets, data sources, report parameters, and styles, support report items, but do not appear in a report. The ROM specification defines elements, their properties, and an element’s relationship to other elements. The ROM specification describes elements by their methods, properties, slots, and styles. ROM elements describe: ■ The data source and query with which to populate a report ■ The placement, size, style, and structure of report items ■ The report page layout The report design, template, or library file contains XML elements that describe the ROM elements in the file. The BIRT design engine interprets the ROM elements using the ROM specification and the ROM schema. The ROM specification describes the content of each report element type. The ROM schema describes the supported structure of the XML in a file. Each BIRT file type appears in the ROM schema. Examining the XML in a BIRT file and the ROM schema shows that a template’s structure is identical to a report design. BIRT Report Designer displays the elements that the design engine interprets. Visual report items appear in the layout window. Data-related items such as cubes, data sets, and report parameters appear in the data explorer. All elements in the report design appear in the Outline view.

18 Integrating Applications into BIRT iHub ROM methods A ROM element can have one or more methods, called event handlers. BIRT fires many different events during the course of executing a report. When BIRT fires an event, the appropriate event handler executes to handle the event. By default, event handlers are empty methods that do nothing. By supplying code for an event handler, a report developer customizes and extends the functionality of BIRT. Supplying code for an event handler is called scripting. An event handler can be scripted in either JavaScript or Java. Report items can have four events: onPrepare, onCreate, onPageBreak, and onRender. Each event fires in a specific phase of report creation. onPrepare fires in the preparation phase. onCreate fires during the generation phase. onRender and onPageBreak fire during the presentation phase. ROM properties ROM element properties are typed. Property types are similar to variable types in programming or data types in database terminology. Like variables and data types, ROM property types can be simple or complex. Design.xsd defines these types. Simple types include color, dimension, number, and string. Complex types include lists and structures. A complex type contains more than one component. For example, a text type contains both the text and a resource key used to internationalize the text. ROM slots A ROM slot is a container for elements of defined types. For example, a report element has a Body slot that contains any number of any type of report item. The Styles slot in the report element contains only Style items, which are the styles available to the report. ROM styles The ROM style system is based on cascading style sheets (CSS), where a style set in a container cascades to its contents. The Report element contains all other elements, so the style property of the Report element defines the default style for the entire report. An element within the report can override the default style. A report developer can either choose a style from a defined set of styles or create a new style. Typical style attributes include alignment, background image, color, and text size.

Chapter 3, Understanding the Report Object Model 19 The ROM schema The ROM schema, written in the XML Schema language, encapsulates the ROM specification. XML Schema provides a standard way of defining the structure, content, and semantics of an XML file. XML Schema is similar to document type definition (DTD). The ROM schema, therefore, contains the formal expression of the content, structure, and semantics of the ROM report design. The ROM schema, design.xsd, is located at: http://www.eclipse.org/birt/2005/design Design.xsd is also in the plug-in, org.eclipse.birt.report.model. A statement similar to the following one appears at the top of every report design, library, or template file: BIRT uses this statement, which identifies the version of the schema, to interpret the file structure. A file is not valid if it contains elements that are not defined in the schema or that violate the rules in the schema. Opening a file using a schema-aware tool such as XMLSpy supports verifying the file against the schema. Using a schema-aware tool also enables a developer of a custom report designer to verify the output of the custom report designer. The ROM schema defines syntax that supports extensions to BIRT without making changes to the actual schema. For example, an extended item uses the following tag: The ROM schema defines properties using the following syntax: value The ROM schema does not define any actual properties. ROM element properties are defined in another file, rom.def.

The rom.def file The rom.def file contains metadata defining the specific ROM elements, their properties, their slots, and their methods. You can find rom.def in: $INSTALL_DIR\eclipse\plugins \org.eclipse.birt.report.model_.jar \org\eclipse\birt\report\model\elements\rom.def

20 Integrating Applications into BIRT iHub The rom.def file is an internal file that the design engine uses to present a property sheet for a ROM element. The property sheet for an element contains the element’s properties and their types, the element’s methods, and valid choice selections for each of the element’s properties. When the BIRT development team changes the structure of a ROM element, the changed item includes an attribute that shows the BIRT version in which that change occurred, for example: The rom.def file specifies the following kinds of metadata: ■ Choice Choice specifies all the allowable values that an attribute can have. Most choice definitions relate to style attributes. The following example from rom.def defines all the allowable font families available to a fontFamily style specification:

■ Class Class defines a Java class that a report designer application can access using the BIRT model API. Class definitions describe the following component types: ■ Data types, such as Array, Number, and String ■ Functional classes, such as Global, Math, and RegExp A class definition defines attributes, constructors, localization, members, and methods identifiers. The following example from rom.def shows part of the definition of the Number class:

Chapter 3, Understanding the Report Object Model 21 ... ...

■ Element The rom.def file contains an element definition for every ROM element. Every element definition includes attributes, such as the element’s name, display name, and the element type that it extends. ROM supports methods, properties, property visibility, slot, and style properties in an element definition. The following example from the rom.def file illustrates an element definition:

22 Integrating Applications into BIRT iHub false PropertyVisibility specifies whether BIRT exposes an inherited property to the user interface. For example, the label element extends ReportItem, which has dataSet and dataBindingRef properties. Because a label does not bind data, a property inherited by a label element must not appear visible to a user. The following example shows the use of property visibility to hide these properties: ... ... Slot defines the element as a container and specifies the types of items that the slot contains. Slots appear in the user interface in BIRT views such as Outline. The following example illustrates a slot definition: ...

Chapter 3, Understanding the Report Object Model 23 StyleProperty defines the style components supported by the ROM element. The following example illustrates style property definitions for the data element. The label element definition does not have these style properties because it contains only string values, not numbers. ... ...

■ Structure Structure is a complex data type that typically consists of two or more members. A few structures that are candidates for future expansion have only a single member. The following example from the rom.def file illustrates the definition of a structure. hour,minute,second

■ Style Style contains the least information of any type of metadata described in rom.def. A style definition defines the name of the style, its display name, and a reference value, as shown in the following example.

Chapter 24, Developing a report rendering extension 649 html new Date()]]>

ProductInventory PRODUCTNAME

650 Integrating Applications into BIRT iHub PRODUCTNAME dataSetRow["PRODUCTNAME"] string QUANTITYINSTOCK QUANTITYINSTOCK dataSetRow["QUANTITYINSTOCK"] integer MSRP MSRP dataSetRow["MSRP"] float

Chapter 24, Developing a report rendering extension 651

PRODUCTNAME QUANTITYINSTOCK MSRP
The BIRT report engine can render a report design for output using a standard emitter extension or a customized emitter extension, such as this CSV rendering example.

Developing an XML report rendering extension The sample XML report rendering extension is a plug-in that can export BIRT report data in XML format. Typically, report developers render BIRT report data to XML to enable sharing data with another application.

652 Integrating Applications into BIRT iHub For example, business-to-business (B2B) systems must transmit data to customers and trading partners in a consistent way that supports interoperability according to Electronic Data Interchange (EDI) standards. These systems use specialized forms of XML such as Electronic Business eXtensible Markup Language (ebXML). A custom XML report rendering extension can render BIRT report data in a format that is consistent with this established standard. The sample XML report rendering extension provides the following capabilities: ■ Exports BIRT report data in XML format The XML report rendering plug-in renders each report element and writes to the output file, .xml. ■ Defines a public API for rendering BIRT reports in XML format The plug-in extends the functionality defined by the org.eclipse.birt .report.engine.emitter extension point defined in the org.eclipse.birt .report.engine plug-in. ■ Supports the user specifying an XML schema for formatting output During the rendering process, the sample plug-in processes all the elements in the report design, exporting XML properties and related data to the output file. Optionally, the plug-in supports mapping the report elements to an XML schema to provide additional formatting for output. The plug-in defines these mappings in the property file, .xmlemitter. The plug-in reads the property file at run time and loads the custom tags. Creating an XML report rendering plug-in project Create a new plug-in project for the XML report rendering extension using the Eclipse Plug-in Development Environment (PDE).

How to create the XML report rendering plug-in project 1 From the Eclipse PDE menu, choose File➛New➛Plug-in Project. 2 In Plug-in Project, modify the settings as shown in Table 24-4. Table 24-4 Values for the XML emitter plug-in project fields Section Option Value Plug-in Project Project name org.eclipse.birt.report .engine.emitter.xml Use default location Selected Location Not available when you select Use default location

Chapter 24, Developing a report rendering extension 653 Table 24-4 Values for the XML emitter plug-in project fields Section Option Value Project Settings Create a Java project Selected Source folder src Output folder bin Target Platform Eclipse version 3.5 or greater OSGi framework Not selected Working Sets Add project to working sets Not selected

Choose Next. 3 In Content, modify the settings as shown in Table 24-5. Table 24-5 Values for the XML emitter plug-in content fields Section Option Value Plug-in ID org.eclipse.birt.report Properties .engine.emitter.xml Version 1.0.0.qualifier Name BIRT XML Emitter Vendor yourCompany.com or leave blank Execution Environment JavaSE-1.7 Plug-in Options Generate an activator, a Java Selected class that controls the plug-in’s life cycle Activator org.eclipse.birt.report .engine.emitter.xml .XmlPlugin This plug-in will make Not selected contributions to the UI Enable API Analysis Not selected Rich Client Would you like to create a rich No Application client application?

Choose Finish. The XML report rendering extension project appears in the Eclipse PDE Workbench, as shown in Figure 24-10.

654 Integrating Applications into BIRT iHub Figure 24-10 XML report rendering extension project Defining the dependencies for the XML report rendering extension To compile and run the XML report rendering example, specify the org.eclipse.birt.report.engine plug-in, which must be available on the classpath for the XML rendering extension. Declaring the emitters extension To implement the XML report rendering extension, specify the org.eclipse.birt.report.engine.emitters extension point and add the extension element details.

How to specify the extension 1 On PDE Manifest Editor, choose Extensions.

Chapter 24, Developing a report rendering extension 655 2 In All Extensions, choose Add. New Extension—Extension Point Selection appears. 3 In Available extension points, select the following plug-in: org.eclipse.birt.report.engine.emitters Choose Finish. 4 In All Extensions, right-click the extension point, org.eclipse.birt.report .engine.emitters, and choose the extension element, emitter. 5 In Extension Element Details, specify the properties for the XML emitter extension element, emitter, as shown in Table 24-6. Table 24-6 Property values for the XML emitter extension element Property Value class org.eclipse.birt.report.engine.emitter.xml.XMLReportEmitter format xml mimeType xml id org.eclipse.birt.report.engine.emitter.xml

The sample XML report rendering extension The XML report rendering extension extends the report emitter interfaces and XML writer in org.eclipse.birt.report.engine.emitter. The extension example provides access to the report container, pages, tables, rows, cells text, labels, data, images, hyperlinks, and other contents at different phases of the report generation process. The example writes the contents of the report to an XML output file. The example creates the XML file in the same folder as the exported report. The output file name is the name of the report with a .xml extension. The example provides only limited error checking. The following section provides a general description of the code-based extensions a developer must make to develop an XML report rendering extension after defining the plug-in framework in the Eclipse PDE. The XML report rendering extension package The implementation package for the XML report rendering extension example, org.eclipse.birt.report.engine.emitter.xml, is in the Third Edition (published 2011): http://www.actuate.com/birt/contributions It contains the following classes:

656 Integrating Applications into BIRT iHub ■ XMLPlugin The plug-in run-time class for the report item extension example. ■ XMLReportEmitter Handles the start and end processing that renders the report container. ■ XMLRenderOption Integrates the plug-in with BIRT report engine, specifying configuration information, including the output format as XML. ■ XMLTags.java Defines the controls and associated property lists used when writing to the XML file. ■ XMLFileWriter Writes the XML version, text, image, data, label, and report tag content of the report to the XML output file. ■ LoadExportSchema Loads the XML schema file, if one exists, to replace the default values specified for the XML version, data, image, label, report tags, and text. An accessor method for each tag returns the value to XMLReportEmitter for output to the export file. The following section contains more specific information about the implementation details for the classes in the XML report rendering extension package.

XMLReportEmitter XMLReportEmitter writes the contents of the report to an XML file. XMLReportEmitter instantiates the writer and emitter objects and handles the start and end processing that renders the report container. XMLReportEmitter exports the XML version, data, image, label, report tag content, and text of the report to the XML output file. XMLReportEmitter implements the following methods: ■ XMLReportEmitter( ) instantiates the XML report emitter class as an org.eclipse.birt.report.engine.presentation.ContentEmitterVisitor object to perform emitter operations. ■ initialize( ) performs the following operations required to create an output stream that writes the report contents to the XML file, similar to the CSV report rendering extension: ■ Obtains a reference to the IEmitterServices interface ■ Instantiates the file and output stream objects, using the specified settings

Chapter 24, Developing a report rendering extension 657 ■ Instantiates the XML file writer object ■ start( ) performs the following operations: ■ Obtains a reference to the IReportContent interface, containing accessor methods that get the interfaces to the report content emitters ■ Sets the start emitter logging level and writes to the log file ■ If an optional XML schema file exists, start( ) ❏ locates the XML schema file for the report ❏ instantiates a LoadExportSchema object to read the XML schema file ■ Opens the output file, specifying the encoding scheme as UTF-8 ■ Starts the XML writer ■ Writes the start tag, which specifies the tag, including the version and encoding schema, to the output file ■ Writes the tag, which specifies the report name and other properties in the report property list to the output file Listing 24-16 shows the start( ) method. Listing 24-16 The start( ) method

public void start( IReportContent report ) { logger.log( Level.FINE, "[XMLReportEmitter] Start emitter." ); String fileName = report.getDesign( ).getReportDesign( ).getFileName( ); int pos = fileName.indexOf("/"); String fn = fileName.substring(pos+1,fileName.length( )); fileName = fn; if ( fileName.length( ) > 0) { pos = fileName.lastIndexOf( "." ); if ( pos > 0 ) {

658 Integrating Applications into BIRT iHub fileName = fileName.substring( 0, pos ); } fileName = fileName + ".xmlemitter"; pos = fileName.lastIndexOf( "/" ); String propFileName = fileName.substring( pos + 1 , fileName.length( ) ); String resourceFolder = report.getDesign().getReportDesign( ) .getResourceFolder( ); if ( fileExists(resourceFolder + "/" + propFileName)) { exportSchema = new LoadExportSchema( resourceFolder + "/" + propFileName ); } else if ( fileExists(fileName)) { exportSchema = new LoadExportSchema( fileName ); } else { exportSchema = new LoadExportSchema( "" ); } } this.report = report; writer.open( out, "UTF-8" ); writer.startWriter( ); writer.closeTag( exportSchema.getExportStartTag( )); writer.closeTag( XMLTags.TAG_CR ); String rp = exportSchema.getExportReportTag( ); for ( int i = 0;i < XMLTags.rPropList.length;i++ ) { if ( exportSchema.isPropertyRequired( XMLTags.rPropList[i], rp )) { String propValue = getReportPropValue( i,report ); rp = replaceTag( rp, "??" + XMLTags.rPropList[i], propValue ); } } writer.writeCode( rp ); writer.closeTag( XMLTags.TAG_CR ); }

■ end( ) performs the following operations, similar to the CSV rendering extension:

Chapter 24, Developing a report rendering extension 659 ■ Sets the end report logging level and writes to the log file ■ Ends the write process and closes the XML writer ■ Closes the output file

Understanding the other XMLReportEmitter methods The XMLReportEmitter class defines the following additional methods, called at different phases of the report generation process, that provide access to the report container, pages, tables, rows, cells text, labels, data, images, hyperlinks, and other contents. The following examples show the processing for a label: ■ startLabel( ) performs the following operations: ■ Calls LoadExportSchema.getExportLabelTag( ) to get the pattern for the

■ Iterates through the following label properties list defined in XMLTags to determine the properties required by the report: static String[ ] lPropList = { "Bookmark", "Height", "Hyperlink", "InlineStyle", "Name", "TOC", "Width", "X", "Y" };

■ Calls getLabelPropValue( ) to obtain each required property value and substitute the value in the

660 Integrating Applications into BIRT iHub Listing 24-17 The startLabel( ) method

public void startLabel( ILabelContent label ) { String lbl = exportSchema.getExportLabelTag( ); int len = XMLTags.lPropList.length; for ( int i = 0;i < XMLTags.lPropList.length;i++ ) { if (exportSchema.isPropertyRequired( XMLTags.lPropList[i], lbl)) { String propValue = getLabelPropValue( i,label ); lbl = replaceTag( lbl, "??"+XMLTags.lPropList[i], propValue ); } } startText( label, lbl ); writer.closeTag( XMLTags.TAG_CR ); }

■ startText( ) performs the following operations: ■ Sets the start text logging level and writes to the log file. ■ Uses getLabelPropValue( ) iteratively to get the label text value. ■ Writes the

Chapter 24, Developing a report rendering extension 661 Listing 24-18 The startText( ) method

public void startText( ITextContent text, String exportTag ) { logger.log( Level.FINE, "[XMLReportEmitter] Start text" ); String txt = exportSchema.getExportLabelTag( ); int len = XMLTags.lPropList.length; for ( int i = 0; i < XMLTags.lPropList.length; i++ ) { if ( exportSchema.isPropertyRequired( XMLTags.lPropList[i], lbl )) { String propValue = getLabelPropValue( i,label ); lbl = replaceTag( lbl, "??" + XMLTags.lPropList[i], propValue ); } } String textValue = text.getText( ); writer.writeCode( replaceTag( exportTag, XMLTags.valueTag, textValue ) ); }

■ getLabelPropValue( ) performs the following operations: ■ Calls the appropriate IContent accessor method to obtain the property value. ■ Returns the value to startLabel( ) for substitution in the

private String getLabelPropValue( int property, ILabelContent label) { String propValue; switch ( property ) { case 0: // "Bookmark": propValue = label.getBookmark( ); break; case 1: // "Height": if ( label.getHeight( ) != null ) { propValue = label.getHeight().toString( ); }

662 Integrating Applications into BIRT iHub else { propValue = ""; } break; case 2: //"Hyperlink": if ( label.getHyperlinkAction( ) != null ) { propValue = label.getHyperlinkAction( ).getHyperlink( ); } else { propValue = ""; } break; ... case 8: //"Y": if ( label.getY( ) != null ) { propValue = label.getY( ).toString( ); } else { propValue = ""; } break; default: propValue = ""; break; } if ( propValue == null ) { propValue = ""; } return propValue; }

XMLTags class The XMLTags class defines the controls and associated property lists used in analyzing the report contents, as shown in Listing 24-20. Listing 24-20 The XMLTags class public class XMLTags { public static final String TAG_CR = "\n"; static String valueTag = "??value";

Chapter 24, Developing a report rendering extension 663 static String labelControl = "label"; static String textControl = "text"; static String imageControl = "image"; static String dataControl = "data"; static String reportControl = "report"; static String startControl = "start"; static String endControl = "end"; static String[ ] iPropList = { "Bookmark", "Height", "Hyperlink", "ImageMap", "InlineStyle", "MIMEType", "Name", "Style", "TOC", "URI", "Width", "X", "Y" }; static String[ ] dPropList = { "Bookmark", "Height", "Hyperlink", "InlineStyle", "Name", "Style", "TOC", "Width", "X", "Y" }; static String[ ] lPropList = { "Bookmark", "Height", "Hyperlink", "InlineStyle", "Name", "TOC", "Width", "X", "Y" }; static String[ ] tPropList = { "Bookmark", "Height", "Hyperlink", "InlineStyle", "Name", "Style", "Text", "TOC", "Width", "X", "Y" }; static String[ ] rPropList = { "TotalPages", "TOCTree", "Name" }; }

XMLFileWriter class The XMLFileWriter class writes the closing tag similar to the CSVWriter class in the CSV report rendering extension.

XMLRenderOption class The org.eclipse.birt.report.engine.emitter.xml.XMLRenderOption class adds the XML rendering option to the BIRT report engine run time, as shown in Listing 24-21. Listing 24-21 The XMLRenderOption class

package org.eclipse.birt.report.engine.emitter.xml; import org.eclipse.birt.report.engine.api.RenderOption; public class XMLRenderOption extends RenderOption { public static final String XML = "XML"; public XMLRenderOption( ) { }

664 Integrating Applications into BIRT iHub LoadExportSchema class The org.eclipse.birt.report.engine.emitter.xml.LoadExportSchema class optionally loads an XML schema by performing the following operations: ■ Specifies the default substitution patterns for the XML tags ■ Calls the readSchemaFile( ) method ■ Specifies an accessor method for each tag that returns a value to XMLReportEmitter for output to the export file Listing 24-22 shows the specification of the default substitution patterns for the XML tags and the constructor, which calls the readSchemaFile( ) method. Listing 24-22 The LoadExportSchema class package org.eclipse.birt.report.engine.emitter.xml; ... public class LoadExportSchema { protected String fileName = ""; protected String startTag = ""; protected String textTag = "??value"; protected String imageTag = "??value"; protected String dataTag = "??value"; protected String labelTag = ""; protected String endTag = ""; protected String reportTag = ""; public LoadExportSchema(String fileName) { if ( fileName.length( ) > 0 ) { this.fileName = fileName; readSchemaFile( ); } } ... The readSchemaFile( ) method reads the XML schema file, one line at a time, replacing the default values for the patterns of the XML version, data, image, label, report tags, and text with the values specified in the XML schema file. Listing 24-23 shows the code for the readSchemaFile( ) method. Listing 24-23 The readSchemaFile( ) method private void readSchemaFile( ) {

Chapter 24, Developing a report rendering extension 665 BufferedReader input = null; try { input = new BufferedReader( new FileReader( fileName ) ); String line = null; //not declared within while loop while (( line = input.readLine( )) != null) { int pos = line.indexOf("="); if ( pos > 0 ) { String index = line.substring(0, pos ); String indexTag = line.substring(pos + 1, line.length( )); if ( index.equalsIgnoreCase( XMLTags.labelControl ) ) { labelTag = indexTag; } if ( index.equalsIgnoreCase( XMLTags.imageControl ) ) { imageTag = indexTag; } if ( index.equalsIgnoreCase( XMLTags.dataControl ) ) { dataTag = indexTag; } if ( index.equalsIgnoreCase( XMLTags.startControl ) ) { startTag = indexTag; } if ( index.equalsIgnoreCase( XMLTags.endControl ) ) { endTag = indexTag; } if ( index.equalsIgnoreCase( XMLTags.reportControl ) ) { reportTag = indexTag; } } } } catch (FileNotFoundException ex) { ex.printStackTrace( ); } catch (IOException ex) { ex.printStackTrace( ); } finally { try {

666 Integrating Applications into BIRT iHub if (input!= null) { input.close( ); } } catch (IOException ex) { ex.printStackTrace( ); } } } Listing 24-24 shows the values of the patterns for the XML version, data tags, image, label, report, and text specified in the XML schema file, xmlReport.xmlemitter. Listing 24-24 The XML schema file start= report= label= text=??value image=??value data=??value end=

Testing the XML report rendering plug-in To test the XML report rendering example, create a Java application that runs a report design in an installation of the BIRT run-time engine, similar to the application created to run the CSV report rendering example. To test the XML report rendering plug-in, perform the following tasks: ■ Build the org.eclipse.birt.report.engine.emitter.xml plug-in. ■ Deploy the plug-in to the BIRT run-time engine directory. ■ Launch a run-time instance of the Eclipse PDE or open an Eclipse Workbench. ■ Create a Java application that runs the report design and writes the report’s data to an XML file. ■ Create a report design containing a table that maps to a data source and data set. ■ Run the application and examine the XML in the output file. Figure 24-11 shows the report design used in the XML report rendering example.

Chapter 24, Developing a report rendering extension 667 Figure 24-11 Report design for the XML report rendering example Listing 24-25 shows the contents of the XML output file, containing XML version, report, image, label, and data tags for an executed report. Listing 24-25 The XML output file

/9j/4AAQSkZJRgABAgEBLAEsAAD/4RVaRXhpZgAATU0AKgAAAAgABwESAAMA ... 7PMv9I9nVo5cj8b7MV9zB/gh8cf/2Q== 1969 Harley Davidson Ultimate Chopper 7933 95.7 1952 Alpine Renault 1300 7305 214.3 1996 Moto Guzzi 1100i 6625 118.94 2003 Harley-Davidson Eagle Drag Bike 5582 193.66 ... American Airlines: MD-11S

668 Integrating Applications into BIRT iHub 8820 74.03 Boeing X-32A JSF 4857 49.66 Pont Yacht 414 54.6 ...

Chapter 24, Developing a report rendering extension 669 670 Integrating Applications into BIRT iHub Chapter 25

Chapter 25Developing an ODA extension

This chapter contains the following topics: ■ ODA extension overview ■ Understanding an ODA extension ■ Developing the CSV ODA driver extensions ■ Implementing the CSV ODA driver plug-in ■ The CSV ODA user interface extension ■ The sample CSV ODA user interface extension ■ Testing the CSV ODA user interface plug-in ■ Developing a Hibernate ODA extension

Chapter 25, Developing an ODA extension 671 ODA extension overview BIRT uses the Eclipse Data Tools Platform (DTP) open data access (ODA) API to build a driver that connects to a data source and retrieves data for a report. This API defines interfaces and classes that manage the following tasks: ■ Connecting to a data source ■ Preparing and executing a query ■ Handling data and metadata in a result set ■ Mapping between the object representation of data and the data source Eclipse DTP also provides tools and support for SQL development, locales, logging, and other special types of processing. For more information about the Eclipse DTP project, see http://www.eclipse.org/datatools. The ODA framework is a key component of the DTP. ODA presents the Java developer with a robust architecture to extend the capabilities of BIRT by being able to report on custom data sources. The framework provides new project wizards to create plug-in projects for ODA run-time and designer extensions. The generated plug-in projects include class templates and default implementation. These plug-in projects support expediting the development of customized ODA data source extensions. This chapter shows how to develop an ODA extension using examples that extend the org.eclipse.datatools.connectivity.oda.dataSource extension point to provide access to the following data sources: ■ CSV file Uses the new DTP ODA wizards to create a plug-in project that accesses a CSV data source. DTP ODA interfaces are similar to JDBC interfaces with extensions that support retrieving data from relational and non-relational database sources. ■ Relational database Uses Hibernate Core for Java, an object-oriented software system for generating SQL and handling JDBC result sets. Hibernate Query Language (HQL) provides a SQL-transparent extension that makes the DTP ODA extension portable to all relational databases. Hibernate also supports developing a query in the native SQL dialect of a database. Hibernate is free, open-source software licensed under the GNU Lesser General Public License (LGPL). For more information about Hibernate, see http://www.hibernate.org/. These examples can be found in the Third Edition (published 2011): http://www.actuate.com/birt/contributions

672 Integrating Applications into BIRT iHub Understanding an ODA extension A BIRT report design specifies the type of data access and data transformations required to generate a report. All data comes from an external data source. The BIRT data engine supports the DTP ODA framework. The DTP ODA framework provides access to standard and custom data sources using an open API. Using the DTP ODA framework makes it possible to create a plug-in driver to any external data source. BIRT uses DTP ODA extension points for the report designer and report generation environments. A DTP ODA extension adds a new data source driver to the BIRT framework by implementing the following extension points: ■ ODA data source org.eclipse.datatools.connectivity.oda.dataSource supports the extension of BIRT design-time and run-time data source access. The XML schema file, org.eclipse.datatools.connectivity.oda/schema/dataSource.exsd, describes this extension point. ■ ODA user interface org.eclipse.datatools.connectivity.oda.design.ui.dataSource supports optionally adding an integrated user interface for an ODA driver to BIRT Report Designer. The plug-in can provide user interface support used by a report designer to specify the data source and edit the data set. The XML schema file, org.eclipse.datatools.connectivity.oda.design.ui/schema /dataSource.exsd, describes this extension point. ■ ODA connection profile org.eclipse.datatools.connectivity.oda.connectionProfile supports optionally adding different types of connection profiles to an ODA driver user interface for BIRT Report Designer. A connection profile can define a category or set of configuration types such as JDBC connection profiles. This user interface defines a corresponding newWizard element used to create the resource. The XML schema file, org.eclipse.datatools.connectivity/schema /connectionProfile.exsd, describes this extension point. ■ ODA connection properties page org.eclipse.ui.propertyPages supports optionally adding a page used to edit the properties of a connection profile. The XML schema file, org.eclipse.ui.propertyPages/schema/propertyPages.exsd, describes this extension point. For more information about the DTP ODA APIs, see the Javadoc for the org.eclipse.datatools.connectivity.oda package hierarchy. The Javadoc is in the DTP Software Development Kit (SDK) available from the Eclipse Data Tools Platform project at http://www.eclipse.org/datatools.

Chapter 25, Developing an ODA extension 673 Developing the CSV ODA driver extensions Eclipse DTP provides two ODA plug-in template wizards, one for ODA data source run-time driver, another for ODA data source designer. Each wizard creates a new plug-in project, generating implementations of related ODA extension points. The auto-generated Java classes implement method stubs that support a single result set and input parameters. The classes have hard-coded result set data so that an ODA extension developer can immediately verify that the generated ODA driver plug-ins work with an ODA consumer, for example, BIRT. After the ODA wizard generates the plug-ins, modify the TODO tags in the generated source code to customize data source behavior. To develop the CSV ODA extensions, perform the following tasks: ■ Download the required BIRT source code from the Eclipse CVS repository. ■ Create two new projects using the ODA wizards in the Eclipse PDE to implement the following plug-ins: ■ CSV ODA driver to access the data source ■ CSV ODA user interface to select the data file and available data columns in BIRT Report Designer ■ Extend the source code in the CSV ODA plug-in projects by adding new functionality at the defined extension points. ■ Test and deploy the extensions in the run-time environment. You can download the source code for the CSV ODA driver extension examples at: http://www.actuate.com/birt/contributions

About the CSV ODA plug-ins The CSV ODA extensions require the following two plug-ins: ■ org.eclipse.birt.report.data.oda.csv The CSV ODA data source plug-in extends the functionality defined by the extension point, org.eclipse.datatools.connectivity.oda.dataSource, to create the CSV ODA driver. The first row of the CSV input file contains the column names. The remaining rows, separated by new line markers, contain the data fields, separated by commas. The org.eclipse.birt.report.data.oda.csv plug-in contains the database classes and data structures, such as data types, result set, metadata result set, and query used to handle data in a BIRT report. The org.eclipse.datatools.connectivity.oda.dataSource extension point is in the Eclipse DTP project and is part of the org.eclipse.datatools

674 Integrating Applications into BIRT iHub .connectivity.oda plug-in. This plug-in is available from the CVS repository in /home/datatools. ■ org.eclipse.birt.report.data.csv.ui The CSV ODA user interface plug-in extends the functionality defined by the org.eclipse.datatools.connectivity.connectionProfile, org.eclipse.ui .propertyPages, and org.eclipse.datatools.connectivity.oda.design.ui .dataSource extension points. The user interface consists of the following two pages: ■ The data source page, which specifies and validates the path and name of the CSV file. ■ The data set page, which shows the selected data file and columns available in the file. By default, the user interface selects all the columns in the data set. Downloading BIRT source code The CSV ODA driver plug-in, org.eclipse.birt.report.data.oda.csv, requires the following plug-ins: ■ org.eclipse.core.runtime ■ org.eclipse.datatools.connectivity.oda ■ org.eclipse.datatools.connectivity.oda.profile The CSV ODA user interface extension, org.eclipse.birt.report.data.csv.ui, requires the following plug-ins: ■ org.eclipse.birt.report.data.oda.csv ■ org.eclipse.core.runtime ■ org.eclipse.datatools.connectivity.oda.design.ui ■ org.eclipse.ui For the org.eclipse.birt.report.data.oda.csv plug-in, extend only the Java classes in the org.eclipse.datatools.connectivity.oda plug-in. For the org.eclipse.birt.report.data.csv.ui plug-in, extend the Java classes in the org.eclipse.datatools.connectivity.oda.design.ui plug-in. The BIRT source code is available to the developer community as a downloadable package. You can configure the system to use the JAR files in the eclipse\plugins folder. Source code is not needed to compile the required plug-ins. To debug, you may need the source code for required BIRT and DTP plug-ins. Additional information is available at the eclipse.org downloads site.

Chapter 25, Developing an ODA extension 675 Implementing the CSV ODA driver plug-in This section describes how to implement an ODA driver plug-in, using the CSV ODA driver plug-in as an example. To create an ODA driver plug-in, perform the following tasks: ■ Create the ODA driver plug-in project. ■ Define the dependencies. ■ Specify the run-time archive. ■ Declare the ODA extension points. You can create the CSV ODA driver plug-in project, org.eclipse.birt.report .data.oda.csv, in the Eclipse PDE. This section describes how to create the plug-in project using the New Plug-in Project wizard.

How to create the CSV ODA driver plug-in project 1 From the Eclipse PDE menu, choose File➛New➛Project. 2 In New Project—Select a wizard, open Business Intelligence and Reporting Tools, and select ODA Runtime Driver Plug-in Project, as shown in Figure 25-1. Choose Next.

Figure 25-1 Specifying the CSV ODA run-time driver plug-in project 3 In Plug-in Project, modify the settings as shown in Table 25-1.

676 Integrating Applications into BIRT iHub Table 25-1 Settings for the CSV ODA plug-in project options Section Option Value Plug-in Project Project name org.eclipse.birt.report.data .oda.csv Use default location Selected Location Not available when you select Use default location Project Settings Create a Java project Selected Source folder src Output folder bin Target Platform Eclipse version 3.5 or greater OSGi framework Deselected Working Sets Add project to working set Deselected

Choose Next. 4 In Plug-in Content, modify the settings as shown in Table 25-2. Table 25-2 Settings for the CSV ODA plug-in content options Section Option Value Properties ID org.eclipse.birt.report.data .oda.csv Version 1.0.0.qualifier Name CSV ODA Driver Vendor yourCompany.com or leave blank Execution Environment JavaSE-1.7 Options Generate an activator, a Deselected Java class that controls the plug-in’s life cycle Activator Not available when you deselect Generate an activator This plug-in will make Deselected contributions to the UI Enable API Analysis Deselected Rich Client Would you like to create a No Application 3.x rich client application?

Chapter 25, Developing an ODA extension 677 Choose Next. 5 In Templates, choose ODA Data Source Runtime Driver, as shown in Figure 25-2.

Figure 25-2 Specifying the CSV ODA data source run-time driver template Choose Next. 6 In ODA Data Source Runtime Driver, specify values for the following options used to generate the ODA plug-in, as shown in Table 25-3. Table 25-3 Settings for the CSV ODA data source run-time driver options Option Value Java Package Name org.eclipse.birt.report.data.oda.csv.impl ODA Data Source Element Id org.eclipse.birt.report.data.oda.csv Data Source Display Name CSV Data Source Number of Data Source 1 Properties Data Set Display Name CSV Data Set Number of Data Set Properties 0

Choose Finish. The CSV ODA driver plug-in project appears in the Eclipse PDE Workbench. The project created by the wizard appears as shown in Figure 25-3. The wizard creates all the plug-in files and the main functional Java classes. Customize the default settings as needed and add code to the Java class stubs to implement the desired functionality. 7 Choose plugin.xml in Package Explorer and double-click to open PDE Manifest Editor. Using PDE Manifest Editor, you can review and edit all the plug-in settings.

678 Integrating Applications into BIRT iHub Figure 25-3 Viewing project package structure ODA data source extension points In this step you review the extension points added by the wizard. Click the Extensions tab in PDE Manifest Editor to open the Extensions pane in the editor. The PDE Manifest Editor automatically adds the following two extension points: ■ org.eclipse.datatools.connectivity.oda.dataSource ■ org.eclipse.datatools.connectivity.oda.connectionProfile dataSource extension point properties The ODA data source extension point supports extending design-time and run-time data source access for an application. The extension must implement the ODA Java run-time interfaces defined in the org.eclipse.datatools .connectivity.oda plug-in. Figure 25-4 shows the ODA data source extension points used in the CSV ODA plug-in example. The extension point, org.eclipse.datatools.connectivity.oda.dataSource, specifies the following properties that identify the extension in the run-time environment: ■ ID Optional identifier of the extension instance. The wizard added a reference, %oda.data.source.id, to the extension point ID that you specified in the wizard. The plugin.properties file provides definitions of all the localized variables. The value for the ID, shown in Listing 25-1, is as follows: org.eclipse.birt.report.data.oda.csv

Chapter 25, Developing an ODA extension 679 Figure 25-4 PDE Manifest Editor—CSV ODA Extensions Listing 25-1 plugin.properties

############################################################ # Copyright (c) 2013 <> # ############################################################ # Plug-in Configuration # oda.data.source.id=org.eclipse.birt.report.data.oda.csv # ############################################################ # NLS String ############################################################ # plugin.name=CSV Data Source ODA Runtime Driver data.source.name=CSV Data Source data.set.name=CSV Data Set connection.profile.name=CSV Data Source Connection Profile

680 Integrating Applications into BIRT iHub ■ Name Optional name of the extension instance. Fully qualified identifier of the extension. The extension point defines the extension elements and extension element details for the CSV ODA driver. The dataSource extension element defines the ODA data source extension type to use at design time and run time. It contains the following properties: ■ id Fully qualified identifier of an ODA data source extension. The wizard references the externalized id with the notation %oda.data.source.id. ■ driverClass Java class that implements the org.eclipse.datatools.connectivity.oda.IDriver interface. This interface provides the entry point for the ODA run-time driver extension. ■ odaVersion Version of the ODA interfaces. Specify version 3.2 for an ODA driver developed for BIRT Release 4.3.1. ■ defaultDisplayName Display name of the ODA data source extension. To externalize the value, use the plugin.properties mechanism. ■ setThreadContextClassLoader Indicates whether the consumer of the ODA run-time extension plug-in must set the thread context class loader before calling an ODA interface method. The OSGi class loader that loads the ODA run-time plug-in is not designed to load additional classes. To load additional classes, an ODA run-time plug-in must provide its own java.net.URLClassLoader object and switch the thread context class loader as required. The dataSource element also specifies a property, containing the following extension element details: ■ name Unique name of a property group. Type HOME for a property name. ■ defaultDisplayName Default display name of a property group. To localize the value, use the plugin.properties mechanism. For the default display name, type "CSV File Full Path". ■ type Data type of the property. The default is string.

Chapter 25, Developing an ODA extension 681 ■ canInherit Flag indicating whether the property extension element can inherit properties. Select true. ■ defaultValue Default value of the property extension element. ■ isEncryptable Flag indicating whether the property is encrypted. Select false. ■ allowsEmptyValueAsNull Flag indicating whether an empty value of this property can be treated as a null value. The default value is true. The dataSet extension element describes the following properties: ■ id Required identifier of the ODA data set extension. ■ defaultDisplayName Display name of the ODA data set extension. To localize the value, use the plugin.properties file. The default display name is CSV Data Set, as you can see from Listing 25-1. The dataSet element also specifies a complex data type, dataTypeMapping, which defines a sequence of data type mappings containing the following properties: ■ nativeDataTypeCode Integer value that must match one of the data type codes returned in the implementation for the ODA driver interface. ■ nativeDataType String value specifying the data source native data type. ■ odaScalarDataType ODA scalar data type that maps to the native type. Supported ODA data types include Date, Double, Integer, String, Time, Timestamp, Decimal, and Boolean. The default supported types set by the wizard are shown in Table 25-4. Table 25-4 Settings for CSV ODA dataTypeMapping elements nativeDataTypeCode nativeDataType odaScalarDataType 1 String String 4 Integer Integer 8 Double Double 3 BigDecimal Decimal

682 Integrating Applications into BIRT iHub Table 25-4 Settings for CSV ODA dataTypeMapping elements nativeDataTypeCode nativeDataType odaScalarDataType 91 Date Date 92 Time Time 93 TimeStamp Timestamp 16 Boolean Boolean

ConnectionProfile properties This extension point supports creating database connections using connections profiles. The CSV ODA plug-in uses the following settings created by the plug-in wizard: ■ CSV ODA Data Source (category) ■ CSV ODA Data Source Connection Profile (connectionProfile) ■ ODA Connection Factory (connectionFactory) Dependencies for the CSV ODA driver extension In Figure 25-5, the Dependencies page shows a list of plug-ins that must be available on the classpath of the CSV ODA driver extension to compile and run.

Figure 25-5 The CSV ODA Dependencies page The ODA Runtime driver wizard adds the following dependencies to your plug-in: ■ org.eclipse.datatools.connectivity.oda ■ org.eclipse.datatools.connectivity.oda.profile You can run the Organize Manifests wizard at the end of your work to optimize the dependencies settings. To open the wizard, expand META-INF and right-click MANIFEST.MF. Choose Plug-in Tools➛Organize Manifests. Figure 25-6 shows an example of settings to use when running the wizard.

Chapter 25, Developing an ODA extension 683 Figure 25-6 Organize Manifests Wizard The link to this wizard is on the Overview page of the Manifest Editor. The next wizard page displays the changes in the plug-in manifest file. You can review the proposed changes and accept or decline the modifications. The sample CSV ODA driver extension The BIRT data engine supports the Eclipse DTP ODA framework. The DTP ODA framework supports creating an extension that can plug any external data source into BIRT Report Engine. The DTP ODA API specifies the interfaces for a run-time driver. The BIRT data engine uses the data source and data set definitions in a report design to access the ODA run-time driver to execute a query and retrieve data. The DTP ODA interfaces are similar to JDBC interfaces, having extensions that support retrieving data from non-RDBMS sources. An extended ODA driver can implement these interfaces to wrap the API for another data source, such as a CSV file, to retrieve a result set containing data rows. The CSV ODA driver extension described in this chapter is a simplified example that illustrates how to create an ODA plug-in using the Eclipse PDE. The package for the CSV ODA extension example, org.eclipse.birt.report.data.oda.csv, uses the following classes to implement the ODA plug-in interfaces:

684 Integrating Applications into BIRT iHub ■ CSVFileDriver Implements the IDriver interface. Instantiates the connection object for the CSV ODA driver and sets up the log configuration and application context. ■ Connection Implements the IConnection interface. Opens and closes the connection to the CSV file and instantiates the IQuery object. ■ Query Implements the IQuery interface. Handles the processing that performs the following operations: ■ Sets up the java.io.File object, containing the file and path names ■ Fetches the data rows from the data file, using the internal class, CSVBufferReader ■ Trims the column data, removing extraneous characters such as commas and quotes ■ Prepares the result set metadata, containing the table and column names ■ ResultSet Implements the IResultSet interface. Handles the processing that transforms the String value for a column to the specified data type. ■ ResultSetMetaData Implements the IResultSetMetaData interface. Describes the metadata for each column in the result set. ■ DataSetMetaData Implements the IDataSetMetaData interface. Describes the features and capabilities of the data set. ■ Messages Defines the exception messages for the CSV ODA driver. ■ CommonConstant Defines the constants used in the package, such as the driver name, ODA version, query keywords, and delimiters. CSVFileDriver class The CSVFileDriver class instantiates the connection object for the CSV ODA driver by calling the getConnection( ) method, as shown in Listing 25-2. Listing 25-2 The getConnection( ) method public IConnection getConnection( String dataSourceType ) throws OdaException

Chapter 25, Developing an ODA extension 685 { return new Connection( ); }

Connection class The Connection class opens and closes the connection to the CSV file and calls the newQuery( ) method to instantiate the Query object. Listing 25-3 shows the newQuery( ) method. Listing 25-3 The newQuery( ) method

public IQuery newQuery( String dataSetType ) throws OdaException { if( !isOpen( ) ) throw new OdaException( Messages.getString( "common_CONNECTION_HAS_NOT_OPENED" ) ); return new Query( this.homeDir, this); }

Query class The Query class constructor sets up a java.io.File object, containing the file and path names. The constructor supports an application submitting the home directory parameter, homeDir, as a file name as well as a path. Query( ) configures the data source property based on the value of the HOME property specified in the report design, as shown in Listing 25-4. Listing 25-4 The Query class constructor

Query ( String homeDir, IConnection host ) throws OdaException { if ( homeDir == null || host == null ) throw new OdaException(Messages.getString ( "Common.ARGUMENT_CANNOT_BE_NULL" )); File file = new File(homeDir); if (file.isDirectory( ) { this.homeDirectory = homeDir; } else if (file.isFile( ) { this.homeDirectory = file.getParent( ); } this.connection = host; }

686 Integrating Applications into BIRT iHub The Query class prepares and executes a query, then retrieves the data. Query implements the following additional methods: ■ prepare( ) performs the following operations: ■ Generates query and column information by calling splitQueryText( ) ■ Validates the connection by calling validateOpenConnection( ) ■ Formats the query String, eliminating redundant spaces and converting all keywords to uppercase, by calling formatQueryText( ) ■ Validates the query by calling validateQueryText( ) ■ Prepares the metadata required for the execution of the query and retrieval of the query results by calling prepareMetaData( ) Listing 25-5 shows the prepare( ) method. Listing 25-5 The prepare( ) method

public void prepare( String queryText ) throws OdaException { if ( queryText != null ) { String query = splitQueryText(queryText)[0] ; String colInfo = splitQueryText( queryText )[1]; validateOpenConnection( ); String formattedQuery = formatQueryText( query ); validateQueryText( formattedQuery ); prepareMetaData( formattedQuery, colInfo ); } else throw new OdaException( Messages.getString( "common_NULL_QUERY_TEXT" ) ); }

■ prepareMetaData( ) acquires the following metadata: ■ Table name ■ Actual column names read from data file ■ Query column names ■ Query data types prepareMetaData( ) then instantiates and configures the ResultSetMetaData object. Listing 25-6 shows the prepareMetaData( ) method. Listing 25-6 The prepareMetaData( ) method

private void prepareMetaData( String query, String savedSelectedColInfo ) throws OdaException

Chapter 25, Developing an ODA extension 687 { String[ ] queryFragments = parsePreparedQueryText( query ); String tableName = queryFragments[2]; String[ ] allColumnNames = discoverActualColumnMetaData( tableName,NAME_LITERAL ); String[ ] allColumnTypes = createTempColumnTypes( allColumnNames.length ); String[ ] queryColumnNames = null; String[ ] queryColumnTypes = null; String[ ] queryColumnLables = null; queryColumnNames = allColumnNames; queryColumnTypes = allColumnTypes; queryColumnLabels = allColumnNames; this.resultSetMetaData = new ResultSetMetaData( queryColumnNames, queryColumnTypes, queryColumnLabels ); this.currentTableName = tableName; }

■ executeQuery( ) performs the following operations: ■ Fetches the data from the file to a Vector object ■ Transfers the data from the Vector to a two-dimensional String array ■ Returns the data rows and metadata in a single ResultSet object Listing 25-7 shows the executeQuery( ) method. Listing 25-7 The executeQuery( ) method

public IResultSet executeQuery( ) throws OdaException { Vector v = fetchQueriedDataFromFileToVector( ); String[ ][ ] rowSet = copyDataFromVectorToTwoDimensionArray( v ); return new ResultSet( rowSet, this.resultSetMetaData ); }

■ The internal class, CSVBufferedReader, fetches the data rows from the data file. Listing 25-8 shows the readLine( ) method. Listing 25-8 The readLine( ) method

public String readLine( ) throws IOException { if ( isLastCharBuff( ) && needRefillCharBuff( ) ) { return null; }

688 Integrating Applications into BIRT iHub if ( needRefillCharBuff( ) ) { charBuffer = newACharBuff( ); int close = reader.read( charBuffer ); if ( close == -1 ) { return null; } if ( close != CHARBUFFSIZE ) { this.eofInPosition = close; } this.startingPosition = 0; } String candidate = ""; int stopIn = CHARBUFFSIZE; if ( isLastCharBuff( ) ) { stopIn = this.eofInPosition; } for ( int i = this.startingPosition; i < stopIn; i++ ) { if ( this.charBuffer[i] == '\n' ) { return readALine( candidate, stopIn, i ); } } if ( isLastCharBuff( ) ) { return readLastLine( candidate ); } return readExtraContentOfALine( candidate ); }

ResultSet class The ResultSet class performs the following operations: ■ Provides the cursor processing that fetches forward into the buffered result set rows ■ Transforms the String value for a column to the specified data type ResultSet implements the following methods: ■ ResultSet( ), the constructor, sets up a two-dimensional array that contains the table data and metadata, as shown in Listing 25-9.

Chapter 25, Developing an ODA extension 689 Listing 25-9 The ResultSet( ) constructor

ResultSet( String[ ][ ] sData, IResultSetMetaData rsmd ) { this.sourceData = sData; this.resultSetMetaData = rsmd; }

■ getRow( ) returns the cursor, indicating the position of the row in the result set, as shown in Listing 25-10. Listing 25-10 The getRow( ) method

public int getRow( ) throws OdaException { validateCursorState( ); return this.cursor; }

■ next( ) increments the cursor to point to the next row, as shown in Listing 25-11. Listing 25-11 The next( ) method

public boolean next( ) throws OdaException { if ( (this.maxRows <= 0 ? false : cursor >= this.maxRows - 1) || cursor >= this.sourceData.length - 1 ) { cursor = CURSOR_INITIAL_VALUE; return false; } cursor++; return true; }

■ getString( ) returns the value for a column in the row at the column position specified in the result set, as shown in Listing 25-12. Listing 25-12 The getString( ) method

public String getString( int index ) throws OdaException { validateCursorState( ); String result = sourceData[cursor][index - 1]; if ( result.length( ) == 0 ) { result = null; }

690 Integrating Applications into BIRT iHub this.wasNull = result == null ? true : false; return result; }

ResultSetMetaData class The ResultSetMetaData class describes the metadata for a column in the result set, including the following information: ■ Column count in the result set ■ Display length ■ Label ■ Name ■ Data type ■ Precision ■ Scale ■ Permits null getColumnName( ) returns the column name for a column at the row, column position specified in the result set, as shown in Listing 25-13. Listing 25-13 The getColumnName( ) method public String getColumnName( int index ) throws OdaException { if ( index > getColumnCount( ) || index < 1 ) throw new OdaException( Messages.getString( "resultSetMetaData_INVALID_COLUMN_INDEX" ) + index ); return this.columnNames[index - 1].trim( ); }

DataSetMetaData class The DataSetMetaData class describes the features and capabilities of the data set, including the following: ■ Indicating whether the data set supports multiple result sets ■ Providing information about the sort mode for columns ■ Returning a reference to the data source connection getConnection( ) returns a reference to a data source connection, as shown in Listing 25-14.

Chapter 25, Developing an ODA extension 691 Listing 25-14 The getConnection( ) method

public IConnection getConnection( ) throws OdaException { return m_connection; }

Messages class The Messages class defines the exception messages for the CSV ODA driver. The text strings are stored in messages.properties to ease national language translation. getString( ) returns a message from the resource bundle using the key value, as shown in Listing 25-15. Listing 25-15 The getString( ) method

public static String getString(String key) { try { return RESOURCE_BUNDLE.getString(key); } catch (MissingResourceException e) { return '!' + key + '!'; } }

CommonConstants class The CommonConstants class defines the constants used in the package, such as the driver name, ODA version, query keywords, and delimiters. Listing 25-16 shows these definitions. Listing 25-16 The CommonConstants class

final class CommonConstants { public static final String DELIMITER_COMMA = ","; public static final String DELIMITER_SPACE = " "; public static final String DELIMITER_DOUBLEQUOTE = "\""; public static final String KEYWORD_SELECT = "SELECT"; public static final String KEYWORD_FROM = "FROM"; public static final String KEYWORD_AS = "AS"; public static final String KEYWORD_ASTERISK = "*"; public static final String DRIVER_NAME = "ODA CSV FILE DRIVER"; public static final int MaxConnections = 0; public static final int MaxStatements = 0; public static final String CONN_HOME_DIR_PROP = "HOME";

692 Integrating Applications into BIRT iHub public static final String CONN_DEFAULT_CHARSET = "UTF-8"; public static final String PRODUCT_VERSION = "3.0"; }

The CSV ODA user interface extension The data source extension point, org.eclipse.datatools.connectivity.oda .design.ui.dataSource, supports adding a new data source to a user interface, such as BIRT Report Designer. For each data source, the extension implements the following optional components: ■ A wizard for creating the data source ■ A set of pages for editing the data source ■ The list of data sets that the data source supports For each data set, the extension implements the following optional components: ■ A wizard for creating the data set ■ A set of pages for editing the data set The data source editor page must implement the extension point, org.eclipse .ui.propertyPages, by extending the abstract class, org.eclipse.datatools .connectivity.oda.design.ui.wizards.DataSourceEditorPage. The data set editor page must implement the extension point, org.eclipse.ui .propertyPages, by extending the abstract class, org.eclipse.datatools .connectivity.oda.design.ui.wizards.DataSourceEditorPage. The ODA data source and data set user interface extensions extend these base classes to create customized property pages with page control and other behavior. This section describes how to implement a BIRT ODA user interface plug-in, using the CSV ODA driver plug-in as an example. To create an ODA driver plug-in, perform the following tasks: ■ Create the CSV ODA user interface plug-in project. ■ Define the dependencies. ■ Specify the run-time archive. ■ Declare the ODA user interface extension points. Creating the CSV ODA user interface plug-in project You can create the CSV ODA user interface plug-in project, org.eclipse.birt .report.data.oda.csv.ui, using the Eclipse PDE. The Eclipse PDE provides a wizard

Chapter 25, Developing an ODA extension 693 to assist you in setting up a plug-in project and creating the framework for a plug-in extension. The New Plug-in Project wizard simplifies the process of specifying a plug-in project, automatically adds the required extension points, and sets the dependencies. The wizard also generates the plug-in manifest file, plugin.xml, and optionally, the Java plug-in run-time class. The wizard creates all the implementation Java classes. It also puts TODO tags in the generated source code for customizing code along with guiding comments. After using the wizard to create the plug-in, review the settings, make adjustments to the settings, and add the code to the Java class stubs to implement the desired functionality. The following section describes how to create the plug-in project using the New Plug-in Project wizard.

How to create the CSV ODA user interface plug-in project 1 From the Eclipse menu, choose File➛New➛Project. New Project appears. 2 On New Project—Select a wizard, open Business Intelligence and Reporting Tools, and select ODA Designer Plug-in Project, as shown in Figure 25-7.

Figure 25-7 Specifying the CSV ODA Designer plug-in project 3 Choose Next.

694 Integrating Applications into BIRT iHub 4 In Plug-in Project, modify the settings as shown in Table 25-5. Table 25-5 Settings for the CSV ODA user interface plug-in project options Section Option Value Plug-in Project Project name org.eclipse.birt.report .data.oda.csv.ui Use default location Selected Location Not available when you select Use default location Project Settings Create a Java project Selected Source folder src Output folder bin Target Platform Eclipse version 3.5 or greater OSGi framework Deselected Working Sets Add project to working set Deselected

Choose Next. 5 In Plug-in Content, modify the settings, where needed, as shown in Table 25-6. Table 25-6 Settings for the CSV ODA user interface plug-in content options Section Option Value Properties ID org.eclipse.birt.report .data.oda.csv.ui Version 1.0.0.qualifier Name CSV File ODA Vendor yourCompany.com or leave blank Execution Environment JavaSE-1.7 Options Generate an activator, a Java Selected class that controls the plug-in’s life cycle Activator org.eclipse.birt.report .data.oda.csv.ui.UiPlugin (continues)

Chapter 25, Developing an ODA extension 695 Table 25-6 Settings for the CSV ODA user interface plug-in content options (continued) Section Option Value Options This plug-in will make Selected (continued) contributions to the UI Enable API analysis Deselected Rich Client Would you like to create a No Application 3.x rich client application?

Choose Finish. 6 In Templates, choose ODA Data Source Designer. Choose Next. 7 In ODA Data Source Designer, specify values for the following options used to generate the ODA plug-in, as shown in Table 25-7. Table 25-7 Settings for the CSV ODA UI plug-in content options Option Value Java Package Name org.eclipse.birt.report.data.oda.csv.ui.impl ODA Runtime Driver org.eclipse.birt.report.data.oda.csv Plug-in Id ODA Runtime Data Source org.eclipse.birt.report.data.oda.csv Element Id ODA Runtime Driver Class org.eclipse.birt.report.data.oda.csv.impl .CSVFileDriver ODA Runtime Data Set org.eclipse.birt.report.data.oda.csv.dataSet Element Id Data Source Display Name CSV Data Source Data Set Display Name CSV Data Set

Choose Finish. The CSV ODA user interface plug-in project appears in Eclipse Package Explorer. Double-click plugin.xml to open it in PDE Manifest Editor. The plug-in Overview page looks like the one shown on Figure 25-8. The ODA data source user interface extensions In this next step, you review the extensions added by the wizard to implement the CSV ODA user interface extension and add the extension element details. Figure 25-9 shows the list of CSV ODA user interface extensions.

696 Integrating Applications into BIRT iHub Figure 25-8 Viewing the CSV ODA user interface plug-in

Figure 25-9 CSV ODA user interface extensions

Chapter 25, Developing an ODA extension 697 The CSV ODA user interface plug-in extends the functionality defined by the following extension points: ■ org.eclipse.datatools.connectivity.connectionProfile Provides support for adding a connection profile. ■ org.eclipse.datatools.connectivity.connectionProfileImage The connection profile image extension point supports adopters using multiple icons from their main connection profile extension into a separate plug-in for user interface code and resources. ■ org.eclipse.ui.propertyPages Adds a property page that displays the properties of an object in a dialog box. ■ org.eclipse.datatools.connectivity.oda.design.ui.dataSource Extends the ODA Designer user interface framework to support creating a dialog page so a user can specify an ODA data source and a related data set. The extension points specify the following properties that identify the extensions in the run-time environment: ■ ID Optional identifier of the extension instance ■ Name Optional name of the extension instance connectionProfile extension point The connectionProfile extension point specifies the newWizard, which creates the connection profile.

propertyPages extension point The propertyPages extension point specifies the following extension elements: ■ page Defines a property page. Specifies properties such as id, display name, category, icon, object class, filter, and category. The id and the display name are localized in the plugin.properties file, as shown in Listing 25-17. Listing 25-17 plugin.properties

######################################################## # Copyright (c) 2013 <> ####################################################### # Plug-in Configuration # oda.data.source.id=org.eclipse.birt.report.data.oda.csv #

698 Integrating Applications into BIRT iHub ####################################################### # NLS strings # plugin.name=CSV File ODA Data Source ODA Designer newwizard.name=CSV File ODA Data Source newwizard.description=Create a CSV File ODA Data Source connection profile wizard.window.title=New CSV File ODA Data Source Profile wizard.data.source.page.title=CSV File ODA Data Source profile.propertypage.name=CSV File ODA Data Source Connection Properties wizard.data.set.window.title=New CSV File ODA Data Set wizard.data.set.page.title=Query The ODA user interface framework provides a default implementation that creates a text control for each property value, which is why there is no need to provide a custom implementation. By default, the wizard sets the page.class in the following org.eclipse.ui.propertyPages extension point: page.class=org.eclipse.datatools.connectivity.oda.design.ui .pages.impl.DefaultDataSourcePropertyPage

■ filter Specifies an action filter that evaluates the attributes of each object in a current selection. If an object has the specified attribute state, a match occurs. Each object must implement the org.eclipse.ui.IActionFilter interface. dataSource extension point The dataSource extension point specifies the following extension elements: ■ dataSourceUI Adds user interface support for specifying an extended data source. ■ dataSetUI The dataSetUI extension element defines the following extension elements and details: ■ id Fully qualified name of the data set, such as org.eclipse.birt.report.data .oda.csv.dataSet. This name must be the same as the name for the ODA extension driver data set. ■ dataSetWizard Wizard class, which uses or extends org.eclipse.datatools.connectivity .oda.design.ui.wizards.DataSetWizard to specify a data set in the BIRT Report Designer user interface. Localize the window title, %wizard .data.set.window.title in the plug-in properties file.

Chapter 25, Developing an ODA extension 699 ■ dataSetPage Editor page class, which uses or extends org.eclipse.datatools .connectivity.oda.design.ui.wizards.DataSetWizardPage to add to the editor dialog for a data set. The pages appear in the user interface in the order in which the pages are defined. org.eclipse.birt.report.data .oda.csv.ui.impl.CustomDataSetWizardPage contains implementation code. The wizard provides default implementation code. The page display name, %wizard.data.set.page.title, is externalized in the plugin.properties file.

The sample CSV ODA user interface extension The CSV ODA user interface extension described in this chapter illustrates how to create an ODA user interface plug-in using the Eclipse PDE. The following section describes the code-based extensions a developer must make to complete the development of the CSV ODA user interface extension, after defining the plug-in framework in the Eclipse PDE. The CSV ODA user interface plug-in contains the following packages: ■ org.eclipse.birt.report.data.oda.csv.ui Contains the UiPlugin class, which is automatically generated by the PDE Manifest Editor when you create the plug-in project. ■ org.eclipse.birt.report.data.oda.csv.ui.i18n Contains the Messages class and the messages.properties properties file to generate the messages displayed in the user interface. Localized versions of these messages are in files that use the following naming syntax: messages_.msg

■ org.eclipse.birt.report.data.oda.csv.ui.impl Contains the CustomDataSetWizardPage class, an automatically generated implementation of an ODA data set designer page, which supports creating or editing an ODA data set. ■ org.eclipse.birt.report.data.oda.csv.ui.wizards The wizards package contains the classes that create the user interface pages used to choose a data source and data set in BIRT Report Designer. Implementing the ODA data source and data set wizards BIRT Report Designer uses the Eclipse Data Tools Platform (DTP) ODA design-time framework and offers wizards that automatically generate

700 Integrating Applications into BIRT iHub customizable implementations. The DTP ODA framework defines two of the three extension points used in the CSV ODA user interface plug-in: ■ Connection profile Defined in org.eclipse.datatools.connectivity.connectionProfile ■ Data source and data set wizards Defined in org.eclipse.datatools.connectivity.oda.design.ui.dataSource The CSV ODA user interface plug-in also must implement the extension point for property pages defined in org.eclipse.ui.propertyPages. The CSV ODA user interface plug-in uses the following abstract base classes in the org.eclipse.datatools.connectivity.oda.design.ui.wizards package to create the wizards that specify the data source and data set pages. An ODA user interface plug-in must extend these classes to provide the wizard pages with page control and related behavior: ■ DataSourceEditorPage Provides the framework to implement an ODA data source property page ■ DataSourceWizardPage Provides the framework to implement an ODA data source wizard page ■ DataSetWizardPage Provides the framework to implement an ODA data set wizard page org.eclipse.birt.report.data.oda.csv.ui.impl package This customizable page provides a simple Query Text control for user input. The page extends org.eclipse.datatools.connectivity.oda.design.ui.wizards .DataSetWizardPage in the DTP ODA design-time framework to support updating an ODA data set design instance using query metadata. org.eclipse.birt.report.data.oda.csv.ui.wizards package The org.eclipse.birt.report.data.oda.csv.ui.wizards package in the CSV ODA user interface extension example implements the following classes: ■ Constants Defines the constants for the data source connection properties defined in the run-time drive implementation, org.eclipse.birt.report.data.oda.csv. ■ CSVFilePropertyPage Extends DataSourceEditorPage to create and initialize the editor controls for the property page used to specify the ODA data source. The class updates connection profile properties with values collected from the page.

Chapter 25, Developing an ODA extension 701 ■ CSVFileSelectionPageHelper Specifies the page layout and sets up the control that listens for user input and verifies the location of the CSV data source file. ■ CSVFileSelectionWizardPage Extends DataSourceWizardPage. This class creates and initializes the controls for the data source wizard page. The class sets the select file message and collects the property values. ■ FileSelectionWizardPage Extends DataSetWizardPage. This class creates and initializes the controls for the data set wizard page and specifies the page layout. The class connects to the data source, executes a query, retrieves the metadata and result set, and updates the data set design.

Constants class The Constants class defines the following variables for the data source connection properties defined in org.eclipse.birt.report.data.oda.csv: ■ ODAHOME specifies the CSV ODA file path constant, HOME. ■ ODA_DEFAULT_CHARSET specifies the default character set as 8-bit Unicode Transformation Format (UTF-8). ■ DEFAULT_MAX_ROWS sets the default maximum number of rows that can be retrieved from the data source. Listing 25-18 shows the code for the Constants class. Listing 25-18 The Constants class

public class Constants { public static String ODAHOME="HOME"; public static String ODA_DEFAULT_CHARSET = "UTF-8"; public static int DEFAULT_MAX_ROWS = 1000; }

CSVFilePropertyPage class CSVFilePropertyPage extends the DataSourceEditorPage class, implementing the following methods to provide page editing functionality for the CSV ODA data source property page: ■ The createAndInitCustomControl( ) method performs the following tasks: ■ Instantiates a CSVFileSelectionPageHelper object ■ Specifies the page layout and sets up the editing control by calling the CSVFileSelectionPageHelper.createCustomControl( ) and initCustomControl( ) methods

702 Integrating Applications into BIRT iHub Listing 25-19 shows the code for createAndInitCustomControl( ). Listing 25-19 The createAndInitCustomControl( ) method

protected void createAndInitCustomControl ( Composite parent, Properties profileProps ) { if( m_pageHelper == null ) { m_pageHelper = new CSVFileSelectionPageHelper( this ); } m_pageHelper.createCustomControl( parent ); m_pageHelper.initCustomControl( profileProps ); if( ! isSessionEditable( ) ) { getControl( ).setEnabled( false ); } }

■ collectCustomProperties( ) updates the connection profile properties with the values collected from the page by calling CSVFileSelectionPageHelper .collectCustomProperties( ) method, as shown in Listing 25-20. Listing 25-20 The collectCustomProperties( ) method

public Properties collectCustomProperties ( Properties profileProps ) { if( m_pageHelper == null ) { return profileProps; } return m_pageHelper.collectCustomProperties ( profileProps ); }

CSVFileSelectionPageHelper class CSVFileSelectionPageHelper provides auxiliary processing for the CSVFilePropertyPage and CSVFileSelectionWizardPage classes. CSVFileSelectionPageHelper implements the following methods: ■ createCustomControl( ) performs the following tasks: ■ Sets up the composite page layout ■ Calls the setupFileLocation( ) method that sets up a control to listen for user input and verify the location of the CSV data source file Listing 25-21 shows the code for the createCustomControl( ) method.

Chapter 25, Developing an ODA extension 703 Listing 25-21 The createCustomControl( ) method

void createCustomControl( Composite parent ) { Composite content = new Composite( parent, SWT.NULL ); GridLayout layout = new GridLayout( 2, false ); content.setLayout(layout); setupFileLocation( content ); }

■ setupFileLocation( ) performs the following tasks: ■ Sets up the label and the grid data object in the page layout ■ Sets up the control that listens for user input and verifies the location of the CSV data source file Listing 25-22 shows the code for the setupFileLocation( ) method. Listing 25-22 The setupFileLocation( ) method

private void setupFileLocation( Composite composite ) { Label label = new Label( composite, SWT.NONE ); label.setText( Messages.getString( "label.selectFile" ) ); GridData data = new GridData( GridData.FILL_HORIZONTAL ); fileName = new Text( composite, SWT.BORDER ); fileName.setLayoutData( data ); setPageComplete( false ); fileName.addModifyListener( new ModifyListener( ) { public void modifyText( ModifyEvent e ) { verifyFileLocation(); } } ); }

■ collectCustomProperties( ) sets the data source directory property in the connection profile, as shown in Listing 25-23. Listing 25-23 The collectCustomProperties( ) method

Properties collectCustomProperties( Properties props ) { if( props == null ) { props = new Properties( );

704 Integrating Applications into BIRT iHub } props.setProperty( CommonConstants.CONN_HOME_DIR_PROP, getFolderLocation( ) ); return props; }

■ initCustomControl( ) initializes the data source wizard control to the location of the data source file, as shown in Listing 25-24. Listing 25-24 The initCustomControl( ) method

void initCustomControl( Properties profileProps ) { if( profileProps == null || profileProps.isEmpty( ) || fileName == null ) { return; } String folderPath = profileProps.getProperty( CommonConstants.CONN_HOME_DIR_PROP ); if( folderPath == null ) { folderPath = EMPTY_STRING; } fileName.setText( folderPath ); verifyFileLocation( ); }

Understanding CSVFileSelectionWizardPage The CSVFileSelectionWizardPage class extends the DataSourceWizardPage class, implementing the following methods to provide the functionality for the CSV ODA data source wizard page: ■ The createPageCustomControl( ) method performs the following tasks: ■ Instantiates a CSVFileSelectionPageHelper object ■ Specifies the page layout and sets up the wizard page control by calling CSVFileSelectionPageHelper.createCustomControl( ) method ■ Calls CSVFileSelectionPageHelper.initCustomControl( ) to initialize the control to the location of the data source file Listing 25-25 shows the code for the createPageCustomControl( ) method. Listing 25-25 The createPageCustomControl( ) method

public void createPageCustomControl( Composite parent ) { if( m_pageHelper == null )

Chapter 25, Developing an ODA extension 705 { m_pageHelper = new CSVFileSelectionPageHelper( this ); } m_pageHelper.createCustomControl( parent ); m_pageHelper.initCustomControl( m_csvFileProperties ); }

■ The collectCustomProperties( ) method instantiates a Properties object to contain the CSV data source properties information, as shown in Listing 25-26. Listing 25-26 The collectCustomProperties( ) method

public Properties collectCustomProperties( ) { if( m_pageHelper != null ) { return m_pageHelper.collectCustomProperties( m_csvFileProperties ); } return ( m_csvFileProperties != null ) ? m_csvFileProperties : new Properties( ); }

Understanding FileSelectionWizardPage The FileSelectionWizardPage class extends the DataSetWizardPage class, implementing the following methods to provide the functionality for the CSV ODA data set wizard page: ■ The createPageControl( ) method performs the following tasks: ■ Specifies the page layout and sets up the wizard page control ■ Gets the data source properties ■ Calls populateAvailableList( ) to update the data set design Listing 25-27 shows the code for the createPageControl( ) method. Listing 25-27 The createPageControl( ) method

private Control createPageControl( Composite parent ) { Composite composite = new Composite( parent, SWT.NULL ); FormLayout layout = new FormLayout( ); composite.setLayout( layout ); FormData data = new FormData( ); data.left = new FormAttachment( 0, 5 ); data.top = new FormAttachment( 0, 5 ); fileName = new Text( composite, SWT.BORDER ); fileName.setLayoutData( data );

706 Integrating Applications into BIRT iHub Properties dataSourceProps = getInitializationDesign( ) .getDataSourceDesign( ).getPublicProperties( ); fileName.setText( ( String )( dataSourceProps.getProperty( Constants.ODAHOME ))); data = new FormData( ); data.top = new FormAttachment( fileName, 10, SWT.BOTTOM ); data.left = new FormAttachment( 0, 5 ); data.right = new FormAttachment( 47, -5 ); data.bottom = new FormAttachment( 100, -5 ); data.width = DEFAULT_WIDTH; data.height = DEFAULT_HEIGHT; m_availableList = new List( composite, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL ); m_availableList.setLayoutData( data ); m_selectedFile = new File(( String )( dataSourceProps.getProperty( Constants.ODAHOME ))); populateAvailableList( ); return composite; }

■ getQuery( ) method builds the query for the data set by performing the following tasks: ■ Gets the table name from the file object ■ Appends the table name to a query that selects all the columns using a wildcard ■ Appends the column list, then the table name, to a query that selects specific columns ■ Returns the query text Listing 25-28 shows the code for the getQuery( ) method. Listing 25-28 The getQuery( ) method

private String getQuery( ) { String tableName = null; StringBuffer buf = new StringBuffer( ); File file = m_selectedFile; if(file != null) { tableName = file.getName( ); } if(tableName != null) { if(m_availableList.getItemCount( ) == 0)

Chapter 25, Developing an ODA extension 707 { buf.append("select * from ").append(tableName); } else { buf.append("select "); String[ ] columns = m_availableList.getItems( ); for(int n = 0; n < columns.length; n++) { buf.append(columns[n]); if(n < columns.length - 1) { buf.append(", "); } } buf.append(" from ").append(tableName); } } return buf.toString( ); }

■ getQueryColumnNames( ) method performs the following tasks: ■ Instantiates the CSVFileDriver ■ Prepares the query and gets the results set metadata using the CSV ODA run-time driver and data source connection properties settings ■ Gets the column count ■ Iterates through the metadata results to get the column names and return the results Listing 25-29 shows the code for the getQueryColumnNames( ) method. Listing 25-29 The getQueryColumnNames( ) method

private String[ ] getQueryColumnNames( String queryText, File file ) { IDriver ffDriver = new CSVFileDriver( ); IConnection conn = null; try { conn = ffDriver.getConnection( null ); IResultSetMetaData metadata = getResultSetMetaData( queryText, file, conn ); int columnCount = metadata.getColumnCount( ); if( columnCount == 0 )

708 Integrating Applications into BIRT iHub { return null; } String[ ] result = new String[columnCount]; for( int i = 0; i < columnCount; i++) { result[i] = metadata.getColumnName( i + 1 ); } return result; } catch( OdaException e ) { setMessage( e.getLocalizedMessage( ), ERROR ); disableAll( ); return null; } finally { closeConnection( conn ); } }

■ getResultSetMetaData( ) method performs the following tasks: ■ Sets up the Properties object with the location of the data source file ■ Opens the connection to the data source ■ Sets up a Query object and prepares the query text ■ Executes the query ■ Returns the metadata Listing 25-30 shows the code for the getResultSetMetaData( ) method. Listing 25-30 The getResultSetMetaData( ) method

private IResultSetMetaData getResultSetMetaData( String queryText, File file, IConnection conn ) throws OdaException { java.util.Properties prop = new java.util.Properties( ); prop.put( CommonConstants.CONN_HOME_DIR_PROP, file.getParent( ) ); conn.open( prop ); IQuery query = conn.newQuery( null ); query.setMaxRows( Constants.DEFAULT_MAX_ROWS ); query.prepare( queryText ); query.executeQuery( ); return query.getMetaData( ); }

Chapter 25, Developing an ODA extension 709 ■ setResultSetMetaData( ) method updates the data set page design with metadata returned by the query by performing the following tasks: ■ Calls the DesignSessionUtil.toResultSetColumnsDesign( ) method to convert run-time metadata to a design-time ResultSetColumns object ■ Obtains a ResultSetDefinition object from the design factory to use in populating the data set page design with the metadata definitions ■ Calls the resultSetDefn.setResultSetColumns( ) method to set the reference to ResultSetColumns object, containing the metadata content ■ Assigns the result set definition to the data set design Listing 25-31 shows the code for the setResultSetMetaData( ) method. Listing 25-31 The setResultSetMetaData( ) method

private void setResultSetMetaData( DataSetDesign dataSetDesign,IResultSetMetaData md ) throws OdaException { ResultSetColumns columns = DesignSessionUtil.toResultSetColumnsDesign( md ); ResultSetDefinition resultSetDefn = DesignFactory.eINSTANCE.createResultSetDefinition( ); resultSetDefn.setResultSetColumns( columns ); dataSetDesign.setPrimaryResultSet( resultSetDefn ); dataSetDesign.getResultSets().setDerivedMetaData( true ); }

■ savePage( ) method performs the following tasks: ■ Instantiates the CSVFileDriver ■ Gets the result set metadata ■ Updates the data set design with the metadata ■ Closes the connection Listing 25-32 shows the code for the savePage( ) method. Listing 25-32 The savePage( ) method

private void savePage( DataSetDesign dataSetDesign ) { String queryText = getQuery( ); dataSetDesign.setQueryText( queryText ); IConnection conn = null; try { IDriver ffDriver = new CSVFileDriver( ); conn = ffDriver.getConnection( null );

710 Integrating Applications into BIRT iHub IResultSetMetaData metadata = getResultSetMetaData( queryText, m_selectedFile, conn ); setResultSetMetaData( dataSetDesign, metadata ); } catch( OdaException e ) { dataSetDesign.setResultSets( null ); } finally { closeConnection( conn ); } }

Testing the CSV ODA user interface plug-in On PDE Manifest Editor, in Overview, the Testing section contains links to launch a plug-in as a separate Eclipse application in Run or Debug mode.

How to launch the CSV ODA user interface plug-in 1 From the Eclipse SDK menu, choose Run➛Run Configurations. In Run Configurations, right-click Eclipse Application. Choose New. 2 Create a configuration to launch an Eclipse application by performing the following tasks: 1 In Name, type: CSV ODA Test 2 In Main, in Location, type: C:\Test Run Configurations appears, as shown in Figure 25-10. 3 Choose the Arguments tab. Ensure the following arguments are entered: ■ Program arguments: -os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog

■ VM arguments: -Dosgi.requiredJavaVersion=1.6 -Xms40m -Xmx512m -XX:MaxPermSize=256M 4 Choose the Plug-ins tab to select the list of plug-ins to launch with the run configuration.

Chapter 25, Developing an ODA extension 711 Figure 25-10 Creating a configuration to launch an Eclipse application 5 In Launch with, from the drop-down list, select: plug-ins selected below only In Plug-ins, select the following plug-ins, as shown in Figure 25-11. org.eclipse.birt.data.oda.csv org.eclipse.birt.data.oda.csv.ui The plug-ins selected below only option supports configuring an environment that uses a subset of the plug-ins from the workspace and the target platform. The target platform consists of all the plug-ins that are explicitly checked on the Window—Preferences—Plug-in Development—Target Platform preference page. When using the option, plug-ins selected below only, ensure that the list of selected plug-ins is up to date when you add or remove a plug-in from the workspace. Use the Add Required Plug-ins button often to ensure the selected subset of plug-ins is complete. 6 To launch the run-time workbench, choose Run.

712 Integrating Applications into BIRT iHub Figure 25-11 Selecting required plug-ins for launch configuration

How to create a report design 1 In the run-time workbench, choose the Report Design perspective. 2 In Report Design, choose File➛New➛Project. 3 Expand Business Intelligence and Reporting Tools and select Report Project. Choose Next. 4 In Report Project, in Project name, type: testCSVODA 5 Choose Finish. 6 In Navigator, right-click testCSVODA and choose New➛Report. 7 In New Report, in Enter or select the parent folder, select testCSVODA. 8 In File name, type or accept the default value: new_report.rptdesign Choose Finish.

Chapter 25, Developing an ODA extension 713 In Navigator, new_report.rptdesign appears in the testCSVODA project folder and an empty report layout appears in the layout editor, as shown in Figure 25-12.

Figure 25-12 new_report.rptdesign in the report design environment

How to specify a CSV data source and data set 1 In Report Design, choose Data➛New Data Source. In New Data Source, select CSV Data Source, as shown in Figure 25-13. Choose Next.

Figure 25-13 Choosing CSV Data Source

714 Integrating Applications into BIRT iHub 2 In New CSV File ODA Data Source Profile, type the path and file name of the CSV data source file, as shown in Figure 25-14. Note that the Test Connection function has not been extended for this dialog and will not work to check for the file. Choose Finish.

Figure 25-14 Specifying path to the CSV ODA data source file directory 3 In Report Design, choose Data➛New Data Set➛New Data Set. New Data Set appears, as shown in Figure 25-15. Choose Next. Query appears.

Figure 25-15 New Data Set for the CSV ODA data source 4 In Query, select all the columns, as shown in Figure 25-16. Choose Finish.

Chapter 25, Developing an ODA extension 715 Figure 25-16 Selecting columns Edit Data Set appears, as shown in Figure 25-17.

Figure 25-17 Edit Data Set 5 Choose Preview Results. Preview Results appears, as shown in Figure 25-18. View the other wizard pages. Then, choose OK.

Figure 25-18 Data preview 6 In Data Explorer, expand Data Sources and Data Sets. Data Explorer appears as shown in Figure 25-19.

716 Integrating Applications into BIRT iHub Figure 25-19 Data Set in Data Explorer

How to run a report design using CSV ODA user interface and driver extensions 1 To build the report, drag Data Set from Data Explorer to the layout editor and select all columns. Layout appears, as shown in Figure 25-20.

Figure 25-20 Report design in the layout editor 2 To run new_report.rptdesign, choose Preview. The report runs, displaying the data set from the CSV data source, as shown in Figure 25-21.

Figure 25-21 Preview of the data set from the CSV ODA data source

Developing a Hibernate ODA extension To develop the Hibernate ODA extension, create two new projects in the Eclipse PDE. These two projects implement the following plug-ins:

Chapter 25, Developing an ODA extension 717 ■ org.eclipse.birt.report.data.oda.hibernate The Hibernate ODA driver accesses a relational data source using HQL. The Hibernate ODA data source plug-in extends the functionality defined by the org.eclipse.datatools.connectivity.oda.dataSource extension point. ■ org.eclipse.birt.report.data.oda.hibernate.ui The Hibernate ODA user interface plug-in for BIRT Report Designer selects a Hibernate data source and creates an HQL statement to retrieve data from the available tables and columns. The Hibernate ODA user interface plug-in extends the functionality defined by the org.eclipse.datatools.connectivity .oda.design.ui.dataSource, org.eclipse.ui.propertyPages, and org.eclipse.datatools.connectivity.connectionProfile extension points. The user interface consists of the following pages: ■ Data source page Includes the Hibernate data source in the list of available data sources. The Hibernate ODA driver contains the preconfigured Hibernate configuration and mapping files that connect to the MySQL version of the BIRT demonstration database, Classic Models, Inc. ■ Data set page Creates an HQL statement that selects the data set and embeds the HQL statement in the report design. In BIRT Report Designer, the Hibernate ODA data source wizard supports selecting a Hibernate ODA driver containing preconfigured Hibernate configuration and mapping files. The Hibernate ODA driver searches for these configuration and mapping files in the plug-in’s hibfiles directory. The Hibernate ODA driver also searches in the hibfiles directory for JAR and ZIP files and the org.eclipse.birt.report.data.oda.jdbc plug-in for JDBC drivers to add to the classpath. This approach prevents the need to copy drivers to multiple locations. Note that changing the configuration causes the Hibernate ODA driver plug-in to rebuild the Hibernate SessionFactory, which is a machine-intensive operation. Once the Hibernate ODA driver creates the data source configuration, a data set can be created. The Hibernate data set wizard allows the user to enter HQL statements. The Hibernate ODA user interface example supports only simple queries, such as the following types of statements: From Customer or: Select ord.orderNumber,cus.customerNumber, cus.customerName from Orders as ord, Customer as cus where ord.customerNumber = cus.customerNumber and cus.customerNumber = 363

718 Integrating Applications into BIRT iHub The Hibernate ODA plug-in contains an exampleconfig directory. This directory contains a sample Hibernate configuration file, mapping files, and Java classes that connect to the BIRT sample MySQL database. Test the plug-in using these files as follows: ■ Modify the hibernate.cfg.file to connect to your database configuration. ■ Copy these files to the hibfiles directory. ■ Create a JAR file containing the Java classes. You can test and deploy the extensions in the Eclipse PDE run-time environment. The following sections describe how to create and deploy the Hibernate ODA driver and user interface plug-in projects. To download the source code for the Hibernate ODA driver and user interface extension examples, go to http://www.actuate.com/birt/contributions. Creating the Hibernate ODA driver plug-in project Create the Hibernate ODA driver plug-in project, org.eclipse.birt.report.data .oda.hibernate, using the New Plug-in Project wizard in the Eclipse PDE.

How to create the Hibernate ODA driver plug-in project 1 From the Eclipse PDE menu, choose File➛New➛Project. 2 In New Project—Select a wizard, open Business Intelligence and Reporting Tools and select ODA Runtime Driver Plug-in Project. Choose Next. New Plug-in Project appears. 3 In Plug-in Project, apply the settings shown in Table 25-8. Choose Next. Table 25-8 Settings for the Hibernate ODA plug-in project options Section Option Value Plug-in Project Project name org.eclipse.birt.report.data .oda.hibernate Use default location Selected Location Not available when you select Use default location Project Settings Create a Java project Selected Source folder name src Output folder name bin (continues)

Chapter 25, Developing an ODA extension 719 Table 25-8 Settings for the Hibernate ODA plug-in project options (continued) Section Option Value Target Platform Eclipse version 3.5 or greater OSGi framework Deselected Working Sets Add project to working Not selected sets

4 On Plug-in Content, modify the settings as shown in Table 25-9. Table 25-9 Settings for the Hibernate ODA plug-in content options Section Option Value Properties ID org.eclipse.birt.report.data .oda.hibernate Version 2.0.0 Name BIRT ODA-Hibernate Driver Vendor yourCompany.com or leave blank Execution Environment JavaSE-1.7 Options Generate an activator, a Selected Java class that controls the plug-in’s life cycle Activator org.eclipse.birt.report.data .oda.hibernate.Activator This plug-in will make Deselected contributions to the UI Enable API Analysis Deselected Rich Client Would you like to create No Application a 3.x rich client application?

Choose Next. 5 In Templates, choose ODA Data Source Runtime Driver. Choose Next. 6 In ODA Data Source Runtime Driver, specify values for the following options used to generate the ODA plug-in, as shown in Table 25-10.

720 Integrating Applications into BIRT iHub Table 25-10 Settings for the ODA data source run-time driver options Option Value Java Package Name org.eclipse.birt.report.data.oda.hibernate ODA Data Source Element Id org.eclipse.birt.report.data.oda.hibernate Data Source Display Name Hibernate Data Source Number of Data Source 2 Properties Data Set Display Name Hibernate Data Set Number of Data Set 0 Properties

Choose Finish. After a few moments of processing, the Hibernate ODA driver plug-in project appears in the Eclipse PDE Workbench.

How to specify the properties of the Hibernate ODA plug-in project 1 Using the Eclipse PDE Manifest Editor, in Dependencies, specify the following required plug-ins in the following order: ■ org.eclipse.core.runtime ■ org.eclipse.datatools.connectivity.oda ■ org.eclipse.birt.report.data.oda.jdbc 2 On Runtime, in Classpath, add the following JAR files to the plug-in classpath:

■ odahibernate.jar ■ lib/commons-collections-2.1.1.jar ■ lib/ant-antlr-1.6.5.jar ■ lib/commons-logging-1.0.4.jar ■ lib/antlr-2.7.6rc1.jar ■ lib/dom4j-1.6.1.jar ■ lib/asm.jar ■ lib/ehcache-1.1.jar ■ lib/asm-attrs.jar ■ lib/hibernate3.jar ■ lib/cglib-2.1.3.jar ■ lib/jta.jar

These JAR files must have been previously imported into the lib directory in the Hibernate ODA plug-in. These JAR files can also be put in a new plug-in that the Hibernate ODA plug-in references. 3 In Runtime, in Exported Packages, use Add and verify that the following packages that the plug-in exposes to clients appear in the list:

Chapter 25, Developing an ODA extension 721 ■ antlr ■ org.hibernate.connection ■ antlr.actions.cpp ■ org.hibernate.context ■ antlr.actions.csharp ■ org.hibernate.criterion ■ antlr.actions.java ■ org.hibernate.dialect ■ antlr.actions.python ■ org.hibernate.dialect.function ■ antlr.ASdebug ■ org.hibernate.engine ■ antlr.build ■ org.hibernate.engine.query ■ antlr.collections ■ org.hibernate.engine.transaction ■ antlr.collections.impl ■ org.hibernate.event ■ antlr.debug ■ org.hibernate.event.def ■ antlr.debug.misc ■ org.hibernate.exception ■ antlr.preprocessor ■ org.hibernate.hql ■ javax.transaction ■ org.hibernate.hql.antlr ■ javax.transaction.xa ■ org.hibernate.hql.ast ■ net.sf.cglib.beans ■ org.hibernate.hql.ast.exec ■ net.sf.cglib.core ■ org.hibernate.hql.ast.tree ■ net.sf.cglib.proxy ■ org.hibernate.hql.ast.util ■ net.sf.cglib.reflect ■ org.hibernate.hql.classic ■ net.sf.cglib.transform ■ org.hibernate.id ■ net.sf.cglib.transform.hook ■ org.hibernate.impl ■ net.sf.cglib.transform.impl ■ org.hibernate.intercept ■ net.sf.cglib.util ■ org.hibernate.jdbc ■ net.sf.ehcache ■ org.hibernate.jmx ■ net.sf.ehcache.config ■ org.hibernate.loader ■ net.sf.ehcache.hibernate ■ org.hibernate.loader.collection ■ net.sf.ehcache.store ■ org.hibernate.loader.criteria ■ org.apache.commons.collections ■ org.hibernate.loader.custom ■ org.apache.commons.collections ■ org.hibernate.loader.entity .comparators ■ org.apache.commons.collections ■ org.hibernate.loader.hql .iterators ■ org.apache.commons.logging ■ org.hibernate.lob ■ org.apache.commons.logging.impl ■ org.hibernate.mapping

722 Integrating Applications into BIRT iHub ■ org.apache.tools.ant.taskdefs ■ org.hibernate.metadata .optional ■ org.dom4j ■ org.hibernate.param ■ org.dom4j.bean ■ org.hibernate.persister ■ org.dom4j.datatype ■ org.hibernate.persister.collection ■ org.dom4j.dom ■ org.hibernate.persister.entity ■ org.dom4j.dtd ■ org.hibernate.pretty ■ org.dom4j.io ■ org.hibernate.property ■ org.dom4j.jaxb ■ org.hibernate.proxy ■ org.dom4j.rule ■ org.hibernate.secure ■ org.dom4j.rule.pattern ■ org.hibernate.sql ■ org.dom4j.swing ■ org.hibernate.stat ■ org.dom4j.tree ■ org.hibernate.tool.hbm2ddl ■ org.dom4j.util ■ org.hibernate.tool.instrument ■ org.dom4j.xpath ■ org.hibernate.transaction ■ org.dom4j.xpp ■ org.hibernate.transform ■ org.hibernate ■ org.hibernate.tuple ■ org.hibernate.action ■ org.hibernate.type ■ org.hibernate.cache ■ org.hibernate.usertype ■ org.hibernate.cache.entry ■ org.hibernate.util ■ org.hibernate.cfg ■ org.objectweb.asm ■ org.hibernate.classic ■ org.objectweb.asm.attrs ■ org.hibernate.collection

4 On Extensions, add the extension point, org.eclipse.datatools.connectivity .oda.dataSource, and the following elements and details for: ■ dataSource Add the extension element details, as shown in Table 25-11. Table 25-11 Property settings for the Hibernate dataSource extension element Property Value id org.eclipse.birt.report.data.oda .hibernate (continues)

Chapter 25, Developing an ODA extension 723 Table 25-11 Property settings for the Hibernate dataSource extension element (continued) Property Value driverClass org.eclipse.birt.report.data.oda .hibernate.HibernateDriver odaVersion 3.2 defaultDisplayName Hibernate Data Source setThreadContextClassLoader true overrideExplorerFiltering

The dataSource extension has an attribute named setThreadContextClassLoader, which, if set to true, sets the thread context class loader to the Hibernate ODA plug-in class loader. In this example, this attribute is set to true to avoid potential class conflicts with classes loaded with the Eclipse Tomcat plug-in. ■ dataSet Add the extension element details, as shown in Table 25-12. Table 25-12 Property settings for the Hibernate dataSet extension element Property Value id org.eclipse.birt.report.data.oda .hibernate.dataSet defaultDisplayName Hibernate Data Set

5 In Extensions, select dataSource and add the following properties and element details, setting all other details to blank: ■ HIBCONFIG, as shown in Table 25-13 Table 25-13 HIBCONFIG property settings Property Value name HIBCONFIG defaultDisplayName Hibernate Configuration File type string canInherit true

■ MAPDIR, as shown in Table 25-14

724 Integrating Applications into BIRT iHub Table 25-14 MAPDIR property settings Property Value name MAPDIR defaultDisplayName Hibernate Mapping Directory type string canInherit true

6 In Extensions, select dataSet and add the list of dataTypeMapping elements, as shown in Table 25-15. Table 25-15 Settings for Hibernate dataTypeMapping elements nativeDataTypeCode nativeDataType odaScalarDataType -5 BIGINT Decimal -2 BINARY String -7 BIT Integer 2004 BLOB Blob 16 BOOLEAN Integer 1CHARString 2005 CLOB Clob 91 DATE Date 3DECIMALDecimal 8DOUBLEDouble 6FLOATDouble 4 INTEGER Integer -4 LONGVARBINARY String -1 LONGVARCHAR String 2NUMERICDecimal 7REALDouble 5 SMALLINT Integer 92 TIME Time 93 TIMESTAMP Timestamp -6 TINYINT Integer -3 VARBINARY String 12 VARCHAR String

Chapter 25, Developing an ODA extension 725 The sample Hibernate ODA driver extension The package for the Hibernate ODA extension example, org.eclipse.birt .report.data.oda.hibernate, implements the following classes using the ODA plug-in interfaces defined in the DTP plug-in, org.eclipse.datatools .connectivity.oda, and the extension points defined in the XML schema file, datasource.exsd. The package implements the following classes: ■ Activator Extends org.eclipse.core.runtime.Plugin. Defines the methods for starting, managing, and stopping a plug-in instance. ■ HibernateDriver Implements the IDriver interface. Instantiates the connection object for the Hibernate ODA driver, which provides the entry point for the Hibernate ODA plug-in. ■ Connection Implements the IConnection interface. Opens and closes the connection to the Hibernate ODA data source and instantiates the IQuery object. ■ Statement Implements the IQuery interface. Prepares the result set metadata containing the table and column names, executes the query, and fetches the data rows from the data source. This class is used instead of the default Query class added by the plug-in wizard to avoid name conflicts with org.hibernate.Query. ■ ResultSet Implements the IResultSet interface. Provides access to the data rows in the result set, maintaining a cursor that points to the current row. Handles the processing that gets the value for a column as the specified data type. ■ ResultSetMetaData Implements the IResultSetMetaData interface. Describes the metadata for each column in the result set. ■ DataSetMetaData Implements the IDataSetMetaData interface. Describes the features and capabilities of the driver for the data set. ■ Messages Defines the exception messages for the Hibernate ODA driver. ■ DataTypes Defines, validates, and returns the data types supported by the Hibernate ODA driver.

726 Integrating Applications into BIRT iHub ■ CommonConstant Defines the constants used in the package, such as the driver name, ODA version, query keywords, and delimiters. ■ HibernateUtil Manages the Hibernate SessionFactory that provides the session or run-time interface between the Hibernate service and the ODA driver. This class is built based on the example HibernateUtil, available at http://www.hibernate.org. The Hibernate ODA driver plug-in supports specifying the Hibernate configuration file and mapping files directory in the data source wizard. The plug-in creates the Hibernate SessionFactory from these settings. The example project has an exampleconfig directory that contains a Hibernate configuration and mapping files for use with the BIRT MySQL example database, Classic Models, Inc. The following sections describe the classes where there are important differences between the implementation of Hibernate ODA driver and the earlier example, the CSV ODA driver.

HibernateDriver class The HibernateDriver class instantiates the Connection object for the Hibernate ODA driver. This class implements the IDriver interface, but does not provide any processing for the methods that configure logging and set the application context. Listing 25-33 shows the getConnection( ) method. Listing 25-33 The getConnection( ) method public IConnection getConnection( String connectionClassName ) throws OdaException { return new Connection( ); } getMaxConnections( ) returns 0, imposing no limit on the number of connections to the ODA data source from the application. Listing 25-34 shows the getMaxConnections( ) method. Listing 25-34 The getMaxConnections( ) method public int getMaxConnections( ) throws OdaException { return( 0 ); }

Connection class The Connection class implements the following methods:

Chapter 25, Developing an ODA extension 727 ■ open( ) Opens a Hibernate session and sets the Boolean variable, isOpen, to true. The open( ) method uses the HibernateUtil class to obtain a session from a Hibernate SessionFactory, providing the run-time interface between the Hibernate service and the ODA driver. The open( ) method retrieves the locations for the Hibernate configuration file and mapping files directory from connection properties. The open( ) method calls HibernateUtil.constructSessionFactory( ), which attempts to build the SessionFactory with these settings. If the SessionFactory already exists, the plug-in does not recreate the SessionFactory unless the Hibernate configuration file or the mapping directory have changed. Listing 25-35 shows the code for the open( ) method. Listing 25-35 The open( ) method

public void open( Properties connProperties ) throws OdaException { try { configfile = connProperties.getProperty( "HIBCONFIG" ); mapdir = connProperties.getProperty( "MAPDIR" ); HibernateUtil.constructSessionFactory( configfile, mapdir ); Session testSession = HibernateUtil.currentSession( ); this.isOpen = true; }catch( Exception e ) { throw new OdaException( e.getLocalizedMessage( ) ); } }

■ newQuery( ) Opens a new query by returning an instance of a Statement object, the class that implements the IQuery interface. The connection can handle multiple result set types, but the Hibernate ODA example uses only one and ignores the dataSetType parameter, as shown in Listing 25-36. Listing 25-36 The newQuery( ) method

public IQuery newQuery( String dataSetType ) throws OdaException { if ( !isOpen( ) ) throw new OdaException( Messages.getString( "Common.CONNECTION_IS_NOT_OPEN" ) ); return new Statement( this ); }

728 Integrating Applications into BIRT iHub ■ getMetaData( ) Returns an IDataSetMetaData object of the data set type, as shown in Listing 25-37. Listing 25-37 The getMetaData( ) method

public IDataSetMetaData getMetaData( String dataSetType ) throws OdaException { return new DataSetMetaData( this ); }

■ getMaxQueries( ) Indicates the maximum number of queries the driver supports. The getMaxQueries( ) method returns 1, indicating that the Hibernate ODA driver does not support concurrent queries, as shown in Listing 25-38. Listing 25-38 The getMaxQueries( ) method

public int getMaxQueries( ) throws OdaException { return 1; }

■ commit( ) and rollback( ) Handle transaction processing. The Hibernate ODA driver example does not support transaction operations, so these methods throw UnsupportedOperationException. Listing 25-39. Listing 25-39 The commit( ) method

public void commit( ) throws OdaException { throw new UnsupportedOperationException ( ); }

■ close( ) Closes the Hibernate session, as shown in Listing 25-40. Listing 25-40 The close( ) method

public void close( ) throws OdaException { this.isOpen = false; try { HibernateUtil.closeSession( ); } catch(Exception e) {

Chapter 25, Developing an ODA extension 729 throw new OdaException( e.getLocalizedMessage( ) ); } }

DataSetMetaData class The DataSetMetaData class describes the features and capabilities of the data source for the specified data set. The Hibernate ODA driver example returns true or false to indicate support for a feature. The Hibernate ODA driver example does not support input, output, or named parameters. The driver also does not support multiple result sets, as shown in Listing 25-41. Listing 25-41 The supportsMultipleResultSets( ) method

public boolean supportsMultipleResultSets( ) throws OdaException { return false; } A method such as getSQLStateType( ), which has no implementation, simply throws UnsupportedOperationException, as shown in Listing 25-42. Listing 25-42 The getSQLStateType( ) method

public int getSQLStateType( ) throws OdaException { throw new UnsupportedOperationException ( ); }

Statement class The Statement class implements the IQuery interface. This class prepares and executes the query. Statement also handles parameters and retrieves the result set and result set metadata. The Statement class implements the following methods: ■ prepare( ) The ODA framework calls the prepare( ) method before executing the query. The ODA framework uses the query saved in the report design. The Hibernate ODA user interface plug-in also calls prepare( ) to verify the columns used in the report design. The user interface plug-in passes an HQL statement that gets the columns from the result set object. prepare( ) sets up the result-set metadata and stores the query in an object variable for use by the executeQuery( ) method. The ODA run time uses the result-set metadata to retrieve the data. BIRT Report Designer also uses the result-set metadata to display the columns in the user interface.

730 Integrating Applications into BIRT iHub The prepare( ) method performs the following operations: ■ Sets up array lists to contain the columns, column types, and column classes ■ Trims the query String ■ Creates a Hibernate Query object, using the HQL query ■ Gets the Hibernate column names, types, and classes for the query ■ Instantiates a ResultSetMetaData object, passing in the column names and data types ■ Saves the query for execution Listing 25-43 shows the code for the prepare( ) method. Listing 25-43 The prepare( ) method public void prepare( String query ) throws OdaException { Query qry = null; testConnection( ); ArrayList arColsType = new ArrayList( ); ArrayList arCols = new ArrayList( ); ArrayList arColClass = new ArrayList( ); String[ ] props = null; try { Session hibsession = HibernateUtil.currentSession( ); query = query.replaceAll( "[\\n\\r]+"," " ); query = query.trim( ); qry = hibsession.createQuery( query ); Type[ ] qryReturnTypes = qry.getReturnTypes( ); if ( qryReturnTypes.length > 0 && qryReturnTypes[0].isEntityType( ) ) { for ( int j=0; j< qryReturnTypes.length; j++ ) { String clsName=qryReturnTypes[j].getName( ); props = HibernateUtil.getHibernateProp( clsName ); for ( int x = 0; x < props.length; x++ ) { String propType = HibernateUtil.getHibernatePropTypes( clsName, props[x] ); if( DataTypes.isValidType( propType )) { arColsType.add( propType ); arCols.add( props[x] );

Chapter 25, Developing an ODA extension 731 arColClass.add( clsName ); } else { throw new OdaException( Messages.getString( "Statement.SOURCE_DATA_ERROR" ) ); } } } } else { props = extractColumns( qry.getQueryString( ) ); for( int t=0; t < qryReturnTypes.length; t++) { if ( DataTypes.isValidType( qryReturnTypes[t].getName( ))) { arColsType.add( qryReturnTypes[t].getName( )); arCols.add( props[t] ); } else { throw new OdaException( Messages.getString( "Statement.SOURCE_DATA_ERROR") ); } } } } catch( Exception e ) { throw new OdaException( e.getLocalizedMessage( ) ); } this.resultSetMetaData = new ResultSetMetaData( ( String[ ] )arCols.toArray( new String[arCols.size()] ), ( String[ ] )arColsType.toArray( new String[arColsType.size( )] ), ( String[ ] )arCols.toArray( new String[arCols.size()] ), ( String[ ] )arColClass.toArray( new String[arColClass.size( )] )); this.query = query; }

■ getMetaData( ) The BIRT framework calls getMetaData( ) after the prepare( ) method to retrieve the metadata for a result set. The BIRT framework uses the metadata to create the data set in the report. Listing 25-44 shows the code for the getMetaData( ) method.

732 Integrating Applications into BIRT iHub Listing 25-44 The getMetaData( ) method

public IResultSetMetaData getMetaData( ) throws OdaException { return this.resultSetMetaData; }

■ executeQuery( ) The executeQuery( ) method executes the prepared query and retrieves the results. The executeQuery( ) method returns an IResultSet object, which is created using the list results, result-set metadata, and Hibernate types returned from the HQL query. The ODA framework uses the IResultSet object to iterate over the results. The executeQuery( ) method performs the following operations: ■ Sets up an array of org.hibernate.type.Type to map Java types to JDBC data types ■ Sets up a list to contain the results set ■ Trims the query String ■ Instantiates a Hibernate Query object, creating the HQL query ■ Executes the HQL query, returning the query result set in a List ■ Gets the Hibernate types for the query result set ■ Instantiates a ResultSet object, passing in the data, metadata, and Hibernate types Listing 25-45 shows the code for the executeQuery( ) method. Listing 25-45 The executeQuery( ) method

public IResultSet executeQuery( ) throws OdaException { Type[ ] qryReturnTypes = null; List rst = null; try { Session hibsession = HibernateUtil.currentSession( ); String qryStr = this.query; qryStr = qryStr.replaceAll( "[\\n\\r]+"," " ); qryStr.trim( ); Query qry = hibsession.createQuery( qryStr ); rst = qry.list( ); qryReturnTypes = qry.getReturnTypes( ); } catch( Exception e ) { throw new OdaException( e.getLocalizedMessage( ) );

Chapter 25, Developing an ODA extension 733 } return new ResultSet( rst, getMetaData( ), qryReturnTypes ); }

■ close( ) The close( ) method clears the Connection and ResultSetMetaData objects. In the Connection object, the close( ) method closes the Hibernate session. Listing 25-46 shows the code for the Statement.close( ) method. Listing 25-46 The Statement.close( ) method

public void close( ) throws OdaException { connection = null; resultSetMetaData = null; mmaxRows = 0; }

ResultSet class The ResultSet class implements the IResultSet interface. When this class is instantiated, it stores the list.iterator( ) passed from the Statement object. It uses the iterator when the ODA driver framework calls the next( ) method. The iterator points to the next available row of data from the HQL query results. The framework calls the accessor methods that get the data types for the columns in the current row. For example, if the first column is a String, the framework calls getString( ). This method calls the getResult( ) method, which interprets the HQL query results. The getResult( ) method parses the results in two ways, depending on whether the query returns a Hibernate EntityType or just an array of values: ■ If the query uses HQL and each return type is an EntityType, getResult( ) gets each Column class and uses the Hibernate ClassMetaData methods to retrieve the value. ■ If the query returns standard data types, getResult( ) gets each value or values, returning an Object containing the simple value or an array of Objects containing the multiple values. Listing 25-47 shows the code for the getResult( ) method. Listing 25-47 The getResult( ) method

private Object getResult( int rstcol ) throws OdaException { Object obj = this.currentRow; Object value = null; try {

734 Integrating Applications into BIRT iHub if ( qryReturnTypes.length > 0 && qryReturnTypes[0].isEntityType( )) { String checkClass = (( ResultSetMetaData ) getMetaData( )).getColumnClass(rstcol); Object myVal = HibernateUtil.getHibernatePropVal( obj, checkClass, getMetaData( ).getColumnName( rstcol )); value = myVal; } else { if( getMetaData( ).getColumnCount( ) == 1) { value = obj; } else { Object[ ] values = ( Object[ ])obj; value = values[rstcol-1]; } } } catch( Exception e ) { throw new OdaException( e.getLocalizedMessage( ) ); } return( value ); }

HibernateUtil class HibernateUtil is a utility class that provides the run-time interface between the Hibernate service and the application. The HibernateUtil class example derives from the class provided with the Hibernate documentation. HibernateUtil performs the following operations: ■ Initializes the SessionFactory ■ Builds the Hibernate SessionFactory ■ Opens and closes a session ■ Returns information on Hibernate classes and properties ■ Registers the JDBC driver with the DriverManager Connection.open( ) calls HiberFnateUtil.constructSessionFactory( ), which creates a SessionFactory if one does not already exist. The constructSessionFactory( ) method closes and rebuilds the SessionFactory if the location of the configuration file or mapping files directory has changed.

Chapter 25, Developing an ODA extension 735 The SessionFactory construction process creates the ClassLoader. The ClassLoader adds the drivers directory in the org.eclipse.birt.report.data.oda .jdbc plug-in and the hibfiles directory in the Hibernate ODA plug-in to classpath. This process also registers the JDBC driver specified in the Hibernate config file with the DriverManager. The HibernateUtil class implements the following methods: ■ initSessionFactory( ) This method creates the SessionFactory object from the configuration settings in the hibernate.cfg.xml file. Listing 25-48 shows the code for the initSessionFactory( ) method. Listing 25-48 The initSessionFactory( ) method

private static synchronized void initSessionFactory( String hibfile, String mapdir ) throws HibernateException { if ( sessionFactory == null ) { Thread thread = Thread.currentThread( ); try { oldloader = thread.getContextClassLoader( ); refreshURLs( ); ClassLoader changeLoader = new URLClassLoader( ( URL [ ] )URLList.toArray( new URL[0]), thread.getContextClassLoader( )); thread.setContextClassLoader( changeLoader ); Configuration cfg = buildConfig( hibfile,mapdir ); Class driverClass = changeLoader.loadClass( cfg.getProperty( "connection.driver_class" )); Driver driver = ( Driver ) driverClass.newInstance( ); WrappedDriver wd = new WrappedDriver( driver, cfg.getProperty( "connection.driver_class" )); boolean foundDriver = false; Enumeration drivers = DriverManager.getDrivers( ); while ( drivers.hasMoreElements( )) { Driver nextDriver = ( Driver )drivers.nextElement( ); if ( nextDriver.getClass( ) == wd.getClass( )) { if ( nextDriver.toString( ).equals( wd.toString( )) ) { foundDriver = true;

736 Integrating Applications into BIRT iHub break; } } } if( !foundDriver ) { DriverManager.registerDriver( wd ); } sessionFactory = cfg.buildSessionFactory( ); configuration = cfg; HibernateMapDirectory = mapdir; HibernateConfigFile = hibfile; } catch( Exception e) { e.printStackTrace( ); throw new HibernateException( "No Session Factory Created " + e.getLocalizedMessage( )); } finally { thread.setContextClassLoader( oldloader ); } } }

■ constructSessionFactory This method checks to see if a configuration change occurred. If a change occurred, the method closes the session and SessionFactory and calls the initSessionFactory to rebuild the SessionFactory. Listing 25-49 shows the code for the constructSessionFactory( ) method. Listing 25-49 The constructSessionFactory( ) method

public static void constructSessionFactory( String hibfile, String mapdir ) throws HibernateException { if ( hibfile == null) { hibfile = ""; } if ( mapdir == null) { mapdir = ""; } if( sessionFactory == null)

Chapter 25, Developing an ODA extension 737 { initSessionFactory( hibfile, mapdir); return; } if( HibernateMapDirectory.equalsIgnoreCase( mapdir ) && HibernateConfigFile.equalsIgnoreCase( hibfile )) { return; } synchronized( sessionFactory ) { Session s = ( Session ) session.get( ); if ( s != null ) { closeSession( ); } if ( sessionFactory != null && !sessionFactory.isClosed( )) { closeFactory( ); } sessionFactory = null; initSessionFactory( hibfile, mapdir ); } }

■ currentSession( ) This method opens a session when called by the Connection.open( ) method, as shown in Listing 25-50. Listing 25-50 The currentSession( ) method

public static Session currentSession( ) throws HibernateException { Session s = ( Session ) session.get( ); if ( s == null ) { s = sessionFactory.openSession( ); session.set( s ); } return s; } Other methods in this class return information on a particular class and its properties. The getHibernateProp( ) method returns the class properties. The getHibernatePropTypes( ) method returns the data type for a class property.

738 Integrating Applications into BIRT iHub Building the Hibernate ODA driver plug-in To build and deploy the org.eclipse.birt.report.data.oda.hibernate plug-in using the Eclipse PDE Manifest Editor, perform the following tasks: ■ In Build, specify the build configuration to include the following items: ■ In Runtime Information, add the odahibernate.jar file. ■ In Build—Binary Build, select the following files and folders: ❏ META-INF ❏ exampleconfig ❏ hibfiles ❏ lib ❏ plugin.xml ■ In Overview, in Exporting, choose Export Wizard and perform the following tasks: ■ In Available Plug-ins and Fragments, select org.eclipse.birt.report .data.oda.hibernate. ■ In Options, verify that Package plug-ins as individual JAR archives is not selected. In Destination, choose the directory, \birt-runtime-4_3_1\Report Engine. The Hibernate ODA example uses MySQL as the database. The BIRT sample database and the MySQL installation scripts can be downloaded from http://www.eclipse.org/birt/db. For information about the required Hibernate libraries, please refer to the Hibernate website at http://www.hibernate.org. Developing the Hibernate ODA UI extension To use the data retrieved by the Hibernate ODA driver in a BIRT report design, you must extend the DTP design user interface. To implement the Hibernate ODA user interface, you extend the following extension points: ■ org.eclipse.datatools.connectivity.oda.design.ui.dataSource The dataSource extension point defines and implements the user interface for new data source and data set wizards. These wizards use the Hibernate ODA driver plug-in to extend the functionality available in the Data Explorer of BIRT Report Designer. ■ org.eclipse.ui.propertyPages The propertyPages extension displays and manipulates the Hibernate configuration file and mapping files directory locations.

Chapter 25, Developing an ODA extension 739 ■ org.eclipse.datatools.connectivity.connectionProfile The connectionProfile extension shares a data source connection between applications. To start developing the Hibernate ODA user interface plug-in, create the plug-in project, org.eclipse.birt.report.data.oda.hibernate.ui.

How to create the Hibernate ODA user interface plug-in project 1 From the Eclipse menu, choose File➛New➛Project. 2 On New Project—Select a wizard, open Business Intelligence and Reporting Tools and select ODA Designer Plug-in Project. Choose Next. 3 In Plug-in Project, apply the settings shown in Table 25-16. Choose Next. Table 25-16 Settings for the Hibernate ODA UI plug-in project options Section Option Value Plug-in Project Project name org.eclipse.birt.report.data .oda.hibernate.ui Use default location Selected Location Not available when you select Use default location Project Setting Create a Java project Selected Source folder name src Output folder name bin Target Platform Eclipse version 3.5 or greater OSGi framework Deselected Working Sets Add project to working Not selected sets

4 In Plug-in Content, apply the settings shown in Table 25-17. Choose Finish. Table 25-17 Settings for the Hibernate ODA UI plug-in content options Section Option Value Properties ID org.eclipse.birt.report.data .oda.hibernate.ui Version 2.0.0 Name BIRT Hibernate User Interface Plug-in Vendor yourCompany.com or leave blank

740 Integrating Applications into BIRT iHub Table 25-17 Settings for the Hibernate ODA UI plug-in content options Section Option Value Properties Execution Environment JavaSE-1.6 (continued) Options Generate an activator, a Selected Java class that controls the plug-in’s life cycle Activator org.eclipse.birt.report.data .oda.hibernate.ui.Activator This plug-in will make Selected contributions to the UI Enable API Analysis Deselected Rich Client Would you like to create a No Application 3.x rich client application?

5 In Templates, choose ODA Data Source Designer. Choose Next. 6 In ODA Data Source Designer, specify new values for the following options used to generate the Hibernate ODA user interface plug-in, as shown in Table 25-18. Choose Finish. Table 25-18 Settings for the Hibernate ODA data source designer options Option Value Java Package Name org.eclipse.birt.report.data.oda.hibernate.ui ODA Runtime Driver org.eclipse.birt.report.data.oda.hibernate Plug-in Id ODA Runtime Data Source org.eclipse.birt.report.data.oda.hibernate Element Id ODA Runtime Driver Class org.eclipse.birt.report.data.oda.hibernate .Driver ODA Runtime Data Set org.eclipse.birt.report.data.oda.hibernate Element Id .dataSet Data Source Display Name ODA Hibernate File Designer Data Source Data Set Display Name ODA Hibernate File Designer Data Set

The Hibernate ODA user interface plug-in project appears.

How to specify the Hibernate ODA user interface dependencies On the Eclipse PDE Manifest Editor, in Dependencies, specify the required plug-ins in the following order:

Chapter 25, Developing an ODA extension 741 ■ org.eclipse.core.runtime ■ org.eclipse.ui ■ org.eclipse.datatools.connectivity.oda.design.ui ■ org.eclipse.birt.report.data.oda.hibernate

How to specify the Hibernate ODA user interface run time In Runtime, in Exported Packages, add org.eclipse.birt.report.oda.hibernate.ui to the list of packages that this plug-in exposes to clients.

How to specify the Hibernate ODA user interface extensions 1 Check to ensure that the following extensions have been defined: ■ org.eclipse.datatools.connectivity.oda.design.ui.dataSource ■ org.eclipse.ui.propertyPages ■ org.eclipse.datatools.connectivity.connectionProfile 2 In Extensions, select the extension point, org.eclipse.datatools.connectivity .oda.design.ui.dataSource, and add the following elements and element details: ■ dataSourceUI extension element details for the newDataSourceWizard extension element, as shown in Table 25-19. Table 25-19 Property settings for the Hibernate newDataSourceWizard extension element Property Value pageClass org.eclipse.birt.report.data.oda.hibernate .ui.HibernateDataSourceWizard windowTitle Hibernate Data Source includesProgressMonitor false pageTitle Hibernate Data Source

■ dataSetUI extension element details, as shown in Table 25-20. Table 25-20 Property settings for the Hibernate dataSetUI extension element Property Value id org.eclipse.birt.report.data.oda.hibernate .dataSet initialPageId org.eclipse.birt.report.data.oda.hibernate .ui.HibernatePage

742 Integrating Applications into BIRT iHub Table 25-20 Property settings for the Hibernate dataSetUI extension element Property Value supportsInParameters true supportsOutParameters false

3 In Extensions, select dataSetUI, and add the following properties and element details: ■ dataSetWizard, as shown in Table 25-21 Table 25-21 Property settings for the Hibernate dataSetWizard extension element Property Value class org.eclipse.datatools.connectivity.oda .design.ui.wizards.DataSetWizard windowTitle Hibernate Data Set

■ dataSetPage, as shown in Table 25-22 Table 25-22 Property settings for the Hibernate dataSetPage extension element Property Value id org.eclipse.birt.report.data.oda.hibernate .ui.HibernatePage wizardPageClass org.eclipse.birt.report.data.oda.hibernate .ui.HibernateHqlSelectionPage displayName Enter HQL path /

4 In Extensions, select org.eclipse.ui.propertyPages, and add the ODA Hibernate Data Source Connection Properties (page) property and extension element details, as shown in Table 25-23. Table 25-23 Property settings for the Hibernate page extension element Property Value id org.eclipse.birt.report.data.oda.hibernate (continues)

Chapter 25, Developing an ODA extension 743 Table 25-23 Property settings for the Hibernate page extension element (continued) Property Value name ODA Hibernate Data Source Connection Properties class org.eclipse.birt.report.data.oda.hibernate.ui .HibernatePropertyPage objectClass org.eclipse.datatools.connectivity .IConnectionProfile

5 In Extensions, select ODA Hibernate Data Source Connection Properties (page), and add the filter property and extension element details, as shown in Table 25-24. Table 25-24 Property settings for the Hibernate filter extension element Property Value name org.eclipse.datatools.profile.property.id value org.eclipse.birt.report.data.oda.hibernate

6 In Extensions, select org.eclipse.datatools.connectivity.connectionProfile, and add the following properties and element details: ■ category, as shown in Table 25-25 Table 25-25 Property settings for the Hibernate category extension element Property Value id org.eclipse.birt.report.data.oda.hibernate parentCategory org.eclipse.datatools.connectivity.oda .profileCategory name Hibernate Data Source

■ connectionProfile, as shown in Table 25-26 Table 25-26 Property settings for the Hibernate connectionProfile extension element Property Value id org.eclipse.birt.report.data.oda.hibernate category org.eclipse.birt.report.data.oda.hibernate

744 Integrating Applications into BIRT iHub Table 25-26 Property settings for the Hibernate connectionProfile extension element Property Value name ODA Hibernate Data Source Connection Profile pingFactory org.eclipse.datatoools.connectivity.oda .profile.OdaConnectionFactory

■ connectionFactory, as shown in Table 25-27 Table 25-27 Property settings for the Hibernate connectionFactory extension element Property Value id org.eclipse.datatools.connectivity.oda .IConnection class org.eclipse.datatools.connectivity.oda .profile.OdaConnectionFactory profile org.eclipse.birt.report.data.oda.hibernate name ODA Connection Factory

■ newWizard, as shown in Table 25-28 Table 25-28 Property settings for the Hibernate newWizard extension element Property Value id org.eclipse.birt.report.data.oda.hibernate name ODA Hibernate Data Source class org.eclipse.datatools.connectivity.oda .design.ui.wizards.NewDataSourceWizard profile org.eclipse.birt.report.data.oda.hibernate description Create an ODA Hibernate connection profile

The completed extension definitions appear as shown in Figure 25-22.

Chapter 25, Developing an ODA extension 745 Figure 25-22 Extensions for the Hibernate ODA UI The sample Hibernate ODA UI extension The following sections describe the code-based extensions a developer must make to complete the development of the Hibernate ODA user interface extension, after defining the plug-in framework in the Eclipse PDE. The Hibernate ODA user interface plug-in implements the following classes: ■ HibernatePropertyPage Creates and initializes the editor controls for the property page that specify the ODA data source. This class updates the connection profile properties with the values collected from the page. HibernatePropertyPage extends org.eclipse .datatools.connectivity.oda.design.ui.wizards.DataSourceEditorPage, the abstract base class for implementing a customized ODA data source property page. ■ HibernatePageHelper Implements the user interface that specifies data source properties. This utility class specifies the page layout, sets up the controls that listen for user input, verifies the location of the Hibernate configuration file, and sets up the location of the mapping directory. The HibernateDataSourceWizard and HibernatePropertyPage classes use HibernatePageHelper. ■ HibernateDataSourceWizard Creates and initializes the controls for the data source wizard page. The class sets the configuration file message and collects the property values. In the extension element settings for newDataSourceWizard, the pageClass property specifies this class as the implementation class for the dataSourceUI wizard. The HibernateDataSourceWizard class extends org.eclipse.datatools

746 Integrating Applications into BIRT iHub .connectivity.oda.design.ui.wizards.DataSourceWizardPage, the abstract base class for implementing a customized ODA data source wizard page. ■ HibernateHqlSelectionPage Creates the user interface that specifies an HQL statement. The Hibernate ODA user interface plug-in calls HibernateHqlSelectionPage when creating or modifying the data set for a data source. In the extension element settings for dataSetPage, the wizardPageClass property specifies this class as the implementation class for the dataSetUI page wizard. HibernateHqlSelectionPage also extends org.eclipse.datatools .connectivity.oda.design.ui.wizards.DataSourceWizardPage. ■ Messages This class and the related properties file, messages.properties, generate the messages displayed in the Hibernate ODA user interface.

HibernatePageHelper class This class creates the components that select the Hibernate configuration file and a mapping files directory using the following methods: ■ createCustomControl( ) Builds the user interface for the data source ■ initCustomControl( ) Sets the initial property values ■ collectCustomProperties( ) Returns the modified properties to the ODA framework When the data source page displays, the Finish button becomes available when the setPageComplete( ) method indicates the page is complete. HibernateDataSourceWizard.createPageCustomControl( ) and HibernatePropertyPage.createAndInitCustomControl( ) call HibernatePageHelper. The createCustomControl( ) method is the entry point for this class. Listing 25-51 shows the code for the createCustomControl( ) method. Listing 25-51 The createCustomControl( ) method void createCustomControl( Composite parent ) { Composite content = new Composite( parent, SWT.NULL ); GridLayout layout = new GridLayout( 3, false ); content.setLayout(layout); setupConfigLocation( content ); setupMapLocation( content );

Chapter 25, Developing an ODA extension 747 The setupConfigLocation( ) method sets up the configuration file location. The setupMapLocation( ) method sets up the mapping folder. These two methods perform similar tasks. Listing 25-52 shows the code for the setupConfigLocation( ) method. This method adds a label, a text entry component, and a button. The text entry component has a ModifyListener( ) method, which verifies that the file selected exists, and the button has a SelectionAdapter( ) method, which uses the FileDialog( ) method to access the configuration file. Listing 25-52 The setupConfigLocation( ) method

private void setupConfigLocation( Composite composite ) { Label label = new Label( composite, SWT.NONE ); label.setText("Select Hibernate Config File" ); GridData data = new GridData( GridData.FILL_HORIZONTAL ); m_configLocation = new Text( composite, SWT.BORDER ); m_configLocation.setLayoutData( data ); setPageComplete( true ); m_configLocation.addModifyListener( new ModifyListener( ) { public void modifyText( ModifyEvent e ) { verifyConfigLocation( ); } ); m_browseConfigButton = new Button( composite, SWT.NONE ); m_browseConfigButton.setText( "..." ); m_browseConfigButton.addSelectionListener( new SelectionAdapter( ) { public void widgetSelected( SelectionEvent e ) { FileDialog dialog = new FileDialog( m_configLocation.getShell( ) ); if ( m_configLocation.getText( ) != null && m_configLocation.getText( ).trim( ).length( ) > 0 ) { dialog.setFilterPath( m_configLocation.getText() ); } dialog.setText( "Select Hibernate Config File" ); String selectedLocation = dialog.open( ); if( selectedLocation != null ) { m_configLocation.setText( selectedLocation ); }

748 Integrating Applications into BIRT iHub } } ); } The initCustomControl( ) method initializes the properties settings. The plug-in passes the properties to the method from the createPageCustomControl( ) and setInitialProperties( ) methods of the HibernateDataSourceWizard class and the createAndInitCustomControl( ) method of the HibernatePropertyPage class. The initCustomControl( ) method retrieves the properties for the Hibernate configuration file and mapping files directory and sets text component values. Listing 25-53 shows the code for the initCustomControl( ) method. Listing 25-53 The initCustomControl( ) method void initCustomControl( Properties profileProps ) { setPageComplete( true ); setMessage( DEFAULT_MESSAGE, IMessageProvider.NONE ); if ( profileProps == null || profileProps.isEmpty() || m_configLocation == null ) { return; } String configPath = profileProps.getProperty( "HIBCONFIG" ); if ( configPath == null ) { configPath = EMPTY_STRING; } m_configLocation.setText( configPath ); String mapPath = profileProps.getProperty( "MAPDIR" ); if ( mapPath == null ) { mapPath = EMPTY_STRING; } m_mapLocation.setText( mapPath ); verifyConfigLocation( ); } When the user presses the Finish or Test Connection button, the plug-in calls the collectCustomProperties( ) method to retrieve the new values for the Hibernate configuration file and mapping files directory. The HibernateDataSourceWizard and HibernatePropertyPage classes call the HibernatePageHelper.collectCustomProperties( ) method from their collectCustomProperties( ) methods.

Chapter 25, Developing an ODA extension 749 Listing 25-54 shows the code for the collectCustomProperties( ) method. Listing 25-54 The collectCustomProperties( ) method

Properties collectCustomProperties( Properties props ) { if( props == null ) { props = new Properties( ); } props.setProperty( "HIBCONFIG", getConfig( ) ); props.setProperty( "MAPDIR", getMapDir( ) ); return props; }

HibernateDataSourceWizard class The HibernateDataSourceWizard class extends the DTP DataSourceWizardPage by implementing three methods that the ODA framework calls: ■ createPageCustomControl( ) Constructs the user interface ■ setInitialProperties( ) Sets the initial values of the user interface ■ collectCustomProperties( ) Retrieve the modified values This class creates the HibernatePageHelper class, and uses the methods described earlier to handle these three methods. The ODA framework uses this class to create a new data source.

HibernatePropertyPage class The HibernatePropertyPage class extends the DTP DataSourceEditorPage by implementing two methods that the ODA framework calls: ■ createAndInitCustomControl( ) Constructs the user interface and sets the initial values ■ collectCustomProperties( ) Retrieves the modified values This class creates the HibernatePageHelper class and uses the methods described earlier to handle these two methods. The ODA framework uses this class to create a new data source.

750 Integrating Applications into BIRT iHub HibernateHqlSelectionPage class The HibernateHqlSelectionPage class extends DataSetWizardPage to define the page controls and related functionality for the Hibernate ODA data set wizard. HibernateHqlSelectionPage allows the user to create an HQL statement that selects the data set and embeds the HQL statement in the report design. This page links to the Hibernate ODA through the wizardPageClass attribute of the dataSetPage element within the dataSource extension. The HibernateHqlSelectionPage class implements the following methods: ■ createPageControl( ) This method performs the following operations: ■ Sets up a composite set of controls using a series of GridLayout and GridData objects to create the data set editor user interface ■ Sets the user prompt to enter an HQL statement and verify the query ■ Adds a text control to allow the user to enter and modify text ■ Adds a ModifyListener to the text control to detect user input ■ Sets up the Verify Query button and adds a SelectionListener to detect when the user selects the button ■ Returns the composite page control Listing 25-55 shows the code for the createPageControl( ) method. Listing 25-55 The createPageControl( ) method

public Control createPageControl( Composite parent ) { Composite composite = new Composite( parent, SWT.NONE ); GridLayout layout = new GridLayout( ); layout.numColumns = 1; composite.setLayout( layout ); Label label = new Label( composite, SWT.NONE ); label.setText( Messages.getString( "wizard.title.selectColumns" )); GridData data = new GridData( GridData.FILL_BOTH ); queryText = new Text( composite,SWT.MULTI | SWT.WRAP | SWT.V_SCROLL ); queryText.setLayoutData( data ); queryText.addModifyListener( new ModifyListener( ) { public void modifyText( ModifyEvent e ) { if( m_initialized == false)

Chapter 25, Developing an ODA extension 751 { setPageComplete(true); m_initialized = true; } else { setPageComplete(false); } } } ); setPageComplete( false ); Composite cBottom = new Composite( composite, SWT.NONE ); cBottom.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); cBottom.setLayout( new RowLayout( ) ); queryButton = new Button( cBottom, SWT.NONE ); queryButton.setText( Messages.getString( "wizard.title.verify" )); queryButton.addSelectionListener( new SelectionAdapter( ) { public void widgetSelected( SelectionEvent event ) { verifyQuery( ); } } ); return composite; }

■ initializeControl( ) The plug-in calls this method to retrieve the HQL query from the current design and initializes the HQL text component with this value. initializeControl( ) also reads the Hibernate configuration file and mapping files directory from the report design and stores them in member variables for use when building a query. Listing 25-56 shows the code for the initializeControl( ) method. Listing 25-56 The initializeControl( ) method

private void initializeControl( ) { Properties dataSourceProps = getInitializationDesign( ) .getDataSourceDesign( ).getPublicProperties( ); m_hibconfig = dataSourceProps.getProperty( "HIBCONFIG" ); m_mapdir = dataSourceProps.getProperty( "MAPDIR" );

752 Integrating Applications into BIRT iHub DataSetDesign dataSetDesign = getInitializationDesign( ); if ( dataSetDesign == null ) { return; } String queryTextTmp = dataSetDesign.getQueryText( ); if ( queryTextTmp == null ) { return; } queryText.setText( queryTextTmp ); this.m_initialized = false; setMessage( "", NONE ); }

■ verifyQuery( ) This method is the selection event called when the user chooses the Verify Query button. verifyQuery performs the following operations: ■ Opens a connection to the run-time environment. ■ Instantiates a Query object and gets the query text entered by the user. ■ Prepares the query. ■ Checks the column to determine if the query prepare was successful. Depending on the success of the query prepare, verifyQuery( ) indicates that page processing is complete or incomplete. ■ Re-enables the Verify Query button. ■ Closes the connection. Listing 25-57 shows the code for the verifyQuery( ) method. Listing 25-57 The verifyQuery( ) method

boolean verifyQuery( ) { setMessage( "Verifying Query", INFORMATION ); setPageComplete( false ); queryButton.setEnabled( false ); Connection conn = new Connection( ); try { Properties prop = new Properties( ); if ( m_hibconfig == null) { m_hibconfig = ""; }

Chapter 25, Developing an ODA extension 753 if ( m_mapdir == null) { m_mapdir = ""; } prop.put("HIBCONFIG", m_hibconfig ); prop.put("MAPDIR", m_mapdir); conn.open( prop ); IQuery query = conn.newQuery( "" ); query.prepare( queryText.getText( ) ); int columnCount = query.getMetaData( ).getColumnCount( ); if ( columnCount == 0 ) { setPageComplete( false ); return false; } setPageComplete( true ); return true; } catch ( OdaException e ) { System.out.println( e.getMessage( ) ); setMessage( e.getLocalizedMessage( ), ERROR ); setPageComplete( false ); return false } catch ( Exception e ) { System.out.println( e.getMessage( ) ); setMessage( e.getLocalizedMessage( ), ERROR ); setPageComplete( false ); return false; } finally { try { queryButton.setEnabled( true ); conn.close( ); } catch ( OdaException e ) { System.out.println( e.getMessage( ) ); setMessage( e.getLocalizedMessage( ), ERROR ); setPageComplete( false ); return false; } } }

754 Integrating Applications into BIRT iHub ■ savePage( ) The savePage( ) method is called when the ODA framework calls the collectDataSetDesign( ) method. This action occurs when the user presses the Finish button on the new data set wizard or the OK button on the data set editor is pressed. The savePage( ) method saves the query to the report, as shown in Listing 25-58. Listing 25-58 The savePage( ) method

private boolean savePage( ) { IConnection conn = null; try { IDriver hqDriver = new HibernateDriver( ); conn = hqDriver.getConnection( null ); IResultSetMetaData metadata = getResultSetMetaData( dataSetDesign.getQueryText( ), conn ); setResultSetMetaData( dataSetDesign, metadata ); } catch( OdaException e ) { dataSetDesign.setResultSets( null ); } finally { closeConnection( conn ); } }

■ getResultSetMetaData( ) The savePage( ) method calls the getResultSetMetaData( ) method when saving the report design. This method retrieves the query metadata that setResultSetMetaData( ) uses to create the data set columns. Listing 25-59 shows the code for the getResultSetMetaData( ) method. Listing 25-59 The getResultSetMetaData( ) method

private IResultSetMetaData getResultSetMetaData( String queryText, IConnection conn ) throws OdaException { java.util.Properties prop = new java.util.Properties( ); if ( m_hibconfig == null) { m_hibconfig = ""; } if ( m_mapdir == null) { m_mapdir = ""; }

Chapter 25, Developing an ODA extension 755 prop.put( "HIBCONFIG", m_hibconfig ); prop.put( "MAPDIR", m_mapdir ); conn.open( prop ); IQuery query = conn.newQuery( null ); query.prepare( queryText ); return query.getMetaData( ); }

■ setResultSetMetaData( ) The savePage( ) method calls the setResultSetMetaData( ) method when saving the report design. This method uses the DataSetDesign and the ResultSetMetaData objects for the query to create the columns in the data set for use in the report design. Listing 25-60 shows the code for the setResultSetMetaData( ) method. Listing 25-60 The setResultSetMetaData( ) method

private void setResultSetMetaData( DataSetDesign dataSetDesign, IResultSetMetaData md ) throws OdaException { ResultSetColumns columns = DesignSessionUtil.toResultSetColumnsDesign( md ); ResultSetDefinition resultSetDefn = DesignFactory.eINSTANCE.createResultSetDefinition( ); resultSetDefn.setResultSetColumns( columns ); dataSetDesign.setPrimaryResultSet( resultSetDefn ); dataSetDesign.getResultSets().setDerivedMetaData( true ); }

■ collectDataSetDesign( ) The plug-in calls this method when creating or modifying the query finishes. The plug-in passes the current design to this method. collectDataSetDesign( ) then verifies that a query exists and sets the design query to the value of the query text. The savePage( ) method saves the design and creates the columns in the data set. Listing 25-61 shows the code for the collectDataSetDesign( ) method. Listing 25-61 The collectDataSetDesign( ) method

protected DataSetDesign collectDataSetDesign( DataSetDesign design ) { if ( ! hasValidData( ) ) { return design; }

756 Integrating Applications into BIRT iHub design.setQueryText( queryText.getText( ) ); savePage( design ); return design; }

Building the Hibernate ODA user interface plug-in To build the org.eclipse.birt.report.data.oda.hibernate.ui plug-in using the Eclipse PDE Manifest Editor, perform the following tasks. In Build, specify the build configuration to include the following items: ■ In Runtime Information, add the file name hibernateodaui.jar, and specify at least one folder to compile into the library. ■ In Binary Build, select the following files and folders: ■ META-INF ■ plugin.xml Build Configuration appears, as shown in Figure 25-23.

Figure 25-23 Build configuration settings Testing the Hibernate ODA user interface plug-in To test the Hibernate ODA user interface plug-in, after exporting it, use a run-time configuration of the Eclipse PDE Workbench.

How to launch the Hibernate ODA user interface plug-in 1 From the Eclipse SDK menu, choose Run➛Run Configurations. In Run Configurations, right-click Eclipse Application. Choose New.

Chapter 25, Developing an ODA extension 757 2 Create a configuration to launch an Eclipse application. 1 In Name, type: Hibernate ODA Test 2 In Main, in Location, type: C:\Test\Hibernate Run Configurations appears as shown in Figure 25-24.

Figure 25-24 Creating a configuration to launch an Eclipse application 3 Choose the Arguments tab. Ensure the following arguments are entered: ■ Program arguments: -os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog

■ VM arguments: -Dosgi.requiredJavaVersion=1.6 -Xms40m -Xmx512m -XX:MaxPermSize=256M

758 Integrating Applications into BIRT iHub 4 Add the Hibernate ODA plug-ins to the launch configuration. 1 In Run Configurations, choose the Plug-ins tab. 2 In Launch with, from the drop-down list, select: plug-ins selected below only 3 In Plug-ins, check the following plug-ins: org.eclipse.birt.data.oda.hibernate org.eclipse.birt.data.oda.hibernate.ui 5 Choose Run to launch the run-time workbench.

How to specify a data source and data set 1 In the run-time workbench, choose the Report Design perspective. 2 In Report Design, create a new report project and a new blank report. 3 In Report Design, choose Data➛New Data Source. In New Data Source, choose Create from a data source type in the following list, and select Hibernate Data Source as the data source type, as shown in Figure 25-25. Choose Next.

Figure 25-25 Selecting Hibernate Data Source Hibernate Data Source appears. 4 In Hibernate Data Source, select the Hibernate configuration file and mapping directory or leave these items blank if you use the hibfiles directory, as shown in Figure 25-26. Choose Finish.

Chapter 25, Developing an ODA extension 759 Figure 25-26 Configuring the Hibernate data source Data Explorer displays the new data source in Data Sources. 5 In Report Design, choose Data➛New Data Set➛New Data Set. New Data Set appears, as shown in Figure 25-27.

Figure 25-27 New Data Set Choose Next. Hibernate Data Set appears. 6 In Edit Data Set, perform the following tasks: 1 In Enter HQL and verify query, type: select ord.orderNumber, cus.customerNumber, cus.customerName from Orders as ord, Customer as cus where ord.customerNumber = cus.customerNumber and cus.customerNumber = 363 Edit Data Set displays the query, as shown in Figure 25-28.

760 Integrating Applications into BIRT iHub Figure 25-28 Editing the HQL query 2 Choose Verify Query. 3 Choose Finish. Edit Data Set appears. 4 Choose Preview Results. Preview Results appears as shown in Figure 25-29.

Figure 25-29 Previewing the data set Choose OK. 7 In Data Explorer, expand Data Sets and Data Set. The new data set lists three columns, as shown in Figure 25-30.

Figure 25-30 Data Set in Data Explorer

Chapter 25, Developing an ODA extension 761 8 To build a report that uses the data set, perform the following tasks: 1 In Data Explorer, drag Data Set to the layout editor. The layout appears, as shown in Figure 25-31.

Figure 25-31 Report design in the layout editor 2 To view the output for the report design, choose Run➛View Report ➛In Web Viewer. The report appears, as shown in Figure 25-32.

Figure 25-32 Preview of the report design

762 Integrating Applications into BIRT iHub Chapter 26

Chapter 26Developing a data extraction extension

This chapter contains the following topics: ■ Understanding a data extraction extension ■ Developing an XML data extraction extension

Chapter 26, Developing a data extraction extension 763 Understanding a data extraction extension BIRT Report Engine provides a data extraction extension point that supports developing a new plug-in for exporting report data to a custom format. The BIRT user interface also provides a built-in data extraction feature that can export data from a report document in CSV format. This functionality is available in the BIRT Web Viewer. The Data Export feature is available in the BIRT Web Viewer toolbar, as shown in Figure 26-1. Export Data

Figure 26-1 BIRT Web Viewer toolbar The user can select the data columns for the export, the export format, the data encoding, and other properties using Export Data, as shown in Figure 26-2. A data extraction extension adds a plug-in to the BIRT Report Engine framework by implementing the extension point, org.eclipse.birt.report .engine.dataExtraction. The XML schema file, org.eclipse.birt.report.engine /schema/dataExtraction.exsd, describes this extension point.

764 Integrating Applications into BIRT iHub Figure 26-2 Export Data menu The data extraction extension point enables support for new output formats in the presentation engine. The BIRT plug-in registry uses this extension point to discover all supported output formats specified for the report engine environment. The Export Data menu lists the available formats in the Export format list. The XML data extraction extension in this chapter provides an example of how to create a data extraction extension. You can download the source code for the XML data extraction extension example at http://www.actuate.com/birt/contributions. For reference documentation, see the BIRT Report Engine API Javadoc in Eclipse help for the org.eclipse.birt.report.engine.dataextraction and org.eclipse.birt.report .engine.content packages.

Chapter 26, Developing a data extraction extension 765 Developing an XML data extraction extension The sample XML data extraction extension is a plug-in that can export BIRT report data in XML format. It is found in the Third Edition (published 2011): http://www.actuate.com/birt/contributions Typically, report developers render BIRT report data to XML to enable sharing data with another application. The XML data extraction extension extends the functionality defined by the org.eclipse.birt.report.engine.dataExtraction package, which is part of the org.eclipse.birt.report.engine.dataextraction plug-in. In the course of developing the XML data extraction extension, you perform the following tasks: ■ Create an XML data extraction extension project in the Eclipse PDE. ■ Define the dependencies. ■ Declare the plug-in extension point. ■ Implement the plug-in interfaces. ■ Test the extension. Creating an XML data extraction plug-in project Create a new plug-in project for the XML data extraction extension using the Eclipse PDE.

How to create the XML data extraction plug-in project 1 From the Eclipse PDE menu, choose File➛New➛Plug-in Project. 2 In Plug-in Project, modify the settings as shown in Table 26-1. Table 26-1 Settings for the XML data extraction plug-in project Section Option Value Plug-in Project Project name org.eclipse.birt.report.engine .dataextraction.xml Use default location Selected Location Not available when you select Use default location Project Settings Create a Java project Selected Source folder src Output folder bin

766 Integrating Applications into BIRT iHub Table 26-1 Settings for the XML data extraction plug-in project Section Option Value Target Platform Eclipse version 3.5 or greater OSGi framework Not selected Working Sets Add project to working Not selected sets

Plug-in Project appears as shown in Figure 26-3. Choose Next. Plug-in Content appears.

Figure 26-3 Specifying plug-in project settings 3 In Plug-in Content, modify the settings as shown in Table 26-2. Table 26-2 Settings for the XML data extraction plug-in content Section Option Value Plug-in ID org.eclipse.birt.report.engine Properties .dataextraction.xml Version 1.0.0.qualifier

Chapter 26, Developing a data extraction extension 767 Table 26-2 Settings for the XML data extraction plug-in content (continued) Section Option Value Name XML Data Extraction Plug-in Vendor yourCompany.com or leave blank Execution Environment JavaSE-1.7 Options Generate an activator, a Not selected Java class that controls the plug-in’s life cycle Activator Not selected (continues) This plug-in will make Not selected contributions to the UI Enable API Analysis Not selected Rich Client Would you like to create No Application a 3.x rich client application?

Plug-in Content appears as shown in Figure 26-4. Choose Finish.

Figure 26-4 Specifying plug-in content settings

768 Integrating Applications into BIRT iHub The XML data extraction extension project appears in the Eclipse PDE Workbench, as shown in Figure 26-5.

Figure 26-5 XML data extraction extension project Defining the dependencies for the XML data extraction extension To compile and run the XML data extraction example, specify the list of plug-ins that must be available on the classpath of the extension.

How to specify the dependencies 1 On PDE Manifest Editor, choose Overview. 2 In Plug-in Content, choose Dependencies. 3 In Required Plug-ins, choose Add. 4 In Plug-in Selection, hold down CTRL and select the following org.eclipse.birt.report.engine plug-ins:

Chapter 26, Developing a data extraction extension 769 ■ org.eclipse.birt.report.engine.dataextraction ■ org.eclipse.birt.report.engine ■ com.ibm.icu Choose OK. Dependencies appears as shown in Figure 26-6.

Figure 26-6 The Dependencies page Specifying the data extraction extension In this step, specify the extension point required to implement the XML data extraction extension and add the extension element details. The extension point, org.eclipse.birt.report.engine.dataExtraction, sets the following properties for the extension: ■ ID Optional identifier of the extension instance ■ Name Optional name of the extension instance The extension point defines how to create a new data extraction extension to extract data in a custom way. The extension point defines the following extension element properties: ■ id Optional identifier for the data extraction extension ■ format Supported format of this data extraction extension ■ class Java class, that implements the IDataExtractionExtension ■ mimeType MIME type of the supported file output format, such as XML ■ name Name of the extension

770 Integrating Applications into BIRT iHub ■ isHidden Used to determine whether format is shown in UI Use the Eclipse PDE to choose the extension point and provide the extension element details.

How to specify the extension 1 On PDE Manifest Editor, choose Extensions. 2 In All Extensions, choose Add. New Extension—Extension Point Selection appears. 3 In Extension Points, select the following extension point: org.eclipse.birt.report.engine.dataExtraction Use the Extension Point filter to narrow your search, as shown in Figure 26-7. Choose Finish. All Extensions lists the extension point, org.eclipse.birt.report.engine .dataExtraction. Extension Details contains the list of extension details specified in the XML schema file, dataExtraction.exsd.

Figure 26-7 Selecting the data extraction extension point

Chapter 26, Developing a data extraction extension 771 4 In All Extensions, choose the extension point, org.eclipse.birt.report .engine.dataExtraction. Extension Element Details appears. 5 In Extension Element Details, specify the properties for the data extraction extension element, as shown in Table 26-3. Table 26-3 Property values for the data extraction extension element Property Value id org.eclipse.birt.report.engine.dataextraction.xml format xml class org.eclipse.birt.report.engine.dataextraction.xml .XMLDataExtractionImpl mimeType xml name XML isHidden false

Extension Element Details appears as shown in Figure 26-8. The PDE Manifest Editor automatically updates plugin.xml.

Figure 26-8 Property values for the emitter extension The sample XML data extraction extension The sample XML data extraction extension example described in this chapter illustrates how to create a plug-in extension that converts all or part of report data to XML format. The XML data extraction extension example exports only the data selected in the export data menu to an output file. The export data feature is available in the BIRT Web Viewer. This extension example creates the XML output stream and sends the stream to the browser. Most browsers show the formatted XML directly. Some show a download message that prompts the user to view or save the XML output. This behavior depends on the browser and how it is configured to work with XML MIME type files. If the user changes the MIME type in the plug-in’s extension properties to text/plain, the browser displays the XML file instead of displaying a download message.

772 Integrating Applications into BIRT iHub Implementing the data extraction interfaces This section provides a general description of the code a developer must write to complete the development of an XML data extraction extension. The org.eclipse.birt.report.engine.api and org.eclipse.birt.report.engine .dataextraction plug-ins define the data extraction interfaces used to extract and format data to a specified format. The XML data extraction extension implements the following interfaces and classes: ■ org.eclipse.birt.report.engine.extension.IDataExtractionExtension Defines three methods to initialize the resources, output extracted data, and release allocated resources during the data extraction process. The purpose of the output method is to process the metadata in the result set and format the output in the desired format. Extending the implementation class of the interface DataExtractionExtensionBase instead of the interface itself is a recommended best practice. ■ org.eclipse.birt.report.engine.api.IExtractionResults Provides the API for retrieving metadata for the result set. ■ org.eclipse.birt.report.engine.api.IDataExtractionOption Defines the basic properties of the data extraction and related get and set methods. Basic properties include elements such as output format, output file, and output stream. ■ org.eclipse.birt.report.engine.dataextraction.ICommonDataExtractionOption Extends the IDataExtractionOption interface to define the basic properties and related get and set methods for a common data extraction plug-in. The XML data extraction extension uses this interface, since most of the properties defined for the common data extraction apply to the XML extraction as well. The implementation class for this interface is org.eclipse.birt.report.engine .dataextraction.impl.CommonDataExtractionImpl. The class provides utility methods that are initialized according to the data extraction options. The basic properties for the data extraction option are: ■ Output locale ■ Output time zone ■ Output encoding, such as UTF-8, UTF-16LE, or ISO-8859-1 ■ Output date format ■ Selected columns for export ■ Indicator of whether to export the columns data type ■ Indicator of whether to export the locale neutral format value ■ User-defined parameters

Chapter 26, Developing a data extraction extension 773 XML document format The implementation package for the XML data extraction extension, org.eclipse.birt.report.engine.dataextraction.xml, contains only the class XMLDataExtractionImpl.java. The XMLDataExtractionImpl extends org.eclipse.birt.report.engine .dataextraction.impl.CommonDataExtractionImpl class and implements private methods that create an XML document. The XML document schema contains the following elements: ■ encloses the other elements of the XML document. ■ Contents include information about the following report properties: ■ Full path and the report name. ■ Report locale for display. If the locale is null, the default is locale en_US, displaying American English. ■ Specifies an option in the Export Data user interface allowing users to select the encoding for exported report data. By default, the encoding is set to UTF-8. The text content of displays the selected encoding. ■ This tag includes all parameters passed in the URL used to run the report in the Web Viewer. These parameters are referred as user parameters, which are different from report parameters. These items appear in a comma-separated list. The exact number and values of the parameters depend on the report design and the environments in which the report runs. The user parameter names are self-documenting. The following list displays the commonest user parameters:

■ __asattachment ■ __resourceFolder ■ __cubememsize ■ __resultsetname ■ __dpi ■ __rtl ■ __exportdatatype ■ __selectedcolumn0 ■ __exportencoding ■ __selectedcolumn1 ■ __extractextension ■ __selectedcolumn2

774 Integrating Applications into BIRT iHub ■ __format ■ __selectedcolumnnumber ■ __locale ■ __sep=0 ■ __localeneutral ■ __sessionId ■ __masterpage ■ __svg ■ __report ■ __timezone

Users have the option to export data in a locale neutral format. Numbers are exported as neutral string values. Date format columns are exported in ISO8601 format, such as YYYY-MM-DD or YYYYMMDD, for example. ■ Lists the columns in the data row. Column type is an attribute of . This attribute is optional and appears in an XML document only if the user selects to export the data types in the Data Export dialog. ■ Contains the data for a single data row. Column names appear in tags around each column value. Listing 26-1 shows an example of an exported XML document. Listing 26-1 An exported XML document

C:\Test\XMLDataExtraction\XMLTest\new report.rptdesign English UTF-8 exportencoding=UTF-8, svg=false,_selectedcolumn1= CONTACTFIRSTNAME,_selectedcolumn2=PHONE,_rtl=false, extractextension=org.eclipse.birt.report.engine .dataextraction.xml, report=C:\Test\XMLDataExtraction \XMLTest\new_report.rptdesign, masterpage=true, sessionId=20131212_074641_765,1090400155=, format=html, asattachment=true, selectedcolumnnumber=3, localeneutral=false, sep=0, timezone=US/Pacific-New, locale=en_US, carriagereturn=false, cubememsize=10, exportdatatype=false, resultsetname=ELEMENT_9, selectedcolumn0=CUSTOMERNAME, dpi=96, resourceFolder= C:\Test\XMLDataExtraction\XMLTest

Chapter 26, Developing a data extraction extension 775 Atelier graphique Carine 40.32.2555 Signal Gift Stores Jean 7025551838 Australian Collectors, Co. Peter 03 9520 4555

XMLDataExtractionImpl class XMLDataExtractionImpl extends CommonDataExtractionImpl. The class uses private variables to store the output XML document, the output stream where the document streams as a string, and the properties of the report. These properties are exported in the tag of the output XML file. The variable declarations are shown in Listing 26-2. Listing 26-2 XML data extraction option variables

public class XMLDataExtractionImpl extends CommonDataExtractionImpl { public static final String PLUGIN_ID = "org.eclipse.birt.report.engine.dataextraction.xml"; public static final String DEFAULT_ENCODING = Charset.defaultCharset( ).name( ); private Document outDocument; private OutputStream outputStream; private String encoding; private String selectedColumnNames; private boolean isExportDataType; private boolean isLocaleNeutral; private Locale locale; private String reportName; private String userParameters; The XMLDataExtractionImpl class uses the Java API defined in the org.w3c.dom package for XML processing. Table 26-4 describes the exported properties variables.

776 Integrating Applications into BIRT iHub Table 26-4 Report properties variables Property Variable Description Report name reportName Name of BIRT report. Locale locale Locale in which the report runs. Encoding encoding Encoding used in report. User selects the value in the Export Data menu. Selected selectedColumnNames The columns selected for export. column names User pUserParameters Parameters passed in the Web parameters Viewer URL by the report engine. Export the isExportDataType Variable that defines whether to data types export the data type of the columns to the output XML document. User selects the value in the Export Data menu. Neutral locale isLocaleNeutral Variable that defines whether to use a neutral locale format for the data types columns. User defines the value in the Export Data menu.

The following XMLDataExtractionImpl methods set up and implement the data extraction: ■ initialize( ) Defined by the org.eclipse.birt.report.engine.extension .IDataExtractionExtension interface class. Initializes context and options objects and calls the private initXMLOptions( ) method to initialize local variables. Listing 26-3 shows the initialize( ) method. Listing 26-3 initialize( ) method

public void initialize( IReportContext context, IDataExtractionOption options ) throws BirtException { super.initialize( context, options ); initXMLOptions( options ); }

■ initXMLOptions( ) Called at the beginning of each data extraction to perform the following operations. Listing 26-4 shows the initXMLOptions( ) method. ■ Creates the output stream that writes the text contents of the report to the XML file.

Chapter 26, Developing a data extraction extension 777 ■ Obtains a reference to the CommonDataExtractionOption object xmlOption, containing accessor methods that get the IDataExtractionOption interface options for the plug-in. ■ Uses the data extraction API methods to initialize report property values, such as encoding, locale, iLocaleNeutral, selected columns, isExportDataType, user parameters, and report name. Listing 26-4 initXMLOptions( ) method

private void initXMLOptions( IDataExtractionOption options ) { outputStream = options.getOutputStream( ); CommonDataExtractionOption xmlOption; if ( options instanceof CommonDataExtractionOption ) { xmlOption = ( CommonDataExtractionOption )options; } else { xmlOption = ( CommonDataExtractionOption ) new CommonDataExtractionOption( options.getOptions( )); } encoding = xmlOption.getEncoding( ); if ( encoding == null || "".equals( encoding.trim( ))) { encoding = null; } else { encoding = encoding.trim( ); } if ( encoding == null ) { encoding = DEFAULT_ENCODING; } isLocaleNeutral = xmlOption.isLocaleNeutralFormat( ); locale = (Locale) xmlOption.getLocale( ); if ( locale == null ) { locale = Locale.getDefault( ); } selectedColumnNames = xmlOption.getSelectedColumns( ); isExportDataType = xmlOption.isExportDataType( ); Map pUserParameters = xmlOption.getUserParameters( ); userParameters = getUserParameters(pUserParameters); getReportName( pUserParameters ); }

778 Integrating Applications into BIRT iHub ■ getReportName( ) Called by the initXMLOptions( ) method to extract the report name and path from the user parameters. Listing 26-5 shows the getReportName( ) method. Listing 26-5 getReportName( ) method

private void getReportName( Map pUserParameters ) { Map uParameters = pUserParameters; \\ Iterate over the keys, values in the map if ( uParameters != null ) { java.util.Iterator it = null; for ( it = (java.util.Iterator) uParameters.keySet( ).iterator( ); ((java.util.Iterator) it).hasNext( ); ) { Object key = it.next( ); Object value = uParameters.get(key); if (key.toString( ).equalsIgnoreCase("__report")) { reportName = value.toString( ); } } } }

■ output( ) Interface method called to format the output stream for the data extraction. Uses the Document Object Model (DOM) component API to create the output XML document. The data set result set is passed to the output( ) method through the IExtractionResults results input parameter. The code iterates through the result set to extract the data for only the selected columns. At the end the code converts the XML document to a string and writes the string to the output stream. Listing 26-6 shows the output( ) method. Listing 26-6 output( ) method

public void output( IExtractionResults results ) throws BirtException { String[ ] columnNames = (String[ ]) selectedColumnNames; try { outDocument = createNewDocument ( );

Chapter 26, Developing a data extraction extension 779 } catch (Exception e) { e.printStackTrace(); } // Create root element of output XML document Element rootElement = outDocument.createElement( "Report" ); rootElement.appendChild( outDocument.createComment( "Extract report data in XML format" )); outDocument.appendChild( rootElement ); Element pRow = outDocument.createElement( "Properties" ); rootElement.appendChild( outDocument.createComment( "Lists the report properties, such as name, locale, encoding, user parameters" )); rootElement.appendChild( pRow ); Element nodeReportName = outDocument.createElement( "ReportName" ); nodeReportName.appendChild( outDocument.createTextNode( reportName )); pRow.appendChild( nodeReportName ); Element nodeLocale = outDocument.createElement( "Locale" ); nodeLocale.appendChild(outDocument.createTextNode( locale.getDisplayLanguage( ) )); pRow.appendChild( nodeLocale ); Element nodeEncoding = outDocument.createElement( "Encoding" ); nodeEncoding.appendChild( outDocument.createTextNode( encoding )); pRow.appendChild( nodeEncoding ); Element nodeParameters = outDocument.createElement( "Parameters" ); nodeParameters.appendChild( outDocument.createTextNode( userParameters )); pRow.appendChild(nodeParameters); try { // If selected columns are null or empty, // returns all columns if ( columnNames == null || columnNames.length <= 0 ) { int count = results.getResultMetaData( ).getColumnCount( ); columnNames = new String[ count ]; for ( int i = 0; i < count; i++ ) {

780 Integrating Applications into BIRT iHub String colName = results.getResultMetaData( ).getColumnName(i); columnNames[i] = colName; } } IDataIterator iData = null; if ( results != null ) { iData = results.nextResultIterator( ); if ( iData != null && columnNames.length > 0 ) { String[ ] values = new String[ columnNames.length ]; while ( iData.next( ) ) { Element row = outDocument.createElement( "Row" ); rootElement.appendChild( row ); for (int i = 0; i < columnNames.length; i++) { String columnName = results .getResultMetaData( ).getColumnName( i ); values[i] = getStringValue( iData.getValue( columnNames[i] ), isLocaleNeutral, locale ); Element node = outDocument.createElement( columnName ); node.appendChild( outDocument.createTextNode( values[i] )); row.appendChild( node ); } } } } if ( encoding != null && encoding.trim( ).length( ) > 0 ) { outputStream.write( serialize( outDocument ) .getBytes( encoding.trim( ))); } else { outputStream.write( serialize( outDocument ) .getBytes( )); } } catch ( Exception e ) { } }

Chapter 26, Developing a data extraction extension 781 ■ createNewDocument( ) Creates the new document. Listing 26-7 shows the createNewDocument( ) method. Listing 26-7 createNewDocument( ) method

private Document createNewDocument( ) throws Exception { try { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance( ); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder( ); Document document = documentBuilder.newDocument( ); return document; } catch (Exception e) { System.out.println( "error in createNewDocument" ); throw e; } }

■ serialize( ) Uses org.w3c.dom classes to serialize the document as a string. Listing 26-8 shows the serialize( ) method. Listing 26-8 serialize( ) method

public static String serialize(Document doc) throws IOException { String str = null; try { DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); DOMImplementationLS impl = ( DOMImplementationLS ) registry.getDOMImplementation("LS"); LSSerializer writer = impl.createLSSerializer(); str = writer.writeToString(doc); } catch (Exception e) { e.printStackTrace(); } return str; }

782 Integrating Applications into BIRT iHub Testing the XML data extraction plug-in You can run the new XML data extraction plug-in directly in BIRT Report Designer or programmatically when you run and render a report using the Web Viewer. This section describes how to test the XML data extraction plug-in in BIRT Report Designer.

How to launch the XML data extraction plug-in 1 From the Eclipse SDK menu, choose Run➛Run Configurations. In Run Configurations, right-click Eclipse Application. Choose New. 2 Create a configuration to launch an Eclipse application: 1 In Name, type: XMLDataExtraction 2 In Main, in Location, type: C:\Test\XMLDataExtraction Run Configurations appears as shown in Figure 26-9.

Figure 26-9 Creating the XMLDataExtraction run configuration 3 Choose the Arguments tab. Ensure the following arguments are entered:

Chapter 26, Developing a data extraction extension 783 ■ Program arguments: -os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog

■ VM arguments: -Dosgi.requiredJavaVersion=1.6 -Xms40m -Xmx512m -XX:MaxPermSize=256M 4 Choose the Plug-ins tab to select the list of plug-ins to launch with the run configuration. 5 In Launch with, from the drop-down list, select: plug-ins selected below only In Plug-ins, select the following plug-in, as shown in Figure 26-10: plug-ins selected below only

Figure 26-10 Selecting the XMLDataExtraction plug-in 6 Choose Run to launch the run-time Eclipse Workbench. A new instance of Eclipse opens up.

How to extract data from a BIRT report to XML format BIRT Report Designer discovers the new XML data extraction plug-in and displays the new XML format in the Export Data menu. 1 In the new Eclipse Workbench, open the BIRT Report Design perspective. 2 In BIRT Report Designer perspective, open a BIRT report. 3 Choose Run➛View Report➛In Web Viewer from the main menu.

784 Integrating Applications into BIRT iHub 4 In the Web Viewer, select Export Data from the viewer toolbar, as shown in Figure 26-11.

Export Data

Figure 26-11 Selecting the Export Data feature 5 In Export Data, choose the following options: 1 In Available Columns, press and select the columns to export. 2 Choose the arrow to move columns to the Selected Columns list. Use the double arrow to select and move all the columns in the data set. Use the up and down arrows to change the order in which the columns appear in the output file. 3 In Export format, select XML(*.xml) from the list. 4 Select Export column’s data type and Export column as locale neutral, as shown in Figure 26-12.

Figure 26-12 Setting the export data properties

Chapter 26, Developing a data extraction extension 785 5 Choose OK to start the export. Your browser may prompt you about how to handle the download. For example, Chrome shows a prompt at the bottom of the browser window, as shown in Figure 26-13.

Figure 26-13 Handling the exported XML data 6 Choose Keep or Save. 7 Open the saved XML file using any modern browser or XML editor. The structure of the file is similar to Listing 26-1. The report design XML code The XML file for the report design, new_report.rpdesign, contains the following source code settings, as specified in the report design: ■ Data sources, including the ODA plug-in extension ID, driver class, URL, and user ■ Data sets, including the ODA JDBC plug-in extension ID, result set properties, and query text ■ Page setup, including the page footer ■ Body, containing the table structure and properties for the bound data columns, including the header, footer, and detail rows The report design example specifies a data source that connects to org.eclipse.birt.report.data.oda.sampledb, the BIRT Classic Models, Inc. sample database. Listing 26-9 shows the XML source code for the report design used to test the XML data extraction example. Listing 26-9 The report design XML code

Eclipse BIRT Designer Version 4.3.1.v201309091055 Build <4.3.1.v20130917-1035> in /templates/blank_report.gif ltr 96

786 Integrating Applications into BIRT iHub contentBidiFormatStr ILYNN metadataBidiFormatStr ILYNN org.eclipse .birt.report.data.oda.sampledb.Driver jdbc:classicmodels:sampledb ClassicModels CUSTOMERNAME CUSTOMERNAME CUSTOMERNAME CONTACTFIRSTNAME CONTACTFIRSTNAME CONTACTFIRSTNAME PHONE PHONE PHONE

Chapter 26, Developing a data extraction extension 787 1 CUSTOMERNAME string 2 CONTACTFIRSTNAME string 3 PHONE string Data Source 1 CUSTOMERNAME CUSTOMERNAME string 12 2 CONTACTFIRSTNAME CONTACTFIRSTNAME string 12 3 PHONE PHONE string 12

788 Integrating Applications into BIRT iHub CLASSICMODELS.CUSTOMERS.CONTACTFIRSTNAME, CLASSICMODELS.CUSTOMERS.PHONE from CLASSICMODELS.CUSTOMERS]]> 2.0 CUSTOMERNAME 1 12 50 0 Nullable CUSTOMERNAME CUSTOMERNAME 50 CONTACTFIRSTNAME 2 12 50 0

Chapter 26, Developing a data extraction extension 789 Nullable CONTACTFIRSTNAME CONTACTFIRSTNAME 50 PHONE 3 12 50 0 Nullable PHONE PHONE 50 ]]>

790 Integrating Applications into BIRT iHub html new Date()]]>

Data Set CUSTOMERNAME CUSTOMERNAME dataSetRow["CUSTOMERNAME"] string CONTACTFIRSTNAME CONTACTFIRSTNAME dataSetRow["CONTACTFIRSTNAME"] string PHONE PHONE

Chapter 26, Developing a data extraction extension 791 dataSetRow["PHONE"] string

CUSTOMERNAME CONTACTFIRSTNAME

792 Integrating Applications into BIRT iHub PHONE

Chapter 26, Developing a data extraction extension 793 794 Integrating Applications into BIRT iHub Index

Symbols charts 128, 140 component libraries 13 _ (underscore) character 287, 452 custom data sources 673 , (comma) character 629, 631 dashboard gadgets 364 ; (semicolon) character 286, 452 data 35, 608 : (colon) character 286, 451, 491 data sets 120 ! (exclamation point) character 286, 451 data structures 114 ? (question mark) character 286, 452 design model objects 39 . (period) character 286, 452, 491 Eclipse PDE 513 ‚ (comma) character 286, 451 expression builder 610, 613 " (double quotation mark) character 286, 451 external classes 96 expressions and 609 external data sources 27, 673, 679 JavaScript code and 139 external objects 97 {} (curly brace) characters 487 HTML buttons 407 @ (at-sign) character 286, 451 HTML5 charts 363 * (asterisk) character 286, 451, 482 Information Console functionality 280, / (forward slash) character 286, 451 450 / (slash) character 491 Interactive Crosstabs 352 \ (backslash) character 139, 286, 451 Interactive Viewer 494 & (ampersand) character 286, 451 Java classes 21, 79, 227, 230 # (number sign) character 286, 451 JavaScript API 352 % (percent) character 286, 452 JavaScript API class libraries 352, 353 + (plus sign) character 286, 452 JDBC data sources 78 < (less than) character 286, 451 metadata 35 = (equals sign) character 286, 451 ODA data sources 672 > (greater than) character 286, 451 Online Archive Driver 262 $ (dollar sign) character 286, 451 plug-in extension examples 534 $$$ (file type) value 274 plug-ins 81, 208, 500 proxy objects 207 A report components 41, 42 AbstractPageGenerator class 601 report design elements 87 Accept directive 208 report design structures 72, 106 access control lists report designs 41, 106, 108 archiving 263 report documents 104 Permission property 287 report elements 72, 87, 106, 182, 363 access rights report items 72, 110, 111, 112 See also privileges report parameters 88, 89 accessing report properties 41 BIRT APIs 78 Report Studio 491 BIRT Javadoc files 78 report viewer 364 BIRT Viewer 494 reporting libraries 72 builders 592 reports 104, 362 chart themes 426 repository items 475

Index 795 accessing (continued) adding resource files 81, 108 archiving rules 262, 267, 268 resources 356 bookmarks 363 ROM schemas 20 charts to designs 142, 146, 164, 165 source code 352, 500 connection profiles 698 styles 42 context menus 595 web applications 473 custom drivers 11 web service applications 356 custom security adapters 226, 227–228, web services 196, 197, 202, 206 357 WSDL files 203 dashboards 365 accessing a report document 296 data cubes 437 accessToGrant parameter 484 data object data sources 181, 182 AcFilesFoldersFilter variable 476 data service components 393 AcFilesFoldersTypeFilter variable 476 data sets 183 ACL data sorters 442 file 314 data sources 693 files 312 display names. See display names folder 309 emitters 618 ACL files filters 422 See also access control lists folders 463 acLoad( ) function 335 HTML buttons 407 ACLs. See access control lists HTML5 charts 363 Acrobat Reader 104 interactive features 419, 440 ACS. See Caching service lists 27 Action Details window 421 master pages 99 action filters 699 ODA drivers 673 action handlers 100 ODA user interfaces 535, 673, 693, 700 action parameter 480 parameter components 380 actions 100, 453, 456 plug-ins (required) 518 performing 422 property editors 598 triggering 418 property pages 698 Activator class 726 report elements 40 activators 515 Report Explorer components 370 Active Directory servers 234 report item builder 592 actuate class 352, 354 report items 109, 119, 538 Actuate Java Components 355 report viewer components 358 actuate.initialize( ) JSAPI method 297 ROM elements 25, 26, 120 actuate.load( ) method 297 tables 27 actuate.RequestOptions object 297 update sites 531–533 actuate.Viewer class 296 upload security adapters 230, 231–232 ActuateAPI service 202, 294 URI parameters 286, 451, 452 ActuateSoapPort parameter 294 URL parameters 356 ActuateSoapSSLPort 294 web pages 352, 353 adapter classes 54 addMeasure function 439 adapter elements 548, 600 Administrate operations AddArchiveRules element 269 See also administration operations addDimension function 439 administration applications 196

796 Integrating Applications into BIRT iHub administrators iHub environment 170 See also administration operations application programming interfaces (APIs) archiving and 262, 267 See also Information Delivery API managing iHub System and 213 accessing 78 ageDays parameter archiving and 262, 268 execute report page 469 BIRT engines and 9 submit job page 484 BIRT extensions and 500 ageHours parameter charts and 126, 154 execute report page 469 data objects and 181 submit job page 484 developing with 30 aggregate data. See aggregation external data sources and 673 aggregate functions 53 extracting data and 773, 776, 779 aggregate functions. See aggregation ODA drivers and 672 functions rendering CSV output and 632, 638 aggregate package 53 rendering rotated text images and 576 aggregating data 11, 138 rendering XML output and 653 aggregation report designs and 14, 39, 79 building cross tabs and 434, 441 report engine and 32, 72 building data cubes and 436 report generators and 14 aggregation functions report item extensions and 539 adding totals and 441 reporting applications and 14 aging intervals 469, 484 application server plug-in 9 aging rules 262, 267 application servers 355, 356 aging rules. See archiving rules application services 354 AIS. See Integration service application/dime media type 208 AJAX POST request 304, 333 application/soap media type 208 All user group 288 applications 494 allowExpression property 548 accessing 473 allowsEmptyValueAsNull attribute 682 accessing BIRT APIs for 78 analyzing data 436 accessing report designs and 10, 72, 106, anchor property 133 108 annotation element 507 accessing report items and 107 annotations 507, 524 accessing report parameters and 88, 89 Apache Ant scripts 529 accessing structured content and 41, 72 Apache Axis environments 197, 200 building security 234 Apache Tomcat servers 9, 356 building user interfaces for. See user API package 72 interfaces api package 3, 30, 79 changing designs and 79 API Reference Javadoc 30 changing source code and 500 app.log file 292 compiling code for 184 appContext objects 171 configuring BIRT home for 80 appendToJobStatus method 174, 175 configuring logging environments for 86 appinfo attribute 507 connecting to external sources and 673, application context 97 679 application context objects 171 copying archives and 262 application context roots 300, 450 creating proxy objects for 206 application programming interfaces creating stand-alone 14

Index 797 applications (continued) execute report page 470 customizing 14, 500 submit job page 485 debugging 85 archiveconfig element 264 deploying 79, 82, 106, 224 ArchiveOnExpiration element 269 developing 30, 73, 75, 170 ArchiveOnExpire element 269 developing IDAPI. See IDAPI applications archivePolicy parameter developing RSSE. See RSSE applications execute report page 470 developing web. See web applications submit job page 485 displaying data and 393, 394, 436 ArchiveRoot parameter 263 displaying reports and 353, 358, 362, 380 ArchiveRule data type 217 establishing connections to 354, 356, 357 ArchiveRule element 270, 272 extracting subsets of data for 363 ArchiveRule objects generating formatted output and 102 See also archiving rules generating report designs and 9, 106 ArchiveRule operations 269 generating reports and 14, 31, 72, 79 ArchiveRuleInherited element 269 installing plug-ins for 75, 509 archives 262, 263 integrating with BIRT iHub 196, 197 ArchiveVolume element 266 integrating with Eclipse 4 archiving integrating with web services 197 access control lists 263 launching Eclipse 564 files 263, 267 loading class libraries from 352 archiving API 268 managing service 512 archiving operations providing security for 355–357 configuring driver for 262, 264, 266 rendering CSV output and 634, 637, 640 copying dependent files for 263 rendering HTML documents and 83, 84 developing 262, 268 rendering XML output and 652, 667 scheduling 269, 273 retrieving browser instance for 177 setting archiving rules for 267, 268, 270 retrieving volume names for 178 setting expiration policy for 267 running reports and 32 setting root folder for 263, 264 setting up platform context for 82 starting 274 sharing authentication information for 356 updating archiving rules for 271–273 sharing data and 766 archiving precedence 268 starting platforms and 84 archiving report objects 470, 485 applyFilter parameter 474, 476 archiving rules archive driver 262 changing 269, 272 archive files creating 262, 267, 268 See also jar files; war files getting 274 BIRT source code 502 inheriting 270, 272 plug-ins and 506, 526, 530 scheduling jobs and 270 archive policies 470, 485 setting default 270 archive rules. See archiving rules setting folder specific 270 archive service 266 updating 269, 271–273 archive service provider 266 archiving software 262 enabling 267 area charts 126, 128 archive settings 262 arguments. See command line arguments; ARCHIVE_DRIVER_JRE variable 267 parameters archiveBeforeDelete parameter array lists 90, 731

798 Integrating Applications into BIRT iHub arrays logging in to web services and 357 chart objects and 133 authentication identifier 298 class definitions and 21 authentication IDs 175, 455 JDBC data sources and 733 getting system 212 ODA result sets and 688, 689, 734 authentication information parameter entry boxes and 94 prompting for 355 viewer objects and 381 sharing 356 asynchronous operations 422 SOAP headers and 211 Attachment data type 217 unloading 357 attachments authentication token 298 setting HTTP version for 208 authexpired action 456 attribute declarations 197 AuthId 299, 300 attribute editor 525 authId 303, 304, 314, 335 attribute package 53, 59, 61 authId authentication token 297 attributes AuthId element See also properties SOAP headers and 212 action filters 699 AuthId header field 287 archiving files and 262 authId URL parameter 287 binding definitions and 201 authId variable 335 chart model classes and 53, 59 autoarchive policies 470, 485 chart utility classes and 70 autoarchiving 262 complex properties and 113 autoarchiving. See archiving operations data type definitions and 200 autobinding charting example 161 declaring class 524 AutoDataBindingViewer class 161 displaying 522, 524 axes properties 133 HTTP headers and 208 axes values 135, 137 plug-in extension points and 506, 510 Axis servers. See Apache Axis environments report item extensions and 507 axis types (cross tabs) report parameters and 88, 91 changing 441 ROM elements and 19, 21, 22 setting allowable values for 21 B SOAP requests and 214 B2B applications 653 testing chart 61 backslash (\) character 139 AUTH_ID_HEADER parameter 291 banner elements 474 authenticate function bar charts 126, 128 actuate class 355, 357 BarSeriesImpl class 136 security adapter 225, 227 base class 352 authentication 300 base URLs (hyperlinks) 100 accessing applications and 224, 357 base URLs (images) 84, 99 accessing corporate networks and 224 base-64 encoding 312 accessing external security systems beans. See JavaBeans and 234 BETWEEN operator 472 customizing 5, 224, 227 bidirectional text 99 issuing URIs and 454 binary builds 526, 528 loading resources and 356 binary files 13, 490, 494 logging in to Information Console binding data sets to charts 145 and 225, 226

Index 799 binding data sets to report items 122, 608, 610 blocks (charts) 128 binding definitions (WSDL) 201, 202 BMP formats 99 binding element 198, 201 bookmark parameter 393 BIRT 4 bookmarks 34, 87, 103 BIRT APIs 170, 181 creating 363 BIRT applications 5, 8 displaying report elements and 359, 393 BIRT components 4 returning table objects for 422 BIRT Data Analyzer. See Data Analyzer branching BIRT design files 213 from a parent resource 300 See also design files browse file page 453, 460, 462 BIRT Designer 406 browse page. See browse file page BIRT Designer Professional 437 browsefile action 456, 457 accessing iHub API and 171 browsers. See web browsers returning unexpected values 174 browsing 462 BIRT documentation 500 bubble charts 128 BIRT engine 171 BubbleDataSet interface 129 BIRT engines 5, 9 Build All command 529 BIRT extensions 14, 499, 500 Build Automatically command 529 BIRT home directory 80 Build Configuration page (PDE Editor) 526 BIRT home property 80 Build page (PDE Editor) 517, 526 BIRT iHub. See iHub System build paths 78, 171 BIRT packages 30 build.properties file 506, 517, 529 BIRT RCP Report Designer Build.properties page (PDE Editor) 517 compared to BIRT Report Designer 8 build scripts 529 BIRT Report Designer build settings 517, 526 building report designs and 4, 8 build.xml 529 changing source code for 500 buildDesignList function 333 compared to BIRT RCP Designer 8 builder element 546 extending functionality of 11 builders 592, 595, 610 generating reports and 79 buildFolderItemsList( ) function 320 installing 501 building integrating with ODA drivers 11, 673 BIRT open-source projects 500, 502–506 BIRT report files charting API example plug-ins 159 See also report files CSV ODA driver plug-in 683 BIRT report object model 18 data extraction extensions 769 BIRT reports Hibernate driver plug-in 739 See also reports Hibernate ODA UI plug-in 757 BIRT scripting api package 4 plug-in extensions 526–529 BIRT Viewer 352 plug-ins 541, 675 accessing 494 report designer 40 linking to 494 report designs 40 navigating through reports and 494 report rendering extensions 621, 635, 655 See also report viewer rotated label extension 540 BIRT Viewer servlet 494, 495 update sites 532 BIRT_HOME variable 80, 182 buildItemContent method 601 BirtException class 188 builds 500, 526 Block interface 128, 132, 133 buildUI method 562

800 Integrating Applications into BIRT iHub BundleActivator interface 512 categoryData variable 421 Business Intelligence and Reporting Tools 4 cbFail parameter 474 Business Intelligence and Reporting Tools. cbSuccess parameter 474 See BIRT CellHandle class 43 business-to-business applications 653 cells button controls 610, 613 adding grid elements and 26, 119 button elements 407 determining contents of 111 button events 407 placing label elements in 119 writing to CSV files and 629, 631 C changeLogLevel method 86 C# applications 206 changeMeasureDirection function 441 cache 4, 509 changing SOAP messages and 209 archiving rules 269, 272 cache database. See Caching service database archiving schedules 273 Cache-Control directive 209 chart properties 131 calculated columns chart themes 426 See also computed columns charts 52, 139, 363 callback functions cross tabs 438, 440 authenticating users and 356, 357 data cubes 438 connecting to web services and 356 data set bindings 122 defined 352 data sources 121 displaying dashboards and 365 log file names 86 displaying data and 394, 395 logging levels 86 displaying reports and 359, 371, 373 MIME types 772 filtering data and 363 model definitions 609 hiding report elements and 363 plug-in project settings 516, 517 retrieving parameters and 381 property types 609 retrieving result sets and 395 property values 598 sorting data and 364 report designs 79, 106 canceljob action 456, 457 report elements 40, 107 canceljob page. See request drop page report item properties 113, 114 cancelling running tasks 105 report output 380 cancelreport action 457 report templates 107 canInherit attribute 682 ROM elements 21 canInherit property 547 servlets 490 carriage return characters 631 sort order 115 cascading parameter groups 89, 90, 93 source code 500 cascading parameters 89, 93, 94 tables 362 cascading style sheets 19, 76, 77 text elements 362 CASCADING_PARAMETER_GROUP user interface options 362 value 90 viewer servlets 494 case sensitivity 453, 484, 494 channels iHub schemas 197 removing notifications from 464 servlet names 490 character codes (URLs) 491 category element 698 character data. See strings category series 135, 136, 138 character encoding 285, 451, 452 character encoding. See encoding

Index 801 character encryption. See encryption Chart interface 52, 131 character patterns chart item extensions 10 filter expressions 472 chart item interface 64 character sets 208, 452 chart items character strings. See strings accessing data for 144 character substitution 286, 451 adding to designs 140 characters creating 12, 144 CSV output files and 629, 631 defining behavior of 64 JavaScript code and 139 getting 140 property type conversions and 609 setting dimensions of 145 SOAPAction directive and 209 setting properties for 144 text string limitations for 217 chart labels trimming 685 applying styles to 162 charset attribute 208 setting 53 chart areas 66, 132, 419 chart legends 419 chart blocks 128 chart model attributes 53, 59, 61 chart builder 12, 418 chart model implementation classes 52, 76 chart builder examples 164 chart model packages 52, 53, 59 chart data binding example 161 chart objects chart device package 54 getting 128, 140 chart dimensions 137 instantiating 52, 130, 144 chart elements 128 See also charts chart engine chart package 3, 30, 52 configuring 127 chart programming examples 159–166 generating charts and 8 chart properties handling events for 129 changing 131, 161 handling exceptions for 57 getting 65 logging tasks for 58 report items and 144 overview 10 setting 52, 65 Chart Engine API 30, 52 chart render package 69 chart engine API 3, 5 chart report design examples 164, 165 Chart Engine API library 76 chart report item example 539 chart engine archive 126 chart reports 8 chart engine classes 52, 53 chart script package 69 chart engine generator 30 chart scripting example 162 chart event handler examples 165 chart subtypes 142 chart event handlers chart themes 426 developing 138 chart types viewing 162 multiple series and 53 chart event package 54, 55 setting 141, 142 chart examples plug-in 159 chart utility package 70 Chart Examples view 165 chart view example 165 chart exception package 57 chart wizard 164 chart factory package 57 chart wizard launcher chart format examples 161 See also chart builder chart instance objects 52 chart.script package 69 chart interactive features 161, 418 Chart3DViewer application 163

802 Integrating Applications into BIRT iHub chartengineapi.jar 76 outlining areas in 133 chartexamplescoreapi.jar 76 plotting sample data for 141, 143 charting API data example plug-ins 160, 161 rendering as images 99 charting API format example plug-in 161 rendering to specific output type 54, 83, charting API interactivity example 161, 625 plug-ins 161 setting style preferences for 162 charting API pdf example plug-in 161 ChartWithAxes interface 52, 131 charting API preference example plug-in 162 ChartWithAxes type 133 charting API processor example plug-in 162 ChartWithAxesImpl class 52, 128, 131 Charting API Reference 30 ChartWithoutAxes interface 52, 131 charting API script example plug-in 162 ChartWithoutAxesImpl class 52, 128 charting API viewer example plug-ins 163 ChartWizardLauncher class 164 charting APIs cheat sheets 14 adding charts and 10, 130 check boxes 475 changing charts and 139 checkParameters( ) function 333, 335 developing with 126 choice definitions 21 Swing applications and 154 Choice element 21 charting application examples 126, 160 chunked attachments 208 charting applications class attributes 524 changing chart objects and 52 class definitions 21, 188, 227 creating 127, 146, 154 class element 21, 548 developing 126 class files 524 displaying charts and 10 class libraries 227, 352 handling events in 138 class loaders 75, 681 charting classes 52, 130 class names 507 chartitemapi.jar 76 class paths 267 ChartModels class 162 class property 547, 600, 622, 770 charts classes See also Flash charts; HTML5 charts accessing BIRT 79 accessing 128, 140 accessing external 96 accessing themes for 426 accessing Java 21, 227 adding interactive features to 161, 418, 419 accessing Java security extension 230 adding to designs 142, 146, 164, 165 accessing report parameters and 88 binding data series to 129 building mashup pages and 407 binding to data sets 141, 145 building ODA drivers and 672, 674, 675, building custom data sets for 54 684, 726 creating 8, 52, 127, 130 building ODA user interfaces and 693, customizing 30, 126 700, 701 deploying 127 building report designs and 39, 40, 43 developing. See charting APIs changing chart objects and 52, 53 editing 52, 139 changing report designs and 79 formatting 161 creating proxy objects and 206 generating 10, 154 developing with 9, 30, 352 getting primary base axis for 133 generating C# 206 hard-coding data values for 160 generating code libraries for 197 initializing data structures for 129 generating data objects and 181 laying out 66 generating reports and 72, 79, 86

Index 803 classes (continued) CLUSTER_WORKERS parameter 291 hierarchical diagrams for 30 clusters implementing data extraction extensions sending SOAP requests to 206, 213 and 773, 774, 776 code implementing rotated label plug-in accessing Java source 500 and 541, 556 accessing JavaScript API 352 Java event handlers and 170 accessing report parameters and 89 loading 681, 736 accessing reporting functionality and 41 registering 139 accessing sample 535 rendering CSV output and 625, 636 adding chart interactive features and 421 rendering XML output and 656 adding to designs 79 running plug-in instances and 506, 512, building data extraction extensions 515 and 765, 786 running reports and 32, 33, 35 building rotated label plug-in and 540 setting properties for 525 changing 500 setting user-supplied values and 88 charting API examples and 159 ClassLoader objects 736 compiling 184, 501, 529 CLASSPATH property 96 constructing requests and 393 CLASSPATH variable 80 creating custom designers and 40 classpaths 171 creating run configuration for 190 CSV ODA driver extensions and 683 debugging plug-ins and 541 Design Engine API applications 184 defining executable 27 Hibernate ODA drivers and 718, 736 developing applications and 30 plug-in extensions and 516, 519, 541 developing ODA driver extensions rendering extensions and 621, 655 and 674, 719 report engine and 96 developing rendering extensions and 618 rotated label extension and 544 displaying cross tabs and 439, 443 XML data extraction extension and 769 displaying dashboards and 365 clearFilter parameter 474 displaying parameters and 381, 382 CLI library 75, 77 displaying reports and 360, 362 client applications. See applications downloading source 500, 502 ClientChart objects 363 embedding 364 client-initiated requests 209 enabling user interface options and 362, ClientOption objects 363 445 close method extending BIRT functionality and 19 Hibernate drivers and 729, 734 generating data objects and 181 report designs and 123 getting parameter values and 91 report documents and 88 hiding user interface options and 445 task objects and 95 importing 501 closing initializing HTTP sessions and 354 connections 685, 734 initializing HTTPS sessions and 356 CSV writer 628 loading 509 HTTP sessions 357 logging information and 86 output files 628, 660 opening design files and 87 report design files 123 registering event handlers and 438 report document files 88 running 407 XML writer 660 running plug-ins and 509, 530, 541, 675

804 Integrating Applications into BIRT iHub setting up workspaces for 502 Columns element 775 SOAP messages and 206 comma (,) character 629, 631 viewing charts and 69 comma-separated values files. See CSV files writing event handlers and 172, 173 comma tags 631 code archives 502 command line applications 31 code libraries 197 command line library 75, 77 code modules 41 command stack 41 codec library 76, 77 comments property 600 codec.jar 76, 77 commercial model API JAR files 182 collectCustomProperties method commit method 729 CSVFilePropertyPage 703 commit operations 729 CSVFileSelectionPageHelper 704 common.jar 76, 77 CSVFileSelectionWizardPage 706 CommonConstant class 685, 692, 727 HibernateDataSourceWizard 750 CommonDataExtractionImpl class 773, 774 HibernatePageHelper 747, 749 commons-cli.jar 75, 77 HibernatePropertyPage 750 compiler preferences 501 collectDataSetDesign method 756 compiler settings 501 collections 90, 91, 92 compiling 184, 501, 527, 529 colon (:) character 491 completed jobs page 474 color palette 41 completion notices color settings 135 See also notifications column binding 122, 608 complex properties 111, 114 column binding definitions 13 component diagrams (BIRT) 4 column binding expressions 610, 613 component libraries 8, 13, 42 column headers component package 53, 64 See also column names component types (class definitions) 21 column headings 434 components See also column names accessing 41, 42 column name parameter 422 adding report items and 11, 18, 26 column names 691, 708 saving 8 displaying charts and 422 composite messages 206 Column type attribute 775 computed columns columnar layouts 26 See also calculated columns columnBindingsIterator method 122 ComputedColumnHandle type 122 columnNumbers variable 629 concatenation 139 columns conditions. See filter conditions; search accessing 121 conditions exporting data and 775, 779 cone charts 128, 142 getting values in 690 configuration files 748 hiding 363 configuration manager (updates) 530, 531 querying CSV data sources and 691 configuration objects 32 rendering CSV output and 625, 629 configuration variables 41 retrieving 344 configurations retrieving result sets and 395 archive drivers 262, 264, 266 setting size 217 changing servlets and 490 showing summary data in 441 firewalls and 225 sorting on 364 initiating actions and 456

Index 805 configurations (continued) preserving 212 IPSE applications and 229 protecting data and 224–225 upload security adapters and 232 report engine and 10, 74 configuring setting properties for. See connection BIRT home property 80 properties CSV ODA drivers 681 consolidator application. See log consolidator design engine 40, 82 application Eclipse workspace 501 Constants class 701, 702 Hibernate drivers 727, 736, 739, 748 constants.js configuration file 287, 290, 293 caution for 718 AUTH_ID_HEADER parameter 291 HTML emitters 81, 84 CLUSTER_WORKERS parameter 291 image handlers 84 ENABLE_DOCS parameter 291 ODA data source connections 673 FETCHSIZE configuration parameter 288 report emitters 81 FETCHSIZE parameter 291 report engine 33, 74, 79, 80 GLOBALAGENT parameter 291 Connection class HOST_NAME parameter 291 Hibernate ODA drivers and 726, 727 HTTPS_CERT_LOCATION parameter 291 ODA CSV drivers and 685, 686 HTTPS_KEY_LOCATION parameter 291 connection constants 702 HTTPS_PORT parameter 291 connection definition files. See database LOCALE parameter 292 connection definition files location 290 connection handles. See ConnectionHandle LOG_LEVEL parameter 292 element parameters 291 Connection objects 727 SCOPE parameter 292 connection parameters 354 TARGETVOLUME parameter 292 connection profile properties 701 URIPATHS parameter 292 connection profiles 673, 683, 698 USEHTTPS parameter 289, 292 connection properties page 673 VERSION parameter 292 ConnectionHandle element WSDL_PATH parameter 292 SOAP headers and 212 constructSessionFactory method 728, 735, connectionProfile extension point 673, 683, 737 698, 740 container items 26 connectionProfile.exsd 673 containerID parameter 365 connectionProfileImage extension point 698 content components 358, 362, 370 connections content plug-in (report engine) 618 accessing Information Console and 355 content type (messages) 208 accessing volumes and 355, 455, 463, 481 ContentEmitterAdapter class 625 authenticating users and 355 ContentEmitterVisitor objects 626, 657 CSV data sources and 685 Content-Length directive 209 external data sources and 11, 27 Content-Type directive 208 getting 691, 727 context class loaders 681 Hibernate data sources and 726, 727, 728, context menus 595, 598 734 context objects 171 loading JavaScript classes and 407 deployment 80, 82 logging in to web applications and 356, external content 97 357 context roots 300, 450 opening 352, 354 contributors 30, 500

806 Integrating Applications into BIRT iHub controls (HTML buttons) 407 data extraction extensions 765 cookies 454, 475 data objects 181 CopyDependOnFile parameter 263 data service components 393 copying data sets 183 archive driver configurations 266 data sorters 442 archives 262 data sources 182 files 263 debugging messages 174, 175 Information Console directory design engine 40 structures 375, 378, 386, 399, 435 display names. See display names JAR files 171 filters 422 core API library 76, 77 folders 463 Create Ant Build File command 529 HTML buttons 407 create folder page 453, 460, 463 HTML5 charts 363 create method 52, 53 IDAPI applications. See applications createAndInitCustomControl method 702, Java applications 14 747, 749, 750 Java event handlers 170, 173 CreateArchiveSubFolder parameter 263, 264 JavaScript event handlers 170, 172 createCustomControl method 703, 747 lists 27 createDesignEngine method 108 master pages 99 createFactoryObject method 74, 85, 108 ODA driver extensions 672, 673, 674, 717 createfolder action 457 ODA drivers 11, 15 CreateFolder operations 270 ODA user interfaces 535, 673, 693, 700 createGetParameterDefinitionTask parameter components 380 method 89 plug-in extensions 517–526 createPageControl method 706, 751 plug-ins 506, 513 createPageCustomControl method 705, 747, property editors 598 749, 750 property structure objects 116 createRenderTask method 95 report designer 40 createReportEngine method 85 report designs 13, 39, 107, 123, 184, 360, createRotatedText method 557 366, 368, 383, 385, 435 createRunAndRenderTask method 95 report elements 40, 119 createRunTask method 95 report engine 32, 33, 74, 79, 85 createTabItems method 601 report explorer 370 CreateUserRole parameter 263 report item builder 592 creating report item extensions 537, 550, 568 archiving rules 262, 267, 268 report items 11, 119, 538 BIRT projects 500, 502–506 report rendering extensions 618, 652 bookmarks 363 reporting applications 73, 74, 79 charting applications 127, 146, 154 reports 30, 74, 95 charts 8, 52, 127, 130 requests 393 connection profiles 698 SOAP headers 211–213 context menus 595 SOAP messages 200, 206, 207 cross tabs 437 stand-alone applications 14 custom security adapters 226, 227–228, tables 27 357 update sites 531–533 dashboards 365 upload security adapters 230, 231–232 data cubes 184, 437 URIs 286, 299, 450, 451

Index 807 creating (continued) opening 628 URL parameters 356 preparing queries for 687 viewer components 358 preparing result sets for 689 web pages 352, 353 reading from 535, 684, 685 web-based applications 197 setting logging levels for 628 WSDL schemas 197–203 viewing content of 637 credentials writing to 618, 625 external users 356 CSV formats 618, 764 cross tab elements 438 CSV ODA driver extension cross tabs adding data access functionality adding dimensions to 439 to 679–683 adding measures to 439 building projects for 676–678 changing 438, 440 developing 674, 675, 684 creating 437 downloading source code for 674 displaying 434, 438 setting dependencies for 683 drilling through 443 CSV ODA driver extension examples 535, enabling interactive features for 440 674 handling events for 438 CSV ODA driver plug-ins 674, 676 hiding detail data in 445 CSV ODA drivers 535, 674, 681, 684 pivoting elements in 441 CSV ODA UI extensions 675, 693, 696, 700 removing dimensions from 439 CSV ODA UI plug-in 675, 698, 700, 711 removing summary data in 442 CSV ODA UI plug-in projects 674, 693–696 reordering elements in 441 csv package 625 retrieving data for 437, 440 csv plug-in 618, 635 sorting data in 364, 442 CSV rendering option 632 updating 443 CSV report rendering extension viewing summary data in 441 building 635 crossContext parameter 356 creating projects for 619, 636 cross-platform applications 196, 206 developing 618, 625 Crosstab class 438 downloading source code for 534, 618 crosstabcoreapi.jar 77 generating output and 638 CSS files 19, 76, 77 overview 618, 624 See also cascading style sheets running 632, 637 CSV data sources 639, 672, 679 setting dependencies for 621 CSV data structures 674 setting encoding scheme for 628 CSV emitter 625, 632, 638 specifying extension points for 622, 623 CSV emitter logging levels 628 testing 632, 634, 640 csv extension point 674 viewing output for 633, 637 CSV files CSV report rendering plug-in 534 accessing data in 672, 674 csv ui extension 675 closing 628 csv ui wizards extension 701 connecting to 685 CSV writer 625, 626, 628 defining content of 625 CSVBufferReader class 685, 688 defining structure of 625 CSVFilePropertyPage class 701, 702 downloading sample plug-in for 534 CSVFileSelectionPageHelper class 702, 703 extracting data for 764 CSVFileSelectionWizardPage class 702, 705 initializing output streams for 626 CSVPlugin class 625

808 Integrating Applications into BIRT iHub CSVRenderOption class 625, 632 web pages 352 CSVReportEmitter class 625, 629 CVS repository 500 CSVReportEmitter method 626 CSVTags class 625, 631 D csvTest.reportdesign 639 da action 456 CSVWriter class 625, 632 daemonURL parameter 477 cubes dashboard action 456 analyzing data and 436 Dashboard class 364 changing 438 dashboard files 365 creating 184, 437 dashboard page 460 generating 182 dashboards curl command accessing gadgets in 364 using files resources as 310 creating 365 curl commands 299 displaying 364 --user parameter 299 loading 365 currentSession method 738 data cursors 690 accessing 35, 608 CurveFittingViewer application 163 aggregating 11, 138 custom chart generator 30 aggregating. See aggregation custom data sources 673 analyzing 436 custom desktop reporting application 32 displaying 93, 394 custom emitters 10 exporting 618, 764, 775 custom report design tools 40 extracting. See data extraction operations custom report designer 14, 20 filtering 11, 13, 93 custom report generators 14, 30 generating sample 141, 143 custom security adapters 227, 357 grouping 11, 13 custom status handlers 81 hard-coding 160 CustomDataSetWizardPage class 700 hiding 445 customizing localizing. See locales BIRT framework 14, 499, 500 preventing loss of 353 charts 30, 126 protecting corporate 224 data sets 54 restricting access to 224 file verification 231 retrieving 4, 10, 93, 672 ODA drivers 11, 15 returning from multiple sources 210 output formats 95, 539, 618, 765 returning from web services 352, 393 property pages 599, 600, 693 returning subsets of 363 report designs 30 sharing with external applications 652, report emitters 15 766 report items 11, 15, 538, 539, 568 sorting 11, 130 reporting applications 14, 500 summarizing 434 reports 79 data access services 11 security adapters 226–228 data adapter API library 77 upload security adapters 229–232 Data Analyzer URL parameters 356 adding toolbars. See Data Analyzer user authentication 5, 224, 227 toolbars user interfaces 91 user logins 5, 224

Index 809 data analyzer component data series See also Data Analyzer adding 135 data binding 122, 608 associating data with 136 data binding definitions 13 binding to charts 129 data binding expressions 610, 613 building run-time instances of 130 data chart examples 160 creating 134, 135 data charts viewer 160 defined 129 See also charts grouping 160 data cubes. See cubes setting type 53, 67 data elements 24, 27 data series (charts) See also data items displaying values 418 adding 183 data series definition objects 129, 134, 137 creating 184, 360, 366, 368, 383, 385, 435 data series names 422 data engine 10, 11, 673 data series sample plug-ins 160 data extraction 618, 784 data series types 134, 142 data extraction extension data service class 393, 406 creating projects for 766–769 data service components 393 developing 766, 773 data services 10, 11, 164 downloading source code for 765 data set classes 121 implementing 774 data set definitions 25 overview 764, 772 data set editor page 693, 700 running 783 data set elements 25, 28 setting dependencies for 769 data set fields. See fields testing 783, 786 data set handles 120, 121 data extraction extension points 770, 771 data set list data extraction interfaces 35, 773 retrieving 343 data extraction library 77 data set page (ODA UI) 675, 700, 718, 747 data extraction plug-ins 764, 766, 773, 774 data set UI extension 699 data extraction schema definitions 764 data set wizard page 702, 706, 751 data fields 434 data set wizards 699, 700 See also columns data sets data filters. See filters accessing 120 data hierarchies (cubes) 437, 438, 441 adding 183 data items binding charts to 141, 145 See also data binding to report items 122, 608, 610 data mart functions 182 building queries for 718 data object classes 181 changing data sources for 121 data objects 181, 182, 187, 343 changing properties for 121 data package 53, 65, 160 customizing 54 data points developing data extraction extension displaying series values and 129, 130 for 766, 773 data repositories 490 developing ODA extensions for 11, 685, See also volumes 693, 699 displaying content 370 editing 673, 700 web services and 355 generating programmatically 182 data repository file paths 373 getting properties for 121 data rows. See rows retrieving values in 93

810 Integrating Applications into BIRT iHub reusing 13 dataadapterapi.jar 77 setting properties for 25, 121 dataaggregationapi.jar 77 data sorters. See sorters database classes 674 data source classes 120 database connection properties. See data source editor page 693, 701 connection properties data source elements 25, 27 database drivers. See drivers data source extension elements 681, 699 database schemas. See schemas data source extensions 672, 679, 693 databases 672 data source handles 43, 120 See also data sources data source page (ODA UI) 675, 718, 747 DataCharts charting example 160 data source UI extension 699 DataChartsViewer application 160 data source wizard page (ODA UI) 702, 705 dataExtraction package 766 data source wizards (ODA) 700 dataExtraction plug-in 764, 766, 773, 774 data sources dataExtraction.exsd 764 accessing 120, 672, 673, 679 dataextraction.jar 77 adding 693 DataExtractionExtensionBase interface 773 changing 121 datafeed package 53, 54 changing data set 121 datamart functions 182 combining data from multiple 210 dataobject resource 299, 343 creating 182 DataService class 393, 406 defining external 27 DataSet element 25 developing ODA extensions for 11, 673, dataSet extension element 682 674, 699, 717 DataSet interface 129 developing reporting applications and 74 DataSetHandle class 120, 121 extending functionality of 672 DataSetImpl class 136 generating 182 DataSetMetaData class loading JDBC drivers for 78 csv package 685, 691 retrieving data from 10, 672 hibernate package 726, 730 reusing 13 dataSetPage element 700 selecting ODA 673, 700 dataSetUI extension 699 unsupported 11 dataSetUI page wizard 747 data structures 24, 114 dataSetWizard element 699 Data Tools Platform (Eclipse) 11, 672 DataSetWizard extension point 699 data transfer protocols 196, 206 DataSetWizardPage class 701, 751 data transform services 11 DataSetWizardPage extension point 700 data type definitions 199–200 DataSource element 25 data type mappings 682 dataSource extension element 681 data types dataSource extension point 672, 673, 679 CSV files and 685 dataSource.exsd 673 defining 199 DataSourceEditorPage class 693, 701 expressions and 609 DataSourceHandle class 43, 120 Hibernate data sources and 725 dataSourceUI extension 699 naming 199 DataSourceWizardPage class 701 plug-in extension points and 506 dataTypeMapping elements 725 report parameters and 91 dataTypeMapping type 682 ROM metadata structures and 24 DataTypes class 726 specifying required sequence for 200 date parameters 91

Index 811 date stamps 471 jobs 464, 468 date values 775 notifications 464 DateTimeDataSet interface 129 report files 468 dateToDelete parameter summary data 442 execute report page 470 temporary files 33 submit job page 485 Dependencies page (PDE Editor) 516, 517 DCD. See database connection definitions dependent files. See file dependencies debugging deploying applications 85 applications 79, 82, 106, 224 event handlers 174, 175 charts 127 ODA driver extensions 675 Hibernate ODA UI plug-in 757 plug-ins 541 plug-in extensions 530–534 debugging messages 174, 175 plug-ins 506, 531 default archiving rules 270 report engine 75 default authentication 224 report item extensions 540, 564 default character set 208 reports 99 default encoding 452 security adapters 228, 229, 232 default output formats 72 Deployment Kit 352, 355 default settings 356 description element 546 default values 41, 88, 90 descriptions (limits for) 217 DEFAULT_MAX_ROWS constant 702 design configuration objects 40, 108, 182 DefaultDataServiceProviderImpl class 164 design definitions 25, 26 defaultDisplayName attribute 681 design element API classes 77 defaultDisplayName property 681, 682 design element handles 43, 45 DefaultFailureNoticeExpiration element 275 design elements 87 defaultStyle property 547 design engine 4, 9, 40, 106, 182 DefaultSuccessNoticeExpiration element 275 Design Engine API 39, 40, 72, 79 defaultValue attribute 682 Design Engine API applications 184 defaultValue property 547 Design Engine API documentation 72, 78 definitions element 197, 198 Design Engine API extension 181 DelayFlush element 212 Design Engine API package 30, 43 delete file status page 460 design engine API package 3, 5 delete job page 453, 460, 464 design engine classes 39, 40, 43, 108, 184 DELETE method 348 design engine configurations 40, 82 DELETE request 310, 346, 348 design engine extensions 12 delete status page 453, 461, 464 design engine interface 51 deletefile action 456, 457 design engine objects 108 deletejob action 456, 457 design engine tasks 40 deletejobnotice action 456, 458 design files 495 deletejobschedule action 456, 458 accessing 196 deleting creating reports and 31, 72, 74, 87, 103 archived reports 471, 487 designing reports and 12 authentication information 357 generating 4, 9, 14, 40 dimensions 439 loading 34 event handlers 438 opening 74, 86, 108 files 262 renaming 146 folders 468 running 35, 95

812 Integrating Applications into BIRT iHub saving 40 viewing XML output in 667 validating 9, 20 desktop applications 32 design handles destination parameter 481 accessing properties and 42, 106 destroy method 33 accessing report items and 109 detail data 445 creating report elements and 40 detail pages 453, 461, 465 opening report designs and 41, 108, 109 detail rows 27 design model 12, 18 detailType property 547 design model objects 39 developing design objects 41 chart event handlers 138 design properties 26 charts. See charting APIs design tools 8, 39, 40 data extraction extensions 766, 773 design.xsd 19, 20 data objects 181, 187 DesignChoiceConstants interface 111, 114 design tools 39 DesignConfig class 40 IDAPI applications. See IDAPI applications DesignConfig objects 40, 108, 182 ODA extensions 672, 673, 674, 717 DesignElement element 25 ODA user interfaces 673, 693, 700, 739, 746 DesignElementHandle class 43, 45, 113 plug-ins 506, 513 DesignEngine class 40, 108 rendering extensions 617, 618, 652 DesignEngine objects 40, 108 report engine 32 designers 8, 14, 32 report item extensions 537, 539, 568 designing reports 4 reporting applications 30, 73, 75 designs 494 reports 14 accessing 41, 106, 108 rotated label extension 541, 556–564 accessing parameters in 89 RSSE applications. See RSSE applications accessing properties for 42 web applications 170, 197 accessing ROM schemas for 20 web pages 352 accessing structured content in 72 development environments 75, 197, 206 adding charts to 142, 146, 164, 165 development languages 196 adding report items to 109, 119 device package 53, 54 changing 79, 106 DeviceAdapter class 55 creating 39, 107, 123, 184, 360, 366, 368, diagnostic information 479, 481 383, 385, 435 See also Ping operations customizing 30 dial charts 126 generating XML files and 786 DialChart interface 52, 131 getting properties for 87 DialChartImp class 52 opening 492 DialChartImpl class 128, 131 retrieving external data for 673, 684 DialChartViewer application 163 reusing 8, 13 dialog boxes running 213, 380 loading 406 saving 106, 123, 146 Dialog class 406 selecting ODA data sets and 700 difference charts 128 selecting report items for 11 DifferenceDataSet interface 129 standardizing 13 Dimension class 438, 441 testing for parameters in 90 dimension index values 441 validating 20, 24 dimension property 131 viewing CSV output in 639

Index 813 dimensions images 581 adding to cross tabs 439 Interactive Crosstabs features 444 changing axis type 441 login page 450, 476 creating data cubes and 436 manifest header settings 517 drilling through 443 PDF documents 104 expanding or collapsing members in 443 pending jobs 483 generating summary values for 441 plug-in project settings 516 hiding detail data in 445 property annotations 524 removing 439 report elements 363 reordering 441 report executables 476 directories report items 11 accessing JAR files and 40 report parameters 381, 486 archiving and 262, 263, 267 reports 4, 31, 212, 358, 494 building charting API examples and 160 summary data 441 copying 375, 378, 386, 399, 435 tables 360, 422 extracting source code to 502 update site content 532 getting location of plugins 82 XML output 668, 772 installing plug-ins and 500, 506, 509 DisplayName property 548 installing updates and 531 displayNameID property 547 referencing BIRT home 80 displayReport function 373 saving image files and 84 displayText element 547 saving temporary files and 81 distributed iHub System. See clusters directory paths div tag 353, 358, 370 Java event handlers and 171 do directive 453 temporary files 176 do_update page. See options page directory paths. See paths DOC emitter 10 disk space 481 DOCTYPE tag 353 disk writes 31 document files 465, 476 display adapter classes 54 accessing contents 35, 87 display formats. See formats accessing structures 87 display names 681, 682 building 9 displayData function 394, 395 closing 88 displaying creating 72, 95 aggregate values 434 exporting data from 764 cascading report parameters 93 opening 34, 74, 86, 88 cross tabs 434, 438 overview 13 CSV output 633, 637 rendering specific pages in 87 current jobs 482 writing to disk 35 dashboards 364 document objects 74, 87 data 93, 394 Document Type Definitions 494 data cubes 436 documentation xvii, 500 debugging messages 174 See also help collections error messages 469 documentation attribute 507 extension point schemas 522 documents 97, 104 failed jobs 474 See also reports folders 476 viewing 494 HTML output 9 dom package 776

814 Integrating Applications into BIRT iHub Domain element 213 dteapi.jar 77 domains 356 DTP ODA API 672, 673, 684 double quotation mark (") character DTP ODA API Reference 673 expressions and 609 DTP ODA framework 11, 673, 701 JavaScript code and 139 DTP ODA interfaces 672, 681, 684 .dov files. See data object values files DTP ODA wizards 672 download messages 772 duplicate names 210 download operations duplicating. See copying See also downloading dynamic data 129 downloadfile action 456 downloading E See also download operations EasyScript 440 binary files 490, 494 ebXML formats 653 extension examples 534 Eclipse applications 80 ODA driver sample plug-ins 674 Eclipse BIRT packages 30 report parameters 380, 381, 382 Eclipse compiler 501 result sets 394 Eclipse Data Tools Platform 11, 672 source code 500, 502, 541, 675 Eclipse platform 5 downloadParameterValues function 381, 382 Eclipse Plug-in Development downloadResultSet function Environment 506, 513 DataService class 394 Eclipse plug-ins 506 drill function 443 Eclipse projects 4, 515 Driller objects 443 Eclipse views 516 drilling 443 Eclipse Workbench 529, 564 Driver class 685 Eclipse Workbench projects 515 driver classes 78 Eclipse workspace 502 driver constants (ODA) 692 ecore.jar 77 DRIVER_JAR_PATH variable 267 EDI standards 653 driverClass property 681 editMeasure function 440 drivers editor controls 701 accessing external sources and 673 editor element 546 adding connection profiles for 673, 683, editor pages 573, 700, 701 698 Electronic Business extensible markup changing connection properties for 673 language 653 configuring archive 262, 264, 266 Electronic Data Interchange standards 653 creating ODA 11, 15, 717 element adapters extension point 538, 546, defining error messages for 685 548 developing applications and 78 element adapters schema definition 539 developing ODA 672, 673, 674 element attribute 507 downloading sample plug-ins for 535 element definitions (ROM) 22 initializing connections for 685 Element element 22 registering 736 elementAdapters extension point 538, 546, running 684 548, 599 testing 674 elementAdapters.exsd 539 drivers directory 78, 736 ElementDetailHandle class 49 drop pages 453, 462, 468 ElementFactory class 119, 182 DTD (Document Type Definition) syntax 494

Index 815 ElementFactory objects 40, 142 encoding 285, 353, 451, 452 elementFormDefault attribute 199 encoding attribute 199 elements Encoding element 774 class attributes and 524 Encoding property 777 creating report extensions and 550 encoding variable 777 running plug-in extensions and 506, 510, encryption 357 520 Encyclopedia volumes elements. See report elements; XML elements creating archives for 262, 263 elements package 46, 48 creating archiving rules for 267, 268 e-mail removing items in 262 sending attachments with. See attachments updating properties for 273, 275 setting notification options for. See end method 628, 659 notifications end parameter 394 embeddable HTML output 98 endCell method 631 embedded report engine 31 endRow method 631 EMF libraries 76, 77 engine API library 77 emitter csv package 625 engine api package 3, 30, 35, 37 emitter csv plug-in 618, 635 engine constants 96 emitter extension IDs 622 engine variable 101 emitter interfaces 624, 656 engineapi.jar 77 emitter logging levels 628, 658, 660 EngineConfig class 33, 81 emitter objects 625, 657 EngineConfig objects 32, 79, 80, 82, 83 emitter package 618 EngineConstants class 96 emitter plug-in 618, 656 EngineException exceptions 102 emitter xml plug-in 618, 656 engines 5, 9 emitterconfig.jar 77 enumeration classes 52, 53 emitters Envelope attribute 210 adding 618 environments 32, 82, 170 configuring 81 EQ operator 364, 422 creating 625, 657 error action 456 customizing 15 error codes 215 extending functionality of 534, 618 error detail page 465 generating CSV output and 622, 625, 638 error messages 685 generating reports and 10, 83 displaying 469 generating XML output and 655, 657 SOAP messages 213 listed 7 error page 453, 461, 462, 469 emitters extension points 539, 622, 655 errorcallback function 356, 357 emitters plug-in 618, 624 errorCallback parameter 354 emitters.exsd 539, 618 errors ENABLE_DOCS parameter 291 duplicate element names and 210 enablement elements 600 failed SOAP requests and 215 enableToolBar function namespace declarations and 210 Viewer.UIOptions class 362 web service requests and 354 enabling event functions 407 archive service provider 267 event handler examples 162 encapsulation 353 event handlers encode method 452 accessing iHub environment and 170, 171

816 Integrating Applications into BIRT iHub creating HTML buttons and 407 execute report page 470 creating interactive charts and 421 submit job page 485 debugging 174, 175 execute report page 453, 461, 469 defined 19 EXECUTE_REPORT_WAIT_TIME designing reports and 406 parameter 469 displaying cross tabs and 438 ExecuteCSVReport application 637 getting help for 170 ExecuteCSVReport class 636, 638 navigating repository content and 372 ExecuteCSVReport project 636, 640 removing 438 executedocument action 456, 458 rendering report items and 19 executeQuery method 688, 733 writing Java 170, 173 executereport action 456, 458 writing JavaScript 170, 172 ExecuteReport element 213 event model 170 ExecuteReport operations event package 53, 54, 55 assigning resource groups to 213 events ExecuteVolumeCommand element 274 adding to HTML buttons 407 ExecuteVolumeCommandResponse customizing reports and 79 element 274 firing 19 ExecuteXMLReport application 668 handling. See event handlers executing interactive charts and 418 reports 469 running Interactive Crosstabs and 438 executing a report design 297 running JavaScript API scripts and 406 executing BIRT Viewer servlet 494 subscribing to 512 executing reports 618 evt variable 421 execution requests. See ExecuteReport example charting API plug-ins 159–166 operations example charting applications 126, 160 expiration age 269, 270 example event handlers 162 expiration dates 269, 270 example ODA extensions 672, 674 expiration intervals 469, 484 example plug-in extensions 534 expiration notices 275, 276 example plug-in fragment 535 expiration policy 262, 267, 275, 276 examples plug-in 159 expiration times 269, 275, 276 Excel spreadsheets 101 ExpirationAge element 269 EXCELRenderOption class 98, 101 ExpirationDate element Exception class 438 SetParameters operations 269 exception class definitions 188 ExpirationTime element 269 exception package 53, 57 ExpireDependentFiles element 269 exceptions 113, 685 explorerpane parameter 370 authentication and 356, 357 Export data types property 777 cross tabs and 438 Export Data user interface 764, 774, 784 data service components and 394 export destination options 531 executable files Export dialog 530 displaying 476 export options 531 generating output for 478, 484 Export Wizard (Eclipse PDE) 530 running report 380 exporting selecting 475 data 618, 764, 775 third-party reports and 196 plug-in extensions 540 executableName parameter plug-ins 530

Index 817 expression builder 610, 613 finding 521 expressions rendering output and 618, 622, 655 aggregating data values and 440 running plug-ins and 509 binding data and 610, 613 specifying 510 computing cross tab values and 440 viewing attributes of 522 converting strings to 609 Extension Points page (PDE Editor) 517, 519 creating EasyScript 440 extensionName property 547, 568 .exsd files 506, 520 extensions extended character sets 452 adding chart items and 12 extended-item name element 20 adding emitters and 618 ExtendedItemHandle class 128, 548, 599 adding report items and 538, 539, 568 ExtendedItemHandle objects 141, 144, 145 adding reporting functionality and 500 extendsFrom property 547 building plug-in 526–529 extensible markup language. See XML changing MIME types for 772 extension APIs 30 creating 20, 517, 520, 522 extension element 510 customizing BIRT framework and 14, 499, extension examples 534 500 extension names 507, 568 customizing report items and 11 extension package (report engine) 539 declaring 517 extension point schema definitions deploying 530 connection profiles 673 developing ODA 11, 672, 673, 674, 717 data extraction plug-in 764 downloading sample plug-ins for 534 defined 506 extracting data and 764 displaying as HTML 522 implementing 500 displaying property annotations in 524 rendering reports and 618 ODA driver extensions 673 setting class attributes for 524 ODA driver sample plug-ins 726 specifying 519 ODA UI extensions 673 testing 529 opening 520, 521 unloading 33 plug-in extensions 506, 520 viewing property annotations for 524 property pages 673 Extensions page (PDE Editor) 517, 519, 520, report engine emitters 618 522 report item extensions 507, 538, 540, 550 external archive software 262 rotated label sample plug-in 545 external authentication 234 extension points external classes 96 accessing external data sources and 673 external data sources 27, 673, 679 accessing Hibernate data sources and 739, external Java classes 96 742 external objects 97 adding ODA drivers and 11 external security systems 234 building ODA user interface and 696 external user credentials 356 building rotated label sample plug-in external user registration and 545, 549, 550 described 234 customizing BIRT framework and 14, 500 external values 88 customizing property pages and 599 customizing report items and 538, 568 F declaring 517, 522 factory API classes 76 extracting data and 765, 770, 771

818 Integrating Applications into BIRT iHub factory method 34 FileDialog method 748 factory package 53, 57 filefoldersprivilege action 458 factory property 548, 600 filename parameter 481 Factory service 482 files factory service 85, 108 See also report files failed jobs 474 accessing 475 failure notices accessing resource 81 setting expiration time for 275, 276 archiving 263, 267, 470, 485 Fault messages 215 assigning privileges to 482 features 533 creating reports and 4 fetchDirection query parameter 289 deleting 468 fetchHandle field 288 displaying 476, 494 fetchHandle query parameter 289 expiring 262, 267, 270 FETCHSIZE configuration parameter 288 filtering 475 FETCHSIZE parameter 291 generating output and 72 fetchSize query parameter 288, 291 generating temporary 33 fields 121, 434 getting information about 465 See also columns naming 470, 479, 486 Figure UI provider 574, 587, 588 naming. See file names file attributes 262, 371 overview 12–14 See also file properties overwriting 471, 478, 485 File class 686 referencing image 84 File data type 217 rendering output and 618, 625, 656 file dependencies ROM schemas and XML 20 archiving operations and 263, 268 saving 471, 478 file detail page 465 searching 483 file drop page 468 setting properties for. See file properties file ID number 307 specifying owner of 263 file IDs uploading and downloading binary 490 See also FileId element writing logging information to 86 file index page 473 writing to disk 31 file list page 475 files resource 298, 310, 325 file lists 475 FileSelectionWizardPage class 702, 706 file names 74, 86, 102 FileType data type 217 file objects 686 FileType element file output streams 72, 626, 657, 772 ArchiveRule operations 269 file paths. See paths SOAP headers and 213 file permissions 263 TargetResourceGroup element and 213 file system repositories 355 filter conditions file systems 80, 81, 83 matching character patterns and 472 file types 12, 18 filter element 699 inheriting archiving rules and 272 filter objects 422 setting 213 filter parameter 474, 476 setting archiving rules on 268, 270, 272 filtering uploading files and 229 jobs 474 verifying 231 report documents 475 filedatasource parameter 394 filtering data 11, 13, 93

Index 819 filters 474, 475, 476, 699 fontFamily style specifications 21 creating 422 footers 99, 146 displaying charts and 421 forceLogin parameter 225, 455 retrieving data and 363 forcing logins 225, 356 Find declaring extension point setting 520, format parameter 470 521 format property 622, 770 findDataSet method 120 FormatCharts charting example 161 findDataSource method 120 FormatCharts class 161 findElement method 110 FormatChartsViewer class 161 finding data. See search operations formatQueryText method 687 finding source archives 526 formats findTOCByValue method 103 See also output formats Firefox browsers 421 configuring emitters for 81 firewalls 206, 224 customizing report generators for 14 FirstTable parameter 360 exporting and 618, 764 flat file data sources 672 extracting data and 773, 779 floating footers 99 generating ebXML data and 653 flute.jar 76, 77 generating reports and 72, 95 folder detail page 465 loading emitters for 539 folder drop page 468 localizing data and 196, 213 folder ID number 307 rendering images and 99, 623 folder IDs 463 rendering report items and 548 folder index page 473 viewing reports and 4 folder list page 475 formatted output 72, 98, 102, 104 folder lists 475 forward definitions 456 folder names 453, 463 free disk space 481 folder parameter 476, 483 functions 139 folder paths. See paths See also callback functions; methods folders 528 Actuate JavaScript API 352, 353, 406 accessing 475 archiving contents 470 G assigning privileges to 482 gadgets creating 463 accessing 364 deleting 468 Gantt charts 128 displaying 476 GanttDataSet interface 129 getting archiving rules for 274 generating linking to 477 binary documents 97 navigating through 462 C# classes 206 searching 483 charts 10, 154 setting archiving rules for 267, 270 code libraries 197 setting expiration policy for 267 data objects 181, 182, 187 specifying type 479 debugging messages 174, 175 updating archiving rules for 271, 272 ebXML data formats 653 viewing information about 465, 476 formatted output 72, 98, 102 folders resource 298, 307, 325 HTML documents 83, 95, 98 folderType parameter 485 locale-specific data 196, 213 font style constants 114

820 Integrating Applications into BIRT iHub output 478 GetFileDetailsResponse element 275 PDF documents 95 getfolderitems action 458 report design files 9, 14, 40 getfolderitems page. See folder index page report document files 9 getHibernateProp method 738 report items 538, 540 getHibernatePropTypes method 738 Reportlets 406 getjobdetails action 456, 458 reports 14, 40, 79, 86, 103 getjobdetails page. See request detail page sample data 143 getjobdetails.jsp 467 update site listings 532 getJSON object 314 generation requests getLabel method 91, 556 assigning to resource groups 213 getLabelPropValue method 660, 662 preserving connections for 212 getMaxConnections method 727 generation services 7, 9, 10, 31 getMaxQueries method 729 GET folders resource 314, 330 getMeasure method 114 GET method 309, 325, 326, 328 getMetaData method 729, 732 get method 110 getNext method 110 GET request 297, 300 getnoticejobdetails action 458 that returns a list 291 getOption method 102 GET users request 288 getOptions method 102 getAppContext method 81 getOutputFileName method 102 getAuthenticationId method 175 getPageNumber method 103 getBody method 110 getParameterDefn method 90 getBookmarkInstance method 87 getParameterDefns method 90 getBookmarks method 87 getParameterType method 90 getBooleanOption method 102 getParameterValues method 91 getCategoryProvider method 561 getPassword function 227 getChildren method 103 getPlatform method 82 getColumnCount method 629 getPrimaryBaseAxes method 133 getColumnName method 691 getPrimaryOrthogonalAxis method 134 getConnection method 685, 691, 727 getProperty method 87, 128 getContents method 90 getPropertyHandle method 115 getCurrentPageContent function getQuery method 707 Viewer class 362 getQueryColumnNames method 708 getDataSets method 120, 121, 145 getRealPath method 82 getDataSources method 120, 121 getReportName method 779 getDataType method 90, 91 getReportRunnable method 87 getDefaultValue method 90 getrequesterjobdetails action 456, 458 getDefaultValues method 90 getResult method 734 getDesignHandle method 109 getResultSetColumn method 122 getDesignList function 332, 333 getResultSetExpression method 122 getElementFactory method 142 getResultSetMetaData method 709, 755 getErrorMessage function 231 getRoot method 103 getExportLabelTag method 660 getRow method 690 getfiledetails action 458 getRunTimeSeries method 130 GetFileDetails element 274 getSelectionList method 91 GetFileDetails operations 274 getSelectionListForCascadingGroup getfiledetails page. See file detail page method 93, 94

Index 821 getSeriesDefinitions method 138 groups getServerWorkingDirectory method 176 See also notification groups; resource getSQLStateType method 730 groups getStatus method 105 charting data and 130 getString method 690, 692, 734 GUI components 11 getStyle method 111 See also user interfaces getSupportedImageFormats method 99 getTableByBookmark function 422 H getText method 110 handle classes 41, 42, 43 getTOCTree method 103 handle objects 114 getURI method 111 HashMap objects 35, 90, 91 getUserAgentString method 177 hasOption method 102 getUserName function 227 hasOwnModel property 548 getUserRoles method 173, 176, 177 hasStyle property 547 getValue method 91 header elements (SOAP messages) 200, 208 getViewer function See also SOAP headers actuate class 421 header fields getVolumeName method 172, 178 AuthId 287 getVolumeProfile function 227 Locale 287 getWidth method 111, 114 TargetVolume 287 GIF formats 99 Header type 211 global options (design engine) 40 headers 100 global options (report engine) 33 headers (HTML) 407 GLOBALAGENT parameter 291 headline parameter goto action 456 execute report page 470 grand totals 441 output page 478 GrandTotal class 441 submit job page 485 graphical report design tool 8 headlines 178 graphical user interfaces. See user interfaces hexadecimal encoding 451 graphics API 576 Hibernate Core for Java 672 graphics elements Hibernate data sets 718, 747 See also images Hibernate data sources 718 GraphicsUtil class 557 Hibernate data types 725 graphs. See charts Hibernate libraries 739 GREATER_THAN_OR_EQUAL Hibernate ODA driver example 719, 726 operator 472 Hibernate ODA driver plug-in 719, 739 grid items 26, 119 Hibernate ODA drivers 535, 718, 727, 736 GridHandle objects 106 Hibernate ODA extensions 717, 719 grids 26 Hibernate ODA UI example 718, 719 group slots 111 Hibernate ODA UI extension points 742 grouping data 11, 13 Hibernate ODA UI extensions 739 grouping data rows 407 Hibernate ODA UI plug-in grouping plug-ins 533 building 757 GroupOnXSeries charting example 160 creating projects for 740 GroupOnYAxis charting example 160 developing 718, 746 launching 757

822 Integrating Applications into BIRT iHub specifying dependencies for 741 HTML reports specifying run-time settings for 742 configuring properties for 101 testing 757–762 displaying 9 hibernate package 726 generating 83, 95, 98 hibernate plug-in 718, 719, 739 opening 104 hibernate ui plug-in 718 paginating 100 hibernate.cfg 719 referencing images in 84 HibernateClassSelectionPage class 751 rendering output for 74 HibernateDataSourceWizard class 746, 750 saving image files for 84 HibernateDriver class 726, 727 setting up rendering context for 99 HibernateHqlSelectionPage class 747 writing to disk 31 HibernatePageHelper class 746, 747, 750 HTML tables 100 HibernatePropertyPage class 746, 750 HTML tags 99 HibernateUtil class 727, 728, 735, 738 HTML5 charts hibfiles directory 718, 736 accessing 363 hideDetail function 445 applying themes to 426 hiding changing features 363 columns 363 HTMLActionHandler class 100 data 445 HTMLCompleteImageHander class 84 Interactive Crosstabs features 444 HTMLRenderOption class 74, 84, 98, 99, 101 toolbars 362 HTMLRenderOption objects 83 highlight rules 116 HTMLServerImageHandler class 84 home directory parameter 686 HTTP connections 206, 208 home folders 477 HTTP headers 208 home page 477 HTTP methods HOME property 686 DELETE 297 HOME value 681 GET 297 homeDir parameter 686 POST 297 homeFolder parameter 474 PUT 297 Host directive 209 HTTP requests 285, 352 host instance (PDE Workbench) 515 HTTP response codes 288 HOST_NAME parameter 291, 293 HTTP sessions HQL (defined) 672 closing 357 HQL statements initializing 354, 355 adding user interface for 747 providing security for 355, 356 creating 718, 728 sharing information for 356 downloading sample plug-in for 535 HTTPS certificate executing 733 path 291 retrieving data with 734 HTTPS key verifying 753 path 291 HTML buttons 407 HTTPS request 299 HTML code 352 HTTPS requests 289, 291 HTML emitter configurations 81 HTTPS sessions 356 HTML emitter options 83 HTTPS support HTML emitters 10, 83 disabling 292 HTML files 213 enabling 289, 292 HTML rendering options 84, 98, 99

Index 823 HTTPS_CERT_LOCATION parameter 291, managing third-party reports and 196 293 IDataExtractionExtension interface 773 HTTPS_KEY_LOCATION parameter 291, IDataExtractionOption interface 773 293 IDataExtractionTask interface 35 HTTPS_PORT parameter 291 IDataSetMetaData interface 685, 726 hyperlinks 100, 625 IDE (integrated development See also URLs environment) 197 hypertext markup language. See HTML code IDriver interface 681, 685, 726, 727 hypertext transfer protocol. See HTTP IEmitterServices interface 626, 657 IEngineTask interface 34 I IExtractionResults interface 773 IActionFilter interface 699 ifExists parameter 478, 485 ICascadingParameterGroup interface 89 IFigure interface 587 ICommonDataExtractionOption IGetParameterDefinitionTask interface 34 interface 773 IGetParameterDefinitionTask objects 33, 89 icon property 623 IGetParameterDefnTask interface 89 IConnection interface 685, 726 IHTMLImageHandler interface 84 icons 11, 546, 573, 698 IHTMLImageHandler objects 84 IContentEmitter interface 622 iHub ICU library 75, 77 running Information Console and 285, 452 icu_version.jar 171 sending requests over 280, 450 icu.jar 75, 77 iHub API 170, 174 id element 699 iHub API reference 175 ID parameter 468 iHub clusters. See clusters ID property iHub repository. See volumes CSV ODA UI extension 698 iHub servers CSV rendering extension 622 directing SOAP messages to 209 data extraction extension 770 getting environment information for 172 ODA data source extension 679 publishing report files to 170 rotated label plug-in 546 running BIRT reports and 174 id property sending SOAP requests to 206, 209, 210, data extraction extension 770 213 emitter extension 622 iHub services 479, 481, 482 ODA data sets 682 See also specific iHub service ODA data sources 681 iHub System property pages 548 developing administrative applications report element adapters 599 for 196 IDAPI applications integrating web services with 196, 197 See also Information Delivery API integrating with client applications 206 accessing web services for 197, 202, 206 sending SOAP requests to 207 archiving and 262, 268–275 iHub volumes combining multiple data sources and 210 getting names of 172, 178 creating SOAP messages for 200, 206, 207 image constants 111 creating WSDL schemas for 197–203 image directory 84 developing 196, 200 image file names 84 generating locale-specific data for 196, 213 image files 84 image formats 99

824 Integrating Applications into BIRT iHub image handlers 83, 84, 111 See also IDAPI applications Image UI provider 574, 581, 587 accessing WSDL schemas for 203 ImageHandle objects 111 archiving interface for 262, 268 images integrating with BIRT iHub 196 displaying 581 running external archive drivers and 262 exporting 625 text string limitations for 217 generating HTML reports and 83 InheritedFrom element 269, 270 referencing 84 inheriting archive rules 270, 272 rendering charts as 99 initCustomControl method 705, 747, 749 rendering context and 99 initialize function 354, 355, 357 rendering text items as 556, 576, 577 initialize method rotating 559 rendering CSV output and 626 saving 84 rendering XML output and 657 specifying formats for 623 XMLDataExtractionImpl 777 IMenuBuilder interface 595 initializeControl method 752 immediate jobs 470, 485 initSessionFactory method 736 impl packages 52, 53, 129 initXMLOptions method 777 Import Projects dialog 503 input 88, 93, 701 importing input element 202 BIRT projects 501, 503 input file IDs. See InputFileId element exception class definitions 188 input file names. See InputFileName element source code 501 input message element 201 IN operator 472 input messages 201, 202 inclusive range operators 472 See also requests index pages 462, 473 input parameters index values callback functions and 352 changing axis type and 441 input streams 123 creating total objects and 442 Install New Software command 534 setting data row 394 install new software manager 530, 531, 534 Information Console installation accessing functionality 280, 450 archive driver 266 connecting to 355 BIRT Report Designer 501 customizing pages for 352 plug-ins 75, 509 displaying pages for 453 testing 501 logging in to 226, 450, 476 instance property 141, 144 logging out of 477 instantiation 509, 592 text string limitations for 217 integrated development environment 197 viewing debugging messages and 174 integrating with report generators 14 Information Console application 334 Integration Technology. See iHub Integration default 336 Technology Information Console library 227, 230 Interactive Crosstabs Information Console Security Extension 224 accessing 352 See also IPSE applications building user interface for 444 Information Console web application displaying cross tabs and 435, 437, 438 copying directory structures for 375, 378, enabling driller for 443 386, 399, 435 handling events for 438 Information Delivery API hiding features of 445

Index 825 interactive documentation iPortalID parameter 455 customizing the location of 284 iPortalLogin action 458 enabling 291 iPortalSecurityAdapter class 227, 228 SCOPE 292 See also IPSE applications using 282 IPSE applications 5, 224, 227 interactive features 418, 440 IPSE Java classes 227 interactive features (report items) 574 IQuery interface 685, 726 Interactive Viewer IRenderOption interface 98 accessing 494 IRenderOption objects 74 linking to 494 IRenderTask interface 35, 95, 98 navigating through reports and 495 IRenderTask objects 34, 74 Interactive Viewer servlet 495 IReportContent interface 628, 658 interactivity editor 420 IReportDocument interface 34, 87 Interactivity property 587 IReportDocument objects 74, 87 InteractivityCharts example 161 IReportEngineFactory interface 32, 85 interfaces IReportItemBuilderUI interface 592 See also user interfaces IReportItemFactory interface 547 Chart Engine API and 52, 53, 128 IReportItemFigureProvider interface 546, 574 data extraction extensions and 773 IReportItemImageProvider interface 546, 574 Design Engine API and 43, 51 IReportItemLabelProvider interface 573 design model objects and 39 IReportItemPresentation interface 548, 576 developing with 30 IReportRunnable interface 34 generating HTML documents and 84 IReportRunnable objects 74, 86, 87 generating reports and 79 IResultSet interface 685, 726 hierarchical diagrams for 30 IResultSetMetaData interface 685, 726 loading BIRT plug-ins and 82 IRunAndRenderTask interface 35, 95, 98 ODA drivers and 672, 679, 684, 727 IRunAndRenderTask objects 35, 74, 101 opening report files and 74 IRunTask interface 35, 95 plug-in extensions and 507 IRunTask objects 35 rendering output and 74 IScalarParameterDefn interface 89, 91 rendering reports and 624 IScalarParameterDefn objects 90 report document files and 87 isEmpty method 90 Report Engine API and 32, 37, 72 isEncryptable attribute 682 report item extensions and 548 isEncryptable property 548 report parameters and 88 iServer System. See iHub System interfaces package 46, 48 IServerContext interface 171 Internet Explorer 421 isExportDataType variable 777 Invoke Script action 421 isFileTypeAllowed function 230, 231 invokeSubmit parameter 470, 485 isHidden property 623, 771 IPageGenerator interface 548, 601 IsInherited element 269, 270 IParameterDefnBase interface 89 isList property 548 IParameterGroupDefn interface 89 isLocaleNeutral element 775 IParameterSelectionChoice interface 89, 91 isLocaleNeutral variable 777 IParameterSelectionChoice objects 94 isNameRequired property 547 IPlatformContext interface 81, 82 isnull parameter 470 IPlatformContext objects 82 isRowInFooterBand method 630 iportal URL 354 IStatusHandler interface 81

826 Integrating Applications into BIRT iHub IStyleProcessor interface 162 rendering XML output and 656 iterator method 110, 734 running plug-in instances and 506, 512, iterators 395 515 ITOCTree interface 103 running reports and 32, 33, 35 IUploadSecurityAdapter interface 230 setting properties for 525 iv action 456 Java compiler 501 IVServlet page 495 Java Components 355 Java event handler examples 162 J Java event handlers 170, 172, 173 Jakarta Struts action mapping 453, 456 building charts and 139 .jar files Java interfaces 30 accessing JDBC data sources and 78 Java report generator 14 building plug-ins and 541 Java RSSE framework 234 building update sites and 532 See also RSSE applications charting API examples and 159 Java Runtime Environment 267 charting applications and 127 java.util.logging.Level class 292 developing applications and 75, 78 Javadocs 30, 72, 78 developing ODA extensions and 675 JavaScript 301 generating data objects and 182, 184 customizing reports and 79 proxy objects and 206 line breaks in 139 testing CSV rendering extension and 636 JavaScript API 280, 281, 296, 300 JAR files 267 accessing 352 Java event handlers and 171 closing sessions for 357 Java APIs 9 designing reports and 406 Java applications developing with 352 adding charting capabilities to 126 initializing sessions for 354, 355 creating 14 loading resources for 356 generating charts and 10 providing security with 355–357 rendering reports and 31 JavaScript API (JSAPI) 330 Java Attribute Editor 525 JavaScript API class libraries 352 Java classes JavaScript API classes 352, 407 accessing 21, 96, 227, 230 JavaScript API functions building report designs and 39, 40, 43 custom web pages 352, 353 changing chart objects and 52, 53 report designs 406 changing report designs and 79 JavaScript event handler examples 162 developing with 9, 30 JavaScript event handlers 170, 172 event handlers and 170 building charts and 139 generating data objects and 181 JavaScript expressions 611 generating reports and 79, 86 JavaScript files implementing data extraction extensions developing web applications and 291 and 773, 774, 776 JavaScript framework 352 implementing rotated label plug-in JavaScript library 76, 77 and 541, 556 JavaScript platforms loading 681, 736 jQuery 280 registering 139 JavaScriptViewer application 162 rendering CSV output and 625, 636 JavaViewer application 162 JDBC connection profiles 673

Index 827 JDBC data sources 78, 672 JointDataSet element 28 JDBC drivers JPG formats 99 configuring Hibernate data sources JQuery 301 for 718, 736 jQuery 280 loading 78 downloading 302 JDK software 501 source libraries 302 jobID parameter stylesheets 302 delete job page 464 jQuery function 303 delete status page 465 JRE (Java Runtime Environment) 267 request detail page 467 jrem.jar 171 request drop page 468 js.jar 76, 77 requests index page 474 JSAPI server 334 jobName parameter JSAPI viewer 296, 336 delete job page 464 JSAPI viewer classes 297 delete status page 465 JSAPI viewer module 334, 335 execute report page 470 JSON.stringify( ) function 304 request drop page 468 JSPs submit job page 485 mapping actions to 453, 456 JobNotice data type 218 naming 453 JobPrinterOptions data type 218 JobProperties data type 218 K jobs 175, 178 keyup event listener 303 canceling 468 deleting 343, 464, 468 L displaying 474, 482 failing. See failed jobs label elements 24, 540 filtering 474 label items 119 getting information about 466 label tag 660, 661 listing pending 479, 483 Label UI provider 573 pending. See pending jobs labels (reports) 23, 556 print operations and. See print jobs LabelStyleProcessor class 162 removing 342 language-independent applications 196, 206 removing notifications for 464 large reports 359 requesting status 342, 343 Launch an Eclipse application setting 529 running 327 layout editor 538 running immediately 470, 485 layout package 53, 66 scheduling 486 LAYOUT_PREFERENCE_AUTO value 100 sending notifications for 485 LAYOUT_PREFERENCE_FIXED value 100 sending notifications for. See notifications layouts 13, 42 setting priorities for 471, 486 layouts (reports) 353 submitting 473, 484 LDAP environments 356 jobs pages 475 LDAP servers 234 jobs resource 299, 342 legend area (charts) 132, 133 JobSchedule data type 218 Legend interface 133 jobState parameter 464, 465, 468 legend line properties 133 joins 28 Legend objects 133 joint data sets 28 legends (chart) 419

828 Integrating Applications into BIRT iHub LESS_THAN_OR_EQUAL operator 472 list elements 119 Level class 85, 438 list items 26, 27 lib directory 75 list pages 461 libraries Listing element 26 accessing 13, 39, 72, 107 lists 475 accessing web services and 206 accessing report designs and 89 building plug-in extensions and 517, 526, adding to reports 27 527 displaying parameters and 90, 93, 94 configuring report engine for 80 literal attribute 202 creating reporting applications and 107 literal strings 609 deploying report engine and 75 load function developing applications and 75 actuate class 353, 354 developing report designers and 42 Dashboard class 365 finding source archives for 526 DataService class 393 generating code 197 Parameter class 380 installing online archive driver and 267 ReportExplorer class 370 loading IPSE Java class 227 LoadExportSchema class 657, 665 loading JavaScript API class 352 loading naming 527 class files 524 reusing designs and 8 class libraries 352 running Hibernate drivers and 739 dashboards 365 Library element (designs) 26 dialog boxes 406 library files 13, 107 document files 34 library-specific properties 42 Java classes 681 LibraryHandle class 42, 107 JDBC drivers 78 Life Cycle property 588 parameter components 380 Lightweight Directory Access Protocol. See plug-ins 82, 509, 518, 618 LDAP servers report content 362 LIKE operator 472 report designs 34, 74, 86, 108 limit parameter 470 report documents 74, 86, 88 limitNumber parameter 470 report elements 354 line break characters 139 report viewers 358, 364, 406 line breaks (JavaScript) 139 resource files 81 line charts 126, 128 resources 356 LineAttribute objects 133 source code 509 LineSeries objects 135, 136 XML schema files 665 Link To This Page command 494 local classes and interfaces 30 linking to locale code 287 Actuate BIRT Viewers 494 Locale element 774 linking to folders 477 SOAP headers and 211, 213 links 477, 494 Locale header field 287 links (Information Console) LOCALE parameter 292 See also hyperlinks locale parameter 196, 455 Linux servers Locale property 777 See also UNIX systems locale URL parameter 287 Linux systems locale variable 777 configuring archive service for 267 locale-independent formats 89

Index 829 locales login page 450, 454, 461, 476 converting strings and 89 login page (Report Studio) 491 creating session handles for 41 Login requests developing report item extension for 569 authenticating users and 225 exporting data and 775 binding to operations 202 formatting data for 213 type definitions for 199 generating data for 196, 353 login resource 298 localizing display names for 682 login servlet 356 localizing property groups for 681 Login type 199 setting 34, 74 loginacc object 304 specifying 213 loginacc structure 303 specifying current 455, 463 loginacc variable 304 localhost parameter 203 loginPostback parameter 477 localhost value 450 logins log file names 86 customizing 5, 224 log files 81, 86 forcing 225, 356, 455 archiving report files and 264 redirecting 477 tracking error information and. See error LogLevel parameter 264 log files logout action 456, 459 tracking usage information and. See usage logout function 357 log files logout page 454, 461, 477 log package 53, 58 LOG_FILE parameter 293 M LOG_LEVEL parameter 292 machine names 450 Logger class 85 machine-readable metadata 507 logging chart engine tasks 58 mail. See e-mail logging classes 85 Management Console logging configurations 81 text string limitations for 217 logging environments 86 manifest files 506, 509 logging in to manifest headers 515, 517 Information Console 226, 450, 476 Manifest wizard 683 logging in to Report Studio 491 MANIFEST.MF 515 logging levels MANIFEST.MF page (PDE Editor) 517 online archive driver 264 margins 100 logging levels (applications) 86 marker lines (charts) 419 logging levels (emitters) 628, 658, 660 mashup page 407 logging messages 86 master page components 42 logging output 33, 628, 658 master page footers 99 logging threshold 86 master pages login 303 adding report items to 119 login action 456, 459 creating 99 login information 225, 356, 492 reusing 14 Login operations setting margins for 100 See also SystemLogin operations setting properties for 26 binding to requests 202 MasterPage element 26 generating authentication IDs for 212 MATCH operator 472 specifying target volumes for 213

830 Integrating Applications into BIRT iHub MAXLISTENERS 291 updating ODA data sets and 701, 710 MAXSOCKETS 291 metadata schemas. See schemas MDS. See Message Distribution service meter charts 52, 128, 131, 132 Measure class 438, 441 MeterChartExample application 165 measure index values Method property 27 adding totals and 442 method stubs 636, 674 changing axis type and 441 methods 171, 175 measure names 440 See also functions measureExpression variable 440 chart instance objects and 52 measurement units 41 chart properties and 131 measureName variable 440 data extraction extension and 773, 777 measures documentation for 72 adding to cross tabs 439 ODA extensions and 684 changing direction of 441 ODA UI extensions and 702, 703, 705, 706 changing order of 441 opening report files and 74 editing 440 providing external values for 81 generating summary values for 441 rendering output and 625, 656 retrieving 440 report components and 41, 42, 109 viewing data cubes and 436 report engine configurations and 81 media types 208 running plug-in instances and 512 Member element 24 running rotated label plug-in and 556 memory 509 starting platforms and 84 menu builders 595, 596 Microsoft Active Directory servers 234 menuBuilders plug-in 595 Microsoft NET environments. See .NET menus 474, 595, 598 environments Message Distribution Service 480 Microsoft Windows. See Windows systems message element (SOAP definitions) 198, 200 MIME encoding 208 message transfer protocols 196 MIME types 622, 772 messages 473 mimeType property 622, 770 Messages class minOccurs attribute 200 CSV ODA driver extension 685, 692 mobile applications 280, 281 CSV ODA UI extension 700 mode parameter 481 Hibernate ODA extension 726, 747 model API 106, 107 messages. See e-mail model api package 72, 79 messages.properties file 700, 747 model definitions 609 meta tag 353 model element 507, 546 metadata model packages (charts) 53, 59 accessing CSV data sources and 685, 687, model plug-in 20 691 modelapi.jar 77 accessing Hibernate data sources and 729, modelodaapi.jar 77 732 ModifyListener method 748 adding ROM elements and 20–25 module handles 41 building ODA data sets and 708 ModuleHandle class 41 creating plug-in extensions and 507 monitoring tools creating property sheets and 21 See also performance monitoring examining data row 35 multi-byte characters 452 extracting data and 773 multicolumn page layouts 26

Index 831 multidimensional data structures 436 report items 110 multilevel dimensions 441 report rendering extensions 622 multilingual reports. See locales reports 179 multipart/related media type 208 naming collisions 210 multi-volume environments 178 naming restrictions 453, 484 My Documents folder 474 naming restrictions. See case sensitivity myChart.chart file 127 nativeDataType property 682 MySQL installation scripts 739 nativeDataTypeCode property 682 navigation options 494 N needOutputResultSet property 623 name attribute .NET environments 197, 200 dataSource element 681 networks 224 name element 548 Neutral local property 777 name parameter NeverExpire element 269, 270 file or folder detail page 466 New Extension wizard 519 file or folder drop page 468 New Java Class dialog 187 privileges page 482 new line characters 631 Name property new line tags 631 CSV ODA UI extension 698 New Plug-in Project wizard 514, 515 CSV rendering extension 622 new request index page 473 data extraction extension 770 New Source Folder dialog 528 ODA data source extension 681 new_report.rpdesign 786 rotated label plug-in 546 newDataMartCube function 182 name property 547, 770 newDataMartDataCube function 184 name space 42 newDataMartDataSet function 182, 183 name variable 101 newDataMartSource function 182 NameList element newElement method 119 UpdateFile operations 272 newExtendedItem method 144 names newQuery method 686, 728 See also user names newReportItem method 556 duplicating 210 newSession method 41, 108 portType definitions and 201 newSessionHandle method 40 servlets 490 newWizard element 673 text string limits for 217 next function 395 namespace 199, 210 next method 690, 734 namespace attribute types 197 Node.js 280, 291 namespace declarations 197, 200, 209, 210 nodes. See cluster nodes naming NonGroupOnXSeries.rptdesign 160 data extraction extensions 770 NonGroupOnYAxis.rptdesign 160 data types 199 non-native reports. See third-party reports JSPs 453 non-relational database sources 672 ODA driver extensions 681 non-visual components 18 ODA UI extensions 698 non-visual elements 107 output files 98, 102, 470, 479, 486 NOT_BETWEEN operator 472 plug-in libraries 527 NOT_IN operator 472 report item extensions 507, 546, 547 NOT_LIKE operator 472 NOT_MATCH operator 472

832 Integrating Applications into BIRT iHub NOT_NULL operator 472 ODA data set editor page 693, 700 notifications 178 ODA data set elements 28 data transfer protocols for 196 ODA data set extensions 682, 693 deleting 464 ODA data set handles 121 expiring 275, 276 ODA data set IDs 699 sending 485 ODA data set UI extension 699 sending attachments with. See attachments ODA data set wizard page 702, 706, 751 specifying user names for 471, 475 ODA data set wizards 699, 700 notificationSupported parameter 485 ODA data sets notify parameter 485 adding 121, 693 NULL operator 472 creating 685, 691 null parameter 356, 357 editing 673, 700 null values 174, 470, 682 mapping to 682 reserved parameters and 354 selecting 700, 715 testing for 472 specifying 699, 759 number parameters 91 updating 701, 710 NumberDataSet interface 129 ODA data source editor page 693, 701 numeric values 775 ODA data source elements 27 ODA data source extension elements 681, O 699 object attribute filters 699 ODA data source extensions 672, 679, 693 object IDs ODA data source handles 120 See also ObjectId element ODA data source wizard page 702, 705 objectID parameter 466 ODA data source wizards 700 object-oriented programming 672 ODA data sources objects accessing 672, 673, 679 accessing 97 adding 693 initializing actuate 354 connecting to 673, 685 instantiating 509, 592 creating queries for 707 registering service 512 preparing queries for 687 ODA API 672, 673, 684 retrieving data from 672, 684, 685 ODA API Reference 673 selecting 673, 700 ODA connection constants 702 specifying 699, 701, 714, 759 ODA connection profiles 673, 683, 698 ODA data types 682 ODA connection properties page 673 oda dataSource extension 672, 673, 679 oda connectionProfile extension 673, 683 ODA driver constants 692 ODA context class loader 681 ODA driver extension examples ODA CSV driver extension CSV data sources 535, 674 adding data access functionality Hibernate data sources 719, 726 to 679–683 ODA drivers building projects for 676–678 accessing CSV data sources and 674 developing 674, 675, 684 adding connection profiles for 673, 683, downloading source code for 674 698 setting dependencies for 683 adding to BIRT framework 673 ODA CSV driver plug-ins 674, 676 adding user interface for 535, 673, 693, 700 ODA data set designer page 700 changing connection properties for 673 configuring 681

Index 833 ODA drivers (continued) odadesignapi.jar 77 creating 717 ODAHOME constant 702 customizing 11, 15 odaScalarDataType property 682 defining error messages for 685 odaVersion property 681 extending functionality of 672, 674 olap package 46 initializing connections for 685 onceDate parameter 486 running 684 onceTime parameter 486 testing 674 onCreate events ODA DTP framework 11, 672, 701 report items and 19 ODA DTP interfaces 672, 681, 684 on-demand report generation. See ODA extension identifiers 679, 681, 682 synchronous jobs ODA extension points 673, 674 online analytical processing servers. See ODA extensions OLAP servers building 683 Online Archive Driver 262 creating projects for 672 online archive service 266 data type mappings for 682 online archive service provider 266 developing 672, 673, 674, 717 online documentation xvii downloading sample plug-ins for 674 online help setting design-time properties for 681 See also help setting display names for 681, 682 onLoad attribute 303 setting run-time properties for 679, 681 onlyLatest parameter 476 testing 711 onPageBreak events 19 ODA framework 673 onPrepare events 19, 172, 173 ODA packages 673 onRender events 177 oda plug-in 675 report items and 19 ODA Runtime driver wizard 683 onRowSets method 557, 577, 609 ODA UI extensions 675, 693, 696, 700 Open extension point description setting 521 ODA UI plug-in 675, 698, 700, 711 Open extension point schema setting 520 ODA UI plug-in projects 674, 693–696 open method ODA user interface Hibernate drivers and 728 adding connection profiles to 673, 698 open server technology 196 adding data sources to 693 open source applications 494 building CSV drivers and 675 opening creating 535, 673, 693, 700 builders 592 defining editor pages for 700 class files 524 defining property pages for 673, 698, 701 connections 352, 354, 685 defining wizard pages for 701, 705, 706 dashboards 365 enabling page editing functionality document files 34, 74, 86, 88 for 702, 703 Export Wizard 530 generating messages for 700 expression builder 610, 613 testing 711 HTML reports 104 ODA wizards 672, 674, 683, 700 login page 455 ODA_DEFAULT_CHARSET constant 702 output files 628, 658 OdaDataSet element 28 PDF documents 104 OdaDataSetHandle class 121 Plug-in Development perspective 513 OdaDataSource element 27 report designs 34, 74, 86, 108, 492 OdaDataSourceHandle class 120 Report Studio 490

834 Integrating Applications into BIRT iHub reports 358, 373 rendering 10, 31, 74, 618 schema definition files 520, 521 setting options for 98, 623 web applications 473 setting pagination for 623 openReportDesign method 32, 34, 74, 86 storing XML 776 openReportDocument method 32, 34, 74, 86 validating 20 open-source projects 500 viewing CSV 633, 637 operating systems 206 viewing HTML 9, 98 operation name element 201 viewing XML 668, 772 operations output devices 54 administration. See Administrate output element 202 operations output file names 74, 625, 656 archiving files and. See archiving output files operations accessing 104 binding to SOAP messages 201, 202 closing 628, 660 defining web service 197, 202 deleting 469, 470, 485 login. See Login operations exporting to 772 omitting responses for 201 limiting number of 470 processing 422 naming 98, 102, 470, 479, 486 running multiple 206 opening 628, 658 searching. See search operations rendering CSV output and 625 structuring 201 rendering XML output and 653, 656, 668 text string limitations for 217 saving 471, 478 updating files and. See update operations setting archive rules for 269 options action 459 output formats options save action 459 configuring emitters for 81 Organize Manifest wizard 683 customizing 95, 539, 618, 765 orthogonal axis values 133 default 72 orthogonal series 138 developing report generator for 14 OSGi Alliance website 512 exporting and 618, 764 OSGi arguments 33, 40 extracting data and 773, 779 OSGi class loader 681 generating ebXML data and 653 OSGi configuration property type 81 generating reports and 10, 98 OSGi error messages 127 getting 618, 765 OSGi platform 82, 85, 512 rendering images and 623 OSGi resource bundles 512, 515 rendering report items and 548 outline element 546 rendering reports and 34, 35 Outline property 573 setting 74, 622 Outline view (Eclipse) 516 specifying MIME types for 622, 772 outlining chart legends 133 specifying properties for 81 output 471, 478, 485 viewing reports and 4, 618 accessing formatted 104 output message element 201 changing archiving rules for 272 output messages changing report 380 See also responses creating charts and 8, 54 defining 201, 202 customizing reports and 79 output method 779 formatting. See output formats output page 454, 461, 478 generating 72, 102

Index 835 output streams Parameter class 380 creating file 626, 657, 772 parameter components 380 formatting 779 parameter definition tasks 89, 93 generating reports and 98, 104 parameter definitions 34 setting 74 parameter files outputDisplayNone property 623 See also data object values files; report outputFolderType parameter 470, 479 object value files outputFormat parameter 486 parameter groups 89, 90 _ _outputName parameter 486 parameter names 89, 90 outputName parameter parameter pages execute report page 470 navigating through 381 output page 479 retrieving parameters for 381 submit job page 486 parameter values files. See data object values overriding files; report object value files aging and archiving rules 267 PARAMETER_GROUP value 90 Overview page (PDE Editor) 516, 529, 530 parameters overwrite parameter 471 See also report parameters overwrite property 600 accessing information about 34 adding to URIs 286, 451, 452, 454 P adding to viewer component 382 Package Explorer 516 authenticating web services and 355 package visibility settings 517, 519 changing output and 380 packages 30 configuring archive driver and 262 page breaks 623 customizing 356 page components declaring input 352 getting content from 362 defining a dynamic filter. See dynamic page counts 34 filter parameters page extension element 698 defining session-specific 40 page footers 99 displaying 486 page generator 601 displaying dashboards and 365 page headers 100 displaying reports and 358, 364, 370, 373 page information 87 displaying tables and 422 page layouts 13, 42, 353 enabling user interface options and 362 page-level security 234 extracting data and 774, 779 See also page security application generating locale-specific data and 196 Page Level Security licensing option 234 initializing HTTP sessions and 354 page names 453 loading web pages and 450 page not found messages 473 logging in to Report Studio and 492 page properties 26 referencing report 484 pagination 623 retrieving data and 393 pagination property 623 retrieving from third-party palette (color) 41 executables 196 palette (report items) 538, 573 running Report Studio servlet and 490 palette extension element 546 running reports and 469, 472 Palette view 11 setting Interactive Viewer servlet 495 param1 parameter 380 unloading authentication information and 357

836 Integrating Applications into BIRT iHub validating 35 period (.) character 491 Parameters class 406 permissions. See privileges Parameters element 774 persistent connections 212 parameters page 461 persistent files 4 paramValues input parameter 297 persistent reports 212 parse method 91 phased downloading and viewing 212 parser tools 211 pick lists. See selection lists partitionName parameter 481 pie charts 52, 126, 128, 132 partitions 481 ping action 459 passback variable 352 ping modes 481 password parameter 455, 492 ping page 454, 461, 479 password variable 357 pivot function 441 passwords Platform class 84 adding to URIs 455 platform context 82 connecting to Deployment Kit and 355 Platform context property type 81 connecting to web services and 356 PlatformFileContext class 82 external security systems and 234 platform-independent applications 196, 206 running Report Studio and 492 platforms 84 sending in URLs 492 PlatformServletContext class 82 updating 226 PlatformServletContext objects 82 PATH environment variable 295 plot area (charts) 132 pathName parameter 373 Plot interface 132 paths Plot object 132 BIRT APIs 78 plot properties (charts) 132 BIRT home directory 75, 80 plot property 131 BIRT_HOME variable for 182 plug-in activation framework 509 image files and 84 plug-in archive files 506, 519 Java event handlers and 171 Plugin class 512 reports and 774, 779 Plug-in Development Environment 506, 513 setting folder names in 371 Plug-in Development perspective 513 temporary files 176 plug-in drivers 673 updating file 373 plugin element 510 pattern operators 472 plug-in extension examples 534 payloadSize parameter 481 plug-in extension points 509, 517, 520 PDE Manifest Editor 516, 678 plug-in extension schema definitions 520, PDE Workbench 515–534 522 PDF documents plug-in extensions building charts for 161 accessing ODA data sources and 672, 673 generating 95 adding report items and 11, 538, 539, 568 opening 104 adding reporting functionality and 500 rendering output for 74 building 526–529 PDF emitter 10 changing MIME types for 772 PDFChartGenerator charting example 161 creating 517–526 PDFChartGenerator class 162 declaring 517 PDFRenderOption class 98 deploying 530–534 pending jobs 479, 483 developing CSV ODA driver 674 pending page 454, 461, 479 downloading source code for 534

Index 837 plug-in extensions (continued) selecting run-time libraries for 527 exporting 540 setting dependencies for 517 extracting data and 764 setting properties for 515 implementing 500 testing 506, 515 rendering reports and 618 updating 533 setting class attributes for 524 verifying run-time archive for 519 specifying 519 viewing information about 516 testing 529 viewing project settings for 516 unloading 33 plugins directory 75, 82, 509, 675 viewing property annotations for 524 plug-ins packages 532 plug-in extensions. See extensions PMD. See Process Management Daemon plug-in fragment source code 535 PNG formats 99 plug-in manifest file 506, 509, 510, 517 port names 202 plug-in manifest headers 515, 517 ports 450 plug-in projects 514–515, 516 portType definitions 201, 202 plug-in registry 509, 618, 765 portType element 198, 201 plug-in run-time class 506, 509, 512 POST directive 208 Plug-in Selection dialog 518 POST login operation 297 plugin.xml 509, 510 POST request 285, 297, 300, 309, 313, 314, 327, Plug-in.xml page (PDE Editor) 517 328, 345, 347 plug-ins curl 301, 310 accessing BIRT 81, 208, 500 HTTP 309 accessing ODA data sources and 672, 673 HTTPS 300 activating 515, 533 POST resource 297 building rotated label sample extension postback parameter 486 and 540, 544 PostScript emitter 10 compiling code for 502, 529, 541, 675 PPT emitter 10 configuring report engine for 80 PPT formats. See PowerPoint formats controlling life cycle of 515 Pragma directive 209 creating Hibernate driver 719, 739, 746 preferences 455 creating Hibernate ODA UI 757 preferences (users). See user preferences debugging 541 PreferenceServlet charting example 162 deploying 506, 531 preparation services 7 developing applications and 75 prepare method 687, 730 developing content for 506, 513, 520 prepareMetaData method 687 developing with 500, 506 presentation engine 539, 540, 618, 765 downloading sample extensions for 534 presentation implementer class 576 editing project settings for 516, 517 Presentation property 588 exporting 530 presentation services 7, 10 extending functionality of 517 preview engine 634 finding source archives for 526 previewing grouping as features 531, 533 reports 9, 32, 406 installing 75, 509 rotated text images 581 integrating with Eclipse 4 primary base axis (charts) 133 loading 82, 509, 518, 618 print jobs rendering output and 618 See also printing running 509, 512 print requests. See print jobs

838 Integrating Applications into BIRT iHub Printer data type 218 properties printer settings. See printer options accessing 41, 42, 111 printing requests. See print jobs adding text controls for 699 prioritizing jobs 471 builders and 592 priority parameter changing 598 execute report page 471 charting applications and 128, 131–134, submit job page 486 161 priority property 549, 600 connection profiles 701 priorityValue parameter controlling visibility of 23 execute report page 471 CSV emitters and 622 submit job page 486 data extraction extensions 770, 773, 776 private classes 30 data sets and 121 private styles 114 Encyclopedia volumes 273, 275 PrivateStyleHandle class 114 expressions and 609 privileges 482, 484 Hibernate data sources and 749, 750 archiving and 263, 268 Java classes and 525 granting 287 libraries and 42 privileges page 454, 461, 482 master pages and 26 Process Management Daemon 477 ODA CSV extensions and 679, 681, 682 processed action status page 468 ODA data type mappings and 682 processError function 394 plug-ins and 515 processID parameter 481 report designs and 26, 42, 87 processParameters function 381 report elements and 108, 116 program updates 530, 531 report engine and 79, 80, 81, 96 programming environments 75, 197, 206 report items and 27, 111, 113, 114 programming languages 196 ROM elements and 19, 20 progressive parameter 471, 486 rotated label plug-in 546 progressive viewing 471, 486 rotated text items 570, 572, 581, 592 projects user sessions and 41 accessing custom data sources and 672 XML emitters and 660, 663 building BIRT 500, 502–506 Properties element 774 building update sites and 531 .properties files 506 changing settings for 516, 517 properties tag 776 creating property annotations 524 data extraction extension 766–769 property definitions 40 ODA driver extension 674, 676, 719 property editors 598, 693 ODA UI extension 674, 693, 740 property groups 681 report rendering extension 619, 653 property handles 114, 115 rotated label extension 541–543 property name element 20 developing plug-in extensions and 526, property names 681 529 property page adapters 538, 546, 548, 599 developing plug-ins and 514, 515 property page generators 601 importing 501, 503 property pages running rotated label extension and 529 adding to user interfaces 538, 540, 562, setting Javadoc locations for 78 601, 698 testing 505 building ODA user interfaces and 693, viewing settings for 516 701, 746

Index 839 property pages (continued) retrieving data with 4, 93 building text item extensions and 598 Query class 685, 686 changing ODA driver settings and 673 query parameters customizing 599, 600, 693 fetchDirection 288 enabling editing functionality for 598, 603, fetchHandle 288 702, 703 fetchSize 288, 291 enabling expression builder for 613 query preparation extensions 538 extending report items and 570, 572, 581 Query Text control 701 implementing read-only 607 QueryImpl class 136 specifying categories for 561, 598, 601 specifying properties for 548 R property pages extension points 673, 698, 739 radar chart example 164 Property property 27 radar charts 128 property sheets 21 RCP applications 80, 85 property structure objects 115, 116 RCP Report Designer package property types 19, 609 See also BIRT RCP Report Designer PropertyHandle class 115 readLine method 688 propertyPages extension point 673, 693, 698, read-only property pages 607 739 readSchemaFile method 665 propertyPages.exsd 673 records protecting corporate data 224 See also rows Prototype JavaScript Framework 352 recurringDay parameter proxy classes 197 execute report page 471 proxy objects 206 submit job page 486 proxy servers 225 recurringTime parameter 486 PS emitter 10 redirect parameter public classes 30 delete job page 464 public directories 371 delete status page 465 public interfaces 30 file or folder drop page 468 publishing request drop page 468 reports 170 submit job page 486 purging. See deleting redirection 477, 485 pUserParameters variable 777 referencing PUT request 310, 314, 346, 348 image files 84 pyramid charts 128, 142 report parameters 484 refresh method 601 Q registerEventHandler function queries XTabAnalyzer class 438 building charts and 134 registering service objects 512 building data cubes and 436 registry (plug-ins) 509, 618, 765 building ODA data sets and 707 relational data sources 672 developing ODA extensions for 672, 684, relational databases 672 718 RemoveArchiveRules element 269 executing 688 removeDimension function 439 getting parameter values and 90 removeEventHandler function preparing 539, 687 XTabAnalyzer class 438

840 Integrating Applications into BIRT iHub removing. See deleting report design element API classes 77 renaming report design files 146 report design element handles 43, 45 render method 98, 103 report design elements 87 render option classes 98 report design engine 4, 9, 40, 106, 182 render option objects 35, 74, 98 report design engine API 39, 40, 72 render options 35, 98, 101 report design engine API package 3, 5, 30, 43 render package 53, 69 report design engine classes 39, 40, 43, 108, render tasks 34, 95 184 rendering See also Design Engine API reports 353, 406 report design engine configurations 40, 82 specific report pages 353 report design engine extensions 12 rendering classes 625, 656 report design engine interface 51 rendering devices 55 report design engine objects 108 rendering environments 32 report design engine tasks 40 rendering extension IDs 622 report design files 495 rendering extension points 618 accessing 196 rendering extensions creating reports and 31, 72, 74, 87, 103 adding emitters and 618 designing reports and 12 building 635 generating 4, 9, 14, 40 creating projects for 619, 653 loading 34 developing 617, 618, 652 opening 74, 86, 108 downloading sample code for 618 renaming 146 downloading sample plug-ins for 534 running 35, 95 naming 622 saving 40 overview 618 validating 9, 20 running 637 report design handles setting dependencies for 621, 655 accessing properties and 42, 106 setting encoding scheme for 628, 658 accessing report items and 109 specifying extension points for 623, 655 creating report elements and 40 testing 632, 667 opening designs and 41, 108, 109 viewing output for 633, 637 report design model 12, 18 rendering options 35, 98, 99, 101 report design model objects 39 rendering output 10, 31, 74 report design objects 41 RenderOption class 74, 98, 101 report design properties 26 RenderTask objects 95 report design tools 8, 39, 40 reorderDimension function 441 report designers 8, 14, 32 reorderMeasure function 441 report designs 494 report classes 362 accessing 41, 106, 108 report components 13, 18, 26, 41, 42 accessing parameters in 89 report components. See components accessing properties for 42 report context class 172 accessing ROM schemas for 20 report context objects 171, 172 accessing structured content in 72 report creation phases 19 adding charts to 142, 146, 164, 165 report descriptions 12 adding report items to 109, 119 report design configuration objects 40, 108, changing 79, 106 182 creating 39, 107, 123, 184, 360, 366, 368, report design definitions 25, 26 383, 385, 435

Index 841 report designs (continued) loading 354 customizing 30 loading property definitions of 40 generating XML files and 786 mapping 653 getting properties for 87 operations unique to 43 opening 492 reusing 13 retrieving external data for 673, 684 ROM specifications and 20 reusing 8, 13 setting properties for 108, 116 running 213, 380 validating 9 saving 106, 123, 146 Report Encyclopedia. See volumes selecting ODA data sets and 700 report engine selecting report items for 11 accessing external classes and 96 standardizing 13 accessing external data sources and 684 testing for parameters in 90 adding emitters for 618 validating 20, 24 cancelling running tasks and 105 viewing CSV output in 639 configuring 33, 74, 79, 80 viewing XML output in 667 connecting to data sources and 74 report document files 465, 476, 495 creating 32, 33, 74, 79, 85 accessing contents 35, 87 customizing output formats for 539, 618, accessing structures 87 652 building 9 defining platform context for 81, 82 closing 88 deploying 75 creating 72, 95 designing reports and 34 exporting data from 764 developing 32 opening 34, 74, 86, 88 enabling reporting functionality for 88 overview 13 extending functionality of 12 rendering specific pages in 87 extracting data and 764 writing to disk 35 generating HTML documents and 84 report document objects 74, 87 generating report items and 539, 540 report documents generating reports and 4, 74, 86 See also reports getting output formats for 618, 765 viewing 494 getting parameter values for 90, 93 Report element 19, 774 integrating with CSV output 618, 624, 625, report element definitions 25 638 report element handles 43, 46, 49, 116 integrating with XML output 652, 656, report element interfaces 46 657, 765 report element services 43 logging information about 85, 86 report elements opening design files and 87 accessing 72, 87, 106, 182, 363 opening document files and 88 adding 40 overview 9 applying styles to 19 rendering reports and 618 assigning bookmarks to 363 running plug-ins and 509 changing 40, 107 running reports and 618 creating 40, 119 setting BIRT home for 80 embedding code in 364 setting global options for 33 embedding in web pages 352 setting HTML rendering options for 84 getting 87 setting properties for 79, 80, 81 handling events for 406 setting up as stand-alone application 85

842 Integrating Applications into BIRT iHub setting up as web application 82 setting archiving rules for 267, 268, 270 shutting down 33, 74 setting expiration policy for 267, 270 starting and stopping platforms and 85 specifying type 213 Report Engine API 10, 31, 32, 72 updating archiving rules for 271, 272 Report Engine API classes 33, 35 report generation requests Report Engine API interfaces 37 assigning to resource groups 213 Report Engine API package 30, 35, 72 preserving connections for 212 report engine api package 3, 5 report generation services 31 Report Engine API Reference Javadoc 72, 78 report generators 14, 30 report engine configuration objects 32, 79, 80, report item builder 592, 595, 610 82, 83 report item definitions 25, 574 report engine constants 96 report item elements 26–27 report engine content plug-in 618 report item emitters 539 report engine dataExtraction plug-in 764, report item extension points 538, 549, 550 766, 773 report item extensions report engine emitter plug-in 618, 656 adding descriptions for 546 report engine emitters extension 539 creating 537, 550, 568 report engine emitters plug-in 618, 624 deploying 540, 564 report engine emitters schema 539 developing 11 report engine extension package 539 displaying reports and 10 report engine objects 74, 79, 85 naming 507, 546, 547 report engine plug-in 655 overview 538–539 report engine services 7, 31 setting dependencies for 544 report engine tasks 34 testing 564, 574 report engines 171 report item generation extension point 538 report example applications (charts) 164 report item generation schema 538 report executable files 380, 476 report item handles 48 report execution requests. See ExecuteReport report item icons 573 operations report item interfaces 48 report explorer. See ReportExplorer report item menu builders 595, 596 components report item model 568 report file types 12 report item model extension point 538, 545, report files 4, 12–14 546, 568 See also files; specific report file type report item model schema 538 accessing 475 report item palette 538, 573 archiving 470, 485 report item plug-ins 540, 572 assigning privileges to 482 report item presentation extension point 538, copying 263 545, 548, 576 deleting 262, 468 report item presentation schema 538 displaying 476, 494 report item property editor 598, 600, 608 filtering 475 report item query extension point 538 getting archiving rules for 274 report item query schema 538 getting information about 465 report item schema definitions 507, 538, 540, naming. See file names 550 overwriting 471, 478, 485 report item UI designs 572, 581, 615 saving 471, 478 report item UI extension point 538, 545, 546, searching 483 572

Index 843 report item UI extension schemas 507 See also parameters report item UI property page 570, 572 accessing 88, 89 report item UI property page adapters 538, converting string values for 89, 92 548 creating report documents and 34 report item UI providers 573, 581, 587 downloading 380, 381, 382 report item UI schema 538 generating reports and 95 report items getting attributes of 91 accessing 72, 110, 111, 112 getting data type of 91 adding 109, 119, 538 getting default values for 90 binding data sets to 122 getting valid values for 90 binding to data sets 608, 610 iterating through 90 changing model definitions for 609 providing input and 88 changing properties for 113, 114, 598 restricting values for. See cascading creating 11, 119 parameters customizing 11, 15, 539 retrieving 380, 381 defined 26 setting values 91, 101 displaying 11, 557 testing for 90 examining 110 testing if grouped 90 extending functionality of 15, 20, 537, 568 updating values for 91 generating 538, 540 validating 35 getting display text for 546 viewing 381 getting handles to 41, 42 report rendering plug-ins 534 getting properties for 111 Report Server Security Extension 234 handling events for 19 See also RSSE applications; RSSE API instantiating 556 report servers. See iHub servers naming 110 Report Studio overview 11–12 accessing 491 providing interactivity for 574 logging in to 491 setting properties for 27, 113, 114, 592 starting 490 setting rendering formats for 548 Report Studio servlet 490 setting styles for 26, 114, 547 report template files 13 setting visibility of 573 report template properties 42 testing 580, 592 report templates report library files 13, 107 accessing structures 72, 107 report model API 39, 40 changing 107 report model api package 3, 30, 39, 43 developing 39 report model plug-in 20 developing reports and 14 Report name property 777 saving designs as 8 report names 774, 777, 779 report viewer Report Object Model API Reference 72, 78 components of 7 report objects. See reports developing for 31 report parameter collections 90, 91, 92 generating charts and 10 report parameter definitions 34 generating reports from 74 report parameter files overview 9 See also data object values files; report report viewer plug-in 9 object value files report viewer servlet 494 report parameters 484, 486 reportContext objects 171, 172

844 Integrating Applications into BIRT iHub ReportDesign element 26 reportitemUI extension point 538, 545, 546, ReportDesignHandle class 40, 42, 107, 109 572 ReportDesignHandle objects 40, 41, 42, 108 reportitemUI extension schema 507 ReportElement element 25 reportitemUI schema definition 538 ReportElementHandle class 43, 46 reportitemUI.exsd 507, 538 ReportElementHandle objects 43 Reportlets ReportEngine class 33, 74, 79, 89 generating 406 ReportEngine objects 32, 33, 74, 79, 85 ReportName element 774 ReportExplorer class 370 reportName variable 777 ReportExplorer components ReportParameterConverter class 89, 92 handling events for 372 reports instantiating 370 accessing 104, 362 loading 370 assigning to resource groups 213 navigating through 372 building security applications for 234 retrieving data for 371 controlling content of 14 selecting items in 372 creating 30, 74, 95 setting file types for 371 customizing 79 submitting requests for 371 deploying 99 viewing report items and 370, 372 developing 14 reporting system. See iHub System displaying 4, 31, 212, 358, 494 ReportItem element 25, 26 embedding code in 364 reportitem plug-in (chart) 539 embedding in web pages 352 reportitem plug-in (rotatedlabel) 540 filtering 475 reportItem.exsd 538 generating 14, 40, 79, 86, 103 ReportItemFactory class 556 getting number of pages in 34 reportItemFigureUI element 546 getting styles for 111 reportitemGeneration extension point 538 hiding content in 623 reportitemGeneration schema definition 538 localizing 196, 213 reportitemGeneration.exsd 538 managing third-party 196 ReportItemHandle class 48 naming 179 reportItemImageUI element 546 navigating through 494 ReportItemLabelProvider class 556 opening 358, 373 reportItemLabelUI element 546 previewing 9, 32, 406 reportItemLabelUI property 574 publishing 170 reportItemModel extension point 538, 545, rendering 353, 406 546, 568 rendering output for 10, 31, 74, 618 reportItemModel schema definition 538 rendering specific pages for 34, 353 reportitemPresentation extension point 538, retrieving data from 393 545, 548, 576 retrieving from web services 352 reportitemPresentation schema retrieving parameters from 380, 381 definition 538 retrieving subsets of data in 363 reportitemPresentation.exsd 538 returning null values 174 ReportItemPresentationBase class 557 returning unexpected values 174 reportitemQuery extension point 538 running 354, 469, 618 reportitemQuery schema definition 538 saving 31, 471, 478 reportitemQuery.exsd 538 sending as attachments. See attachments setting styles for 19, 24

Index 845 reports (continued) testing volumes and 481 submitting requests for 469 validating 212 viewing in web browsers 380 requests index page 474 viewing metadata for 20 reserved parameters 354 viewing schema definitions for 20 resetAll( ) function 336 viewing specific parts of 359 resetAll( ) method 316, 319 repositories 490 resetFilter parameter 474, 476 See also volumes resetting driller objects 443 accessing items in 475 resizing web pages 100 displaying content 370 resource bundles 512, 515 web services and 355 Resource Explorer 13 repository file paths 373 resource files 81, 108 repositoryType parameter 490 Resource files property type 81 request attributes 214 resource groups Request class 393 assigning to reports 213 request detail page 466 resource identifier 297 request drop page 468 resource locations 532 request objects 393 resources request parameter 394 data objects 343 RequestID element 213 dataobject 299 RequestOptions class 356 files 298, 310, 325 RequestOptions objects 354, 364, 370 folders 298, 307, 325 requests 280 HTML emitters and 83 See also SOAP messages jobs 299, 342 binding to operations 202 loading JavaScript API 356 caching 209 login 298, 303 closing HTTP sessions and 357 module handles and 42 defining 200, 201, 213–214 updating report designers and 533 displaying dashboards and 365 user sessions and 41 displaying reports and 358 usergroups 299, 346 dropping 468 users 299, 344 failing 215 visuals 298, 325, 333 initiating 209 responses instantiating 393 See also SOAP messages loading web pages and 450 binding to operations 202 locale-specific reports and 196, 213 caching 209 preserving connections for 212 defining 200, 201, 213–214 retrieving data and 352, 393 omitting 201 retrieving parameters and 381, 382 preserving connections for 212 sending 280, 450 specifying media types for 208 sending to BIRT iHub 206, 207, 209, 210, transmitting to client applications 206, 207 213 REST 281 sending to BIRT iHub clusters 213 REST API 280, 296, 325 sending to volumes 209, 213 context root 292 specifying default settings for 356 documentation 281 specifying file type for 213 documentation URL 282 submitting 225, 469 logging in to iHub 303

846 Integrating Applications into BIRT iHub REST API architecture 281 RetainOwner parameter 263 REST API requests 287, 288, 292, 300, 303 RetainPermission parameter 263 that return a list 288 RetainTimestamp parameter 262 REST API resources 297, 300 rich client platforms 8 POST login 287 right to left generation 99 running and testing 282 roles 173, 176, 177 REST API server 305 archiving access control lists and 263 REST API URI 299 setting privileges for 484 REST API WSDL definition file 293 rollback method 729 REST requests 292, 301 ROM 12, 18 REST server 295 ROM API Reference Javadoc 72, 78 logs 292 ROM Definitions Reference 18 REST server module 280 ROM element definitions 22 REST service 280, 281, 289, 291, 292 ROM element handles 106 context root 285 ROM elements controlling with System Console 290 accessing 106 controlling with Windows services 290 adding 25, 26, 120 deploying on a separate machine 293 applying styles to 19 improving performance 291 changing 21 port numbers 285 defining event handlers for 19 proxy 285 defining executable code for 27 sockets and listeners 291 defining properties and 19, 20, 21 starting 289 overview 18, 25, 27 starting on a separate machine 295 viewing metadata definitions for 20–25 stopping 289 ROM report item elements 26–27, 507 RESTful requests 280 ROM schemas 18, 20 result set components 394 ROM specification 12, 18 result set objects 394 ROM types 19 result sets rom.def 20, 21 See also queries; search results rotated label manifest file 510 building charts and 129 rotated label plug-in 512, 556 displaying data and 394 rotated label report item extension downloading 394 creating projects for 541–543 extracting data and 773, 779 deploying 540 getting column names in 708 developing 541, 556–564 getting metadata for 709 downloading BIRT plug-ins for 540 incrementing data rows for 395 downloading source code for 540 querying CSV data sources and 684, 685, implementing 539, 564 689 launching 564 querying Hibernate data sources and 730, loading BIRT plug-ins for 545 734 running 529 rendering reports and 623 setting dependencies for 544 returning 672 specifying content of 550 testing ODA drivers and 674 specifying extension points for 545, 549, ResultSet class 394, 685, 689, 726, 734 550 ResultSet objects 394 rotated label report item extension points 526 ResultSetMetaData class 685, 691, 726 rotated text builder 592, 595, 610

Index 847 rotated text images 556, 576, 577, 581 rows rotated text item classes 572, 576 exporting data and 775 rotated text item extension 568 getting position of 690 rotated text items grouping 407 adding to user interfaces 568 incrementing 395 binding to data sets 608 incrementing cursors for 690 creating 540, 557 retrieving result sets and 395 rendering as images 556, 576, 577 retrieving specific sets of 363, 394, 422 setting rotation angles for 580, 596 returning result sets and 684 testing 580 setting index values for 394 rotated text menu builder 595, 596 sorting 364 rotated text property editor 598, 600, 608 viewing summary data in 441 rotated text UI designs 572, 581, 615 writing to CSV files and 629, 631 rotated text UI providers 573, 581, 587 RPCs. See remote procedure calls RotatedLabel application 564 rptdesign format rotatedlabel plug-in 512, 556 See also report design files RotatedLabelCategoryProviderFactory rptdocument format class 561 See also report document files RotatedLabelGeneralPage class 562 RSSE applications RotatedLabelItemFactoryImpl class 556 See also Report Server Security Extension RotatedLabelPlugin class 512 registering external users for. See external RotatedLabelPresentationImpl class 557 user registration RotatedLabelUI class 556 rules. See archiving rules RotatedText property 573, 576, 608 run method 97, 98, 102, 103 RotatedTextBuilder class 592 run requests. See report generation requests RotatedTextCustomPage class 607 RunAndRenderTask objects 95 RotatedTextEditor class 593 runnable variable 101 RotatedTextFigure class 589 running RotatedTextFigureUI class 588 BIRT Viewer servlet 494 RotatedTextGeneralPage class 603, 607 Interactive Crosstabs 352 RotatedTextItem class 572 report designs 213, 380 RotatedTextItemFactory class 569 report executables 380 RotatedTextLabelUI class 574 reports 354, 469 RotatedTextMenuBuilder class 595 running page 454, 461, 482 RotatedTextPageGenerator class 601 running reports 618 RotatedTextPageGeneratorFactory class 601 running tasks, cancelling 105 RotatedTextPresentationImpl class 576, 609 runReport function 354 rotateImage method 557, 559 runReport( ) function 333, 336 rotation angle properties 598, 603 RunTask objects 95 rotation angles 580, 596 run-time archives (plug-ins) 506, 519 rotation rendering algorithm 577 run-time drivers 684 rotationAngle property 547, 570 run-time engine 634 .rov files. See report object value files run-time environments 509, 533 Row element 775 run-time generation requests 213 row headings 434 run-time instance (PDE Workbench) 515 row index values run-time libraries 527 setting 394 Runtime page (PDE Editor) 517, 519

848 Integrating Applications into BIRT iHub run-time workbench 529, 564 ODA UI extensions 673 opening 520, 521 S plug-in extensions 506, 520 sac.jar 76, 77 property definitions and 20 SalesReport application 165 property pages 673 sample charting API plug-ins 159–166 report engine emitters 618, 658 sample charting applications 126, 160 report item extensions 507, 538, 540, 550 sample data 141, 143 ROM specifications and 18, 20 sample event handlers 162 rotated label sample plug-in 545 sample ODA extensions 672, 674 validating designs and 20 sample plug-in extensions 534 SCOPE parameter 292 sample plug-in fragment 535 script API library 77 save method 123 script editor 170 saveAs method 123 script package 53, 69 saveOutput parameter 471 script tag 352, 353 savePage method 710, 755 scriptapi.jar 171 saving ScriptCharts class 162 images 84 ScriptDataSetHandle class 121 output files 471, 478 ScriptDataSourceHandle class 120 report components 8 scripted data set elements 28 report designs 40, 106, 123, 146 scripted data sets reports 31 accessing ODA data sources for 121 scalar data types 682 scripted data source elements 27 scalar parameters 89, 90 ScriptedDataSet elements 28 scatter charts 126, 128 ScriptedDataSource elements 27 scheduled job page 454, 461, 483 ScriptHandler class 53 scheduled jobs scripting 19, 30, 97, 406 See also jobs Scripting configuration property type 81 schedulePeriod parameter 487 scripting context 34 schedules scripts setting archiving 269, 273 BIRT designers and 406 scheduleType parameter 487 building charts and 69, 139 scheduling jobs 486 concatenating code for 139 schema directory 506 customizing reports and 79 schema element 507 encapsulating in HTML code 353 schema files 506, 657, 665 providing external values for 81 schemas ScriptViewer charting example 162 See also WSDL schemas scroll bars 359 connection profiles 673 scrolling 359 data extraction extension and 764 search criteria. See search conditions design specifications and 12 search expressions 483 displaying as HTML 522 search folders page 454, 461, 483 displaying property annotations in 524 search operations mapping report elements to 653 See also searching ODA driver extensions 673 setting conditions for. See search ODA driver sample plug-ins 726 conditions search paths 84

Index 849 searchfiles action 459, 460 SeriesDefinitions objects 130 searchFilter parameter 483 SeriesImpl class 53, 135, 136 searching SeriesPalette objects 135 See also search operations server parameter 482 folders 483 serverContext objects 171 security 14, 224, 231, 355–357 servers 491 security adapter class 225, 227, 228 See also iHub servers security adapters 225, 226–232, 357 accessing 224 security applications 234 deploying Information Console over 224 security credentials. See credentials securing web services and 355, 356 security extension Java classes 230 sending SOAP messages over 208 security information 492 setting up firewalls and 224 security roles 173, 176, 177 serverURL parameter 490 security roles. See roles execute report page 471 SECURITY_ADAPTER_CLASS submit job page 487 parameter 228 URIs 455 Selected column names property 777 service applications 512 selectedColumnNames variable 777 service element 198, 202 SelectionAdapter method 748 service objects 512 selectjobs action 459 service references 512 semantic validators 24 service registry 512 SemanticValidator element 25 services 5, 9, 479, 481, 482, 512 sending notifications 485 See also iHub services; web services sending requests 280, 450 serviceurl parameter 356, 357 sendmail utility 196 servlet context 80 sequence element 200 servlet names 490 serialize method 123 ServletContext class 82 serializing servlets 494 SOAP messages 199, 208 changing 490 series routing messages to 208 adding 135 running Report Studio and 490 associating data with 136 session attributes 475 binding to charts 129 session handles 41, 108 building run-time instances of 130 starting user sessions and 189 creating 134, 135 session IDs 212 defined 129 session information 477 grouping 160 session level parameters 390 setting type 53, 67 session parameters 40 series (charts) session state 189 displaying values 418 session variables 475 series definition objects 129, 134 SessionFactory objects 735, 736 series definitions 137 SessionFactory operations 718, 728 series names 422 SessionHandle class 41, 123 series sample plug-ins 160 SessionHandle objects 40, 41, 108 series types 134, 142 setAbsolute method 114 SeriesDefinition objects 134, 137 setActionHandler method 100 SeriesDefinitionImpl interface 135 SetArchiveRules element 269, 270, 271

850 Integrating Applications into BIRT iHub SetAutoArchiveSchedules element 273 setReportletBookmark function 359 SetAutoArchiveSchedules operations 269 setReportName function setBaseImageURL method 99 Parameter class 380 setBaseURL method 100 Viewer class 358, 365, 399 setBeforeOpen method 43 setResourceLocator method 81 setBIRTHome method 80 setResourcePath method 81 setDashboardName function 365 setResultSetMetaData method 710, 756 setDataSet method 120, 122 setScript method 139 setDataSource function 183 setSorters function setDataSource method 121 Crosstab class 442 setEmbeddable method 99 setStatusHandler method 81 setEmitterConfiguration method 81, 84 setSubType method 142 setEnableAgentStyleEngine method 100 setSupportedImageFormats method 99 setExpression function 440 setTempDir method 81, 84 setFolderName function 370 setThreadContextClassLoader property 681 setHeadline method 178 settings. See properties setHideGridlines method 101 setType method 142 setHtmlPagination method 100 setUIOptions function setHtmlRtLFlag method 99 Viewer class 362, 399 setHtmlTitle method 99 setUnits method 131 setImageDirectory method 99 setupConfigLocation method 748 setImageHandler method 84, 99 setupFileLocation method 704 setInitialProperties method 749, 750 setURI method 113 setLayoutPreference method 100 setVersionName method 179 setLogConfig method 81, 86 setWrappingText method 101 setLogFile method 86 shared styles 114 setLogMaxLogBackupIndex method 86 SharedStyleHandle class 114 setLogRollingSize method 86 Show extension point description setMasterPageContent method 99 setting 520, 522 setName method 110 showDetail function setOfficeVersion method 101 Crosstab class 445 setOption method 102 showDocument parameter 476 setOSGiArguments method 81 showExecutables parameter 476 setOSGiConfig method 81 showFolders parameter 476 setOutputFileName method 102 shutdown method 85 setOutputMasterPageMargins method 100 side menu 474 setPageFooterFloatFlag method 99 simple object access protocol. See SOAP setPageNumber method 103 simple properties 111 setPageRange method 103 single sign-on authentication 357 SetParameters operations 269 singleton property 548, 600 setParameterValue method 91, 96 site.xml 532 setParameterValues function slash (/) character 491 Viewer class 382 slot definitions (ROM) 23 setParameterValues method 96 Slot element 23 setPlatformContext method 81, 82 slot handles 110, 111, 122 setProperty method 81 Slot property 23, 27 setRenderOption method 98 slots 19, 23, 26, 109

Index 851 SMTP messaging protocol 196 source builds 526 SOAP endpoints 206 source code See also SOAP ports accessing Java 500 SOAP envelopes 206, 207, 209–210 accessing JavaScript API 352 SOAP Fault messages 215 accessing report parameters and 89 SOAP headers accessing reporting functionality and 41 binding definitions and 202 accessing sample 535 creating 211–213 adding chart interactive features and 421 message definitions and 200 adding to designs 79 namespace declarations in 200, 209, 210 building data extraction extensions SOAP messages and 765, 786 accessing multiple data sources and 210 building rotated label plug-in and 540 accessing proxy objects for 207 changing 500 adding HTTP headers to 206, 208 charting API examples and 159 binding to web service operations 201, 202 compiling 184, 501, 529 creating 200, 206, 207 constructing requests and 393 defining locale-specific 196, 213 creating custom designers and 40 defining requests/responses in 200, creating run configuration for 190 213–214 debugging plug-ins and 541 preserving connections for 212 defining executable 27 running multiple operations and 206 developing applications and 30 scoping to WSDL files 199 developing ODA driver extensions sending and receiving 206, 211 and 674, 719 serializing and deserializing 199 developing rendering extensions and 618 setting length of 209 displaying cross tabs and 439, 443 specifying media type for 208 displaying dashboards and 365 structuring content 197, 209 displaying parameters and 381, 382 SOAP messaging framework 196, 206 displaying reports and 360, 362 SOAP ports 202 downloading 500, 502 SOAP requests. See requests embedding 364 SOAP responses. See responses enabling user interface options and 362 SOAP VersionMismatch error 210 extending BIRT functionality and 19 SOAPAction directive 209 generating data objects and 181 soapAction parameter 202 getting parameter values and 91 SOAP-based archiving interface 262, 268 hiding user interface options and 445 software 530, 534 importing 501 Software Development Kit initializing HTTP sessions and 354 See also SDK package initializing HTTPS sessions and 356 sort fields. See sort columns loading 509 sort order 115 logging information and 86 Sorter class 442 opening design files and 87 sorter objects 442 registering event handlers and 438 sorters running 407 creating 442 running plug-ins and 509, 530, 541, 675 sorting data and 364, 442 setting up workspaces for 502 sorting data 11, 130, 364, 442 SOAP messages and 206 sortTable function 364 viewing charts and 69

852 Integrating Applications into BIRT iHub writing event handlers and 172, 173 STATUS_SUCCEEDED value 105 source code archives 502 stock charts 126, 128 source code modules 41 StockDataSet interface 129 source extension point 526 StockReport application 165 source files 352 stopping the REST service 289 space character 286, 452 strict.dtd value 353 space characters 491 string pattern operators 472 special characters 285, 451, 491 string properties 114 splitQueryText method 687 strings 454, 472 spreadsheets 101 changing property type for 609 spreadsheets. See Excel spreadsheets concatenating 139 SQL statements converting 89 CSV data sources and 684, 685, 687 converting to locale-independent Hibernate data sources and 672 formats 89 SQL statements. See queries creating debugging messages and 174 src attribute 84 exporting data and 775, 779 stand-alone applications 14 limitations for characters in 217 accessing engine plug-ins for 81 localizing 353 configuring BIRT home for 80 setting parameter values and 91, 92 configuring report engine as 85 writing to CSV files and 625 creating charts and 52 Structure element 24 generating HTML documents and 84 structure property objects 115 stand-alone environments 81 structured report items 110 stand-alone report engine 31 StructureFactory class 116 standards compliance mode 353 StructureHandle class 49 start method 628, 658 structures 24 start parameter 394 Struts action mapping 453, 456 StartArchive command 274 style attributes 19, 21, 113 starting style components 19, 24 Eclipse Workbench 529 style definitions 24 online archive service 266 Style element 24 Report Studio 490 style properties 41 starting the REST service 289 style property 19, 24 startLabel method 660 style sheets 19, 76, 77 startRow method 629 StyleChartViewer application 162 startTable method 629 StyleHandle class 114 startText method 630, 661 StyleProcessor charting example 162 startup messages 473 StyleProcessor class 162 startup method 84 StyleProperty property 27 startUpMessage parameter 473 styles Statement class 726, 730 accessing 42 static data 129 adding report items and 26, 114, 547 Status handling property type 81 creating charts and 162 STATUS_CANCELLED value 105 creating reports and 19 STATUS_FAILED value 105 generating HTML output and 100 STATUS_NOT_STARTED value 105 getting 111, 114 STATUS_RUNNING value 105 reusing 13

Index 853 styles (continued) system administrators 213 setting attributes for 19, 21, 113 See also administrators setting properties for 27 system schemas. See schemas subclasses 352 subdirectories. See subfolders T subfolders 484 tabbed property sheets 474 creating volume archives and 263, 264 table bookmarks 422 setting archiving rules for 267 Table class 362 submit function table elements 119 actions and 422 table headers 407 Dashboard class 365 table items 26, 27 Parameter class 380 table of contents 103 Viewer class 358, 362, 399 table of contents markers 34 submit job page 454, 461, 484 tables submitCallback function 365 changing 362 submitjob action 460 creating 27 SubmitJob operations displaying 360, 422 archiving and 268, 270 filtering data in 421 submitting jobs 473, 484 generating HTML content and 100 subpage parameter 473, 475 grouping rows in 407 SubTotal class 441 hiding columns in 363 subtotals 441 rendering CSV output and 625, 629 subType property 547 retrieving 422 success notices sorting data in 364 setting expiration times for 275, 276 tabs summary data selecting 474 adding 434, 436, 441 tab-separated values files. See TSV files deleting 442 tabular layouts 27 generating grand totals and 441 targetNamespace attribute 199 generating subtotals and 441 targetPage parameter 450, 477 supportedFormats element 548 TargetResourceGroup element 213 supportedImageFormats property 623 TargetServer element 213 supportsMultipleResultSets method 730 TargetVolume element 213 SVG formats 99 TargetVolume header field 287 SvgInteractivityViewer application 161 TARGETVOLUME parameter 292 Swing applications 154, 161 targetVolume parameter 292 Swing graphics API 576 targetVolume URL parameter 287 SwingChartViewersSelector application 163 task classes 95 SwingGraphicsUtil class 583 task objects 95 SwingInteractivityViewer application 161 tasks 34, 105 SwingLiveChartViewer application 164 tcpmon utility. See TCPMonitor SWT applications 161, 162 template files 13 SWTchartViewerSelector application 164 template properties 42 SwtInteractivityViewer application 161 templates synchronous jobs accessing structures 72, 107 assigning to resource groups 213 changing 107 synchronous reports 213

854 Integrating Applications into BIRT iHub developing 39 text messages 473 developing reports and 14 text property 570 saving designs as 8 text strings. See strings Temporary file location property type 81 TextDataSet interface 129 temporary files 33, 81, 176, 481 themes 41, 42 temporary files. See transient files third-party reports 196 temporary images 84 this keyword 364 temporary reports. See transient reports thread context class loader 681 testCharts.chart 164 time dimensions (cubes) 437 testing time stamps 262, 471, 481 BIRT installations 501 time zones 455 BIRT projects 505 timeToDelete parameter chart attributes 61 execute report page 471 context menus 598 submit job page 487 CSV emitter 632, 640 timezone parameter 455 CSV ODA UI plug-in 711 title tag 99 data extraction extension 783, 786 TMP_DIR parameter 293 Hibernate ODA UI plug-in 757–762 tmpdir variable 84 ODA drivers 674 TOCNode class 103 plug-in extensions 529 Tomcat servers 9, 356 plug-ins 506, 515 toolbars 494 report item extensions 564, 574 disabling 398 reporting services 482 viewers 362, 398 rotated text items 580, 592 tooltips 418 scripts 406 Total class 441 XML emitter 667 total objects 442 text 110 TotalCount field 288 limitations for 217 totals Text class 362 viewing in charts 418 text controls 699, 701 viewing in cross tabs 441 text elements 362, 540 transactions 729 text files See also Transaction operations accessing data in 672 transfer protocols 196, 206 reading from 535, 684, 685, 688 transient files 176, 481 rendering output to 618 transient reports 212 text item builders 592, 595, 610 truncated strings 454 text item property editor 598, 600, 608 trusted names 450 text items TSV formats 618 binding to data sets 608 tube charts 128, 142 changing model definitions for 609 type attribute 681 changing properties for 598 Type elements 27 changing values for 608 type package 53, 67 rendering as images 556, 576 type property 547, 548, 600 rotating 540, 557, 580, 596 typens namespace prefix 199 testing 580, 592 types. See data types writing to CSV files 625 types element 198, 199–200 writing to XML files 657, 661

Index 855 U UPLOAD_SECURITY_ADAPTER parameter 232 UI elements uploadimage action 460 See also user interfaces uploading binary files 490, 494 ui plug-ins 673, 675 uploading update sites 532 UI providers 573, 581, 587 uploadlicense action 460 UIOptions class URI parameters 490, 495 Viewer 362, 398 URIPATHS parameter 292 XTabAnalyzer 444 URIs 111, 113, 494 UiPlugin class 700 adding parameters to 286, 451, 452, 454 ULocale methods 171 creating 286, 299, 450, 451 unauthorized users 224 encoding characters and 285, 451, 452 Unicode character sets 208 obtaining list values and 475 Uniform Resource Locators. See URLs overview 297, 299, 450, 453 uniform resource names (URNs) 208 Process Management Daemon and 477 unit of measure 41 processing SOAP messages and 208, 209 universal hyperlinks. See hyperlinks redirecting logins and 477 Universal Resource Identifiers. See URIs returning diagnostic information and 479 UNIX systems running reports and 469, 472 sending notifications over 196 submitting requests and 280, 450 unpaginated HTML formats 95 URIs reference 460 unsupported data sources 11 URL parameters 162 update configuration manager 530, 531 authId 287 update manifest file 532 HTTP sessions and 356 update operations, saving 212 locale 287 Update Site Editor 530 targetVolume 287 update site maps 533 URLClassLoader objects 681 Update Site Project wizard 532 URLs 494 update sites 530, 531–533 accessing web services and 202, 357 UpdateFile operations accessing WSDL documents and 203 archiving and 268, 270, 271, 272 activating security manager and 226 UpdateJobSchedule operations character codes in 491 archiving and 269, 272 connecting to multiple web services 356 updates 530, 531, 534 generating HTML documents and 84, 100 UpdateVolumeProperties operations 269, 273 generating reports and 74 updating iHub 490 archiving rules 269, 271–273 image files and 84 cross tabs 443 initializing HTTP sessions and 354 ODA data sets 701, 710 Report Studio 490, 491 passwords 226 Report Studio design environment 492 plug-ins 533 Report Studio login page 491 source code 500 Report Studio servlet 490 user interfaces 610 report viewer and 9 upload security adapter class 231, 232 running reports and 774 upload security adapter interface 230 security information in 492 upload security adapters 229–232 specifying media types and 208 UPLOAD_FILE_TYPE_LIST parameter 229 text string limits for 217

856 Integrating Applications into BIRT iHub unloading authentication information controlling viewer features and 362 and 357 creating chart reports and 12 URNs (uniform resource names) 208 creating custom report designer and 14, 40 Usage property 588 customizing 91 USEHTTPS parameter 292, 293 disabling features in web pages 398 user accounts displaying images in 581 managing 344 displaying output formats and 623 user credentials 356 displaying properties in 23, 592 User data type 219 enabling or disabling Interactive Crosstabs User element viewer 444 CreateUser operations 276 exporting data and 764, 774, 784 user group generating reports and 79 details 347 HQL queries and 747 user groups mapping report items to 546 creating 347 registering 545 deleting 348 replicating parameter groups and 90 description 347 selecting ODA data sources and 673 listing users 348 updating 610 managing 346 user logins, forcing 356 requesting 346, 347 user names 492 user groups. See groups character limitations for 217 user IDs 455 connecting to Deployment Kit and 355 See also UserId element --user parameter 299 authentication and 356 user parameter 477 user interface extensions User parameters property 777 custom report items and 507, 538, 545, 572 user sessions 40, 41, 108 downloading sample plug-ins for 535 User-Agent directive 209 ODA data drivers 673, 675 UserGroup data type 219 property page adapters and 538, 546, 548 usergroups resource 299, 346 user interface options userID parameter 356, 455 changing 362 userid parameter 492 enabling 362 userName parameter hiding 445 delete status page 465 user interface providers 573, 581, 587 request detail page 467 user interface schema definitions requests index page 475 property page adapters 539 username parameter 300 report items 507, 508, 538 username variable 357 user interfaces userpassword parameter 356 accessing ODA data sources and 11 users adding connection profiles to 673, 698 archiving access control lists for 263 adding data sources to 693 creating 345 adding property pages to 538, 540, 562 deleting 346 adding report items to 540 description 345 adding rotated text items 568 developing RSSE applications for 234 adding slots to 23 displaying preferences for 455 building context menus for 595–598 getting authentication IDs for 175 changing property values and 598 getting security roles for 173, 176, 177

Index 857 users (continued) data extraction and 776 managing volume data and 213 getting 41 requesting details 345 verifyFile function 230, 231 requesting list 344 verifyQuery method 753 sending notifications to 471, 475, 485 version names 179 updating passwords for 226 See also VersionName element users parameter 471 VERSION parameter 292 users resource 299, 344 version parameter UTF-8 character encoding 353 file or folder detail page 466 UTF-8 character set 208, 301 versionName parameter UTF-8 encoding 285, 452 execute report page 471 util package 53, 70 output page 479 submit job page 487 V view parameters validateOpenConnection method 687 See also ViewParameter element validateParameters method 35 View service 212, 482 validateQueryText method 687 viewer applications (charts) 161 validating report designs 20, 24 Viewer charting examples 163 validating report output 20 Viewer class 358, 380, 406 validator classes 24 viewer classes 363 validator definitions (ROM) 24 viewer components 358 value parameter 422 viewer package 163 value series 138 viewer page 461 value series (charts) viewer servlet 494 interactive features and 419 viewer1 parameter 358 valueData variable 421 viewers values accessing report content for 362 See also data adding interactive features to 418 assigning to data types 200 building user interface for 362, 398 changing dynamically 608 displaying charts in 421 displaying external 88 displaying parameters in 381, 382 generating summary 441 displaying reports in 358, 373, 380 getting default 90 getting content for 363 getting property 87 instantiating 358 matching set of 472 loading 358, 364, 406 populating property 592 viewing returning duplicate 210 aggregate values 434 selecting 93 cascading report parameters 93 setting default 88 cross tabs 434, 438 setting parameter 95 CSV output 633, 637 setting property 114 current jobs 482 setting user-supplied 88 dashboards 364 testing for null 472 data 93, 394 valueSeriesName variable 421 data cubes 436 variables 475 debugging messages 174 callback functions and 352 error messages 469 extension point schemas 522

858 Integrating Applications into BIRT iHub failed jobs 474 developing administration applications folders 476 for 196 HTML output 9 getting information about 213, 465, 481 images 581 integrating third-party reports with 196 Interactive Crosstabs features 444 integrating with external security login page 450, 476 sources 234 manifest header settings 517 sending requests to 209, 213 PDF documents 104 specifying 213, 490 pending jobs 483 testing connections to 481 plug-in project settings 516 writing reports to 471, 487 property annotations 524 __vp parameter 491 report elements 363 report executables 476 W report items 11 wait parameter 471 report parameters 381, 486 wait values 471 reports 4, 31, 212, 358, 494 waitforreportexecution action 460 summary data 441 .war files tables 360, 422 application deployment and 80, 82 update site content 532 platform context and 81 XML output 668, 772 web applications 170, 280, 281 viewing parameters. See view parameters See also applications viewing preferences. See viewer preferences changing source code and 500 viewing service. See View service configuring BIRT home for 80 views 516 configuring report engine as 82 visibility property 23 deploying 224 visitor objects 626, 657 generating HTML documents and 83, 84 Vista computers. See Windows systems generating reports and 14, 32 visual components 11, 18, 26 protecting corporate data and 224 visual elements 25 web services and 197 visualizations 325 web-based reports 32 visuals resource 298, 325, 333 web browsers 100, 104, 177, 491, 772 volume administrators. See administrators displaying reports and 380 volume file paths 373 encoding and 285, 451, 452 volume names 172, 178, 490 initializing HTTP sessions for 354 volume parameter 490 integrating with reporting services 355 execute report page 471 issuing URIs and 454 submit job page 487 loading web pages for 450 URIs 455, 463 redirecting 477, 485 volume schemas. See schemas rendering output for 353 VolumeProfile parameter 455, 463, 491 viewer events and 421 VolumeProfile.xml 491 web pages volumes accessing class libraries for 352 accessing items in 212 adding interactive features to 440 connecting to 455, 463 adding JavaScript functions to 353 creating folders for 463 customizing 352 deleting objects in 468 developing 352

Index 859 web pages (continued) working folders 462, 475 displaying dashboards in 365 workingFolder parameter 462 embedding report parameters in 380, 382 workingFolderID parameter 463 embedding reports in 352, 353 workingFolderName parameter 463 loading 450 workspace 502 resizing 100 workspace directory 502 retrieving data for 352, 393 wr action 456 update sites and 532 writer objects 625, 658 web resources 532 WSDL (defined) 197 web service applications 197 WSDL definition See also IDAPI applications path 292 web service attributes 197, 198 WSDL documents web service definitions 202–203 See also WSDL files Web Service Description Language. See displaying 203 WSDL subclassing IDAPI classes and 206 web service namespace 199 WSDL elements web services See also XML elements accessing 196, 197, 202, 206 WSDL files 197, 199, 203 authenticating users for 355 WSDL schemas defining operations for 197, 202 case sensitivity for 197 encapsulating data for 352 creating 197–203 initializing connections for 354 developing IDAPI applications and 200 integrating web pages with 355 developing web service applications integrating with 196, 197 and 197 opening connections for 352 development environments for 203 providing secure sessions for 356 omitting responses and 201 retrieving data from 352 structuring operations in 201 setting content types for 208 XML namespaces and 200, 209, 210 specifying 202 WSDL_PATH parameter 292, 293 web services messaging framework. See wsdl.xml 294 SOAP wsdl.xml configuration file 294 web viewer WSDL2Java package changing source code and 500 See also code emitter extracting data and 764 wsdlns namespace prefix 199 viewing XML schema definitions in 522 WYSIWYG 581 web.xml 490, 494 well-formed messages 206 X whitespace characters 491 x-axis labels 53 wildcards 483 x-axis values (charts) Windows systems adding interactive features to 419 configuring archive service for 267 XLS emitter 10 sending notifications over 196 xmi.jar 77 Wizard class 699 XML attributes. See attributes wizardPageClass property 747 XML code 181, 206 wizards 513, 672, 739 See also code wizards package 700, 701 XML data extraction extension workbench projects 515

860 Integrating Applications into BIRT iHub creating projects for 766–769 XML schema standard 200 developing 766, 773 XML schemas downloading source code for 765 See also WSDL schemas implementing 774 connection profiles 673 overview 764, 772 data extraction extension and 764 running 783 design specifications and 12 setting dependencies for 769 displaying as HTML 522 testing 783, 786 displaying property annotations in 524 XML data extraction extension points 770, mapping report elements to 653 771 namespace prefixes in 199, 210 XML data extraction interfaces 773 ODA driver extensions 673 XML data extraction schema definitions 764 ODA driver sample plug-ins 726 XML documents 209, 774, 776, 779 ODA UI extensions 673 XML elements 18 opening 520, 521 binding definitions and 202 plug-in extensions 506, 520 case sensitivity for 197 property definitions and 20 defining data types and 199 property pages 673 multiple data sources and 210 report engine emitters 618, 658 qualifying 199 report item extensions 507, 538, 540, 550 SOAP headers and 211 ROM specifications and 18, 20 SOAP messages and 197, 200, 206 rotated label sample plug-in 545 XML emitter 657, 667 validating designs and 20 XML emitter logging levels 658 web services and 197 xml emitter plug-in 618, 656 XML writer 656, 657, 658, 660, 664 XML emitter properties file 653 XMLDataExtractionImpl class 774, 776 XML file output streams 657, 772 .xmlemitter properties file 653 XML files 12, 18, 653 XMLFileWriter class 657, 664 XML formats 618, 653, 772 XMLPlugin class 657 XML namespace 200, 209, 210 XMLRenderOption class 657, 664 xml plug-in 774 XMLReportEmitter class 657, 660 XML rendering option 664 XMLReportEmitter method 657 XML report rendering extension XMLSpy utility 20 creating projects for 653 XMLTags class 657, 663 developing 652, 656 XP computers. See Windows systems downloading source code for 535, 618 xsd namespace prefix 199, 200, 210 overview 618, 656 xsi namespace prefix 210 setting dependencies for 655 XTabAnalyzer class 438 setting encoding scheme for 658 specifying extension points for 655 Y testing 667 y-axis values (charts) XML report rendering plug-in 535 adding interactive features to 419 XML reports. See XML documents y-series items 136 XML schema files 506, 657, 665 XML Schema language 20

Index 861 862 Integrating Applications into BIRT iHub