OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

wsrp message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Event payload's root element name

In 4.1.11 EventDescriptionType we mandate that the event's payload root
element name becomes the event's (q)name.
Although this is not a conformance statement, I would ask if this is really
necessary although I can see some use to it.
I would be greatly interested in opinions and perhaps implementation
choices you have choosen here for the sake of interoperability.

The current problem that I see is that JSR286 does not mandate to have the
class definition be annotated with a namespace and name element.
E.g. the following class could be defined by a portlet programmer:

class foo {
  String attribute;
  String value;

A typical JAXB serializer would serialize this to:

<foo attribute="someASttributeValue">

This means that for WSRP the Producer would have to change the root element
name to match the event name, e.g.:
<fooEvent xmlns:x="http://example.org/eventnamespace";

In this case when a portlet would receive <fooEvent>, it might not be able
to deserialize that event payload, because the JAXB unmarshaller would
expect <foo> as the root element name.
Note that when transforming the root element's name, the initial name gets
lost on event distribution.

I see the following solutions to this problem:

1. do no require/mandate that the root element has a certain name
The root element is of no meaning because typically the event source would
match the event's type from it's definition which is a 1:1 relation of name
and type.
So unmarshallers need to be prepared to cope with payloads with arbitrary
root element names - the type is important here. This is explicitly allowed
by the JAXB spec to unmarshall XML strings which have a different root name
And since the target portlet would need to have the same class defined I
guess this way would be easiser for portlet programmers as well as for
container developers.

2. make sure that container implementation always marshal java classes with
a root element who's namespace and name is the event's qname defined in the
This would make the transformation to wsrp payload easy, producer would
just need to stuff in the JAXB serialized XML String as the event payload.
The same applies here to unmashalling as in 1. The unmarshalling code needs
to invoke the JAXB unmarshaller with the XML String and class name (type
information) which would then generate the according portlet class
referenced in the DD. I would presume most implementation would do that
anyway and don't care about the root element's name because they have a)
the event qname and b) the matching class at hand.

3. mandate in the JSR286 spec that JAXB annotated classes need to annoted
the root element with namespace & name matching the event name, e.g.:
class foo {
  String attribute;
  String value;
If the root element annotation contains no namespace and name attributes,
then the JSR286 container's JAXB serializer would create the root element
according to above rules.
Note that some convention like this is also necessary for JSR286 event
payloads consisting of simple types like java.lang.String.
There is no definition about what the root name will be in this case in the
JAXB spec, I guess JAXB implementation can choose an arbitrary naming
algorithm here.
I guess a similar convention would come handy in the JSR286 spec, too.
Although I realize that this is more a directive to container
implementations rather than portlet programmers.
Typically portlet programmers will never need to deal with the form the
JAXB serializer chooses.

Mit freundlichen Gruessen / best regards,

        Richard Jacob
IBM Lab Boeblingen, Germany
Dept. 2289, WebSphere Portal Server Development 1
WSRP Team Lead
WSRP Architecture & Standardization
Phone: ++49 7031 16-3469  -  Fax: ++49 7031 16-4888

IBM Deutschland Entwicklung GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Herbert Kircher
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]