Portal Pack IPC Story Board - Tutorial
By ranjansatya on Jun 19, 2007
The Sun Java System Portal Server 7.x (Now Open Portal)/Open Portal Portlet Container enables portlets to communicate with each other through custom portlet eventing. The new Portal Pack 1.3 Beta for NetBeans 5.5/5.5.1 has a new feature IPC Story Board. Interportlet Communication Story Board(aka "IPC Story Board") provides a visual way of wiring(linking) portlets to listen each other's events. Then these portlet applications can be deployed and tested on Open Portal/Sun Java System Portal Server 7.x which are supported by the Portal Pack.
This blog is intended to help portlet developers to get acquainted with the new IPC Story Board feature in the Portal Pack.
Before using IPC Story Board, you need to select the target run time for the project as Sun Java System Portal Server 7.x or Open Portal Portlet Container.
How to Open IPC Story Board
Click Window > IPC StoryBoard menu item in the NetBeans IDE to open IPC StoryBoard in NetBeans IDE.
Project Explorer View
In Project Explorer View, portlet.xml node can be expanded to see all the portlets defined in the portlet.xml. The portlets node shown
under portlet.xml can be dragged and dropped to the IPC Story Board. You can drag portlets from multiple projects to the Story Board. Once a portlet is dragged to the IPC Story Board the corresponding portlet is shown as in Fig : 1.
Fig : 3
Add An Event To a Portlet
User can right click on a Portlet Node in the Story Board and select "Add Event" to add a new event to the portlet. The sun-portlet.xml is also automatically updated for the new event. By default the new event is added with some predefined name. You can double click on the newly added event element and rename it.To remove a portlet node from the story board, select "Remove Portlet From StoryBoard"
Fig : 4
Generate Code for an Event
Right click on a event element and select "Generate Source" to generate eventing code in the corresponding portlet java file. User has an option to create a new method for the event or to add the generate event code snippet to an existing method.The dialog box shown in the Fig: 6 is shown to the user for more information regarding code generation.
Fig : 5
The event generation code looks like the following code snippet in Fig : 7
Fig : 7
Consume an Event in a Portlet
Drag an event generated by a portlet and put it on an another portlet to make that event consume by the second portlet. The association between two portlets is shown by an arrow. When a portlet is dragged to the story board, the story board automatically resolves the dependency and updates the view accordingly.
Fig : 8
Generate Consume Event Source
Right click on a consume event element node of a portlet node and click on the "Generate Consume Event Source" pop up menu item. It creates appropriate consume event source in the corresponding portlet java file. Fig : 11 shows sample generated code snippet for consume event .
Fig : 9
Fig : 11
If you want to reset the story board, then right click and select "reset" anywhere inside the IPC StoryBoard.