cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r808508 - in /cxf/branches/2.2.x-fixes: ./ rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/ rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/ rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5...
Date Thu, 27 Aug 2009 16:44:13 GMT
Author: dkulp
Date: Thu Aug 27 16:44:13 2009
New Revision: 808508

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

........
  r806980 | bimargulies | 2009-08-23 10:35:02 -0400 (Sun, 23 Aug 2009) | 2 lines
  
  CXF-2402 Allow minOccurs and maxOccurs and nillable specs for parameters for custom
  and builtin types.
........

Added:
    cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeClassInfo.java
      - copied unchanged from r806980, cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeClassInfo.java
    cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/NillableService.aegis.xml
      - copied unchanged from r806980, cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/NillableService.aegis.xml
    cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/NillableService.java
      - copied unchanged from r806980, cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/NillableService.java
    cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xmlconfig/NillableTest.java
      - copied unchanged from r806980, cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xmlconfig/NillableTest.java
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/databinding/AegisDatabinding.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/type/DefaultTypeCreator.java
    cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeCreator.java
    cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/XMLTypeCreator.java
    cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java
    cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 27 16:44:13 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,806687,806876,806922,806979
+/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,806876,806922,806979-806980

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/databinding/AegisDatabinding.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java?rev=808508&r1=808507&r2=808508&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
Thu Aug 27 16:44:13 2009
@@ -35,8 +35,8 @@
 
 import org.apache.cxf.aegis.AegisContext;
 import org.apache.cxf.aegis.DatabindingException;
-import org.apache.cxf.aegis.type.AbstractTypeCreator;
 import org.apache.cxf.aegis.type.Type;
+import org.apache.cxf.aegis.type.TypeClassInfo;
 import org.apache.cxf.aegis.type.TypeCreationOptions;
 import org.apache.cxf.aegis.type.TypeCreator;
 import org.apache.cxf.aegis.type.TypeMapping;
@@ -350,7 +350,11 @@
                 }
             }
             
-            part.setProperty("nillable", Boolean.valueOf(type.isNillable()));
+            // The concept of type.isNillable is questionable: how are types nillable? 
+            // However, this if at least allow .aegis.xml files to get control.
+            if (part.getProperty("nillable") == null) {
+                part.setProperty("nillable", Boolean.valueOf(type.isNillable()));
+            }
             if (type.hasMinOccurs()) {
                 long miValue = type.getMinOccurs();
                 if (miValue != 0) {
@@ -552,11 +556,6 @@
     private Type getParameterType(Service s, TypeMapping tm, MessagePartInfo param, int paramtype)
{
         Type type = tm.getType(param.getTypeQName());
 
-        /*
-         * if (type == null && tm.isRegistered(param.getTypeClass())) { type =
-         * tm.getType(param.getTypeClass()); part2type.put(param, type); }
-         */
-
         int offset = 0;
         if (paramtype == OUT_PARAM) {
             offset = 1;
@@ -567,12 +566,18 @@
             OperationInfo op = param.getMessageInfo().getOperation();
 
             Method m = getMethod(s, op);
-            AbstractTypeCreator.TypeClassInfo info;
+            TypeClassInfo info;
             if (paramtype != FAULT_PARAM && m != null) {
                 info = typeCreator.createClassInfo(m, param.getIndex() - offset);
             } else {
                 info = typeCreator.createBasicClassInfo(param.getTypeClass());
             }
+            Boolean nillable = info.getNillable();
+            /* Note that, for types from the mapping, the minOccurs, maxOccurs, and nillable
+             * from the 'info' will be ignored by createTypeForClass below. So we need
+             * to override.
+             */
+
             if (param.getMessageInfo().getOperation().isUnwrapped() && param.getTypeClass().isArray())
{
                 // The service factory expects arrays going into the wrapper to
                 // be
@@ -582,15 +587,32 @@
                 // want the default.
                 param.setProperty("minOccurs", "1");
                 param.setProperty("maxOccurs", "1");
-                param.setProperty("nillable", Boolean.TRUE);
+                if (nillable == null) {
+                    nillable = Boolean.TRUE;
+                }
+                param.setProperty("nillable", nillable);
+            } else {
+                if (nillable != null) {
+                    param.setProperty("nillable", nillable);
+                }
+                /*
+                 * TypeClassInfo uses -1 to mean 'not specified'
+                 */
+                if (info.getMinOccurs() != -1) {
+                    param.setProperty("minOccurs", Long.toString(info.getMinOccurs()));
+                }
+                if (info.getMaxOccurs() != -1) {
+                    param.setProperty("maxOccurs", Long.toString(info.getMaxOccurs()));
+                }
             }
             if (info.getMappedName() != null) {
                 param.setConcreteName(info.getMappedName());
                 param.setName(info.getMappedName());
             }
             type = typeCreator.createTypeForClass(info);
-            // We have to register the type if we want minOccurs and such to
-            // work.
+            
+            //We have to register the type if we want minOccurs and such to
+            // work. (for custom types)
             if (info.nonDefaultAttributes()) {
                 tm.register(type);
             }

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=808508&r1=808507&r2=808508&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:44:13 2009
@@ -135,7 +135,8 @@
             result = type;
         }
 
-        if (newType && !getConfiguration().isDefaultNillable()) {
+        if (newType
+            && !getConfiguration().isDefaultNillable()) {
             result.setNillable(false);
         }
 
@@ -337,11 +338,11 @@
         if (info.nonDefaultAttributes()) {
             localName += "-";
             if (info.getMinOccurs() >= 0) {
-                localName += info.minOccurs;
+                localName += info.getMinOccurs();
             }
             localName += "-";
             if (info.getMaxOccurs() >= 0) {
-                localName += info.maxOccurs;
+                localName += info.getMaxOccurs();
             }
             if (info.isFlat()) {
                 localName += "Flat";
@@ -433,131 +434,4 @@
     public void setConfiguration(TypeCreationOptions tpConfiguration) {
         this.typeConfiguration = tpConfiguration;
     }
-
-    /**
-     * Object to carry information for a type, such as that from an XML mapping file. 
-     */
-    public static class TypeClassInfo {
-        Class typeClass;
-
-        Object[] annotations;
-
-        Object genericType;
-
-        Object keyType;
-        Object valueType;
-        QName mappedName;
-        QName typeName;
-        Class type;
-        String description;
-        long minOccurs = -1;
-        long maxOccurs = -1;
-        boolean flat;
-        
-        public boolean nonDefaultAttributes() {
-            return minOccurs != -1 || maxOccurs != -1 || flat;
-        }
-
-        public String getDescription() {
-            return description;
-        }
-
-        public void setDescription(String description) {
-            this.description = description;
-        }
-
-        public Object[] getAnnotations() {
-            return annotations;
-        }
-
-        public void setAnnotations(Object[] annotations) {
-            this.annotations = annotations;
-        }
-
-        public Object getGenericType() {
-            return genericType;
-        }
-
-        public void setGenericType(Object genericType) {
-            this.genericType = genericType;
-        }
-
-        public Object getKeyType() {
-            return keyType;
-        }
-
-        public void setKeyType(Object keyType) {
-            this.keyType = keyType;
-        }
-
-        public Class getTypeClass() {
-            return typeClass;
-        }
-
-        public void setTypeClass(Class typeClass) {
-            this.typeClass = typeClass;
-        }
-
-        public QName getTypeName() {
-            return typeName;
-        }
-
-        public void setTypeName(QName name) {
-            this.typeName = name;
-        }
-
-        public Class getType() {
-            return type;
-        }
-
-        public void setType(Class type) {
-            this.type = type;
-        }
-
-        public QName getMappedName() {
-            return mappedName;
-        }
-
-        public void setMappedName(QName mappedName) {
-            this.mappedName = mappedName;
-        }
-
-        public long getMaxOccurs() {
-            return maxOccurs;
-        }
-
-        public void setMaxOccurs(long maxOccurs) {
-            this.maxOccurs = maxOccurs;
-        }
-
-        public long getMinOccurs() {
-            return minOccurs;
-        }
-
-        public void setMinOccurs(long minOccurs) {
-            this.minOccurs = minOccurs;
-        }
-
-        public boolean isFlat() {
-            return flat;
-        }
-
-        public void setFlat(boolean flat) {
-            this.flat = flat;
-        }
-
-        @Override
-        public String toString() {
-            return "TypeClassInfo " + getDescription();
-        }
-
-        public Object getValueType() {
-            return valueType;
-        }
-
-        public void setValueType(Object valueType) {
-            this.valueType = valueType;
-        }
-
-    }
 }

Modified: cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeCreator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeCreator.java?rev=808508&r1=808507&r2=808508&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeCreator.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeCreator.java
Thu Aug 27 16:44:13 2009
@@ -22,7 +22,6 @@
 import java.lang.reflect.Method;
 
 import org.apache.cxf.aegis.DatabindingException;
-import org.apache.cxf.aegis.type.AbstractTypeCreator.TypeClassInfo;
 import org.apache.cxf.aegis.type.basic.BeanType;
 import org.apache.cxf.aegis.type.basic.BeanTypeInfo;
 

Modified: cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeCreator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeCreator.java?rev=808508&r1=808507&r2=808508&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeCreator.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeCreator.java
Thu Aug 27 16:44:13 2009
@@ -24,7 +24,6 @@
 
 import javax.xml.namespace.QName;
 
-import org.apache.cxf.aegis.type.AbstractTypeCreator.TypeClassInfo;
 
 /**
  * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>

Modified: cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/XMLTypeCreator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/XMLTypeCreator.java?rev=808508&r1=808507&r2=808508&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/XMLTypeCreator.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/XMLTypeCreator.java
Thu Aug 27 16:44:13 2009
@@ -471,6 +471,11 @@
         if (flat != null) {
             info.setFlat(Boolean.valueOf(flat.toLowerCase()).booleanValue());
         }
+        
+        String nillable = DOMUtils.getAttributeValueEmptyNull(parameter, "nillable");
+        if (nillable != null) {
+            info.setNillable(Boolean.valueOf(nillable.toLowerCase()).booleanValue());
+        }
     }
 
     @Override

Modified: cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java?rev=808508&r1=808507&r2=808508&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java
Thu Aug 27 16:44:13 2009
@@ -29,6 +29,7 @@
 
 import org.apache.cxf.aegis.type.AbstractTypeCreator;
 import org.apache.cxf.aegis.type.Type;
+import org.apache.cxf.aegis.type.TypeClassInfo;
 import org.apache.cxf.aegis.type.basic.BeanType;
 import org.apache.cxf.aegis.util.NamespaceHelper;
 import org.apache.cxf.aegis.util.ServiceUtils;

Modified: cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java?rev=808508&r1=808507&r2=808508&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/AbstractServiceConfiguration.java
Thu Aug 27 16:44:13 2009
@@ -189,17 +189,34 @@
         return null;
     }
     
+    /**
+     * If Aegis is at work, the XML can render a wrapper part non-nillable.
+     * @param mpi part
+     * @return nillability
+     */
     public Boolean isWrapperPartNillable(MessagePartInfo mpi) {
-        return null;
+        return (Boolean)mpi.getProperty("nillable");
     }
+    
     public Boolean isWrapperPartQualified(MessagePartInfo mpi) {
         return null;
     }
     public Long getWrapperPartMaxOccurs(MessagePartInfo mpi) {
-        //return Long.MAX_VALUE for unbounded
+        String miString = (String)mpi.getProperty("maxOccurs");
+        if (miString != null) {
+            if ("unbounded".equals(miString)) {
+                return Long.MAX_VALUE;
+            } else {
+                return Long.valueOf(miString, 10);
+            }
+        }
         return null;
     }
     public Long getWrapperPartMinOccurs(MessagePartInfo mpi) {
+        String miString = (String)mpi.getProperty("minOccurs");
+        if (miString != null) {
+            return Long.valueOf(miString, 10);
+        }
         return null;
     }
 }



Mime
View raw message