Portal event declaration builder
In this topic ...
Related Topics ...
Use the Portal Event Declaration Builder to define a portal event and create a method for firing the event. This Builder supports events in IBM WebSphere Portals only. This Builder does not support JSR 168 portal events .
The method created by this Builder is named: fire<buildername>. Use an Event Handler Builder call to associate an action with the event created by this Builder.
Use the "Factory Portal Event" type when interacting with other Factory Portlets. This event type is more flexible than the other choices available. If we need to interact with non-Factory portlets (IBM or SAP), choose the appropriate WPS or SAP event type, depending on the portal container in which you are working.
Choosing an Event Type
This Builder supports the following types of portal events. The type you choose depends on the type of portlets you are interacting with. We can choose:
- Factory Portlet Event - This event type sends events between Factory models. Internally this sends a WebAppPortletMessage written specifically for use with Factory models. This special portlet message contains the target event name, and an Object[] that holds any arguments to pass on to the event handlers action (method). Any number of arguments can be passed to the target handler action with this event type. All values are passed as String values
- WPS Default Portlet Message with Event Name - (Not supported in SAP portal environments) This event type sends events to Factory models as well as to non-model portlets. Internally, this event sends an org.apache.jetspeed.portlet.DefaultPortletMessage, which allows it to span outside of the current application, providing the target portlet is on the same page. A limitation of the DefaultPortletMessage is that it can only contain a single text message.
To allow this message to pass an event name as well as the message the single message is encoded with the event name and the message data. For example if you wanted to declare an event named "MyEvent" and pass its target the string "Here is some data" the message text will contain both pieces of information: "EventName:MyEvent Message: Here is some data" Because of this limitation you can pass a maximum of one argument to the target handler action. The argument must be of type String.
- WPS Default Portlet Message- This event type sends events to Factory models as well as to non-model portlets. Internally, it sends an org.apache.jetspeed.portlet.DefaultPortletMessage, which allows it to span outside of the current application providing the target portlet is on the same page. This event type will send a single text message so there will always be one argument of type String declared.
There is no special encoding of the event name in the message (as in WPS Default Portlet Message with Event Name) so this will create the declaration with the fixed event name of "DefaultPortletMessage_Event".
Using a fixed name allows models to listen to a DefaultPortletMessage from a non-model portlet. To listen you would create an event handler to handle the "DefaultPortletMessage_Event" event. If your portlet is the target of a DefaultPortletMessage, its "DefaultPortletMessage_Event" handler action will be invoked by the portlet adapter.
Typically this declaration type is used to send a message to a non-model portlet that is looking for a specific message value, or to receive a DefaultPortletMessage from a portlet that cannot encode the action inside its message.
Specifying Inputs
The Portal Event Declaration Builder takes the inputs described in the table below. For help on inputs common to many or all Builders such as those in the Properties input group, see Using the Builder Call Editor.
Input Name
Description
Event Type Select the type of even to declare. We can choose:
- Factory Portlet Event - Select this event type to send events between models.
- WPS Default Portlet Message with Event Name - Select this event type to send events to models as well as to non-model portlets.
- WPS Default Portlet Message - Select this event type to send events to Factory models as well as to non-model portlets
Click here for more information about these event types.
Event Name Enter a name for this event. This name appears in the Builder call list and in the list of events to handle in the Event Handler's Builder call editor. Fire Event Locally This input is available when Factory Portlet Event is selected as the event type. Enable this check box to allow the model/portlet that fires the event to also catch the event. This technique might be useful in a portlet that must respond to a user action by presenting a revised UI.
Arguments To define arguments that will be passed to the action specified by an Event Handler, name those arguments and specify their data type here.