Project titled MASHUP portlet
Submitted by Archana H N and Ajay Kumar C S under guidance of SUN
Microsytems., Bangalore.
Archana H N ( University No : 1bm04is010) Ajay Kumar C S
Email id : archana_hn55@yahoo.com Email id : koolajay@gmail.com
Address : #1320, 14th main, Address : #8, 2nd floor, 5th cross
BTM 2nd stage VYSYA Bank Colony(revenue site)
Bangalore- 560076 J PNagar 1st phase
India Bangalore-560078, India
Res no : 080-26684648 Res no : 080-26654336
SYNOPSIS
As a plug-in for NetBeans (IDE), Portal Pack supports full life-cycle of portlet application
development inside NetBeans. Using this tool portlet developers can develop, package, deploy
and test portlet inside their NetBeans IDE. By automatic code and Deployment Descriptor
generation, this tool helps developers to develop portlets quickly.
The Sun and Liferay products resulting from this project will bring developers
simple, lightweight presentation capabilities for GlassFish, Sun's open source Java Platform
Enterprise Edition (Java EE) application server. Sun's new platform will provide customers and
Web developers with Multi-language support,.Workflow API,Simplification of page
development and maintenance in Web-oriented architectures.
Liferay Portal Server
This new project will provide the Liferay Portal Server integration support in Portal Pack.
Liferay is an opensource portal server which supports JSR 186 portlets. Using the Liferay Portal
server Integration support, user can develop and deploy portlets on Liferay Portal server directly
from their NetBeans IDE.
Web 2.0 Mashup Portlet
A mashup means getting data from a variety of data sources and mashing them up together to
create a new dataset that is richer than any of the original sources on their own. Mashups and
RSS are very recent Web 2.0 concepts. In this portlet that we are going to develop we will use
RSS feeds and the photos available from Flickr to create a mashup that will make reading news
more visual and interesting.
The portlet will get news data from sites such as BBC, CNN etc, and relevant photos from Flickr,
mashup this data together to render more visual news.
SOFTWARE REQUIREMENTS
OPERATING SYSTEM: Windows Xp.
NETBEANS IDE 6.0 AND 6.1 BETA. SOURCE – www.netbeans.org
JAVA SE DEVELOPMENT KIT (JDK) 6.
Source- http://java.sun.com/javase/downloads/index.jsp
MERCURIAL Source - http://mercurial.berkwood.com/
PORTAL-PACK-PLUGIN-2_0_BETA 3.ZIP
This zip archive contains following plugin modules
Generic Portlet - Plugin to create JSR 168/JSR 286 Public Draft based generic
portlet applications.
Portal Server Integration Framework - Base framework library for portal server
integration.
Osportletcontainer - Plugin to integrate OpenPortal Portlet Container
Installing the zip files:
Download the zip file for the Portal Pack Plugins.
Unzip the downloaded zip file to a directory.
Start the NetBeans IDE 6.0.
Go to Tools > Plugins
Click on "Downloaded" tab
Click "Add Plugins" Button
Add/Select all extracted *.nbm files and follow the instructions to install portal
pack plugins.
GETTING ANT AND INSTALLATION PROCESS.
The latest stable version of Ant is downloaded from the Ant web page
http://ant.apache.org/.
For this current version of Ant, JDK should be installed in the system.
The ant.bat script makes use of three environment variables - ANT_HOME,
CLASSPATH and JAVA_HOME. If these variables are set, they should not have
quotes (either ' or ") and they should not end.
Assume Ant is installed in c:\ant\. The following sets up the
environment:
set ANT_HOME=c:\ant
set JAVA_HOME=c:\jdk-1.5.0_15
set PATH=%PATH%;%ANT_HOME%\bin
INSTALL STEPS FOR LIFERAY
Download Liferay(glassfish-installer-v2ur1-b09d-windows) bundled with Glassfish for
your platform from http://www.liferay.com/web/guest/downloads/portal
java -Xmx256m -jar liferay-portal-glassfish-(platform)-(version).jar -console
cd glassfish
ant -f setup.xml
./bin/asadmin start-domain
Access Portal at http://localhost:8080/portal The first request will take a while to respond
since JSPs are compiled.
Running of the MashUp Portlet on the Liferay Portal
The URL http://localhost:8080/portal is typed on the Browser to check for the proper
installation of the Liferay Portal. This looks like as shown in he below snapshot
The Users run the Mashup code from the Netbeans IDE. The two steps in the Netbeans IDE
are as follows:
1. The user selects the MashUp project and then gives “clean and build”.
2. Then after the build is successful, the project is selected and “run”.
After the successful completion of the “run”, the Liferay Plugin developed to integrate Liferay
with the Netbeans IDE, automatically open the browser on its own and the above shown
snapshot will be displayed.
The user can sign in the portal with the default username “test@liferay.com” and the
password “test”. Once the user has signed in, he is entitled to remove, add and edit the page.
This looks like as shown in the below snapshot
The user can add the portlets that he wishes to see on the portal page by selecting the “Add
Application” option in the menu. This tab has a list of portlets under different category like
Admin, Entertainment, Wiki etc. The user portlets are listed in User_Portlets
category.
This is the mashup portlet which displays the news from a news website and the relevant
photos from the flickr website.
This is the edit mode of the portlet where the user can give a RSS URL of the news
website of their choice and obtain the news from that website. Once the user submits the
request, the view mode of portlet
displayed.
MASHUP PORTLET
Our project is developing a portlet under guidance of Sun Microsystems, Bangalore.
A mashup is an application that combines data from two or more external online sources. The
external sources are typically other Web sites and their data may be obtained by the mashup developer
in various ways, including, but not limited to APIs, XML feeds, and screenscraping. To build a mashup,
you need access to a minimum of two data sources that can be combined to create a service, which is
not otherwise available from either source.
Because portlets can incorporate mashups, the latter are a natural fit for portals. A portlet can fetch
content from various data sources to create a mashup. Subsequently, the portal can personalize that
data so that its users can have their own mashups with data sources that suit their individual needs,
hence saving a major task in the development cycle.
We have developed News Mashup portlet. This extracts headlines from any of the news
website namely CNN, BBC, NDTV etc.. with the corresponding photos from Flickr website.
As we all know, every website maintains a list of updates called RSS feeds. This is indicated in all
website that uses it. We can use that particular link of RSS feed as input to our portlet.
RSS WORKING:
RSS works by having the website author maintain a list of notifications on their website in a
standard way. This list of notifications is called an "RSS Feed". People who are interested in finding out
the latest headlines or changes can check this list. Special computer programs called "RSS aggregators"
have been developed that automatically access the RSS feeds of websites user cares about and organize
the results for him. (RSS feeds and aggregators are also sometimes called "RSS Channels" and "RSS
Readers".)
Producing an RSS feed is very simple and hundreds of thousands of websites now provide this feature,
including major news organizations like the New York Times, the BBC, and Reuters, as well as many
weblogs.
RSS provides very basic information to do its notification. It is made up of a list of items
presented in order from newest to oldest. Each item usually consists of a simple title describing the item
along with a more complete description and a link to a web page with the actual information being
described. Sometimes this description is the full information user wants to read (such as the content of a
weblog post) and sometimes it is just a summary.
ROME AND JDOM :
Rome library is used to parse this RSS feeds which is in the form of XML format.ROME is a set of
open source Java tools for parsing, generating and publishing RSS and Atom feeds. The core ROME
library depends only on the JDOM XML parser and supports parsing, generating and converting all of the
popular RSS and Atom formats including RSS 0.90, RSS 0.91 Netscape, RSS 0.91 Userland, RSS 0.92, RSS
0.93, RSS 0.94, RSS 1.0, RSS 2.0, Atom 0.3, and Atom 1.0. User can parse to an RSS object model, an
Atom object model or an abstract SyndFeed model that can model either family of formats.
ROME includes a set of parsers and generators for the various flavors of syndication feeds, as
well as converters to convert from one format to another. The parsers can give back Java objects that
are either specific for the format given to work with, or a generic normalized SyndFeed class that
continues the work with the data without bothering about the incoming or outgoing feed type.
ROME and JDOM are the two jar files to b included in an application.It has all the packages
required to get RSS feed from particular site and parse it using XMLReader.
This returns the details about news such as description, author, title and other related details in
the form of objects. Then particular detail can be obtained. In our portlet, we use only title or the
headlines of the news.
FLICKR API
The Flickr API is available for non-commercial use by outside developers. JFlickr is intended to
become a full Java implementation of the Flickr photo service APIs. JFlickr will include implementations
of the REST, SOAP, and XML-RPC request and response formats.
Flickr photo site allows the user to access both public and private photos.
It has various packages for obtaining the photo urls,photos, date of uploading the photo.Flickr api jar file
should be included in application in order to make use of all these facilities. The Flickr API consists of a
set of callable methods, and some API endpoints.
To perform an action using the Flickr API, you need to select a calling convention, send a request
to its endpoint specifying a method and some arguments, and will receive a formatted response. All
request formats take a list of named parameters. The REQUIRED parameter method is used to specify
the calling method. The REQUIRED parameter api_key is used to specify your API Key.
The api_key is obtained by logging on to yahoo account. The user obtains two keys namely
application key and secret key.These keys are used to import photos and related information in our
application. The optional parameter format is used to specify a response format.In our portlet we have
used only the urls of public photos of Flickr website.
DESIGN FOR MASHUP PORTLET
The design of mashup portlet involves three stages :
Getting the data from news website.
Getting the relevant photoURLs from Flickr site.
Combining them together that displayes news headlines along with the relevant photo urls.
STAGE 1
Getting the data from news website.
RSS feed of the news site is obtained from dataset-1. The RSS feed wil be in the XML format. To parse
this RSS feed, we create RSSUtil class which will use two libraries called ROME(Rss and atOM utilitiEs)
and JDOM(Java-based Document Object Model). Headlines of news is obtained after parsing.Thus
output of stage-1 is news headlines.
STAGE 2
Getting the relevant photos:
Urls are obtained with our own keywords.
STAGE 3
The dataset-1 and dataset-2 are combined to give mashup portlet.This can be explained as
follows:
The RSSUtil class uses the RSSfeed of the news site to obtain the headlines.As we have seen in
stage1, one headline is considered and broken down into series of tokens and each token is passed as
tags. In stage2 each tag is considered and corresponding search is done in order to obtain the
PhotoURLs.
Thus in stage3 we see that, stage1 and stage2 steps are repeated for each headline using the
MashUp Portlet, which creates tags for each of the headlines using RSSUtil. Using these tags,
corresponding PhotoURL set is created.So the headline and the respective Photos are displayed.An
approprite front end is given to run as a portlet and the mashed up dataset is displayed thus with the
enhanced dataset rendering a more visual news.
DATA SET1 DATA SET2
(NEWS (FLICKR
WEBSITE) WEBSITE)
COMBINED DATA SET
(JAVA CODE)
FRONT END PORTLET
(JSP FILE)
In present world, its very important to keep ourselves with updated news from time to time. If the
photos are provided along with headlines in the same space, it wil be more easy and faster to
understand the news which is provided by our mashup portlet. We can also customize as to from which
website we want to get the news, it may be from CNN or BBC, it may be national or international news.
Our website is developed with every convenient and friendly features to render news to every person
sitting on his computer.