Parsing/Reading RSS/Atom Feed Using ROME

ROME library contains utility classes for parsing and publishing syndicated feeds, it is an open source Java library that make it easy to work with RSS/Atom feeds.

Rome library have converters to convert from one format to another. Rome can parse any format of Newsfeed, including RSS variants and Atom.

It will support most of the syndication formats includes following

  1. RSS 0.90
  2. RSS 0.91 Netscape
  3. RSS 0.91 Userland
  4. RSS 0.92
  5. RSS 0.93
  6. RSS 0.94
  7. RSS 1.0
  8. RSS 2.0
  9. Atom 0.3
  10. Atom 1.0

Note : Download ROME and JDOM

Parsing/Reading RSS/Atom Example

import java.util.Iterator;

import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;

public class Reader {

public static void main(String[] args) throws Exception {

URL url  = new URL("");
XmlReader reader = null;

try {

reader = new XmlReader(url);
SyndFeed feed = new SyndFeedInput().build(reader);
System.out.println("Feed Title: "+ feed.getAuthor());

for (Iterator i = feed.getEntries().iterator(); i.hasNext();) {
SyndEntry entry = (SyndEntry);
} finally {
if (reader != null)

Hope you will like this. Cheers.. 🙂


Create Sitemap Using Java

Sitemaps are an easy way for webmasters to inform search engines about pages on their sites that are available for crawling.

Sitemap is an XML file that lists URLs for a site along with additional metadata about each URL (when it was last updated, how often it usually changes, and how important it is, relative to other URLs in the site) so that search engines can more intelligently crawl the site.

Web crawlers usually discover pages from links within the site and from other sites. Using the Sitemap protocol does not guarantee that web pages are included in search engines, but provides hints for web crawlers to do a better job of crawling your site. Sitemap 0.90 has wide adoption, including support from Google, Yahoo!, and Microsoft.

It will also support for google site map updations.

Note : sitemapgen4j-1.0.1.jar – Set in classpath

SitemapGen4j Features

SitemapGen4j is a library to generate XML sitemaps in Java.

  • Adding any number of URLs
  • Can set gzipped output
  • Can set lastmod option
  • Can set priority option
  • Can set changefreq option
  • Configuring the date format
  • Configuring sitemap index file
  • Validate your sitemaps against official XML Schema Definition (XSD)

Create Sitemap Using SitemapGen4j

import java.util.Date;

import com.redfin.sitemapgenerator.ChangeFreq;
import com.redfin.sitemapgenerator.WebSitemapGenerator;
import com.redfin.sitemapgenerator.WebSitemapUrl;

public class SitemapGenerator {

public static void main(String[] args) throws MalformedURLException {
// If you need gzipped output
WebSitemapGenerator wsg = WebSitemapGenerator.builder("", new File("C:\\sitemap"))

WebSitemapUrl url = new WebSitemapUrl.Options("")
.lastMod(new Date()).priority(1.0).changeFreq(ChangeFreq.HOURLY).build();
// this will configure the URL with lastmod=now, priority=1.0, changefreq=hourly

//You can add any number of urls here

Hope you will like this. Cheers… 🙂

Create PDF With iText Java Tutorial

Creating PDF with java in enterprise applications is quite common these days.

iText is a free and open source library for creating and manipulating PDF files in Java. It was written by Bruno Lowagie, Paulo Soares, and others. It enables developers looking to enhance web and other applications with dynamic PDF document generation and/or manipulation.

Note : itext-5.1.2.jar – Set in classpath to access and make pdf.

Developers can use iText to:

  • Serve PDF to a browser
  • Generate dynamic documents from XML files or databases
  • Use PDF’s many interactive features
  • Add bookmarks, page numbers, watermarks, etc.
  • Split, concatenate, and manipulate PDF pages
  • Automate filling out of PDF forms
  • Add digital signatures to a PDF file

Text is used in projects that have one of the following requirements:

  • The content isn’t available in advance: it’s calculated based on user input or real-time database information.
  • The PDF files can’t be produced manually due to the massive volume of content: a large number of pages or documents.
  • Documents need to be created in unattended mode, in a batch process.
  • The content needs to be customized or personalized; for instance, the name of the end user has to be stamped on a number of pages.

Create PDF With iText

import java.util.Date;

import com.lowagie.text.Document;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;

public class CreatePDFWithItext{

public static void main(String[] args) {
try {
OutputStream file = new FileOutputStream(new File("C:\\example.pdf"));
Document document = new Document();
PdfWriter.getInstance(document, file);;
document.add(new Paragraph("Hello World"));
document.add(new Paragraph(""));
document.add(new Paragraph(new Date().toString()));
} catch (Exception e) {

Hope you will like this. Cheers… 🙂

Call Jasper Report / Ireport From Java Application

JasperReports is an open source Java reporting tool that can write to screen, to a printer or into PDF, HTML, Microsoft Excel, RTF, ODT, Comma-separated values and XML files.

It can be used in Java-enabled applications, including Java EE or Web applications, to generate dynamic content. It reads its instructions from an XML or .jasper file dynamically.

We can generate reports using two ways,

1) From “JRXML” (Source) file
2) From “Jasper” (Compiled) file

Following jar must be in classpath

  1. commons-beanutils-1.8.2.jar
  2. commons-collections-3.2.1.jar
  3. commons-digester-1.7.jar
  4. commons-logging-1.1.jar
  5. groovy-all-1.7.5.jar
  6. iText-2.1.7.jar
  7. jasperreports-4.1.1.jar

Note : iReport for designing the report.

Create PDF Report From JRXML File

JRXML file is a JasperReports Document. JasperReports are defined in an XML file format, called JRXML, which can be hand-coded, generated, or designed using a tools like IReport, JasperAssistant etc

Execution of report from JRXML file will be very slow, as it need to compile before the execution

import java.util.HashMap;

import net.sf.jasperreports.engine.JREmptyDataSource;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;

public class PdfFromXmlFile {
public static void main(String[] args) throws JRException, IOException {

JasperReport jasperReport = JasperCompileManager.compileReport("report.jrxml");
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,new HashMap(), new JREmptyDataSource());
JasperExportManager.exportReportToPdfFile(jasperPrint, "sample.pdf");

Create PDF Report From Jasper File

Jasper file is a compiled format of JasperReports Document.

Execution of report from Jasper file will be very fast, as it is pre-compiled

It is recommended for the production environment

import java.util.HashMap;

import net.sf.jasperreports.engine.JREmptyDataSource;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;

public class PdfFromJasperFile {
public static void main(String[] args) throws JRException, IOException {

JasperPrint jasperPrint = JasperFillManager.fillReport("report.jasper",  new HashMap<String, Object>(),
new JREmptyDataSource());
JasperExportManager.exportReportToPdfFile(jasperPrint, "sample.pdf");


Hope you will like this. Cheers… 🙂

What is OpenERP? Open Source ERP Software Explained.

OpenERP (previously known as TinyERP) is an open source integrated enterprise resource planning (ERP) software manufactured by OpenERP.

Belgium-based OpenERP provides an open source suite of ERP business applications. It follows a typical commercial open source business model where the fully-featured applications are available free through a community-supported version; however no warranties or support for the software is available from the company.

If you choose the Enterprise or Online versions your business can obtain support for the software in addition to migration and maintenance, on a per-user, per-month subscription basis.

While not necessarily encouraged, OpenERP does include a provision in the OpenERP Enterprise license that allows customers to make private OpenERP modules when they need to.

OpenERP is, according to the author, an open source alternative to SAP ERP and Microsoft Dynamics.

What can I do with OpenERP?

OpenERP is a full suite of business software, including the following modules:

Accounting: Record your operations in a few clicks and manage all your financial activities in one place.

Application Builder:  The OpenERP application builder lets you customize every module of OpenERP directly from the web interface without any development required.

CRM: Track leads and opportunities customized your sales cycle, controls statistics and forecasts and marketing campaign automation to improve your sales performance.

Human Resources:  The module is for personnel information management, leave, time tracking, attendance‚ expenses, payroll, periodic evaluations and recruitment.

Invoicing: Create and supervise your entire supplier and customer invoices.

Manufacturing: Plan and control your supply chain through different applications in the Manufacturing module.

Marketing: Marketing campaigns can help you automate email and email sending, qualify leads and encourage customers to contact the right department.

Point of Sale: The OpenERP touchscreen point of sale allows you to manage your shop sales. It’s fully web-based so you don’t need to install or deploy any software.

Project Management: Keep track and manage your projects using tasks for short term project execution or plan phases for long term planning.

Purchase: Create and track your purchase orders, manage your suppliers’ info, control your products reception process and check suppliers’ invoices.

Warehouse Management: An inventory management system to easily manage complex needs: tracking stocks of suppliers/customers, full traceability, accounting links, and more. OpenERP supports multi-warehouse management based on hierarchical locational structure.

Because OpenERP is open source and backed by a large community, you can take advantage of more than 700 OpenERP modules on the OpenERP Apps website. These applications extend functionality of the ERP software and provide more business apps for things like manufacturing, localization, project management and more.

The other benefit to users is that you do not need to use all the business apps. You can choose only the modules that you need for your business from the suite (e.g. just CRM or CRM and invoicing). This keeps your OpenERP tidy and less overwhelming if you do not need all the business apps. You can add additional modules (at no cost) as you need them.


Client-server Architecture : OpenERP has separate client and server components. The server runs separately from the client. It handles the business logic and communicates with the database application. The client presents information to users and allow them to inter-operate with the server. Multiple client applications are available.

Server and Modules : The server part is written in Python programming language. The client communicates with the server using XML-RPC interfaces.

Business functionality is organised into modules. A module is a folder with a pre-defined structure containing Python code and XML files. A module defines data structure, forms, reports, menus, procedures, workflows, etc… Modules are defined using a client-independent syntax. So, adding new objects, such as menus or forms, makes it available to any client.

Client applications : The clients are thin clients as they contain no business logic. Two client applications are officially supported:

  • A web application, which is deployed as an HTTP server to allow users to connect using their Web browser.
  • A desktop application, written in Python and using the GTK+ toolkit.

Other alternative clients have also been developed by the community

Database : OpenERP uses PostgreSQL as database management system.

Reporting : OpenERP also provides a reporting system with integration allowing customization of reports.

Source code and contributions : The source code of OpenERP is hosted on Launchpad, using the Bazaar revision control system, and the contributions are also handled using Launchpad. The documentations are also managed using this service but a website dedicated to all publications has been set up in 2009

OpenERP Versions:  Free, Supported, Hosted or On-Premise Business Apps

OpenERP is made available through three different versions. The OpenERP software is free, but enterprise and hosted versions are fee-based.  OpenERP Enterprise and OpenERP Community are exactly the same product, only the user pays for the additional services being offered by the OpenERP Team, not for the software.

OpenERP Community: (AGPL license) Open source OpenERP software (with all features) with no warranties. With this version you rely on community-based support only and migrations, bug fixes and private ERP modules are not allowed.  Price: Free

OpenERP Enterprise: (AGPL or AGPL plus Private Use) Open source OpenERP as production-ready management software. The Enterprise version is fully supported by the OpenERP Team and includes unlimited migrations, bug fixes, private modules and security alerts. OpenERP Enterprise version is on-premises software that you host yourself (Linux or Windows operating systems). Price: €165 per month for 1 to 10 users, up to €15,500 for 70 to 150 users.

OpenERP Online: Similar to the services offered in the enterprise version with the exception of no private modules or community modules, and it is hosted and maintained by OpenERP. Price: €39 per user per month. Free 30-day trial available.

Hope you will like this.  Cheers… 🙂

Spket: Setting up Eclipse IDE for Ext JS and JQuery development

Spket – Development tool for RIA

Eclipse is great, and I what I like the most about it is the autocomplete feature. Unfortunately, it is available only for Java (or any other supported programming language), and if you work with web development, you probably also work with javaScript. And I miss the autocomplete feature for js files.

But there is a solution for this case. You can use Spket Eclipse plugin. I’ve been using it for a couple of months and it is very good. It is saving me some time when I am coding.

So I decided to write this tutorial. I hope it will be useful to you!

Spket IDE is powerful toolkit for JavaScript and XML development.

The powerful editor for JavaScript, XUL/XBL and Yahoo! Widget development. The JavaScript editor provides features like code completion, syntax highlighting and content outline that helps developers productively create efficient JavaScript code.

Tutorial: Spket: Setting Up Eclipse IDE for Ext JS and JQuery Development

Hope you will like this. Cheers… 🙂


Shept – Data grid based Web Apps with Spring and Hibernate

Shept – Data grid based Web Apps with Spring and Hibernate

Build complex web form data entry applications based on data grids rapidly with spring and hibernate. As a mainly server-side approach it offers close integration and can easily be used to create new web apps or add administrative features to your existing ones.

Shept is a library meant to make development of data entry web applications easier by introducing data grids for data entry as a primary input element. It allows the concatenation of those elements in a simple fashion inspired by what used to be a standard in 4GL tools for building client server apps in the 90’s.

In technical terms shept is a thin layer closely integrated with the spring framework and hibernate. As such it is also a documentation project about building data centric web applications with these major opens source projects and provides templates and online demo applications to give you a quick start.

Shept is short for

  • Spring The core application building java toolset
  • Hibernate The core object relational layer and toolset
  • Eclipse as the development environment
  • Postgres as the industry strength open source database
  • Tomcat as the industry standard web application server

All of these are Open Source heavy weights with a long history and huge reputation in the world of Open Source Development frameworks and Tools. They are widely used and heavily documented and all have a large community of enthusiastic supporters worldwide.

Shept has been under development since 2007. It started as a proprietary library and is used in a couple custom web projects so far. Although it introduces new concepts it is more a pragmatic than a generic solution and its APIs are considered to be stable to a large extent.

Use cases

  • Migrate any legacy data driven project (e.g. ‘client server’) into the web
  • Migrate any kind of vendor specific data driven project to Open Source
  • Merge into your existing Spring-Hibernate project for RAD features
  • Building administrative frontends to community projects
  • Creating data entry wizards


Shept picks up the tradition of 4GL frameworks which were commonly used for building Client-Server applications.
It offers decent capabilities for data-handling in tables (data-grids). Beeing a thin layer on top and a close integration into todays popular web application building tools Spring and Hibernate it is as well a concept as a toolset and a framework.

  • Data Grids
  • Layout composition
  • Business objects lifecycle support
  • Comprehensive Data Source Coverage
  • Segment chaining and reuse
  • Validation and Error Handling

Hope you will like this for small web apps. Cheers… 🙂