You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bi...@apache.org on 2009/08/28 04:35:01 UTC

svn commit: r808736 - in /cxf/trunk: api/src/main/java/org/apache/cxf/endpoint/ common/common/src/main/java/org/apache/cxf/staxutils/ rt/core/src/main/java/org/apache/cxf/test/ rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/ rt/databinding/aeg...

Author: bimargulies
Date: Fri Aug 28 02:34:58 2009
New Revision: 808736

URL: http://svn.apache.org/viewvc?rev=808736&view=rev
Log:
Merge branch 'flat2' into trunk

Added:
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/BeanWithFlatArray.aegis.xml   (with props)
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/BeanWithFlatArray.java   (with props)
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayService.aegis.xml   (with props)
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayService.java   (with props)
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayServiceInterface.aegis.xml   (with props)
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayServiceInterface.java   (with props)
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayTest.java   (with props)
Removed:
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/jdom/JDOMReader.java
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/jdom/JDOMWriter.java
Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/ServiceContractResolverRegistry.java
    cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/DepthXMLStreamReader.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/TestUtilities.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisXMLStreamDataReader.java
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/Context.java
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/XMLStreamDataReader.java
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/XMLStreamDataWriter.java
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/Type.java
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ArrayType.java
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ObjectType.java
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/collection/CollectionType.java
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageWriter.java
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementReader.java
    cxf/trunk/rt/databinding/aegis/src/main/resources/META-INF/cxf/aegis.xsd
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/ReaderTest.java
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/WriterTest.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/ServiceContractResolverRegistry.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/ServiceContractResolverRegistry.java?rev=808736&r1=808735&r2=808736&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/ServiceContractResolverRegistry.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/ServiceContractResolverRegistry.java Fri Aug 28 02:34:58 2009
@@ -29,7 +29,7 @@
 public interface ServiceContractResolverRegistry {
 
     /**
-     * Resolves a service's QName to a URI respresenting the location of a 
+     * Resolves a service's QName to a URI representing the location of a 
      * WSDL contract. The registry method is called by the bus and should use 
      * the <code>getContractLocation</code> methods of the registered contract 
      * resolvers to do the actual resolution.

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/DepthXMLStreamReader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/DepthXMLStreamReader.java?rev=808736&r1=808735&r2=808736&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/DepthXMLStreamReader.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/DepthXMLStreamReader.java Fri Aug 28 02:34:58 2009
@@ -86,7 +86,7 @@
     public String getElementText() throws XMLStreamException {
         String ret = reader.getElementText();
         //workaround bugs in some readers that aren't properly advancing to 
-        //the END_ELEMNT (*cough*jettison*cough*)
+        //the END_ELEMENT (*cough*jettison*cough*)
         while (reader.getEventType() != XMLStreamReader.END_ELEMENT) {
             reader.next();
         }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java?rev=808736&r1=808735&r2=808736&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java Fri Aug 28 02:34:58 2009
@@ -116,8 +116,8 @@
      * @param xpath
      * @throws Exception 
      */
-    public boolean assertValidBoolean(String xpath, Node node) throws Exception {
-        return testUtilities.assertValidBoolean(xpath, node);
+    public void assertValidBoolean(String xpath, Node node) throws Exception {
+        testUtilities.assertValidBoolean(xpath, node);
     }
     /**
      * Assert that the following XPath query selects no nodes.

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/TestUtilities.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/TestUtilities.java?rev=808736&r1=808735&r2=808736&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/TestUtilities.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/TestUtilities.java Fri Aug 28 02:34:58 2009
@@ -153,8 +153,8 @@
      * @param xpath
      * @throws Exception
      */
-    public boolean assertValidBoolean(String xpath, Node node) throws Exception {
-        return XPathAssert.assertValidBoolean(xpath, node, namespaces);
+    public void assertValidBoolean(String xpath, Node node) throws Exception {
+        XPathAssert.assertValidBoolean(xpath, node, namespaces);
     }
 
 

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java?rev=808736&r1=808735&r2=808736&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java Fri Aug 28 02:34:58 2009
@@ -72,7 +72,7 @@
      * 
      * @param xpath
      */
-    public static boolean assertValidBoolean(String xpath, Node node, Map<String, String> namespaces)
+    public static void assertValidBoolean(String xpath, Node node, Map<String, String> namespaces)
         throws Exception {
         if (node == null) {
             throw new NullPointerException("Node cannot be null.");
@@ -84,8 +84,12 @@
             throw new AssertionFailedError("Failed to select any nodes for expression:\n" + xpath
                                            + " from document:\n" + writeNodeToString(node));
         }
-
-        return b.booleanValue();
+        
+        if (!b.booleanValue()) {
+            throw new AssertionFailedError("Boolean XPath assertion evaluated to false:\n"
+                                           + xpath
+                                           + " from document:\n" + writeNodeToString(node));
+        }
     }
 
     private static String writeNodeToString(Node node) {

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisXMLStreamDataReader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisXMLStreamDataReader.java?rev=808736&r1=808735&r2=808736&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisXMLStreamDataReader.java (original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisXMLStreamDataReader.java Fri Aug 28 02:34:58 2009
@@ -20,10 +20,12 @@
 
 import java.util.logging.Logger;
 
+import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamReader;
 import org.apache.cxf.aegis.type.Type;
 import org.apache.cxf.aegis.type.TypeUtil;
+import org.apache.cxf.aegis.type.basic.ArrayType;
 import org.apache.cxf.aegis.xml.stax.ElementReader;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
@@ -54,7 +56,6 @@
         if (reader.getEventType() != XMLStreamConstants.START_ELEMENT) {
             Message message = new Message("STREAM_BAD_POSITION", LOG);
             throw new DatabindingException(message.toString());
-            
         }
     }
 
@@ -81,4 +82,12 @@
 
         return type.readObject(elReader, context);
     }
+
+    public Object readFlatArray(XMLStreamReader input, 
+                                ArrayType arrayType, QName concreteName) throws Exception {
+        setupReaderPosition(input);
+        ElementReader elReader = new ElementReader(input);
+        return arrayType.readObject(elReader, concreteName, context);
+        
+    }
 }

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/Context.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/Context.java?rev=808736&r1=808735&r2=808736&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/Context.java (original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/Context.java Fri Aug 28 02:34:58 2009
@@ -38,6 +38,7 @@
     private Collection<Attachment> attachments;
     private Fault fault;
     private Map<Class<?>, Object> properties;
+    private Map<String, Object> namedProperties;
     
     public Context(AegisContext aegisContext) {
         this.globalContext = aegisContext;
@@ -88,4 +89,13 @@
     public void setProperty(Object value) {
         properties.put(value.getClass(), value);
     }
+    
+    //named properties to solve other problems
+    public void setProperty(String name, Object value) {
+        namedProperties.put(name, value);
+    }
+    
+    public <T> T getProperty(String name, Class<T> type) {
+        return type.cast(namedProperties.get(name));
+    }
 }

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java?rev=808736&r1=808735&r2=808736&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java (original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java Fri Aug 28 02:34:58 2009
@@ -40,6 +40,7 @@
 import org.apache.cxf.aegis.type.TypeCreationOptions;
 import org.apache.cxf.aegis.type.TypeCreator;
 import org.apache.cxf.aegis.type.TypeMapping;
+import org.apache.cxf.aegis.type.basic.ArrayType;
 import org.apache.cxf.aegis.type.mtom.AbstractXOPType;
 import org.apache.cxf.common.WSDLConstants;
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
@@ -68,18 +69,16 @@
 import org.apache.ws.commons.schema.utils.NamespaceMap;
 
 /**
- * CXF databinding object for Aegis. By default, this creates an AegisContext object. To customize
- * the behavior of the binding, an application should create its own AegisContext object and
- * pass it to {@link #setAegisContext(AegisContext)} <i>before</i> any call to {@link #initialize(Service)}.
- * That does not require special arrangements; the service factories do not call {{@link #initialize(Service)}
- * until after the application passes the data binding into the factory.
- * 
- * This class adds root classes to the context based on the SEI and implementation.
+ * CXF databinding object for Aegis. By default, this creates an AegisContext object. To customize the
+ * behavior of the binding, an application should create its own AegisContext object and pass it to
+ * {@link #setAegisContext(AegisContext)} <i>before</i> any call to {@link #initialize(Service)}. That does
+ * not require special arrangements; the service factories do not call {{@link #initialize(Service)} until
+ * after the application passes the data binding into the factory. This class adds root classes to the context
+ * based on the SEI and implementation.
  * 
  * @see org.apache.cxf.aegis.AegisContext
  */
-public class AegisDatabinding
-    extends AbstractDataBinding {
+public class AegisDatabinding extends AbstractDataBinding {
 
     // these are here only for compatibility.
     /**
@@ -94,7 +93,7 @@
      * @deprecated 2.1
      */
     public static final String READ_XSI_TYPE_KEY = "readXsiType";
-    
+
     protected static final int IN_PARAM = 0;
     protected static final int OUT_PARAM = 1;
     protected static final int FAULT_PARAM = 2;
@@ -116,8 +115,8 @@
     }
 
     /**
-     * The Databinding API has initialize(Service). However, this object should
-     * be usable even if that API is never called.
+     * The Databinding API has initialize(Service). However, this object should be usable even if that API is
+     * never called.
      */
     private void ensureInitialized() {
         if (!isInitialized) {
@@ -175,19 +174,22 @@
      * {@inheritDoc}
      */
     public Class<?>[] getSupportedReaderFormats() {
-        return new Class[] {XMLStreamReader.class, Node.class};
+        return new Class[] {
+            XMLStreamReader.class, Node.class
+        };
     }
 
     /**
      * {@inheritDoc}
      */
     public Class<?>[] getSupportedWriterFormats() {
-        return new Class[] {XMLStreamWriter.class, Node.class};
+        return new Class[] {
+            XMLStreamWriter.class, Node.class
+        };
     }
 
     /**
-     * {@inheritDoc}
-     * Set up the data binding for a service.
+     * {@inheritDoc} Set up the data binding for a service.
      */
     public void initialize(Service s) {
 
@@ -245,7 +247,7 @@
             if (overrideTypes != null) {
                 aegisContext.setRootClassNames(overrideTypes);
             }
-            
+
             if (configuration != null) {
                 aegisContext.setTypeCreationOptions(configuration);
             }
@@ -258,8 +260,8 @@
         aegisContext.setMappingNamespaceURI(s.getServiceInfos().get(0).getName().getNamespaceURI());
         aegisContext.initialize();
         this.service = s;
-        s.getInInterceptors().add(new AegisSchemaValidationInInterceptor(getBus(), 
-                                                                         s.getServiceInfos().get(0)));
+        s.getInInterceptors()
+            .add(new AegisSchemaValidationInInterceptor(getBus(), s.getServiceInfos().get(0)));
 
         Set<Type> deps = new HashSet<Type>();
 
@@ -351,8 +353,8 @@
                     part.setElementQName(type.getSchemaType());
                 }
             }
-            
-            // The concept of type.isNillable is questionable: how are types nillable? 
+
+            // 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()));
@@ -441,23 +443,23 @@
             boolean needTypesSchema = false;
 
             for (Map.Entry<String, Set<Type>> entry : tns2Type.entrySet()) {
-                
+
                 String schemaNamespaceUri = entry.getKey();
-                
+
                 if (XmlSchemaConstants.XSD_NAMESPACE_URI.equals(schemaNamespaceUri)) {
                     continue;
                 }
-                
+
                 if (AegisContext.UTILITY_TYPES_SCHEMA_NS.equals(schemaNamespaceUri)) {
                     continue; // we handle this separately.
                 }
-                
+
                 if (AbstractXOPType.XML_MIME_NS.equals(schemaNamespaceUri)) {
                     continue; // similiarly.
                 }
-                
+
                 SchemaInfo schemaInfo = si.addNewSchema(entry.getKey());
-                XmlSchema schema = schemaInfo.getSchema(); 
+                XmlSchema schema = schemaInfo.getSchema();
                 NamespaceMap xmlsNamespaceMap = new NamespaceMap();
 
                 // user-requested prefix mappings.
@@ -466,16 +468,16 @@
                         xmlsNamespaceMap.add(e.getValue(), e.getKey());
                     }
                 }
-                
+
                 // tns: is conventional, and besides we have unit tests that are hardcoded to it.
                 if (!xmlsNamespaceMap.containsKey(WSDLConstants.CONVENTIONAL_TNS_PREFIX)
-                    // if some wants something other than TNS, they get it.
+                // if some wants something other than TNS, they get it.
                     && !xmlsNamespaceMap.containsValue(entry.getKey())) {
                     xmlsNamespaceMap.add(WSDLConstants.CONVENTIONAL_TNS_PREFIX, entry.getKey());
                 }
-                
+
                 // ditto for xsd: instead of just namespace= for the schema schema.
-                if (!xmlsNamespaceMap.containsKey("xsd") 
+                if (!xmlsNamespaceMap.containsKey("xsd")
                     && !xmlsNamespaceMap.containsValue(XmlSchemaConstants.XSD_NAMESPACE_URI)) {
                     xmlsNamespaceMap.add("xsd", XmlSchemaConstants.XSD_NAMESPACE_URI);
                 }
@@ -490,8 +492,8 @@
                         t.writeSchema(schema);
                     } catch (XmlSchemaException ex) {
                         QName name = t.getSchemaType();
-                        String expected = " Schema for namespace '" + name.getNamespaceURI() 
-                            + "' already contains type '" + name.getLocalPart() + "'";
+                        String expected = " Schema for namespace '" + name.getNamespaceURI()
+                                          + "' already contains type '" + name.getLocalPart() + "'";
                         String message = ex.getMessage();
                         if (expected.equals(message)) {
                             continue;
@@ -504,23 +506,23 @@
                 if (schemaImportsXmime(schema)) {
                     needXmimeSchema = true;
                 }
-            
+
                 if (AegisContext.schemaImportsUtilityTypes(schema)) {
                     needTypesSchema = true;
                 }
             }
 
             if (needXmimeSchema) {
-                XmlSchema schema = 
-                    aegisContext.addXmimeSchemaDocument(si.getXmlSchemaCollection().getXmlSchemaCollection());
+                XmlSchema schema = aegisContext.addXmimeSchemaDocument(si.getXmlSchemaCollection()
+                    .getXmlSchemaCollection());
                 SchemaInfo schemaInfo = new SchemaInfo(schema.getTargetNamespace());
                 schemaInfo.setSchema(schema);
                 si.addSchema(schemaInfo);
             }
-            
+
             if (needTypesSchema) {
-                XmlSchema schema = 
-                    aegisContext.addTypesSchemaDocument(si.getXmlSchemaCollection().getXmlSchemaCollection());
+                XmlSchema schema = aegisContext.addTypesSchemaDocument(si.getXmlSchemaCollection()
+                    .getXmlSchemaCollection());
                 SchemaInfo schemaInfo = new SchemaInfo(schema.getTargetNamespace());
                 schemaInfo.setSchema(schema);
                 si.addSchema(schemaInfo);
@@ -529,7 +531,7 @@
             si.getXmlSchemaCollection().addCrossImports();
         }
     }
-    
+
     private boolean schemaImportsXmime(XmlSchema schema) {
         return XmlSchemaUtils.schemaImportsNamespace(schema, AbstractXOPType.XML_MIME_NS);
     }
@@ -565,6 +567,8 @@
 
         TypeCreator typeCreator = tm.getTypeCreator();
         if (type == null) {
+            // Current author doesn't know how type can be non-null here.
+            boolean usingComponentType = false;
             OperationInfo op = param.getMessageInfo().getOperation();
 
             Method m = getMethod(s, op);
@@ -575,18 +579,20 @@
                 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.
+            /*
+             * 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.
              */
+            type = typeCreator.createTypeForClass(info);
 
-            if (param.getMessageInfo().getOperation().isUnwrapped() && param.getTypeClass().isArray()) {
-                // The service factory expects arrays going into the wrapper to
-                // be
-                // mapped to the array component type and will then add
-                // min=0/max=unbounded. That doesn't work for Aegis where we
-                // already created a wrapper ArrayType so we'll let it know we
-                // want the default.
+            // if not writing outer, we don't need anything special.
+            if (param.getMessageInfo().getOperation().isUnwrapped() && param.getTypeClass().isArray()
+                && type.isWriteOuter()) {
+                /*
+                 * The service factory expects arrays going into the wrapper to be mapped to the array
+                 * component type and will then add min=0/max=unbounded. That doesn't work for Aegis where we
+                 * already created a wrapper ArrayType so we'll let it know we want the default.
+                 */
                 param.setProperty("minOccurs", "1");
                 param.setProperty("maxOccurs", "1");
                 if (nillable == null) {
@@ -606,20 +612,29 @@
                 if (info.getMaxOccurs() != -1) {
                     param.setProperty("maxOccurs", Long.toString(info.getMaxOccurs()));
                 }
+                
+                if ((type instanceof ArrayType) && !type.isWriteOuter()) {
+                    param.setProperty("org.apache.cxf.aegis.outerType", type);
+                    ArrayType aType = (ArrayType) type;
+                    type = aType.getComponentType();
+                    usingComponentType = true;
+                }
             }
+
             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. (for custom types)
-            if (info.nonDefaultAttributes()) {
-                tm.register(type);
-            }
-            type.setTypeMapping(tm);
 
+            if (!usingComponentType) {
+                // We have to register the type if we want minOccurs and such to
+                // work. (for custom types). Is this really still true with all the 
+                // param setting above?
+                if (info.nonDefaultAttributes()) {
+                    tm.register(type);
+                }
+                type.setTypeMapping(tm);
+            }
             part2Type.put(param, type);
         }
 
@@ -635,7 +650,7 @@
     public Type getType(MessagePartInfo part) {
         return part2Type.get(part);
     }
-    
+
     public MessagePartInfo getPartFromClass(Class<?> cls) {
         for (Map.Entry<MessagePartInfo, Type> entry : part2Type.entrySet()) {
             if (entry.getValue().getTypeClass() == cls) {
@@ -644,7 +659,7 @@
         }
         return null;
     }
-    
+
     public Type getTypeFromClass(Class<?> cls) {
         for (Type t : part2Type.values()) {
             if (t.getTypeClass() == cls) {

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/XMLStreamDataReader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/XMLStreamDataReader.java?rev=808736&r1=808735&r2=808736&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/XMLStreamDataReader.java (original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/XMLStreamDataReader.java Fri Aug 28 02:34:58 2009
@@ -27,6 +27,7 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.aegis.AegisXMLStreamDataReader;
 import org.apache.cxf.aegis.type.Type;
+import org.apache.cxf.aegis.type.basic.ArrayType;
 import org.apache.cxf.databinding.DataReader;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Attachment;
@@ -41,11 +42,18 @@
         this.databinding = databinding;
         reader = new AegisXMLStreamDataReader(databinding.getAegisContext());
     }
-
+    
     public Object read(MessagePartInfo part, XMLStreamReader input) {
-        Type type = databinding.getType(part);
         try {
-            return reader.read(input, type); 
+            Type type = part.getProperty("org.apache.cxf.aegis.outerType", Type.class);
+            if (type == null) {
+                type = databinding.getType(part);
+                return reader.read(input, type); 
+            } else {
+                ArrayType arrayType = (ArrayType) type;
+                return reader.readFlatArray(input, arrayType, part.getConcreteName());
+            }
+     
         } catch (Exception e) {
             throw new Fault(e);
         }

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/XMLStreamDataWriter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/XMLStreamDataWriter.java?rev=808736&r1=808735&r2=808736&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/XMLStreamDataWriter.java (original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/XMLStreamDataWriter.java Fri Aug 28 02:34:58 2009
@@ -31,6 +31,7 @@
 import org.apache.cxf.aegis.DatabindingException;
 import org.apache.cxf.aegis.type.Type;
 import org.apache.cxf.aegis.type.TypeUtil;
+import org.apache.cxf.aegis.type.basic.ArrayType;
 import org.apache.cxf.aegis.xml.MessageWriter;
 import org.apache.cxf.aegis.xml.stax.ElementWriter;
 import org.apache.cxf.common.i18n.Message;
@@ -74,13 +75,21 @@
         context.setAttachments(attachments);
         type = TypeUtil.getWriteType(databinding.getAegisContext(), obj, type);
         
+        /* 
+         * We arrive here with a 'type' of the inner type if isWriteOuter is null.
+         * However, in that case, the original type is available. 
+         */
+        Type outerType  = null;
+        if (part != null) {
+            outerType = part.getProperty("org.apache.cxf.aegis.outerType", Type.class);
+        }
         try {
             if (obj == null) {
                 if (part.getXmlSchema() instanceof XmlSchemaElement
                     && ((XmlSchemaElement)part.getXmlSchema()).getMinOccurs() == 0) {
                     //skip writing minOccurs=0 stuff if obj is null
                     return;
-                } else if (type.isNillable() && type.isWriteOuter()) {
+                } else if (type.isNillable()) {
                     ElementWriter writer = new ElementWriter(output);
                     MessageWriter w2 = writer.getElementWriter(part.getConcreteName());
                     w2.writeXsiNil();
@@ -89,10 +98,18 @@
                 }
             }
             ElementWriter writer = new ElementWriter(output);
-            MessageWriter w2 = writer.getElementWriter(part != null ? part.getConcreteName() 
-                : type.getSchemaType());
-            type.writeObject(obj, w2, context);
-            w2.close();
+            // outerType is only != null for a flat array.
+            if (outerType == null) {
+                MessageWriter w2 = writer.getElementWriter(part != null ? part.getConcreteName() 
+                    : type.getSchemaType());
+                type.writeObject(obj, w2, context);
+                w2.close();
+            } else {
+                // it has better be an array (!)
+                ArrayType aType = (ArrayType) outerType;
+                // the part has to have a name or we can't do this.
+                aType.writeObject(obj, writer, context, part.getConcreteName());
+            }
         } catch (DatabindingException e) {
             throw new RuntimeException(e);
         }

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/Type.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/Type.java?rev=808736&r1=808735&r2=808736&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/Type.java (original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/Type.java Fri Aug 28 02:34:58 2009
@@ -37,16 +37,12 @@
 public abstract class Type {
 
     protected Class typeClass;
-
     private QName schemaType;
-
     private TypeMapping typeMapping;
-
     private boolean abstrct = true;
-
     private boolean nillable = true;
-
     private boolean writeOuter = true;
+    private boolean flatArray;
 
     public Type() {
     }
@@ -202,6 +198,11 @@
         schemaType = name;
     }
 
+    /**
+     * Defaults to true. False for types that disappear entirely when null,
+     * even when nillable.
+     * @return whether to write xsi:nil for null values.
+     */
     public boolean isWriteOuter() {
         return writeOuter;
     }
@@ -250,4 +251,12 @@
         sb.append("]");
         return sb.toString();
     }
+
+    public boolean isFlatArray() {
+        return flatArray;
+    }
+
+    public void setFlatArray(boolean flatArray) {
+        this.flatArray = flatArray;
+    }
 }

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ArrayType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ArrayType.java?rev=808736&r1=808735&r2=808736&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ArrayType.java (original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ArrayType.java Fri Aug 28 02:34:58 2009
@@ -26,6 +26,7 @@
 import java.util.logging.Logger;
 
 import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
 
 import org.apache.cxf.aegis.Context;
 import org.apache.cxf.aegis.DatabindingException;
@@ -33,6 +34,7 @@
 import org.apache.cxf.aegis.type.TypeUtil;
 import org.apache.cxf.aegis.xml.MessageReader;
 import org.apache.cxf.aegis.xml.MessageWriter;
+import org.apache.cxf.aegis.xml.stax.ElementReader;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.xmlschema.XmlSchemaConstants;
 import org.apache.ws.commons.schema.XmlSchema;
@@ -51,48 +53,67 @@
     private QName componentName;
     private long minOccurs;
     private long maxOccurs = Long.MAX_VALUE;
-    private boolean flat;
 
     public ArrayType() {
     }
-
-    @Override
-    public Object readObject(MessageReader reader, Context context) throws DatabindingException {
+    
+    public Object readObject(MessageReader reader, QName flatElementName, Context context) 
+        throws DatabindingException {
         try {
-            Collection values = readCollection(reader, context);
-
+            Collection values = readCollection(reader, flatElementName, context);
             return makeArray(getComponentType().getTypeClass(), values);
         } catch (IllegalArgumentException e) {
             throw new DatabindingException("Illegal argument.", e);
         }
     }
 
+    /*
+     * This version is not called for the flat case. 
+     */
+    @Override
+    public Object readObject(MessageReader reader, Context context) throws DatabindingException {
+        return readObject(reader, null, context);
+    }
+
     protected Collection<Object> createCollection() {
         return new ArrayList<Object>();
     }
 
-    protected Collection readCollection(MessageReader reader, Context context) throws DatabindingException {
+    /**
+     * Read the elements of an array or array-like item.
+     * @param reader reader to read from.
+     * @param flatElementName if flat, the elements we are looking for. When we see
+     * something else. we stop.
+     * @param context context.
+     * @return a collection of the objects.
+     * @throws DatabindingException
+     */
+    protected Collection readCollection(MessageReader reader, QName flatElementName,
+                                        Context context) throws DatabindingException {
         Collection<Object> values = createCollection();
 
-        while (reader.hasMoreElementReaders()) {
-            MessageReader creader = reader.getNextElementReader();
-            Type compType = TypeUtil.getReadType(creader.getXMLStreamReader(), context.getGlobalContext(),
-                                                 getComponentType());
-
-            if (creader.isXsiNil()) {
-                values.add(null);
-                creader.readToEnd();
-            } else {
-                values.add(compType.readObject(creader, context));
-            }
-
-            // check max occurs
-            int size = values.size();
-            if (size > maxOccurs) {
-                throw new DatabindingException("The number of elements in " + getSchemaType()
-                                               + " exceeds the maximum of " + maxOccurs);
+        /**
+         * If we are 'flat' (writeOuter is false), then we aren't reading children. We're reading starting
+         * from where we are.
+         */
+
+        if (isFlat()) {
+            // the reader does some really confusing things.
+            XMLStreamReader xmlReader = reader.getXMLStreamReader();
+            while (xmlReader.getName().equals(flatElementName)) {
+                Type compType = TypeUtil.getReadType(reader.getXMLStreamReader(),
+                                                     context.getGlobalContext(), getComponentType());
+                // gosh, what about message readers of some other type?
+                ElementReader thisItemReader = new ElementReader(xmlReader);
+                collectOneItem(context, values, thisItemReader, compType);
+            }
+        } else {
+            while (reader.hasMoreElementReaders()) {
+                MessageReader creader = reader.getNextElementReader();
+                Type compType = TypeUtil.getReadType(creader.getXMLStreamReader(),
+                                                     context.getGlobalContext(), getComponentType());
+                collectOneItem(context, values, creader, compType);
             }
-
         }
 
         // check min occurs
@@ -103,6 +124,23 @@
         return values;
     }
 
+    private void collectOneItem(Context context, Collection<Object> values, MessageReader creader,
+                                Type compType) {
+        if (creader.isXsiNil()) {
+            values.add(null);
+            creader.readToEnd();
+        } else {
+            values.add(compType.readObject(creader, context));
+        }
+
+        // check max occurs
+        int size = values.size();
+        if (size > maxOccurs) {
+            throw new DatabindingException("The number of elements in " + getSchemaType()
+                                           + " exceeds the maximum of " + maxOccurs);
+        }
+    }
+
     @SuppressWarnings("unchecked")
     protected Object makeArray(Class arrayType, Collection values) {
         int i;
@@ -160,10 +198,26 @@
         return array == null ? values.toArray((Object[])Array.newInstance(getComponentType().getTypeClass(),
                                                                           values.size())) : array;
     }
+    
+    
 
     @Override
     public void writeObject(Object values, MessageWriter writer, 
                             Context context) throws DatabindingException {
+        writeObject(values, writer, context, null);
+    }
+    
+    
+    /**
+     * Write an array type, using the desired element name in the flattened case.
+     * @param values values to write.
+     * @param writer writer to sent it to.
+     * @param context the aegis context.
+     * @param flatElementName name to use for the element if flat.
+     * @throws DatabindingException
+     */
+    public void writeObject(Object values, MessageWriter writer, 
+                            Context context, QName flatElementName) throws DatabindingException {
         boolean forceXsiWrite = false;
         if (values == null) {
             return;
@@ -184,7 +238,19 @@
             ns = type.getSchemaType().getNamespaceURI();
         }
 
-        String name = type.getSchemaType().getLocalPart();
+        /* 
+         * This is not the right name in the 'flat' case. In the flat case,
+         * we need the element name that would have been attached
+         * one level out.
+         */
+        String name;
+        
+        if (isFlat()) {
+            name = flatElementName.getLocalPart();
+            ns = flatElementName.getNamespaceURI(); // override the namespace.
+        } else {
+            name = type.getSchemaType().getLocalPart();
+        }
 
         Class arrayType = type.getTypeClass();
 
@@ -251,7 +317,7 @@
                               String ns) throws DatabindingException {
         type = TypeUtil.getWriteType(context.getGlobalContext(), value, type);
         MessageWriter cwriter;
-        if (type.isWriteOuter()) {
+        if (!type.isFlatArray()) {
             cwriter = writer.getElementWriter(name, ns);
         } else {
             cwriter = writer;
@@ -263,13 +329,17 @@
             type.writeObject(value, cwriter, context);
         }
 
-        if (type.isWriteOuter()) {
+        if (!type.isFlatArray()) {
             cwriter.close();
         }
     }
 
     @Override
     public void writeSchema(XmlSchema root) {
+
+        if (isFlat()) {
+            return; // there is no extra level of type.
+        }
         if (hasDefinedArray(root)) {
             return;
         }
@@ -286,7 +356,7 @@
         XmlSchemaElement element = new XmlSchemaElement();
         element.setName(componentType.getSchemaType().getLocalPart());
         element.setSchemaTypeName(componentType.getSchemaType());
-      
+
         seq.getItems().add(element);
 
         if (componentType.isNillable()) {
@@ -386,12 +456,12 @@
     }
 
     public boolean isFlat() {
-        return flat;
+        return isFlatArray();
     }
 
     public void setFlat(boolean flat) {
         setWriteOuter(!flat);
-        this.flat = flat;
+        setFlatArray(flat);
     }
 
     @Override

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java?rev=808736&r1=808735&r2=808736&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java (original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java Fri Aug 28 02:34:58 2009
@@ -158,7 +158,13 @@
 
                 if (type != null) {
                     if (!childReader.isXsiNil()) {
-                        Object writeObj = type.readObject(childReader, context);
+                        Object writeObj;
+                        if (type.isFlatArray()) {
+                            ArrayType aType = (ArrayType) type;
+                            writeObj = aType.readObject(childReader, name, context);
+                        } else {
+                            writeObj = type.readObject(childReader, context);
+                        }
 
                         writeProperty(name, target, writeObj, clazz, propertyTypeInfo);
                     } else {
@@ -391,20 +397,21 @@
     }
 
     protected void writeElement(QName name, Object value, Type type, MessageWriter writer, Context context) {
-        MessageWriter cwriter = getWriter(writer, name, type);
-
-        type.writeObject(value, cwriter, context);
 
-        cwriter.close();
+        if (!type.isFlatArray()) {
+            MessageWriter cwriter = null;
+            cwriter = getWriter(writer, name, type);
+            type.writeObject(value, cwriter, context);
+            cwriter.close();
+        } else {
+            ArrayType arrayType = (ArrayType)type;
+            arrayType.writeObject(value, writer, context, name);
+        }
     }
 
     private MessageWriter getWriter(MessageWriter writer, QName name, Type type) {
         MessageWriter cwriter;
-        if (type.isAbstract()) {
-            cwriter = writer.getElementWriter(name);
-        } else {
-            cwriter = writer.getElementWriter(name);
-        }
+        cwriter = writer.getElementWriter(name);
         return cwriter;
     }
 
@@ -709,14 +716,24 @@
             sequence.getItems().add(element);
 
             Type type = getType(inf, name);
-            if (AbstractTypeCreator.
-                HTTP_CXF_APACHE_ORG_ARRAYS.equals(type.getSchemaType().getNamespaceURI())) {
-                XmlSchemaUtils.addImportIfNeeded(root, AbstractTypeCreator.HTTP_CXF_APACHE_ORG_ARRAYS);
+            if (type.isFlatArray()) {
+                // ok, we need some tricks here
+                element.setMinOccurs(type.getMinOccurs());
+                element.setMaxOccurs(type.getMaxOccurs());
+                // for now, assume ArrayType. Look at lists or more general solutions later.
+                ArrayType aType = (ArrayType)type;
+                type = aType.getComponentType();
+                element.setNillable(type.isNillable());
+            } else {
+                if (AbstractTypeCreator.
+                    HTTP_CXF_APACHE_ORG_ARRAYS.equals(type.getSchemaType().getNamespaceURI())) {
+                    XmlSchemaUtils.addImportIfNeeded(root, AbstractTypeCreator.HTTP_CXF_APACHE_ORG_ARRAYS);
+                }
             }
-
             writeTypeReference(name, element, type, root);
             needXmime |= type.usesXmime();
             needUtilityTypes |= type.usesUtilityTypes();
+
         }
 
         if (needXmime) {

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ObjectType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ObjectType.java?rev=808736&r1=808735&r2=808736&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ObjectType.java (original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ObjectType.java Fri Aug 28 02:34:58 2009
@@ -262,26 +262,6 @@
     }
 
     @Override
-    public boolean isAbstract() {
-        return super.isAbstract();
-    }
-
-    @Override
-    public boolean isNillable() {
-        return super.isNillable();
-    }
-
-    @Override
-    public boolean isWriteOuter() {
-        return super.isWriteOuter();
-    }
-
-    @Override
-    public void setNillable(boolean nillable) {
-        super.setNillable(nillable);
-    }
-
-    @Override
     public void writeSchema(XmlSchema root) {
         if (serializedWhenUnknown) {
             XmlSchemaSimpleType simple = new XmlSchemaSimpleType(root);

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/collection/CollectionType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/collection/CollectionType.java?rev=808736&r1=808735&r2=808736&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/collection/CollectionType.java (original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/collection/CollectionType.java Fri Aug 28 02:34:58 2009
@@ -49,7 +49,7 @@
     @Override
     public Object readObject(MessageReader reader, Context context) throws DatabindingException {
         try {
-            return readCollection(reader, context);
+            return readCollection(reader, null, context);
         } catch (IllegalArgumentException e) {
             throw new DatabindingException("Illegal argument.", e);
         }
@@ -61,7 +61,7 @@
         Collection values = null;
         
         /*
-         * getTypeClass returns the type of the object. These ifs asked if the proposed
+         * getTypeClass returns the type of the object. These 'if's asked if the proposed
          * type can be assigned to the object, not the other way around. Thus List before
          * Vector and Set before SortedSet.
          */

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageWriter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageWriter.java?rev=808736&r1=808735&r2=808736&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageWriter.java (original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageWriter.java Fri Aug 28 02:34:58 2009
@@ -31,11 +31,6 @@
     
     private boolean xsiTypeWritten;
     
-    /**
-     * Create a LiteralWriter but without writing an element name.
-     * 
-     * @param writer
-     */
     public AbstractMessageWriter() {
     }
 

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementReader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementReader.java?rev=808736&r1=808735&r2=808736&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementReader.java (original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementReader.java Fri Aug 28 02:34:58 2009
@@ -43,23 +43,14 @@
     private static final Pattern QNAME_PATTERN = Pattern.compile("([^:]+):([^:]+)");
 
     private DepthXMLStreamReader root;
-
     private String value;
-
     private String localName;
-
     private QName name;
-
     private QName xsiType;
-
     private boolean hasCheckedChildren;
-
     private boolean hasChildren;
-
     private String namespace;
-
     private int depth;
-
     private int currentAttribute;
 
     /**
@@ -118,9 +109,6 @@
         }
     }
 
-    /**
-     * @see org.codehaus.xfire.aegis.MessageReader#getValue()
-     */
     public String getValue() {
         if (value == null) {
             try {

Modified: cxf/trunk/rt/databinding/aegis/src/main/resources/META-INF/cxf/aegis.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/resources/META-INF/cxf/aegis.xsd?rev=808736&r1=808735&r2=808736&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/resources/META-INF/cxf/aegis.xsd (original)
+++ cxf/trunk/rt/databinding/aegis/src/main/resources/META-INF/cxf/aegis.xsd Fri Aug 28 02:34:58 2009
@@ -49,6 +49,7 @@
       <xsd:element name="parameter" type="parameterType" />
     </xsd:choice>
     <xsd:attribute name="name" type="xsd:string" />
+    <xsd:attribute name="ignore" type="xsd:boolean" />
   </xsd:complexType>
 
   <xsd:complexType name="return-typeType">
@@ -72,7 +73,7 @@
     <xsd:attribute name="typeName" type="xsd:string" />
     <xsd:attribute name="mappedName" type="xsd:string" />
     <xsd:attribute name="nillable" type="xsd:boolean" />
-    <xsd:attribute name="flag" type="xsd:boolean" />
+    <xsd:attribute name="flat" type="xsd:boolean" />
     <xsd:attribute name="ignore" type="xsd:boolean" />
     <xsd:attribute name="componentType" type="xsd:string" />
     <xsd:attribute name="keyType" type="xsd:string" />

Added: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/BeanWithFlatArray.aegis.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/BeanWithFlatArray.aegis.xml?rev=808736&view=auto
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/BeanWithFlatArray.aegis.xml (added)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/BeanWithFlatArray.aegis.xml Fri Aug 28 02:34:58 2009
@@ -0,0 +1,23 @@
+<!-- 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * -->
+<mappings>
+	<mapping>
+		<property name="values" flat='true' nillable='false' minOccurs='1' />
+	</mapping>
+</mappings> 
\ No newline at end of file

Propchange: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/BeanWithFlatArray.aegis.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/BeanWithFlatArray.aegis.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/BeanWithFlatArray.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/BeanWithFlatArray.java?rev=808736&view=auto
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/BeanWithFlatArray.java (added)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/BeanWithFlatArray.java Fri Aug 28 02:34:58 2009
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.aegis.type.array;
+
+/**
+ * Test bean for flat='true'
+ */
+public class BeanWithFlatArray {
+    int[] values;
+
+    public int[] getValues() {
+        return values;
+    }
+
+    public void setValues(int[] values) {
+        this.values = values;
+    }
+
+}

Propchange: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/BeanWithFlatArray.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayService.aegis.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayService.aegis.xml?rev=808736&view=auto
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayService.aegis.xml (added)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayService.aegis.xml Fri Aug 28 02:34:58 2009
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<mappings>
+    <mapping name="FlatArrayService">
+        <method name="submitStringArray">
+            <parameter index="0" minOccurs='2' maxOccurs='50' nillable='false' flat='true' />
+        </method>
+         <method name="getStringArrayValue">
+            <return-type flat='true' />
+        </method>
+    </mapping>
+</mappings>

Propchange: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayService.aegis.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayService.aegis.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayService.java?rev=808736&view=auto
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayService.java (added)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayService.java Fri Aug 28 02:34:58 2009
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.aegis.type.array;
+
+public class FlatArrayService implements FlatArrayServiceInterface {
+    
+    String[] stringArrayValue;
+    BeanWithFlatArray beanWithFlatArrayValue;
+
+    public FlatArrayService() {
+    }
+    
+    /** {@inheritDoc}*/
+    public String[] getStringArrayValue() {
+        return new String[] {"bleh", "bleh"};
+    }
+
+    /** {@inheritDoc}*/
+    public void submitStringArray(String[] array) {
+        stringArrayValue = array;
+    }
+    
+    /** {@inheritDoc}*/
+    public void takeBeanWithFlatArray(BeanWithFlatArray bwfa) {
+        beanWithFlatArrayValue = bwfa;
+    }
+}

Propchange: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayServiceInterface.aegis.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayServiceInterface.aegis.xml?rev=808736&view=auto
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayServiceInterface.aegis.xml (added)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayServiceInterface.aegis.xml Fri Aug 28 02:34:58 2009
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<mappings>
+    <mapping name="FlatArrayService">
+        <method name="submitStringArray">
+            <parameter index="0" mappedName='array' minOccurs='2' maxOccurs='50' nillable='false' flat='true' />
+        </method>
+        <method name="takeBeanWithFlatArray">
+        	<parameter index="0" mappedName="bwfa"/>
+        </method>
+         <method name="getStringArrayValue">
+            <return-type flat='true' />
+        </method>
+    </mapping>
+</mappings>

Propchange: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayServiceInterface.aegis.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayServiceInterface.aegis.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayServiceInterface.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayServiceInterface.java?rev=808736&view=auto
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayServiceInterface.java (added)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayServiceInterface.java Fri Aug 28 02:34:58 2009
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.aegis.type.array;
+
+public interface FlatArrayServiceInterface {
+
+    String[] getStringArrayValue();
+
+    void submitStringArray(String[] array);
+
+    void takeBeanWithFlatArray(BeanWithFlatArray bwfa);
+
+}

Propchange: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayServiceInterface.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayTest.java?rev=808736&view=auto
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayTest.java (added)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayTest.java Fri Aug 28 02:34:58 2009
@@ -0,0 +1,114 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.aegis.type.array;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import org.apache.cxf.aegis.AbstractAegisTest;
+import org.apache.cxf.aegis.databinding.AegisDatabinding;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.frontend.ClientProxyFactoryBean;
+import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class FlatArrayTest extends AbstractAegisTest {
+
+    private static final int[] INT_ARRAY = new int[] {4, 6, 12};
+    private static final String[] STRING_ARRAY = {
+        "fillo", "dough"
+    };
+    private Document arrayWsdlDoc;
+    private FlatArrayService service;
+
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+        service = new FlatArrayService();
+
+        ServerFactoryBean sf = new ServerFactoryBean();
+        // use full parameter names.
+        sf.setServiceClass(FlatArrayServiceInterface.class);
+        sf.setServiceBean(service);
+        sf.setAddress("local://FlatArray");
+        sf.setDataBinding(new AegisDatabinding());
+        Server s = sf.create();
+        s.getEndpoint().getInInterceptors().add(new LoggingInInterceptor());
+
+        arrayWsdlDoc = getWSDLDocument("FlatArrayServiceInterface");
+    }
+
+    @Test
+    public void testXmlConfigurationOfParameterTypeSchema() throws Exception {
+        NodeList typeList = assertValid(
+                                        "/wsdl:definitions/wsdl:types"
+                                            + "/xsd:schema"
+                                            + "[@targetNamespace='http://array.type.aegis.cxf.apache.org/']"
+                                            + "/xsd:complexType[@name=\"submitStringArray\"]"
+                                            + "/xsd:sequence/xsd:element" + "[@name='array']", arrayWsdlDoc);
+        Element typeElement = (Element)typeList.item(0);
+        String nillableValue = typeElement.getAttribute("nillable");
+        assertTrue(nillableValue == null || "".equals(nillableValue) || "false".equals("nillableValue"));
+        String typeString = typeElement.getAttribute("type");
+        assertEquals("xsd:string", typeString); // no ArrayOf
+
+        typeList = assertValid("/wsdl:definitions/wsdl:types"
+                               + "/xsd:schema[@targetNamespace='http://array.type.aegis.cxf.apache.org']"
+                               + "/xsd:complexType[@name='BeanWithFlatArray']"
+                               + "/xsd:sequence/xsd:element[@name='values']", arrayWsdlDoc);
+        typeElement = (Element)typeList.item(0);
+        assertValidBoolean("@type='xsd:int'", typeElement);
+    }
+
+    @Test
+    public void testDataMovementPart() throws Exception {
+        ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
+        proxyFac.setDataBinding(new AegisDatabinding());
+        proxyFac.setAddress("local://FlatArray");
+        proxyFac.setServiceClass(FlatArrayServiceInterface.class);
+        proxyFac.setBus(getBus());
+
+        Object proxyObj = proxyFac.create();
+        FlatArrayServiceInterface client = (FlatArrayServiceInterface)proxyObj;
+        client.submitStringArray(STRING_ARRAY);
+        assertArrayEquals(STRING_ARRAY, service.stringArrayValue);
+    }
+
+    @Test
+    public void testDataMovementBean() throws Exception {
+        ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
+        proxyFac.setDataBinding(new AegisDatabinding());
+        proxyFac.setAddress("local://FlatArray");
+        proxyFac.setServiceClass(FlatArrayServiceInterface.class);
+        proxyFac.setBus(getBus());
+
+        Object proxyObj = proxyFac.create();
+        FlatArrayServiceInterface client = (FlatArrayServiceInterface)proxyObj;
+        BeanWithFlatArray bwfa = new BeanWithFlatArray();
+        bwfa.setValues(INT_ARRAY);
+        client.takeBeanWithFlatArray(bwfa);
+        assertArrayEquals(INT_ARRAY, service.beanWithFlatArrayValue.getValues());
+    }
+
+}

Propchange: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/FlatArrayTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/ReaderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/ReaderTest.java?rev=808736&r1=808735&r2=808736&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/ReaderTest.java (original)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/ReaderTest.java Fri Aug 28 02:34:58 2009
@@ -22,13 +22,10 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
-import org.apache.cxf.aegis.util.jdom.StaxBuilder;
 import org.apache.cxf.aegis.xml.MessageReader;
-import org.apache.cxf.aegis.xml.jdom.JDOMReader;
 import org.apache.cxf.binding.soap.Soap11;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.test.AbstractCXFTest;
-import org.jdom.Document;
 import org.junit.Test;
 
 /**
@@ -61,14 +58,6 @@
         return new ElementReader(reader);
     }
 
-    @Test
-    public void testJDOMReader() throws Exception {
-        StaxBuilder builder = new StaxBuilder();
-        Document doc = builder.build(getResourceAsReader("bean11.xml"));
-
-        testReading(new JDOMReader(doc.getRootElement()));
-    }
-
     public void testReading(MessageReader reader) {
         assertTrue(reader.getLocalName().equals("Envelope"));
 

Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/WriterTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/WriterTest.java?rev=808736&r1=808735&r2=808736&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/WriterTest.java (original)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/xml/stax/WriterTest.java Fri Aug 28 02:34:58 2009
@@ -24,10 +24,8 @@
 
 import org.apache.cxf.aegis.util.jdom.StaxBuilder;
 import org.apache.cxf.aegis.xml.MessageWriter;
-import org.apache.cxf.aegis.xml.jdom.JDOMWriter;
 import org.apache.cxf.test.AbstractCXFTest;
 import org.jdom.Document;
-import org.jdom.Element;
 import org.jdom.output.DOMOutputter;
 import org.junit.After;
 import org.junit.Before;
@@ -71,15 +69,6 @@
         testWrite(doc);
     }
 
-    @Test
-    public void testJDOM() throws Exception {
-        Document doc = new Document(new Element("root", "urn:test"));
-
-        write(new JDOMWriter(doc.getRootElement()));
-
-        testWrite(doc);
-    }
-
     public void write(MessageWriter writer) {
         MessageWriter nons = writer.getElementWriter("nons");
         nons.writeValue("nons");