Integrating Mashups in web applications is not an easy job. Web developers need to write intensive JavaScript code and much duplicate feed parsing code in order to create an interactive Mashup web application.
Mashups4JSF is an open source library that aims at integrating Mashup services in JSF web applications. Using Mashups4JSF, JSF developers will be able to construct rich and customized Mashups using a set of custom JSF components. They will be able to export domain model data as mashup feeds. They will be able to create rich Google Maps declaratively and create custom Ajax actions powered by JSF 2.x architecture. This session discusses how to utilize this library in order to build interactive mashups in the JavaServer Faces applications.
This session was presented by Hazem Saleh in JavaOne Russia 2013.
2. My Bio
Nine years of experience in open source technologies and Java Enterprise.
I worked with many clients in Europe (Sweden), North America (USA and
Canada), Latin America (Peru), Asia (Qatar and Kuwait) and Africa
(Egypt, Morocco and South Africa).
Apache MyFaces Committer.
Co-author of “The Definitive Guide to Apache MyFaces” book (Apress).
Author of “JavaScript Unit Testing” book (Packtpub).
DeveloperWorks Contributing Author.
Technical Speaker in (JavaOne San Francisco, CON-FESS Vienna, IBM
Regional Technical Exchange …etc).
3. Agenda
What is Mashups?
Common Mashup Architecture.
Common Mashup Scenarios.
Current Mashup Complexities.
Mashups4JSF = Mashups meet the JavaServer Faces.
Mashup Demo1.
Building Mashup Application using Mashups4JSF.
Mashup Demo2.
Consuming feed sources from JSF Applications.
Producing feeds from JSF Applications.
4. Agenda
What is Mashups?
Common Mashup Architecture.
Common Mashup Scenarios.
Current Mashup Complexities.
Mashups4JSF = Mashups meet the JavaServer Faces.
Mashup Demo1.
Building Mashup Application using Mashups4JSF.
Mashup Demo2.
Consuming feed sources from JSF Applications.
Producing feeds from JSF Applications.
5. What is Mashups?
Mashup is an application that combines data or functionality from two or
more sources for creating a new service.
Two main actors:
Service Provider Service Consumer
Mashup Service Consumer cycle:
Aggregation
Visualization
Data Retrieval and Formatting
6. What is Mashups?
Composing different mashups and linking them with organization data
may produce a new service that is not realized by the Mashup service
providers (Mashability).
Mashup Styles:
Server-based Mashups.
Web-based Mashups
7. What is Mashups?
Common Mashup Architecture.
Common Mashup Scenarios.
Current Mashup Complexities.
Mashups4JSF = Mashups meet the JavaServer Faces.
Mashup Demo1.
Building Mashup Application using Mashups4JSF.
Mashup Demo2.
Consuming feed sources from JSF Applications.
Producing feeds from JSF Applications.
Agenda
10. What is Mashups?
Common Mashup Architecture.
Common Mashup Scenarios.
Current Mashup Complexities.
Mashups4JSF = Mashups meet the JavaServer Faces.
Mashup Demo1.
Building Mashup Application using Mashups4JSF.
Mashup Demo2.
Consuming feed sources from JSF Applications.
Producing feeds from JSF Applications.
Agenda
18. • GET https://search.twitter.com/search.json?q=javaone&rpp=10
• Parse JSON Feed (Sample for a single item):
{
"completed_in":0.021,
"max_id":320699880265891840,
"max_id_str":"320699880265891840",
"next_page":"?page=2&max_id=320699880265891840&q=javaone&rpp=10",
"page":1,
"query":"javaone",
"refresh_url":"?since_id=320699880265891840&q=javaone",
"results":[
{
"created_at":"Sun, 07 Apr 2013 00:49:44 +0000",
"from_user":"rob_ratcliff",
"from_user_id":265460384,
"from_user_id_str":"265460384",
"from_user_name":"Rob Ratcliff",
"geo":null,
"id":320699880265891840,
"id_str":"320699880265891840",
"iso_language_code":"en",
"metadata":{
"result_type":"recent"
},
"profile_image_url":"http://a0.twimg.com/profile_images/2376270945/rfa2u2nheyb6jj5k9bv8_normal.jpeg",
"profile_image_url_https":"https://si0.twimg.com/profile_images/2376270945/rfa2u2nheyb6jj5k9bv8_normal.jpeg",
"source":"<a href="http://twitter.com/tweetbutton">Tweet Button</a>",
"text":"RT @karianna: Don't forget that the CFP for @javaone is closing in only 8-9 days! Submit your paper today --> http://t.co/6AAWdIf87h #java #dev"
}
...
],
"results_per_page":10,
"since_id":0,
"since_id_str":"0"
}
Retrieve content
+
Custom JSON parsing
19. Common Mashup Scenarios
In order to interact with the most popular mashup service
providers, we have to:
Write Intensive JavaScript code.
Write extra Java code to interact with the server and then
parse different formats:
JSON ATOM RSS
21. Agenda
What is Mashups?
Common Mashup Architecture.
Common Mashup Scenarios.
Current Mashup Complexities.
Mashups4JSF = Mashups meet the JavaServer Faces.
Mashup Demo1.
Building Mashup Application using Mashups4JSF.
Mashup Demo2.
Consuming feed sources from JSF Applications.
Producing feeds from JSF Applications.
22. Current Mashup Complexities
There is no economic-incentive model agreed by all the mashup service
providers for mashup service creation and consumption.
Representations of Mashup services
SOAP REST
Formats of Mashup Data
ATOM CustomRSS JSON
Programming Models for Mashup consumption
Server side (Java, PHP, ...etc) Client side (JavaScript)
24. What is Mashups?
Common Mashup Architecture.
Common Mashup Scenarios.
Current Mashup Complexities.
Mashups4JSF = Mashups meet the JavaServer Faces.
Mashup Demo1.
Building Mashup Application using Mashups4JSF.
Mashup Demo2.
Consuming feed sources from JSF Applications.
Producing feeds from JSF Applications.
Agenda
25. Mashups4JSF
One of the possible ways for simplifying mashup
development in the JavaServer Faces world.
Provides a set of JSF components that allows the JSF developer to
construct rich and customized mashups inside the web page:
Public Feed search components, and drill down the
results for:
Twitter
YouTube
Google Search
Digg
Yahoo Weather Component.
26. Mashups4JSF
Provides feed reader components for reading
different types of feeds:
Provides feed export annotations; @Feed annotation for
exporting application data as Mashup feeds.
ATOM
RSS
JSON
28. Mashups4JSF
GMaps4JSF:
Allows creating declarative maps with all of their details
(markers, notes, graphics. …etc) in the JavaServer
Faces world without using JavaScript.
Fully integrated with Google Maps v2 and v3.
Fully integrated with the JSF 2.x Ajax model:
Ajaxified Map Actions.
Ajaxified Marker Actions.
Home: http://code.google.com/p/gmaps4jsf/
33. What is Mashups?
Common Mashup Architecture.
Common Mashup Scenarios.
Current Mashup Complexities.
Mashups4JSF = Mashups meet the JavaServer Faces.
Mashup Demo1.
Building Mashup Application using Mashups4JSF.
Mashup Demo2.
Consuming feed sources from JSF Applications.
Producing feeds from JSF Applications.
Agenda
36. What is Mashups?
Common Mashup Architecture.
Common Mashup Scenarios.
Current Mashup Complexities.
Mashups4JSF = Mashups meet the JavaServer Faces.
Mashup Demo1.
Building Mashup Application using Mashups4JSF.
Mashup Demo2.
Consuming feed sources from JSF Applications.
Producing feeds from JSF Applications.
Agenda
39. What is Mashups?
Common Mashup Architecture.
Common Mashup Scenarios.
Current Mashup Complexities.
Mashups4JSF = Mashups meet the JavaServer Faces.
Mashup Demo1.
Building Mashup Application using Mashups4JSF.
Mashup Demo2.
Consuming feed sources from JSF Applications.
Producing feeds from JSF Applications.
Agenda
40. Consuming feed sources in JSF
Mashups4JSF provides the following components in
order to consume Mashup feeds:
<mashup:atomFeedReader>
<mashup:rssFeedReader>
<mashup:jsonFeedReader>
41. Consuming feed sources in JSF
Let’s build an application that
consumes Yahoo! News feed.
42. What is Mashups?
Common Mashup Architecture.
Common Mashup Scenarios.
Current Mashup Complexities.
Mashups4JSF = Mashups meet the JavaServer Faces.
Mashup Demo1.
Building Mashup Application using Mashups4JSF.
Mashup Demo2.
Consuming feed sources from JSF Applications.
Producing feeds from JSF Applications.
Agenda
43. Producing feeds from JSF Applications
Mashups4JSF provides the following annotations in order
to produce Mashup feeds:
@Feed which refers to the feed class.
@FeedItems which refers to a Java List object of the
feed items.
All of the other feed producing annotations are optional.
45. Conclusion
Mashups4JSF (including GMaps4JSF) is an open source project
that provides a layer of abstraction to create rich mashup
applications without the need to use JavaScript extensively or
writing a great deal of code.
Mashups4JSF (including GMaps4JSF) is compliant with the JSF
2.x Ajax model and architecture.
Mashups4JSF (including GMaps4JSF) is an open source project, so
your contributions and ideas and improvements are welcome:
http://code.google.com/p/gmaps4jsf
http://code.google.com/p/mashups4jsf