Presentation is loading. Please wait.

Presentation is loading. Please wait.

Architecture Pentaho Reporting Thomas Morgner 20th March 2014

Similar presentations


Presentation on theme: "Architecture Pentaho Reporting Thomas Morgner 20th March 2014"— Presentation transcript:

1 Architecture Pentaho Reporting Thomas Morgner 20th March 2014

2 Today’s To-Do List Family Picture – The Pentaho Reporting Components
5 minute Speed-run: How to process Reports Detailed Report Processing and Modules Designing Reports manually Generating Reports Reporting on the web How to get the code

3 Pentaho Reporting from above
Pentaho BA-Server Interactive Reporting Report Designer Reporting Plugin and Report Viewer Libraries (Base, Fonts, Formula, Loader, Xml, DocBundle) Reporting Engine Design-Time-UI Data-Source Integration Data-Source Modules Server Integration

4 Pentaho Reporting from above
Libraries and Engine Libraries Encapsulate slowly changing code Serve only one purpose per library XML parsing, Resource Loading, Font Management etc Engine Embeddable reporting engine For Desktop and Server Small footprint Extra functions are plugins Defines report structure Layout calculation Parameter

5 Pentaho Reporting from above
Data-Sources and Report Designer Data-Source Split into runtime and designtime modules Runtime: Query, serialize and deserialize as XML Designtime: UI for report-designer Report Designer Swing Fat-Client Aimed at power users Infrastructure for visual editing Plugins Introspection of reports

6 Speed-Run: Processing a Report
Create a report definition Parse PRPT file Build from Scratch Parameterise (optional) Call ReportProcessor: A: Query Data A: Iterate over Data A: Detect groups, calculate values B: Generate Layout Model B: Compute Layout C: Print Content (PDF, XLS etc)

7 Speed-Run: Processing a Report
Engine runs multiple passes over data Data computation Computes global sums Can happen multiple times, for instance when computing averages Average = pre-computed count / pre-computed sum Percentage = current value / pre-computed sum Pagination Compute total number of pages Critical for ‘page-of-pages’ text in footer Used to pre-compute layout and style for table-exports Content Generation Same as pagination, but with final content

8 Deep Dive into Reporting
Acquire a report definition Load a report definition See OEM-SDK Sample-use-full Use LibLoader Load from binary storage Caching and parser Selection Create a report from scratch Use Reporting API for that (No SDK sample yet, use legacy-demo for sample code) Maintenance nightmare Prefer PRPT for all static reports OK for simple unit-tests

9 Deep Dive into Reporting
Grab some data Data processing usually invoked by engine Parameter-processing During Report-run From functions Data-Factory Interface Data-Sources produce Swing-Table-Models for engine Query Selector for engine = String, logical name Actual representation inside data-source is implementation detail Query = Logical Name + parameter dataset Data-Factories extra modules due to large dependencies org.pentaho.reporting.engine.classic.core.DataFactory

10 Deep Dive into Reporting
Parameter processing Input Validate Failed OK Parameter Validation User Report Processor Report hold parameter Info Contains presentation info Validation rules Parameter values are untrusted Data needs validation Beware of SQL injections! Iterative Process Feed-back loop between UI and engine Cascading parameter org.pentaho.reporting.engine.classic.core.parameters.DefaultReportParameterValidator

11 Deep Dive into Reporting
Report Processor and State Machine Report Processing is state machine Stack-level encapsulation of data Divides long process into smaller tasks Interruptible, suspendable States hold minimum of data Allows roll-back on page breaks Widow/Orphans Generate correct header and footer See package org.pentaho.reporting.engine.classic.core.states

12 Deep Dive into Reporting
Layout Calculations Some states can generate content Starts in DefaultOutputFunction Data-Model = (Report Elements + Data) Translate Data-Model into Layout-Model Layout Model based roughly on CSS Box model Boxes are placed on an infinitely large canvas General process Determine box-sizes for contained content X-axis is minor axis: static, mostly pre-defined by user Y-axis is major axis: Position depends on previous content Compute final position of content on paper Shift content across page breaks org.pentaho.reporting.engine.classic.core.layout.output.DefaultOutputFunction Layout code is called from implementation of the org.pentaho.reporting.engine.classic.core.layout.Renderer interface

13 Deep Dive into Reporting
Layout Model into Content When page-finished: Copy content Print Replace final content with empty box of same size Output processor Translates layout-model to output-document Free-form, page oriented: Graphics2D, PDF, Plain-Text Table-based, stream oriented: HTML, CSV, Excel, RTF Special output: Table-XML, Pageable-XML used in Unit-Tests Validate reports against a known good output - org.pentaho.reporting.engine.classic.core.layout.output.OutputProcessor To see how output is handed over to the OutputProcessor see: - org.pentaho.reporting.engine.classic.core.modules.output.pageable.base.PageableRenderer#performPagination

14 Designing Reports API basics
API defines structure of report definition Not pluggable, engine depends on this Main classes: Master-Report, Sub-Report Section – Internal structuring, groups and group-body Band – layout structure for user content Element – base class, styles and attributes, element-type Attributes and styles can be dynamic org.pentaho.reporting.engine.classic.core.MasterReport org.pentaho.reporting.engine.classic.core.Element org.pentaho.reporting.engine.classic.core.Band org.pentaho.reporting.engine.classic.core.Section

15 Designing Reports Elements, Attributes and Styles Element Type
Defines role of element in report Defines data transformation/formatting for content elements Defines meta-data, available styles and attributes Attributes (Namespace,Name) -> Value map Namespaces to separate attributes into groups Attributes define data-processing rules Content used by report-processor Styles (StyleKey) -> Value map Defines look of elements Used by layout calculations org.pentaho.reporting.engine.classic.core.AttributeNames org.pentaho.reporting.engine.classic.core.ReportAttributeMap org.pentaho.reporting.engine.classic.core.style.StyleKey org.pentaho.reporting.engine.classic.core.style.StyleSheet org.pentaho.reporting.engine.classic.core.metadata.ElementType

16 Designing Reports Report Designer Swing Application
Report-Designer Core: Visual editor loop Introspection of Structure Editors for style and attributes Parameter Plugin-Infrastructure Data-Sources as plugins Visual editor is in: org.pentaho.reporting.designer.core.editor.report.RootBandRenderComponent Style and Attributes as tables: org.pentaho.reporting.designer.core.editor.attributes org.pentaho.reporting.designer.core.editor.styles Structure editor: org.pentaho.reporting.designer.core.editor.structuretree

17 Designing Reports Report Designer Visual Editor
Visual Editor provides WYSIWYG interface PRD works on standard MasterReport object Changes trigger design-time report processing Layout computation handled by Reporting Engine Rendering handled by Graphics2D output Extra handling for drawing selections Main class: org.pentaho.reporting.designer.core.editor.report.layouting.ReportLayouter

18 Get the Code Pentaho Reporting
In-official Reporting SDK Report-Viewer

19 Compile and Run Use IntelliJ
Project is defined in Git and ready to use Don’t forget ‘ant resolve’ Lib split into external and internal External: new dependencies not covered by upstream module Internal: Dependencies provided by other IntelliJ-modules Transparent when used from command line

20


Download ppt "Architecture Pentaho Reporting Thomas Morgner 20th March 2014"

Similar presentations


Ads by Google