Integrating and Extending BIRT
Third Edition
Jason Weathersby Tom Bondur Iana Chatalbasheva
Upper Saddle River, NJ Boston Indianapolis San Francisco
New York Toronto Montreal London Munich Paris Madrid
Capetown Sydney Tokyo Singapore Mexico City
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals.
The authors and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein.
The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information, please contact:
U.S. Corporate and Government Sales
(800) 382-3419
For sales outside the United States please contact:
International Sales
Visit us on the Web: informit.com/aw
Library of Congress Control Number: 2011932838
Copyright 2012 by Actuate Corporation
All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission to use material from this work, please submit a written request to Pearson Education, Inc., Permissions Department, One Lake Street, Upper Saddle River, New Jersey 07458, or you may fax your request to (201) 236-3290.
ISBN-13: 978-0-321-77282-4
ISBN-10: 0-321-77282-2
Text printed on recycled paper in the United States at Courier in Westford,
Massachusetts.
First printing, August 2011
Foreword
It is a common misconception that Eclipse projects are focused on simply providing great tools for developers. Actually, the expectations are far greater. Each Eclipse project is expected to provide both frameworks and extensible, exemplary tools. As anyone who has ever tried to write software with reuse and extensibility in mind knows, that is far more difficult than simply writing a tool.
Exemplary is one of those handy English words with two meanings. Both are intended in its use above. Eclipse projects are expected to provide tools that are exemplary in the sense that they provide an example of the use of the underlying frameworks. Eclipse tools are also intended to be exemplary in the sense that they are good and provide immediate utility to the developers who use them.
Since its inception, the BIRT project has worked hard to create both reusable frameworks and extensible tools. This book focuses primarily on how to extend BIRT and how to use BIRT in your own applications and products. As such, it illustrates BIRTs increasing maturity and value as an embedded reporting solution.
As Executive Director of the Eclipse Foundation, Im pleased with the tremendous progress the BIRT team has made since the projects inception in September of 2004, and Im equally pleased with the vibrant community that has already grown up around it. As you work with BIRT and the capabilities that are described in this book, Id encourage you to communicate your successes back to the community, and perhaps consider contributing any interesting extensions you develop. The BIRT web site can be found here:
http://www.eclipse.org/birt
It includes pointers to the BIRT newsgroup, where you can communicate and share your results with other BIRT developers, and pointers to the Eclipse installation of Bugzilla, where you can contribute your extensions. If you like BIRTand I am sure this book will help you learn to love itplease participate and contribute. After all, it is the strength of its community that is the true measure of any open source projects success.
Mike Milinkovich
Executive Director, Eclipse Foundation
Preface
About this book
The second of a two-book series on business intelligence and reporting technology, Integrating and Extending BIRT, introduces programmers to BIRT architecture and the reporting framework. Its companion book, BIRT: A Field Guide, shows report developers how to create reports using the graphical tools of BIRT Report Designer. Built on the open-source Eclipse platform, BIRT is a powerful reporting system that provides an end-to-end solution, from creating and deploying reports to integrating report capabilities in enterprise applications.
BIRT technology makes it possible for a programmer to build a customized report using scripting and BIRT APIs. This book informs report developers about how to write scripts that:
Customize the report-generation process
Incorporate complex business logic in reports
This book also informs application developers about how to:
Debug and deploy reports
Integrate reporting capabilities into other applications
Extend BIRT functionality
A programmer can extend the BIRT framework by creating a new plug-in using the Eclipse Plug-in Development Environment (PDE). This book provides extensive examples that show how to build plug-ins to extend the features of the BIRT framework. The source code for these examples is available for download at http://www.actuate.com/birt/contributions.
The topics discussed in this book include:
Installing and deploying BIRT
Deploying a BIRT report to an application server
Understanding BIRT architecture
Scripting in a BIRT report design
Integrating BIRT functionality into applications
Working with the BIRT extension framework
This revised BIRT 2.6 edition adds the following new content:
Updated architectural diagrams
Expanded scripting examples
Debugging Event Handlers
Developing an advanced report item with data binding
Developing a Data Extraction Extension
Developing a Charting Extension
Who should read this book
This book is intended for people who have a programming background. These readers can be categorized as:
Embedders and integrators
These individuals work with the software to integrate it into their current application infrastructure.
Extenders
These individuals leverage APIs and other extension points to add capability or to establish new interoperability between currently disparate components or services.
To write scripts in report design, you need knowledge of JavaScript or Java. More advanced tasks, such as extending BIRTs functionality, require Java development experience and familiarity with the Eclipse platform.
Contents of this book
This book is divided into several parts. The following sections describe the contents of each of the parts and chapters.
Part 1, Installing and Deploying BIRT
includes the following chapters:
. BIRT provides a number of separate packages as downloadable archive (.zip) files on the Eclipse web site. Some of the packages are stand-alone modules, others require an existing Eclipse environment, and still others provide additional functionality to report developers and application developers. This chapter describes the prerequisites for each of the available packages.