Eclipse Zone is brought to you in partnership with:

Glenn has posted 7 posts at DZone. View Full User Profile

Light Weight Reporting Server on Equinox OSGi

12.01.2008
| 10693 views |
  • submit to reddit

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:

https://sourceforge.net/project/showfiles.php?group_id=228168&package_id=300872

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.

http://localhost/reportInput?INPUT_XML=/temp/test.xml&JASPER_FILE=/temp/test.jasper&PARENT_XPATH=/RowCollection/Row&EXPORT_TYPE=pdf

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.

 Performance

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 (glenn.galang@gmail.com).

 

From: http://ggalangblog.blogspot.com/

Published at DZone with permission of its author, Glenn Galang.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)