Return-Path: Delivered-To: apmail-cxf-dev-archive@www.apache.org Received: (qmail 43418 invoked from network); 31 Aug 2009 11:59:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 31 Aug 2009 11:59:23 -0000 Received: (qmail 11221 invoked by uid 500); 31 Aug 2009 11:59:23 -0000 Delivered-To: apmail-cxf-dev-archive@cxf.apache.org Received: (qmail 11128 invoked by uid 500); 31 Aug 2009 11:59:23 -0000 Mailing-List: contact dev-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list dev@cxf.apache.org Received: (qmail 11118 invoked by uid 99); 31 Aug 2009 11:59:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 31 Aug 2009 11:59:23 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of bimargulies@gmail.com designates 209.85.219.210 as permitted sender) Received: from [209.85.219.210] (HELO mail-ew0-f210.google.com) (209.85.219.210) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 31 Aug 2009 11:59:12 +0000 Received: by ewy6 with SMTP id 6so2284260ewy.10 for ; Mon, 31 Aug 2009 04:58:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=2FAJisCEC6MfRuzqvE0QXyFSFw90Vf1BmRTDUHaskOY=; b=l4RiXxUj+RG0uCrDQ1fnoh2Fzm7VNsuDP88yLu1KVcNtwt5RF6wGRcVmUV8wye/P1B zBH9a7PY6Xp7tdtv1pVxE0pjCiXEo2qxmtOsUeOh5xgSRX5mPgw1a85BMIQAdEa1U6uv uiHzmhlVBtVALXYuEpAesn5vV/0Z6KLaf/gXA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=UAMnLpeCHP98JoicJnIEtEfPiFO1KhrekKkuy/TG5+0z+xY9cEAggfhyipQA0wi2TC S7BpP624aIKH2FEb1unrHBzmFm/P8/V+SskFKhGwdqKtUPKkskKlphyV8zpgInr42W9v wH2quMycQsMyRd4qgcn5Q3v99KHuXgB+vClzw= MIME-Version: 1.0 Received: by 10.216.53.199 with SMTP id g49mr1141664wec.49.1251719931812; Mon, 31 Aug 2009 04:58:51 -0700 (PDT) In-Reply-To: <25115676.post@talk.nabble.com> References: <25076146.post@talk.nabble.com> <61b5d9410908210527l7353856bvef33c5243e4a4170@mail.gmail.com> <25115676.post@talk.nabble.com> Date: Mon, 31 Aug 2009 07:58:51 -0400 Message-ID: <61b5d9410908310458l70df52c1wcaf38baa3a547ce2@mail.gmail.com> Subject: Re: Handling collections with Aegis in JAX-RS From: Benson Margulies To: dev@cxf.apache.org Content-Type: multipart/alternative; boundary=0016e6dbdf9de4da8f04726ec1cc X-Virus-Checked: Checked by ClamAV on apache.org --0016e6dbdf9de4da8f04726ec1cc Content-Type: text/plain; charset=UTF-8 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 that collection through this property map instead of calling setRootClasses? So 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 for root types. Root types have to be in the root classes or derived from the 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 it 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 angle 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 Beryozkin wrote: > > Hi Benson > > Thanks for spending your time on these tests, and fixing CXF 2401. I was > also able to add few more tests, including the one which writes/reads a > complex Map to/from JSON. > > AegisJSONProvider tries its best for users to avoid setting up a namespace > map manually, but in cases when it does not guess properly the users would > be able to overwrite namespaces and their prefixes as needed. This isssue > 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 for > Jettison to report values like @ns1.bar 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 namespace > 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 cases > 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 can not > 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 thread. > Namely, it attempts to convert a JAXRS model info into WSDL-like one and set > 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 data > bindings.... > So we introduced PropertiesAwareDataBinding interface and I've just updated > the JAXRS code to call it like this : > > Map, Type> allClasses = getAllJAXRSResponseInputTypes(); > Map props = new HashMap(); > props.put(PropertiesAwareDataBinding.TYPES_PROPERTY, allClasses); > ((PropertiesAwareDataBinding)db).initialize(props); > > At the moment no CXF DataBindings implement this newly introduced interface. > I think the only way for DataBindingJSONProvider aegis tests which handle > collections to start passing is for Aegis DataBinding to implement > PropertiesAwareDataBinding and initialize itself using the provided > Map, Type>, as opposed to Service. Would you be open to updating > 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 right >>> direction then it would be great. >>> I know you're busy - so just look at it whenever you get a chance, not >>> urgent... >>> >>> cheers, Sergey >>> >>> >>> Sergey Beryozkin-2 wrote: >>>> >>>> >>>> >>>> Hi Benson >>>> >>>> I can't make the Aegis tests writing/reading collections working in CXF >>>> 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) >>>> to AegisJSONProviderTest. I also updated DataBindingJSONProviderTest, >>>> one >>>> of its internal classes to return List. AegisJSONProvider extends >>>> AegisElementProvider, DataBindingJSONProvider extends >>>> DataBindingProvider >>>> which actually (in this case) delegates to Aegis DataBinding. >>>> >>>> AegisJSONProviderTest fails at the write time, it can't find the mapping >>>> for List. DataBindingJSONProviderTest fails early at the Aegis >>>> DataBinding >>>> initialization time for the same reason. I thought Lists were supported >>>> by >>>> default ? I haven't found any exam[le showing how a type mapping for >>>> Lists >>>> can be created. >>>> Can you please, whenever you have a chance, have a look at these tests ? >>>> >>>> thanks, Sergey >>>> >>>> >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/Handling-collections-with-Aegis-in-JAX-RS-tp24933144p25076146.html >>> Sent from the cxf-dev mailing list archive at Nabble.com. >>> >>> >> >> > > -- > View this message in context: http://www.nabble.com/Handling-collections-with-Aegis-in-JAX-RS-tp24933144p25115676.html > Sent from the cxf-dev mailing list archive at Nabble.com. > > --0016e6dbdf9de4da8f04726ec1cc--