Introduction -
JasperSoft is open source Business Intelligence tool. It
comes with below components –
- JasperReport Library
- JasperReport Server
- iReport Designer
- JasperSoft Studio
- JasperSoft ETL
- JasperSoft OLAP
Considering the loose coupling between these components, we
can use JasperReport Library to generate reports even at the places where we
need to generate reports but do not want to setup complete BI tool.
JasperReport
Framework.
JasperReport Framework uses jrxml (a type of xml) language
to define the design of reports. The Framework comes with jrxml DTD and four below mentioned façade to help in various phases of
report generation –
- net.sf.jasperreports.engine.JasperCompileManager – JasperCompileManager provide necessary functions to compile the jrxml to jasper file.
- net.sf.jasperreports.engine.JasperFillManager – JasperFillManager provides necessary functions to populate the reports with data from various data sources like database or bean etc
- net.sf.jasperreports.engine.JasperPrintManager – JasperPrintManager provides necessary functions to get the populated report printed without exporting to a file.
- net.sf.jasperreports.engine.JasperExportManager – JasperExportManager provides necessary function to export the populated reports in various file formats like PDF, Excel, RTF , HTML, XML, CSV etc
Jasper report
lifecycle –
JasperReport life cycle consists of following four steps –
- Design (jrxml file creation)
- Compile (jasper file creation)
- Execute (Filling with Data)
- Print/Export
Design (jrxml file
creation) – JasperReports can be designed either with creating a jrxml file
manually or with available design tool. Design tool way should be preferred as
manual creation process would be very time consuming. There are following tools available for designing the
repots.
- JasperAssistant – JasperAssistant comes as eclipse plug-in. Links to install it can view demo is as mentioned below
- JasperWave
–JasperWave comes as standalone RCP application as well as eclipse
plug-in. Links to install and view the demo is as mentioned below
Download - http://jasperwave.com/download.html
JasperWave demo - http://jasperwave.com/docs/gettingStarted.html
- JasperSoft
Studio - JasperSoft Studio comes as eclipse plug-in. Links to install and
get a view is as mentioned below.
Install - http://jasperforge.org/website/ireportwebsite/JSS%20Website/plugin_install.html?header=project&target=jaspersoftstudio
View - https://hanichalouati.wordpress.com/2011/05/10/a-quick-tour-around-japsersoft-studio/
- iReports
– iReport comes as stand alone application as well as plug-in to NetBeans
IDE. Links to install and get a view is as mentioned below
Download - http://jasperforge.org/website/ireportwebsite/IR%20Website/ir_download.html?header=project&target=ireport
iReport view - http://jasperforge.org/uploads/publish/ireportwebsite/IR%20Website/ir_getting_started.html
Compile (jasper file
creation) - To generate the reports jrxml file needs to compile to jasper
file. During the compilation process,
following steps is performed.
- Validation of jrxml file against the jrxml schema
- Creation of java file from jrxml file
- Compilation of java file to create the class file.
- Creation of object of recently created class file.
- Serialize the object to .jasper file.
The object created in step4 works as template during the
data filling step of report creation.
Jrxml files can be compiled in various ways as mentioned below –
- Compilation through java – net.sf.jasperreports.engine.JasperCompileManager provides necessary functions to compile the jrxml file to jasper file. Compilation should be preferred to be done during the build phase of the project unless the report format keeps on changing in runtime.
- Compilation
through maven – maven compilation of jasper reports should be preferred in
maven projects where the report format is pre-decided and does not change
on runtime. Sample example is as mentioned below -
http://mojo.codehaus.org/jasperreports-maven-plugin/examples/example-1.html
- Compilation through ant – ant compilation of the jasper reports should be preferred in the ant projects where the report format is pre-decided and does not change on runtime. Sample example is as mentioned below –
Execution (Filling
with Data)
net.sf.jasperreports.engine.JasperFillManager provides
necessary functions to fill the data in the reports.
Printing/Exporting
net.sf.jasperreports.engine.JasperPrintManager and net.sf.jasperreports.engine.JasperExportManager
provide necessary functions to display print the report/exporting in various
file formats.
Sample program –
http://java-bytes.blogspot.in/2009/06/jasper-reports-example.html
Maven dependency to
include JasperReports –
JasperReports can be easily integrated into the project
using the below dependency –
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>4.1.2</version>
</dependency>
Maven repository
hosting Jasper report –
JasperReports projects build is published at the below
location –
References
JasperSoft - http://www.jaspersoft.com/
JasperReports Tutorial - http://jasperforge.org/uploads/publish/jasperreportswebsite/trunk/tutorial.html
Jasper API doc - http://jasperreports.sourceforge.net/api/index.html
Maven 2 JasperReports Plug-in - http://mojo.codehaus.org/jasperreports-maven-plugin/index.html
JasperReports Dependency - http://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports/3.7.5
Sample report views - http://jasperforge.org/website/ireportwebsite/IR%20Website/ir_gallery.html?header=project&target=ireport
JasperReports Documentation -http://jasperforge.org/website/jasperreportswebsite/trunk/documentation.html?header=project&target=jasperreports
JRXML tag reference - http://jasperforge.org/uploads/publish/jasperreportswebsite/JR%20Website/jasperreports_quickref.html
Jasper Report Ultimate Guide - http://www.rcss.org/publication/newsletter/7178531-The-Jasper-Reports-Ultimate-Guide.pdf
JasperReports Documentation -http://jasperforge.org/website/jasperreportswebsite/trunk/documentation.html?header=project&target=jasperreports
JRXML tag reference - http://jasperforge.org/uploads/publish/jasperreportswebsite/JR%20Website/jasperreports_quickref.html
Jasper Report Ultimate Guide - http://www.rcss.org/publication/newsletter/7178531-The-Jasper-Reports-Ultimate-Guide.pdf
Thanks for posting such an excellent informative content.
ReplyDeletewoah good content! keep it up! (:
ReplyDelete