Tuesday 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.


                                  Fig: 1

 

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.



Fig : 2 

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

 


 Fig: 6                                                                                                             

 

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

 


User has an option to change the default method name for the consume event. 


 

 

 

 

 

                                  Fig :10

 

 


 

                                                                                                    Fig : 11

 

If you want to reset the story board, then right click and select "reset" anywhere inside the IPC StoryBoard.


Comments:

Hi Satya,

You wouldn't believe it, but in my installation of the new netbeans 6.0 final release, together with portal pack 2.0 beta (and vwp, of course), the "IPC Story Board" menu item in the Window top menu has vanished.

Is this a known bug? Is there another way to invoke the IPC Story Board designer?

Cheers,
Konrad

Posted by Konrad Wulf on December 12, 2007 at 07:39 PM IST #

Hi,

I'm using netbeans 6.5. I found the IPC Story Board in the "Windows -> Other" sub menu. The name has changed to "Portlet Eventing Storyboard"

Posted by Faizul Sulaiman on December 03, 2008 at 11:50 AM IST #

hi Satya,
When i rightclick the event element on the storyboard, and choose the "generate code" option, nothing happens... i have no idea what goes wrong, do you have any perhaps?

Posted by Jeroen on March 17, 2009 at 01:45 PM IST #

Jeroen,

Which type of portlet are you using JSR168/286 or JSF portlet ? If you are trying with JSF portlet, the generate code will not do anything.
BTW, which version of NetBeans and Portal Pack are you using ?

The current eventing storyboard in Portal Pack 3.0 supports JSR-286 eventing.

Thanks !!!

Posted by satya on March 17, 2009 at 03:26 PM IST #

hi! sorry for not providing enough info:
i'm trying to build a set of JSR286 portlets, one was generated with portal pack, the other was constructed using Spring Portlet MVC. I can't generate code with both ...

i'm using NB6.5 and PP3.0.

Posted by Jeroen on March 17, 2009 at 03:38 PM IST #

Hey Satya,

When i create two portlets with Portal Pack, i can generate the eventing code, so i have to check this Spring Portlet MVC-portlet i guess.
Thanks for putting me on the right track!

Posted by Jeroen on March 17, 2009 at 04:37 PM IST #

You can generate code for JSR286 portlets. But not for Spring Portlet, because the spring framework portlet code(like JSF portlet) is not included in your web project. But you can make a JSR286 portlet and a spring mvc portlet communicate with each other through Public Render parameter. Eventing StoryBoard also supports public render parameter.

Posted by satya on March 17, 2009 at 04:40 PM IST #

okay, thanks Satya

Posted by Jeroen on March 17, 2009 at 04:55 PM IST #

Hi,

i have a question regarding portlet events, is there a way to send event to portlet from a simple POJO class ?

thanks
Samar

Posted by Samar on March 26, 2009 at 06:24 AM IST #

what i meant using simple POJO means, can we send an event to portlet from outside portlet container , please let me know

thanks
Samar

Posted by Samar on March 26, 2009 at 11:22 PM IST #

Post a Comment:
  • HTML Syntax: NOT allowed