| By Jon Ferraiolo, on behalf of the OpenAjax Alliance | Article Rating: |
|
| October 10, 2007 02:00 PM EDT | Reads: |
10,331 |
The OpenAjax Alliance is an organization of leading vendors, open source projects, and companies using AJAX that are dedicated to the successful adoption of open and interoperable AJAX-based Web technologies. This article introduces the alliance's first major technical product, OpenAjax Hub 1.0.
The OpenAjax Hub is a set of standard JavaScript that, when included with an AJAX-powered Web application, promotes the ability for multiple AJAX toolkits to work together on the same page.
The central feature of the OpenAjax Hub is its publish/subscribe event manager (the "pub/sub manager"), which enables loose assembly and integration of AJAX components. With the pub/sub manager, one AJAX component can publish (i.e., broadcast) an event to which other AJAX components can subscribe, thereby allowing these components to communicate with each other through the Hub, which acts as an intermediary message bus.
The umbrella use case for the OpenAjax Hub is the set of scenarios in which an AJAX developer needs to deploy a single application that uses multiple AJAX libraries simultaneously. Here are some specific scenarios:
• Your favorite AJAX library does not address all requirements: In some cases, an AJAX developer might choose to build the majority of his applications using one particular AJAX library, but discovers that the library lacks a particular feature that he needs, and therefore would like to integrate a component from a different AJAX library. In other cases, most of the applications might be (non- AJAX) DHTML, but the developer would like to incorporate two components of AJAX technology into the application, where the two components come from different AJAX libraries.
• Mashups: A developer (or end user) is likely to find that the different components participating in the mashup are based on different AJAX libraries.
• Portals: Just as with mashups, it is likely that different AJAX-powered portlets will be based on different AJAX libraries.
• Preference for a loosely coupled application architecture: The Hub's pub/sub engine provides an industry-standard approach for a simple, loosely coupled AJAX component integration facility within a Web page. Because the Hub's pub/sub engine is independent of particular toolkits, implementing to the Hub can sometimes provide modularization benefits that might allow for modular replacement of some technologies used within a given Web page.
The Hub's Publish/Subscribe Manager
The Hub's pub/sub manager allows one part of a mashup to broadcast an event to which other application components subscribe. Let's illustrate with an example.
Suppose we have a business intelligence application that uses the following AJAX runtime libraries:
- UTILS.js: Provides highly useful extensions to the browser's JavaScript environment, such as XMLHttpRequestAPIs
- CALENDAR.js: Provides a calendar widget
- CHARTS.js: Provides a charting widget
- DATAGRID.js: Provides an interactive data grid widget
One way to implement this application is to load the JavaScript for the OpenAjax Hub before loading the other AJAX libraries. For example:
<html>
<head>
...
<script type="text/javascript" src="OpenAjax.js"/>
<script type="text/javascript" src="UTILS.js"/>
<script type="text/javascript" src="CALENDAR.js"/>
<script type="text/javascript" src="CHARTS.js"/>
<script type="text/javascript" src="DATAGRID.js"/>
...
</head>
...
(Note: Some AJAX runtimes will include the OpenAjax Hub as part of their standard distribution, in which case, as long as the given AJAX runtime's JavaScript is loaded before other OpenAjax-compatible runtimes are loaded, it might not be necessary to include a separate <script> element for OpenAjax.js.)
To make the application work, the developer registers a callback function that is invoked whenever the user selects a new date in the calendar widget. This callback function then broadcasts the new date event using the OpenAjax Hub's publish() function:
<script type="text/javascript">
// Somewhere in earlier JavaScript code, you need
// to invoke the calendar widget's APIs to
// register MyCalendarCallback as the callback
// function for when a new date is selected
...
function MyCalendarCallback(...) {
// Publish the "myapp.newdata" event via
// the OpenAjax Hub.
OpenAjax.hub.publish("myapp.newdate", newdate);
}
...
</script>
Published October 10, 2007 Reads 10,331
Copyright © 2007 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Jon Ferraiolo
Jon Ferraiolo is an employee of IBM within its Emerging Internet Technologies group. Jon is devoted exclusively to OpenAjax Alliance, where he manages operations and leads many activities.Before joining IBM in 2006, Jon worked at Adobe for 13 years where he was an architect, engineering manager and product manager.
Jon has been a speaker at every AJAXWorld conference since October 2006, and has spoken at dozens of other industry conferences in the past couple of years. AJAXWorld magazine has published 6 or 7 articles Jon has submitted over the past couple of years.
- Practical Approaches for Optimizing Website Performance
- SQL Anywhere Server and AJAX
- The Difference Between Web Hosting and Cloud Computing
- Ajax in RichFaces 3.3, JSF 2 and RichFaces 4
- Cloud Computing on Gartner's Top 10 List and SYS-CON Events' 2010 Calendar
- IBM Hardware Chief, Intel VC Exec Arrested in Insider Trading Scam
- US Post Office Hops a Ride on NetSuite’s Cloud
- Gang of Four Creates Cloud BI Stack
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- Confessions of a Ulitzer Addict
- AJAX World RIA Conference & Expo Kicks Off in New York City
- An Introduction to Abbot
- What is Web 3.0?
- AJAXWorld RIA Conference & Expo 2009 West: Call for Papers
- Interviewing Java Developers With Tears in My Eyes
- Adobe Enters Cloud Computing with LiveCycle
- REA Is Where RIA Becomes the Norm
- RIAs for Web 3.0 Using the Microsoft Platform
- Practical Approaches for Optimizing Website Performance
- Social Media Terrorists
- Building a Drag-and-Drop Shopping Cart with AJAX
- What Is AJAX?
- Google Maps! AJAX-Style Web Development Using ASP.NET
- Flashback to January 2006: Exclusive SYS-CON.TV Interviews on "OpenAjax Alliance" Announcement
- AJAXWorld Conference & Expo to Take Place October 2-4, 2006, at the Santa Clara Convention Center, California
- AJAX Sponsor Webcasts Are Now Available at AJAXWorld Website
- How and Why AJAX, Not Java, Became the Favored Technology for Rich Internet Applications
- "Real-World AJAX" One-Day Seminar Arrives in Silicon Valley
- AJAXWorld University Announces AJAX Developer Bootcamp
- AJAX Support In JadeLiquid WebRenderer v3.1

































