Adam Zastawski

My Personal Blog

Ride the Page Bus (TIBCO PageBus™)

Posted by Adam

I don't care if you're creating AJAX based applications based in ASP.Net, Yahoo UI, ExtJS, JQuery or Tibco GI, if you're not riding the page bus you could be missing out on some fundamental benefits of a "Publish and Subscribe" event model. Get it here.

Testing
Imagine if you could simulate user click events without having to deal with functional automated test utilities that can inspect and manipulate the Document Object Model (DOM)?  By hooking all of your user initiated events (keyboard or mouse) to Page Bus message handlers you can write test scripts that inject messages on to the bus and manipulate the AJAX application in the same way a user would.  This technique can facilitate automated functional/regression testing.

Run Time Tutorials
Imagine if you could animate your AJAX application to behave as it might according to user interactions as part of a tutorial or training script.  This method would give the user a hands on orientation without actually having any 'hands-on'. You can see something similar to this in TIBCO's sample application called Xignite.

Decoupling/Team Development
I have seen the Page Bus provide a clear delineation between the message publishers and their code and message subscribers and their code. This means you can delegate portions of the application to built by developers and have then interact in terms of messages and their contents. There is typically more meaningful documentation that arises from this interaction as well.

Modularity and Standard JavaScript API's
One way to provide a concise and standard API between modules of code is to provide a series of messages that some modules can publish in order to interact with other modules. TIBCO highlights this in their AJAX Portlet framework.

There are probably more reasons to use TIBCO's page bus. If you have any let me know.

 

The PageBusSample GI Application

image

  1. appCanvas.xml - The only GUI component in the application. It contains 4 panes.

    image 
    • Top Left - A list control depicting the RSS data
    • Top Right - A text box and a button. These are the user interface elements that initiate the message.
    • Bottom Left - A block that serves as a runtime log only.
    • Bottom Right -  A matrix containing the RSS data that was downloaded
  2. RSStoCDF.xsl - An XSLT file that is used to transform RSS data into a Common Data Format (CDF) document. We will bind the list controls to this CDF document in order to display the data.
  3. LogHandler.js - This is a complete rip off of the Xignite application. I was interested in how they did the runtime logging pane at the bottom.
  4. pagebus.js - The TIBCO page bus JavaScript file
  5. pagebussample.js - This is the JavaScript file that contains all of the business logic.

 

What Happens?

  1. When the application loads (onLoad Script property of the Project Settings) the com.adamzastawski.samples.pagebussample.onLoad() function is called. This function subscribes to the message that will soon be published on the bus.

    image
  2. When the user clicks the button in the top right pane, the application publishes a message to the bus that contains the text value of the textbox.

    image

    The handler that was registered onLoad is fired and the data is put into the cache.

    image
  3. All the while the code is logging to the bottom left pane.

 

That's it. I hope this helps you decide if the page bus is something you think you can use in your AJAX application. You can download the sample GI project below.

PageBusSample.zip (10.25 kb)

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Posted on: 7/1/2008 at 11:22 PM
Tags: , , , ,
Categories: AJAX | Tibco - GI
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (1) | Post RSSRSS comment feed

Related posts

Comments

Justin Myrick us

Tuesday, July 01, 2008 11:39 PM

Justin Myrick

Very nice work Adam. Thanks for pulling this together. GI and the Tibco Pagebus are powerful tools that make Javascirpt development fun.

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

Thursday, August 28, 2008 11:47 PM