Kevin,
Any of these links of help?
https://jaxb.dev.java.net/tutorial/section_2_2_16_1-Elements-With-Any-Type.h
tml#Elements%20With%20Any%20Type
https://jaxb.dev.java.net/tutorial/section_2_2_16_2-Another-Content-Tree-as-
Element.html#Another%20Content%20Tree%20as%20Element
https://jaxb.dev.java.net/tutorial/section_6_2_7_6-Collecting-Unspecified-El
ements-XmlAnyElement.html#Collecting%20Unspecified%20Elements:%20XmlAnyEleme
nt
I think dealing with an extension is probably more complex than trying to
figure out how to make it work with primitive types without having to create
a class. Do you expand payload to include all primitive types? What about
arrays of primitive types? I don't even think namedStringArray should be in
payload and even in the specification it appeared like it originally was not
there.
I think you'll have to take the "Any" XML element use it as input to a new
Unmarshaller but only when the value of the payload is requested with the
given type. When marshalling, you'll need to have an extra parameter to
specify that a root should be created with same name as event or use
overloaded methods. Example:
int x = myEvent.GetValue<int>(0); //parameter is default value for type
myEvent.SetValue<int>(x, true); // parameter = true to create an element
with same name as event name
or
int x = myEvent.GetValue(0); //overloaded methods for all primitive types
myEvent.SetValue(x); //these create the element with same name as event
or some variation on this theme.
Nader
-----Original Message-----
From: Kevin Frender [mailto:]
Sent: Wednesday, October 14, 2009 3:58 PM
To:
Subject: [wsrp-interop] WSRP event payloads with "simple" types
Hello all,
For WSRP 2.0 events, the schema-supported event payload types are a
NamedStringArray and "any" from a non-WSRP-types namespace. This was a
conscious decision at the time to not get into the details of
standardizing event payload encoding.
For JSR286 (Java Portlet specification version 2.0) event payloads can
have any JAXB-bindable object type, or any of the JAXB primitive types,
which include very basic things like java.lang.String, java.util.Date,
etc. which have obvious mappings to XML data types. The JAXB primitive
types don't have @XmlRootElement annotations however, so they can't be
marshalled directly (by themselves) to XML.
So if a portlet wanted to send an event with a simple String payload,
JSR286 allows that, but there is no obvious way to represent that in XML
as a WSRP event payload in a manner that other WSRP containers could
recognize.
In the interest of interoperability, I was wondering how everyone
handles the binding of these "primitive" types when they are used as an
event payload. We were thinking of creating a simple XML element for
holding these types inside the event payload, but that wouldn't work too
well for WSRP interoperability, unless the WSRP committee came up with a
standard schema and XML namespace to hold these "simple" types. So as a
second question, I was wondering if there was interest in creating a
standard WSRP extension for handling these simple data types.
Thanks,
Kevin
---------------------------------------------------------------------
To unsubscribe from this mail list, you must leave the OASIS TC that
generates this mail. Follow this link to all your TCs in OASIS at:
https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php