Light Weight Reporting Server on Equinox OSGi
Join the DZone community and get the full member experience.Join For Free
I’ve been building software for quite a few years now and as software programming techniques have advanced, so has the number of layers.
Every once in a while a technology comes along which changes the way we think. Of late I’ve been hearing a lot about how cloud computing will allow us to scale our applications out. I think OSGi can give us similar results at a micro level by removing the traditional boundaries and layers on which our java applications are currently built.
OSGi heavily encourages the breaking up of our applications into bundles or modular components which can be readily plugged into mobile, desktop and server architectures.
I’m forever trying to update my 90’s programming style, so in attempt to get up to speed with OSGi I’ve put together a light weight reporting server based on Equinox OSGi and Jasper Reports 3.1.2.
If you’d like to have a look at code and get the demo running feel free to follow the steps below.
Running the Demo
Download the the LWJSOSGi.zip file from:
Once downloaded, unzip it onto your local pc and open Eclipse 3.4 and select the directory which you unzipped to.
Click the down arrow next to the run button and select Run Light Weight Jasper Server
If you see the following the server is now running.
Copy test.jasper, test.jrxml and test.xml from LWJOSGi.zip file to /temp/ (c:\temp on windows).
Open up a web browser and paste the following url.
You should get a prompt like the following.
Open with adobe reader and if you see the following pdf, you have the demo successfully running.
Optional Step: if you want to change the report download iReport 3.1.2 and open up /temp/test.jrxml and compile the report back to /temp/test.jasper, no need to restart the server after you recompile the jrxml.
I ran a quick burn test and right out of the box with no tweaking or tuning, the server managed to generate 56 pdfs/second or 3,358 pdfs/minute on a Core 2 Duo 2.4 ghz with 2 gig ram (Win XP).
If I ever need upgrade/dowgrade the jasper distribution I simply create a new jasper reports bundle and configure the runtime dependencies via Equinox. If this were a traditional webapp I’d have to worry about breaking other modules that live inside WEB-INF/lib or within the shared app server lib directory.
If you have any troubles/questions with the demo or want to know a bit more detail on any specific area feel free to drop me a line (firstname.lastname@example.org).
Opinions expressed by DZone contributors are their own.