Inter-Widget communication in cross-platform widgets
By Prashant Dighe on May 07, 2008
Project WebSynergy is Sun's next generation web aggregation and presentation platform wherein,widgets developed using various programming languages and web technologies, like Java, Ruby and PHP, can co-exist and inter-communicate. For a demo, please visit our booth at JavaONE 2008, today or anytime this week. Alternatively, you may pick up a CD or a USB Memory Stick from the booth and try it out. The downloadable zip and instructions are also available.
So how is inter-widget communication achieved? Well, "Whats the big deal?", someone may ask. Propreitory inter-widget communication can be acheived in many different ways. But these widgets use a standard defined by Java Portlet Specification 2.0 (JSR 286) known as public render parameters. And this makes all the difference.
But does this mean Ruby and PHP programmers have to first learn Java specification to be able to develop widgets? The answer is, absolutely not. That is why this becomes so important. Project WebSynergy uses Liferay's JRuby and PHP bridges to run the Ruby and PHP widgets. NetBeans 6.1 and Glassfish v3 already support Ruby/PHP. The native PHP support is in early access in NetBeans 6.1 but you can always write PHP code inside NetBeans. Project WebSynergy provides Portal Pack, which are NetBeans plugins for developing widgets. So the tools make all the difference and help Ruby/PHP programmer to write inter-communicating widgets without understanding the underlying details.
This is how a widget will be typically developed by Ruby/PHP programmer using NetBeans widget development plugins:
- right-click and use a wizard to add a new Ruby or PHP widget
- start writing native Ruby/PHP code
- right-click and a few selections to deploy the widget
This is how cross-technology widgets will be wired together by Ruby/PHP programmer using NetBeans widget developement plugins:
- use widget story-board in NetBeans
- drag-n-drop the widgets (Java/Ruby/PHP) on to the storyboard
- right-click and add public render parameters (provide a name, thats all)
- drag-n-connect to wire the widgets together