cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin" <>
Subject RE: Handling collections with Aegis in JAX-RS
Date Mon, 31 Aug 2009 12:22:40 GMT
Hi Benson

I'll update the javaDocs, now it is the Map<Class<?>, Type> that will be
passed. For example, 

List<Baz> updateList(@PathParam("someParam") FooBean param,  List<Bar>

In this method a Foo type won't be of interest to Aegis but only
List<Baz> and List<Bar>.

So the map containing :

1. updateListMethod.getReturnType() :
2. updateListMethod.getParameterTypes()[1] :
Will be passed to the databinding

So it will provide all the required information. Do you think it will
work for Aegis ? I think it should...

> Aegis has a perfectly
good API for passing in a set of root classes. Why is it better to pass
collection through this property map instead of calling setRootClasses?

JAXRS DataBindingProvider is not coded against specific DataBinding
implementations, it is only aware of DataBinding interface, so it should
work with JAXB/Aegis/SDO and XMLBeans. The idea behind introducing this
provider is to let users to use databinding beans as JAXRS provider

Cheers, Sergey

-----Original Message-----
From: Benson Margulies [] 
Sent: 31 August 2009 12:59
Subject: Re: Handling collections with Aegis in JAX-RS

The more I look at this, the less I understand it. Aegis has a perfectly
good API for passing in a set of root classes. Why is it better to pass
collection through this property map instead of calling setRootClasses?
that you can get to the other data bindings the same way? It still won't
work for generics.

The problem is this. Aegis has a pre-generic concept of root classes,
because they are *classes*, not reflection types. Classes don't carry
generic information. While Aegis has a default mappings, it won't use it
root types. Root types have to be in the root classes or derived from
service model. My memory isn't good enough to recall how JAXB deals.
When a
bean has a generic type as a property, the code is using reflection, so
can do generic type processing.

So, to get what you want, we'd need to rework your interface to use
java.lang.reflect.Type. I'm willing to look into the Aegis-specific
here for now and see how to add generic roots. I think the new interface
needs more thinks.

On Mon, Aug 24, 2009 at 8:58 AM, Sergey
> Hi Benson
> Thanks for spending your time on these tests, and fixing CXF 2401. I
> also able to add few more tests, including the one which writes/reads
> complex Map to/from JSON.
> AegisJSONProvider tries its best for users to avoid setting up a
> map manually, but in cases when it does not guess properly the users
> be able to overwrite namespaces and their prefixes as needed. This
> would likely arise on the read side only, when CXF reads it. JSON is
> namespace-unaware so when reading, one needs to setup a namespace map
> Jettison to report values like to the JAXB reader... (but
only if
> AegisJSONProvider has not guessed how to map prefixes to namespaces)
> There's a couple of issues I'd like to discuss. First one is that
> AegisJsonProviderTest.testReadWriteComplexMap does have to setup a
> for a map root element, but it does not have to do it for
> testWrite/ReadCollection tests. I'm wondering, can it be avoided in
> when Maps are being written/read ? That is, can we modify
> createReader/Writer methods such that QNames for containers like
> Map/Collections and its member types are available ?
> Another one is that DataBindingJSONProvider test (aegis tests) still
> handle collections. I think the problem there is that when
> DataBindingProvider (the one DataBindingJSONProvider extends) is being
> initialized, it uses a workaround which we discussed in the other
> Namely, it attempts to convert a JAXRS model info into WSDL-like one
> calls DataBinding.initialize(Service). It's quite limiting for a
number of
> reasons, and one of them is that the generic types are not visible to
> bindings....
> So we introduced PropertiesAwareDataBinding interface and I've just
> the JAXRS code to call it like this :
> Map<Class<?>, Type> allClasses = getAllJAXRSResponseInputTypes();
> Map<String, Object> props = new HashMap<String, Object>();
> props.put(PropertiesAwareDataBinding.TYPES_PROPERTY, allClasses);
> ((PropertiesAwareDataBinding)db).initialize(props);
> At the moment no CXF DataBindings implement this newly introduced
> I think the only way for  DataBindingJSONProvider aegis tests which
> collections to start passing is for Aegis DataBinding to implement
> PropertiesAwareDataBinding and initialize itself using the provided
> Map<Class<?>, Type>, as opposed to Service. Would you be open to
> the Aegis databinding ?
> thanks, Sergey
> bimargulies wrote:
>> I have a rather clear memory of working on these, there wasn't enough
>> passing of Generic classes around. I'll go have a look.
>> On Fri, Aug 21, 2009 at 6:38 AM, Sergey
>> Beryozkin<> wrote:
>>> Hi Benson
>>> if you could look at any of these tests or at least point me in the
>>> direction then it would be great.
>>> I know you're busy - so just look at it whenever you get a chance,
>>> urgent...
>>> cheers, Sergey
>>> Sergey Beryozkin-2 wrote:
>>>> Hi Benson
>>>> I can't make the Aegis tests writing/reading collections working in
>>>> JAX-RS.
>>>> I've found that AegisProviderTest#testReadWriteComplexMap is still
>>>> @Ignored, it might've passed for you because it was @Ignored :-)
>>>> I've also added testWriteCollections() (which writes
>>>> List<AegisTestBean>)
>>>> to AegisJSONProviderTest. I also updated
>>>> one
>>>> of its internal classes to return List<Book>. AegisJSONProvider
>>>> AegisElementProvider, DataBindingJSONProvider extends
>>>> DataBindingProvider
>>>> which actually (in this case) delegates to Aegis DataBinding.
>>>> AegisJSONProviderTest fails at the write time, it can't find the
>>>> for List. DataBindingJSONProviderTest fails early at the Aegis
>>>> DataBinding
>>>> initialization time for the same reason. I thought Lists were
>>>> by
>>>> default ? I haven't found any exam[le showing how a type mapping
>>>> Lists
>>>> can be created.
>>>> Can you please, whenever you have a chance, have a look at these
>>>> thanks, Sergey
>>> --
>>> View this message in context:
>>> Sent from the cxf-dev mailing list archive at
> --
> View this message in context:
> Sent from the cxf-dev mailing list archive at

View raw message