Book Image

Pentaho 8 Reporting for Java Developers

By : Jasmine Kaur, Francesco Corti
Book Image

Pentaho 8 Reporting for Java Developers

By: Jasmine Kaur, Francesco Corti

Overview of this book

This hands-on tutorial, filled with exercises and examples, introduces the reader to a variety of concepts within Pentaho Reporting. With screenshots that show you how reports look at design time as well as how they should look when rendered as PDF, Excel, HTML, Text, Rich-Text-File, XML, and CSV, this book also contains complete example source code that you can copy and paste into your environment to get up-and-running quickly. Updated to cover the features of Pentaho 8, this book will teach you everything you need to know to build fast, efficient reports using Pentaho. If your interest lies in the technical details of creating reports and you want to see how to solve common reporting problems with a minimum of fuss, this is the book for you.
Table of Contents (25 chapters)
Title Page
Credits
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Dedication
Preface

Pentaho Reporting architecture


Pentaho Reporting Engine is mainly a Java class library, broken up into other Java projects, which are then combined to render reports. The library is optimized for performance and a small memory footprint, and can run completely in memory without generating temporary files or requiring extra compilation steps. The source code is available, under the terms of the GNU LGPL Version 2.1, in the GitHub repository https://github.com/pentaho/pentaho-reporting.

The GitHub repository includes the Pentaho Report Designer, providing a graphical editor for report definitions and used as a standalone desktop reporting tool. In addition, there are also other related open source tools and projects in the Pentaho Reporting landscape, including the Report Engine Demo, Report Design Wizard, Report Designer, and the web-based ad hoc reporting user interface.

The following is an introduction of the Java project defining the Pentaho Reporting Engine, with a focus on the libraries, the Reporting Engine core, and the Reporting Engine extensions.

Reporting Engine's libraries

The Pentaho Reporting Engine uses the following libraries to render reports:

  • Flute: This is a CSS 2 parser written in Java that implements SAC (https://www.w3.org/Style/CSS/SAC/). SAC is a standard event-based API for CSS parsers, closely modeled on the SAX API for XML parsers.
  • LibBase: This is the root library for all other Pentaho Reporting libraries. This library contains common capabilities, such as debug and error logging utilities, library configuration, along with library initialization APIs, for consistent startup and shutdown management of the Reporting Engine.
  • LibDocBundle: This abstracts the management of Pentaho Reporting file bundles, which are by default stored as ZIP files, and implements the ODF. This makes it simpler for other parts of the Reporting Engine to work with and manipulate Pentaho Reporting's file formats.
  • LibFonts: This allows Pentaho Reporting to work with TrueType system fonts, extracting the necessary metadata from font types and populating an abstract interface to allow appropriate rendering in various contexts, including PDF and Excel views.
  • LibFormat: This is a string formatting library, which can render dates and numbers appropriately, based on format strings. This library is focused on memory and CPU efficiency for high performance report rendering.
  • LibFormula: This is a formula parsing and execution library based on the OpenFormula standard. You can learn more about OpenFormula by visiting http://wiki.oasis-open.org/office/About_OpenFormula. This library is similar in function to Excel-based formula definitions. LibFormula is a very general library and is used outside Pentaho Reporting in other projects that require OpenFormula style parsing and execution. LibFormula-UI is a formula editor for OpenFormula expressions based on LibFormula.
  • LibLoader: This manages the loading and caching of all necessary resources required for generating reports in a generic way, providing a simple API for other parts of the Reporting Engine that control static and dynamic content, including data sources and images.
  • LibPensol: This is an access layer for accessing a remote Pentaho solution repository via an Apache VFS filesystem. It handles all HTTP calls, the parsing of the XML file, and all client-side state managements.
  • LibPixie: This is a WMF-file reading library, originally written by David R. Harris as converter for the Pixie-image viewer. Pixie was long time dead and has now been resurrected as WMF-reader and image producer for Java 1.2.2 or higher. Pixie lacks the support for most bitmap-formats, but everything else works fine.
  • LibRepository: This abstracts the input and output of hierarchical storage systems, such as file systems, that Pentaho Reporting interacts with. This makes it possible for a custom storage system, such as FTP, to be implemented and to be mapped to the API, giving Pentaho Reporting access to the system.
  • LibSerializer: This provides helper methods for serializing non-serializable objects. This is necessary so that the Reporting Engine can serialize standard Java classes that don't implement Java's serializable interface.
  • LibSparkline: This is a library developed to render sparkline graphs. Sparklines are small-scale bar or line charts that are inserted into text to provide visualized information along with the textual description.
  • LibSwing: This is a common helper class storage for design-time elements, so that they don't have to move into the engine project, where they potentially bloat up the project due to third-party dependencies or a large amount of code.
  • LibXml: This provides utility classes for Simple API for XML (SAX) parsing and XML writing, based on Java's Java API for XML Parsing (JAXP) API. This library assures the speedy loading and validation of Pentaho Reporting XML template files.

Reporting Engine core

The Reporting Engine core project contains the main reporting algorithm for rendering reports, along with the necessary functionality to support styling. This project also contains the algorithms for rendering specific outputs, including PDF, Excel, CSV, XML, and more. The engine relies on the already mentioned libraries for managing the loading, parsing, formatting, rendering, and archiving of generated reports.

Reporting Engine extensions

The Reporting Engine extensions project contains third-party extensions to the Reporting Engine, which are very useful, but increase dependencies. Extensions in this project include JavaScript expression support using the Rhino project, a hibernate data source factory, bar code support using Barbecue, sparkline support using the LibSparkline, along with additional JDK 1.4 support for configuration and printing. Additional extension projects exist that include charting and many of the data sources discussed in this book.

Note

The following are some links to the quoted projects for further details: Rhino: https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino Hibernate: http://hibernate.org Barbeque: http://barbecue.sourceforge.net