Wild cards in process supported-processing-event or supported-publishing events

In the Patterns in ProcessEvent annotation entry i talked about how you can use . as wild card character while annotating methods that should be used for handling the event. But the concept of wild card also applies to the supported-processing-event or supported-publishing-event. This is what the Portlet Specification says

"The portlet is encouraged to organize the local part of the event names in the event-definition element in a hierarchical manner using the dot ‘.’ as separator. A trailing '.'tells the Consumer that this is not the end of the hierarchy and the Portlet is interested in all events with names in this branch of the hierarchy. The portlet must not specify events with the same name but different types. Event names in the event-definition element hould not end with a trailing “.” character as wildcards are not supported in the event 0 definition level. Wildcards should only be used in the supported-processing-event or supported-publishing-event elements and should be able to be resolved by the portlet container to an event definition without wildcards in the event-definition element by matching event names ending with a "." character to any event whose local name starts with the characters before the "." character and also specifies the same namespace. If the wildcard string should match a part of a hierarchy two dots are required at the end of the wildcard string: one to denote the hierarchy and one for the wildcard: “foo.bar..”."

Basic idea is while declaring event you will have to specify fully qualified name of the event and you should use a hierarchical name such as say com.webspherenotes.events.contact, com.webspherenotes.events.address, com.webspherenotes.events.phone But while declaring which portlets can publish or subscribe the event you can use wild character like this com.webspherenotes.events..

Take a look at this sample portlet.xml

<?xml version="1.0" encoding="UTF-8"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
<portlet>
<portlet-name>ProcessEventAnnotationPortlet</portlet-name>
<display-name>Process Event Annotation Portlet</display-name>
<portlet-class>com.webspherenotes.portlet.jsr286.ProcessEventAnnotationPortlet</portlet-class>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
<portlet-mode>edit</portlet-mode>
</supports>
<portlet-info>
<title>Process Event Annotation Portlet</title>
<short-title>Process Event Annotation Portlet</short-title>
<keywords>Process Event Annotation Portlet</keywords>
</portlet-info>
<supported-processing-event>
<name>com.webspherenotes.events.</name>
</supported-processing-event>
<supported-publishing-event>
<name>com.webspherenotes..</name>
</supported-publishing-event>

</portlet>

<default-namespace>http://wpcertification.blogspot.com</default-namespace>
<event-definition>
<name>com.webspherenotes.events.contact</name>
<value-type>com.webspherenotes.portlet.events.Contact</value-type>
</event-definition>
<event-definition>
<name>com.webspherenotes.events.address</name>
<value-type>com.webspherenotes.portlet.events.Address</value-type>
</event-definition>
<event-definition>
<name>com.webspherenotes.events.phone</name>
<value-type>com.webspherenotes.portlet.events.Phone</value-type>
</event-definition>

</portlet-app>


The ProcessEventAnnotationPortlet can process all events starting with com.webspherenotes.events but it can publish all the events starting with com.webspherenotes

2 comments:

srjwebsolutions said...

We are leading responsive website designing and development company in Noida.
We are offering mobile friendly responsive website designing, website development, e-commerce website, seo service and sem services in Noida.

Responsive Website Designing Company in Noida
Website Designing Company in Noida
SEO Services in Noida
SMO Services in Noida

EG MEDI said...

Egmedi.com is online medical store pharmacy in laxmi nagar Delhi. You can Order prescription/OTC medicines online.
Cash on Delivery available. Free Home Delivery


Online Pharmacy in Delhi
Buy Online medicine in Delhi
Online Pharmacy in laxmi nagar
Buy Online medicine in laxmi nagar
Onine Medical Store in Delhi
Online Medical store in laxmi nagar
Online medicine store in delhi
online medicine store in laxmi nagar
Purchase Medicine Online
Online Pharmacy India
Online Medical Store