cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r808498 - in /cxf/branches/2.2.x-fixes: ./ rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/ rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/ rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/ rt/frontend/jaxrs...
Date Thu, 27 Aug 2009 16:27:46 GMT
Author: dkulp
Date: Thu Aug 27 16:27:45 2009
New Revision: 808498

URL: http://svn.apache.org/viewvc?rev=808498&view=rev
Log:
Merged revisions 806687 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r806687 | bimargulies | 2009-08-21 15:24:18 -0400 (Fri, 21 Aug 2009) | 1 line
  
  More changes to cope with collections and their aftermath with Aegis+JAX-RS.
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisXMLStreamDataWriter.java
    cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java
    cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageWriter.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractAegisProvider.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisJSONProviderTest.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisProviderTest.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 27 16:27:45 2009
@@ -1 +1 @@
-/cxf/trunk:782728-782730,783097,783294,783396,784059,784181-784184,784893,784895,785279-785282,785468,785621,785624,785651,785734,785866,786142,786271-786272,786395,786512,786514,786582-786583,786638,786647,786850,787200,787269,787277-787279,787290-787291,787305,787323,787366,787849,788030,788060,788187,788444,788451,788703,788752,788774,788819-788820,789013,789371,789387,789420,789527-789530,789704-789705,789788,789811,789896-789901,790074,790094,790134,790188,790294,790553,790637-790644,790868,791301,791354,791538,791753,791947,792007,792096,792183,792261-792265,792271,792604,792683-792685,792975,792985,793059,793570,794297,794396,794680,794728,794771,794778-794780,794892,795044,795104,795160,795583,795907,796022-796023,796352,796593,796741,796780,796994-796997,797117,797159,797192,797194,797231-797233,797442,797505,797517,797534,797581-797583,797587,797640,797651,797699,797882-797883,798344-798346,798363,798461,798479,798533,798551,798557,798561-798562,798570,798573,79858
 4,798654,798748-798749,798816,798891,798929-798930,799245,799267,799439,799448,799637,799723-799724,799792,800453,800497-800498,801380-801381,801447,801962,802892,803056,803129,803419,803460,803493,803689,804002,804175,804276,805784,805907,805909,806020-806021,806023,806405-806406,806576,806602-806604,806620,806627,806631,806633,806638
+/cxf/trunk:782728-782730,783097,783294,783396,784059,784181-784184,784893,784895,785279-785282,785468,785621,785624,785651,785734,785866,786142,786271-786272,786395,786512,786514,786582-786583,786638,786647,786850,787200,787269,787277-787279,787290-787291,787305,787323,787366,787849,788030,788060,788187,788444,788451,788703,788752,788774,788819-788820,789013,789371,789387,789420,789527-789530,789704-789705,789788,789811,789896-789901,790074,790094,790134,790188,790294,790553,790637-790644,790868,791301,791354,791538,791753,791947,792007,792096,792183,792261-792265,792271,792604,792683-792685,792975,792985,793059,793570,794297,794396,794680,794728,794771,794778-794780,794892,795044,795104,795160,795583,795907,796022-796023,796352,796593,796741,796780,796994-796997,797117,797159,797192,797194,797231-797233,797442,797505,797517,797534,797581-797583,797587,797640,797651,797699,797882-797883,798344-798346,798363,798461,798479,798533,798551,798557,798561-798562,798570,798573,79858
 4,798654,798748-798749,798816,798891,798929-798930,799245,799267,799439,799448,799637,799723-799724,799792,800453,800497-800498,801380-801381,801447,801962,802892,803056,803129,803419,803460,803493,803689,804002,804175,804276,805784,805907,805909,806020-806021,806023,806405-806406,806576,806602-806604,806620,806627,806631,806633,806638,806687

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisXMLStreamDataWriter.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisXMLStreamDataWriter.java?rev=808498&r1=808497&r2=808498&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisXMLStreamDataWriter.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisXMLStreamDataWriter.java
Thu Aug 27 16:27:45 2009
@@ -33,7 +33,7 @@
 public class AegisXMLStreamDataWriter extends AbstractAegisIoImpl implements AegisWriter<XMLStreamWriter>
{
 
     private static final Logger LOG = LogUtils.getL7dLogger(AegisXMLStreamDataWriter.class);
-
+    
     AegisXMLStreamDataWriter(AegisContext globalContext) {
         super(globalContext);
     }
@@ -77,7 +77,9 @@
         
         ElementWriter writer = new ElementWriter(output);
         MessageWriter w2 = writer.getElementWriter(elementName);
-        if (aegisType != null && aegisType.getSchemaType() != null) {
+        if (getContext().isWriteXsiTypes()
+            && aegisType != null 
+            && aegisType.getSchemaType() != null) {
             // if we know the type, write it. We are standalone, and the reader needs it.
             w2.writeXsiType(aegisType.getSchemaType());
         }

Modified: cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java?rev=808498&r1=808497&r2=808498&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java
Thu Aug 27 16:27:45 2009
@@ -410,7 +410,9 @@
             java.lang.reflect.Type rawType = pt.getRawType();
             if (rawType instanceof Class) {
                 info.setTypeClass((Class)rawType);
-            }
+            } 
+        } else if (t instanceof Class) {
+            info.setTypeClass((Class)t);
         }
         
         info.setDescription("reflected type " + t.toString());

Modified: cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageWriter.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageWriter.java?rev=808498&r1=808497&r2=808498&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageWriter.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageWriter.java
Thu Aug 27 16:27:45 2009
@@ -28,6 +28,9 @@
  * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
  */
 public abstract class AbstractMessageWriter implements MessageWriter {
+    
+    private boolean xsiTypeWritten;
+    
     /**
      * Create a LiteralWriter but without writing an element name.
      * 
@@ -37,6 +40,10 @@
     }
 
     public void writeXsiType(QName type) {
+        if (xsiTypeWritten) {
+            return;
+        }
+        xsiTypeWritten = true;
 
         /*
          * Do not assume that the prefix supplied with the QName should be used

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractAegisProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractAegisProvider.java?rev=808498&r1=808497&r2=808498&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractAegisProvider.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractAegisProvider.java
Thu Aug 27 16:27:45 2009
@@ -100,7 +100,7 @@
             rootClasses.add(ct);
         }
     }
-    private AegisContext getClassContext(Class<?> type, Type genericType) {
+    private AegisContext getClassContext(Class<?> type, Type reflectionType) {
         synchronized (classContexts) {
             AegisContext context = classContexts.get(type);
             if (context == null) {
@@ -108,17 +108,24 @@
                 context.setWriteXsiTypes(writeXsiType); 
                 context.setReadXsiTypes(readXsiType);
                 Set<Class<?>> rootClasses = new HashSet<Class<?>>();
-                rootClasses.add(type);
-                if (!(genericType instanceof Class)) {
-                    addType(rootClasses, genericType, true);
+                /* we do not want raw collection types in here.
+                 * so we only add the 'type' to the root classes if the 
+                 * un-erased (reflection) type is non-generic.
+                 * Now, perhaps we should tolerate non-collection
+                 * generic types.  
+                 */
+                if (reflectionType == null || reflectionType instanceof Class) {
+                    rootClasses.add(type);
+                } else {
+                    addType(rootClasses, reflectionType, true);
                 }
                 context.setRootClasses(rootClasses);
                 context.initialize();
                 /* It's not enough, in the presence of generic types, to just add it as a
root.
                     a mapping is also needed */
-                if (genericType != null) {
+                if (reflectionType != null) {
                     org.apache.cxf.aegis.type.Type aegisType;
-                    aegisType = context.getTypeMapping().getTypeCreator().createType(genericType);
+                    aegisType = context.getTypeMapping().getTypeCreator().createType(reflectionType);
                     context.getTypeMapping().register(aegisType);
                 }
                 classContexts.put(type, context);

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisJSONProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisJSONProviderTest.java?rev=808498&r1=808497&r2=808498&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisJSONProviderTest.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisJSONProviderTest.java
Thu Aug 27 16:27:45 2009
@@ -39,7 +39,6 @@
 import org.apache.cxf.jaxrs.resources.Tags;
 
 import org.junit.Assert;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class AegisJSONProviderTest extends Assert {
@@ -133,10 +132,11 @@
         
     }
     
+    @org.junit.Ignore
     @Test
-    @Ignore
     public void testWriteCollection() throws Exception {
         AegisJSONProvider p = new AegisJSONProvider();
+        p.setWriteXsiType(false);
         AbstractAegisProvider.clearContexts();
         ByteArrayOutputStream os = new ByteArrayOutputStream();
         AegisTestBean bean = new AegisTestBean();
@@ -157,8 +157,8 @@
     @Test
     public void testManyTags() throws Exception {
         AegisJSONProvider p = new AegisJSONProvider();
-        AbstractAegisProvider.clearContexts();
         p.setWriteXsiType(false);
+        AbstractAegisProvider.clearContexts();
         p.setSerializeAsArray(true);
         
         Tags tags = new Tags();

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisProviderTest.java?rev=808498&r1=808497&r2=808498&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisProviderTest.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AegisProviderTest.java
Thu Aug 27 16:27:45 2009
@@ -38,11 +38,11 @@
 public class AegisProviderTest extends Assert {
     
     private static final String SIMPLE_BEAN_XML 
-        = "<?xml version='1.0' encoding='UTF-8'?><ns1:AegisTestBean "
-            + "xmlns:ns1=\"http://fortest.jaxrs.cxf.apache.org\" "
-            + "xmlns:ns2=\"http://www.w3.org/2001/XMLSchema-instance\" ns2:type=\"ns1:AegisTestBean\">"
-            + "<ns1:boolValue>true</ns1:boolValue><ns1:strValue>hovercraft</ns1:strValue>"
-            + "</ns1:AegisTestBean>";
+        = "<?xml version='1.0' encoding='UTF-8'?>" 
+           + "<ns1:AegisTestBean xmlns:ns1=\"http://fortest.jaxrs.cxf.apache.org\""
+           + " xmlns:ns2=\"http://www.w3.org/2001/XMLSchema-instance\""
+           + " ns2:type=\"ns1:AegisTestBean\">"
+           + "<ns1:boolValue>true</ns1:boolValue><ns1:strValue>hovercraft</ns1:strValue></ns1:AegisTestBean>";
 
     @After
     public void clearCache() {



Mime
View raw message