cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r632332 - in /incubator/cxf/trunk/rt/databinding/aegis/src: main/java/org/apache/cxf/aegis/ main/java/org/apache/cxf/aegis/databinding/ main/java/org/apache/cxf/aegis/type/ test/java/org/apache/cxf/aegis/type/array/ test/java/org/apache/cxf...
Date Fri, 29 Feb 2008 14:37:03 GMT
Author: bimargulies
Date: Fri Feb 29 06:37:01 2008
New Revision: 632332

URL: http://svn.apache.org/viewvc?rev=632332&view=rev
Log:
Rename the Configuration class in Aegis to TypeCreationOptions for clarity. Add Javadoc here
and 
there.

Added:
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeCreationOptions.java
  (with props)
Removed:
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisServiceFactoryBean.java
Modified:
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/Configuration.java
    incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeCreator.java
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/DuplicateArrayTest.java
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest.java
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/ConfigurationTest.java
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbXmlParamTypeTest.java
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/MapTest.java
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XmlParamTypeTest.java

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java?rev=632332&r1=632331&r2=632332&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java
(original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/AegisContext.java
Fri Feb 29 06:37:01 2008
@@ -28,10 +28,10 @@
 import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.cxf.aegis.type.AbstractTypeCreator;
-import org.apache.cxf.aegis.type.Configuration;
 import org.apache.cxf.aegis.type.DefaultTypeCreator;
 import org.apache.cxf.aegis.type.DefaultTypeMapping;
 import org.apache.cxf.aegis.type.Type;
+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.TypeUtil;
@@ -45,13 +45,15 @@
  * The Aegis Databinding context object. This object coordinates the data binding process:
reading
  * and writing XML.
  * 
- * By default, this object will use the DefaultTypeMapping registry and set up two type mappings:
- * the default set, plus an empty one that will be used for classes mapped here. Applications
- * may replace the type mapping registry and/or the mappings, though there are currently
no examples
- * that show how to do this or how it would be useful.
+ * By default, this object sets up a default set of type mappings. 
+ * This consists of two DefaultTypeMapping objects. The first is empty
+ * and has the Default, Java5, and XML TypeCreator classes configured. The second contains
the
+ * standard mappings of the stock types. If a type can't be mapped in either, then the creators

+ * create a mapping and store it in the first one.
  * 
- * This class has no API that maps from a Class or QName to a Type or visa versa. Our goal
is to allow
- * Aegis-sans-CXF, but the marshal/unmarshal-level APIs aren't sorted out yet.
+ * The application can control some parameters of the type creators by creating a TypeCreationOptions
+ * object and setting properties. The application can add custom mappings to the type mapping,
or 
+ * even use its own classes for the TypeMapping or TypeCreator objecrs.
  * 
  * At the level of the data binding, the 'root elements' are defined by the WSDL message
parts.
  * Additional classes that participate are termed 'override' classes.
@@ -61,11 +63,13 @@
  * root elements) or have its own mapping from elements to classes, and pass the 
  * resulting Class objects to the readers.
  * 
- * At this level, the initial set of classes are just the initial set of classes.
- * If the application leaves this list empty, and reads, then no .aegis.xml files 
- * are used unless the application feeds in a Class<T> for the root of a 
+ * At this level, the application must specify the initial set of classes to make 
+ * make use of untyped collections or .aegis.xml files.
+ * 
+ * If the application leaves this list empty, and reads XML messages, then no .aegis.xml
files 
+ * are used unless the application has specified a Class<T> for the root of
a 
  * particular item read. Specifically, if the application just leaves it to Aegis to
- * map an xsi:type spec to a class, Aegis can't know that some arbitrary class in
+ * map an element tagged with an xsi:type to a class, Aegis can't know that some arbitrary
class in
  * some arbitrary package is mapped to a particular schema type by QName in a
  * mapping XML file. 
  * 
@@ -81,7 +85,7 @@
     private TypeMapping typeMapping;
     private Set<Type> rootTypes;
     private Map<Class<?>, String> beanImplementationMap;
-    private Configuration configuration;
+    private TypeCreationOptions configuration;
     private boolean mtomEnabled;
     private boolean mtomUseXmime;
     // this URI goes into the type map.
@@ -129,7 +133,7 @@
         // The use of the XSD URI in the mapping is, MAGIC. 
         // allow spring config of an alternative mapping.
         if (configuration == null) {
-            configuration = new Configuration();
+            configuration = new TypeCreationOptions();
         }
         if (typeMapping == null) {
             boolean defaultNillable = configuration.isDefaultNillable();
@@ -258,17 +262,36 @@
     /** 
      * Return the type mapping configuration associated with this context.
      * @return Returns the configuration.
+     * @deprecated 2.1
      */
-    public Configuration getConfiguration() {
+    public TypeCreationOptions getConfiguration() {
+        return configuration;
+    }
+
+    /** 
+     * Return the type mapping configuration associated with this context.
+     * @return Returns the configuration.
+     */
+    public TypeCreationOptions getTypeCreationOptions() {
         return configuration;
     }
 
     /**
      * Set the configuration object. The configuration specifies default
+     * type mapping behaviors. 
+     * @param configuration The configuration to set.
+     * @deprecated 2.1
+     */
+    public void setConfiguration(TypeCreationOptions newConfiguration) {
+        this.configuration = newConfiguration;
+    }
+
+    /**
+     * Set the configuration object. The configuration specifies default
      * type mapping behaviors.
      * @param configuration The configuration to set.
      */
-    public void setConfiguration(Configuration newConfiguration) {
+    public void setTypeCreationOptions(TypeCreationOptions newConfiguration) {
         this.configuration = newConfiguration;
     }
 
@@ -292,7 +315,7 @@
     /**
      * Controls the use of xsi:type attributes when reading objects. By default,
      * xsi:type reading is enabled. When disabled, Aegis will only map for objects
-     * in the type mapping. 
+     * that the application manually maps in the type mapping. 
      * @param flag
      */
     public void setReadXsiTypes(boolean flag) {
@@ -323,6 +346,13 @@
         return rootTypes;
     }
     
+    
+    /** 
+     * This property provides support for interfaces. If there is a mapping from an interface's
Class<T>
+     * to a string containing a class name, Aegis will create proxy objects of that class
name.
+     * @see org.apache.cxf.aegis.type.basic.BeanType
+     * @return
+     */
     public Map<Class<?>, String> getBeanImplementationMap() {
         return beanImplementationMap;
     }
@@ -335,6 +365,10 @@
         return rootClasses;
     }
 
+    /**
+     * The list of initial classes.
+     * @param rootClasses
+     */
     public void setRootClasses(Set<Class<?>> rootClasses) {
         this.rootClasses = rootClasses;
     }
@@ -352,7 +386,7 @@
     }
 
     /**
-     * Is the schema for MTOM types xmime:base64Binary instead of xsd:base64Binary?
+     * Should this service use schema for MTOM types xmime:base64Binary instead of xsd:base64Binary?
      * @return
      */
     public boolean isMtomUseXmime() {

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java?rev=632332&r1=632331&r2=632332&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
(original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
Fri Feb 29 06:37:01 2008
@@ -40,8 +40,8 @@
 import org.apache.cxf.aegis.AegisContext;
 import org.apache.cxf.aegis.DatabindingException;
 import org.apache.cxf.aegis.type.AbstractTypeCreator.TypeClassInfo;
-import org.apache.cxf.aegis.type.Configuration;
 import org.apache.cxf.aegis.type.Type;
+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.mtom.AbstractXOPType;
@@ -78,10 +78,19 @@
 import org.jdom.output.DOMOutputter;
 
 /**
- * CXF databinding object for Aegis. 
+ * 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.
     /**
      * @deprecated 2.1
@@ -95,11 +104,11 @@
      * @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;
-    
+
     private static final Logger LOG = LogUtils.getL7dLogger(AegisDatabinding.class);
     private static org.w3c.dom.Document xmimeSchemaDocument;
 
@@ -108,7 +117,7 @@
     private Service service;
     private boolean isInitialized;
     private Set<String> overrideTypes;
-    private Configuration configuration;
+    private TypeCreationOptions configuration;
     private boolean mtomEnabled;
     private boolean mtomUseXmime;
     private JDOMXPath importXmimeXpath;
@@ -119,7 +128,7 @@
         // we have this also in AbstractXOPType. There has to be a better way.
         importXmimeXpath = AbstractXOPType.getXmimeXpathImport();
     }
-    
+
     private boolean schemaImportsXmime(Element schemaElement) {
         try {
             return importXmimeXpath.selectSingleNode(schemaElement) != null;
@@ -127,7 +136,7 @@
             throw new RuntimeException(e);
         }
     }
-    
+
     private void ensureXmimeSchemaDocument() {
         if (xmimeSchemaDocument != null) {
             return;
@@ -142,10 +151,10 @@
             throw new RuntimeException(e);
         }
     }
-    
+
     /**
-     * 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) {
@@ -155,7 +164,7 @@
                     aegisContext.setRootClassNames(overrideTypes);
                 }
                 if (configuration != null) {
-                    aegisContext.setConfiguration(configuration);
+                    aegisContext.setTypeCreationOptions(configuration);
                 }
                 if (mtomEnabled) {
                     aegisContext.setMtomEnabled(true);
@@ -168,7 +177,7 @@
             isInitialized = true;
         }
     }
-    
+
     /**
      * {@inheritDoc}
      */
@@ -176,9 +185,9 @@
     public <T> DataReader<T> createReader(Class<T> cls) {
         ensureInitialized();
         if (cls.equals(XMLStreamReader.class)) {
-            return (DataReader<T>) new XMLStreamDataReader(this);
+            return (DataReader<T>)new XMLStreamDataReader(this);
         } else if (cls.equals(Node.class)) {
-            return (DataReader<T>) new ElementDataReader(this);
+            return (DataReader<T>)new ElementDataReader(this);
         } else {
             throw new UnsupportedOperationException();
         }
@@ -193,7 +202,7 @@
         if (cls.equals(XMLStreamWriter.class)) {
             return (DataWriter<T>)new XMLStreamDataWriter(this);
         } else if (cls.equals(Node.class)) {
-            return (DataWriter<T>) new ElementDataWriter(this);
+            return (DataWriter<T>)new ElementDataWriter(this);
         } else {
             throw new UnsupportedOperationException();
         }
@@ -215,9 +224,10 @@
 
     /**
      * {@inheritDoc}
+     * Set up the data binding for a service.
      */
     public void initialize(Service s) {
-        
+
         // We want to support some compatibility configuration properties.
         if (aegisContext == null) {
             aegisContext = new AegisContext();
@@ -226,31 +236,31 @@
             if ("false".equals(val) || Boolean.FALSE.equals(val)) {
                 aegisContext.setReadXsiTypes(false);
             }
-            
+
             val = s.get(WRITE_XSI_TYPE_KEY);
             if ("true".equals(val) || Boolean.TRUE.equals(val)) {
                 aegisContext.setWriteXsiTypes(true);
             }
-            
+
             val = s.get(OVERRIDE_TYPES_KEY);
             if (val != null) {
-                Collection nameCollection = (Collection) val;
+                Collection nameCollection = (Collection)val;
                 Collection<String> typeNames = CastUtils.cast(nameCollection, String.class);
                 if (overrideTypes == null) {
                     overrideTypes = new HashSet<String>();
                 }
                 overrideTypes.addAll(typeNames);
             }
-            
+
             val = s.get("mtom-enabled");
             if ("true".equals(val) || Boolean.TRUE.equals(val) || mtomEnabled) {
                 aegisContext.setMtomEnabled(true);
             }
-            
+
             if (mtomUseXmime) {
                 aegisContext.setMtomUseXmime(true);
             }
-            
+
             Map<Class<?>, String> implMap = new HashMap<Class<?>, String>();
             // now for a really annoying case, the .implementation objects.
             for (String key : s.keySet()) {
@@ -273,25 +283,25 @@
                 aegisContext.setRootClassNames(overrideTypes);
             }
             if (configuration != null) {
-                aegisContext.setConfiguration(configuration);
+                aegisContext.setTypeCreationOptions(configuration);
             }
-            
+
             if (implMap.size() > 0) {
                 aegisContext.setBeanImplementationMap(implMap);
             }
         }
-        
+
         aegisContext.setMappingNamespaceURI(s.getServiceInfos().get(0).getName().getNamespaceURI());
         aegisContext.initialize();
         this.service = s;
-        
+
         Set<Type> deps = new HashSet<Type>();
 
         for (ServiceInfo info : s.getServiceInfos()) {
             for (OperationInfo opInfo : info.getInterface().getOperations()) {
                 if (opInfo.isUnwrappedCapable()) {
-                    initializeOperation(s, aegisContext.getTypeMapping(), 
-                                        opInfo.getUnwrappedOperation(), deps);
+                    initializeOperation(s, aegisContext.getTypeMapping(), opInfo.getUnwrappedOperation(),
+                                        deps);
                 } else {
                     initializeOperation(s, aegisContext.getTypeMapping(), opInfo, deps);
                 }
@@ -321,8 +331,7 @@
         }
     }
 
-    private void initializeOperation(Service s, TypeMapping serviceTM, OperationInfo opInfo,
-                                     Set<Type> deps) {
+    private void initializeOperation(Service s, TypeMapping serviceTM, OperationInfo opInfo,
Set<Type> deps) {
         try {
             initializeMessage(s, serviceTM, opInfo.getInput(), IN_PARAM, deps);
 
@@ -339,6 +348,7 @@
             throw e;
         }
     }
+
     private void initializeOperationTypes(ServiceInfo s, OperationInfo opInfo) {
         try {
             initializeMessageTypes(s, opInfo.getInput(), IN_PARAM);
@@ -357,8 +367,7 @@
         }
     }
 
-    protected void initializeMessage(Service s, TypeMapping serviceTM,
-                                     AbstractMessageContainer container, 
+    protected void initializeMessage(Service s, TypeMapping serviceTM, AbstractMessageContainer
container,
                                      int partType, Set<Type> deps) {
         for (Iterator itr = container.getMessageParts().iterator(); itr.hasNext();) {
             MessagePartInfo part = (MessagePartInfo)itr.next();
@@ -366,7 +375,7 @@
             Type type = getParameterType(s, serviceTM, part, partType);
 
             if (part.getXmlSchema() == null) {
-                //schema hasn't been filled in yet
+                // schema hasn't been filled in yet
                 if (type.isAbstract()) {
                     part.setTypeQName(type.getSchemaType());
                 } else {
@@ -383,9 +392,7 @@
         }
     }
 
-    protected void initializeMessageTypes(ServiceInfo s,
-                                     AbstractMessageContainer container, 
-                                     int partType) {
+    protected void initializeMessageTypes(ServiceInfo s, AbstractMessageContainer container,
int partType) {
         SchemaCollection col = s.getXmlSchemaCollection();
         for (Iterator itr = container.getMessageParts().iterator(); itr.hasNext();) {
             MessagePartInfo part = (MessagePartInfo)itr.next();
@@ -400,6 +407,7 @@
             }
         }
     }
+
     private void addDependencies(Set<Type> deps, Type type) {
         Set<Type> typeDeps = type.getDependencies();
         if (typeDeps != null) {
@@ -424,7 +432,7 @@
             }
             types.add(t);
         }
-        
+
         for (ServiceInfo si : s.getServiceInfos()) {
             SchemaCollection col = si.getXmlSchemaCollection();
             if (col.getXmlSchemas().length > 1) {
@@ -435,30 +443,32 @@
 
         Map<String, String> namespaceMap = getDeclaredNamespaceMappings();
         boolean needXmimeSchema = false;
-        
+
         for (Map.Entry<String, Set<Type>> entry : tns2Type.entrySet()) {
             String xsdPrefix = SOAPConstants.XSD_PREFIX;
             if (namespaceMap != null && namespaceMap.containsKey(SOAPConstants.XSD))
{
                 xsdPrefix = namespaceMap.get(SOAPConstants.XSD);
             }
-            
+
             Element e = new Element("schema", xsdPrefix, SOAPConstants.XSD);
 
             e.setAttribute(new Attribute(WSDLConstants.ATTR_TNS, entry.getKey()));
-            
-            if (null != namespaceMap) { // did application hand us some additional namespaces?
+
+            if (null != namespaceMap) { // did application hand us some
+                                        // additional namespaces?
                 for (Map.Entry<String, String> mapping : namespaceMap.entrySet()) {
-                    // user gives us namespace->prefix mapping. 
-                    e.addNamespaceDeclaration(Namespace.getNamespace(mapping.getValue(),
-                                                                     mapping.getKey()));

+                    // user gives us namespace->prefix mapping.
+                    e.addNamespaceDeclaration(Namespace.getNamespace(mapping.getValue(),
mapping.getKey()));
                 }
             }
 
-            // if the user didn't pick something else, assign 'tns' as the prefix.
+            // if the user didn't pick something else, assign 'tns' as the
+            // prefix.
             if (namespaceMap == null || !namespaceMap.containsKey(entry.getKey())) {
-                // Schemas are more readable if there is a specific prefix for the TNS.
-                e.addNamespaceDeclaration(Namespace.getNamespace(WSDLConstants.CONVENTIONAL_TNS_PREFIX,

-                                                                 entry.getKey()));
+                // Schemas are more readable if there is a specific prefix for
+                // the TNS.
+                e.addNamespaceDeclaration(Namespace.getNamespace(WSDLConstants.CONVENTIONAL_TNS_PREFIX,
entry
+                    .getKey()));
             }
             e.setAttribute(new Attribute("elementFormDefault", "qualified"));
             e.setAttribute(new Attribute("attributeFormDefault", "qualified"));
@@ -470,21 +480,23 @@
             if (e.getChildren().size() == 0) {
                 continue;
             }
-            
+
             if (schemaImportsXmime(e)) {
                 needXmimeSchema = true;
             }
 
             try {
                 NamespaceMap nsMap = new NamespaceMap();
-                
+
                 nsMap.add(xsdPrefix, SOAPConstants.XSD);
-                
-                // We prefer explicit prefixes over those generated in the types.
-                // This loop may have intended to support prefixes from individual aegis
files,
-                // but that isn't a good idea. 
+
+                // We prefer explicit prefixes over those generated in the
+                // types.
+                // This loop may have intended to support prefixes from
+                // individual aegis files,
+                // but that isn't a good idea.
                 for (Iterator itr = e.getAdditionalNamespaces().iterator(); itr.hasNext();)
{
-                    Namespace n = (Namespace) itr.next();
+                    Namespace n = (Namespace)itr.next();
                     if (!nsMap.containsValue(n.getURI())) {
                         nsMap.add(n.getPrefix(), n.getURI());
                     }
@@ -496,15 +508,16 @@
                     SchemaCollection col = si.getXmlSchemaCollection();
                     col.setNamespaceContext(nsMap);
                     XmlSchema xmlSchema = addSchemaDocument(si, col, schema, entry.getKey());
-                    // Work around bug in JDOM DOMOutputter which fails to correctly
-                    // assign namespaces to attributes. If JDOM worked right, 
+                    // Work around bug in JDOM DOMOutputter which fails to
+                    // correctly
+                    // assign namespaces to attributes. If JDOM worked right,
                     // the collection object would get the prefixes for itself.
                     xmlSchema.setNamespaceContext(nsMap);
                 }
             } catch (JDOMException e1) {
                 throw new ServiceConstructionException(e1);
             }
-            
+
         }
 
         if (needXmimeSchema) {
@@ -537,7 +550,7 @@
 
         return name;
     }
-    
+
     private Type getParameterType(Service s, TypeMapping tm, MessagePartInfo param, int paramtype)
{
         Type type = tm.getType(param.getTypeQName());
 
@@ -550,7 +563,7 @@
         if (paramtype == OUT_PARAM) {
             offset = 1;
         }
-        
+
         TypeCreator typeCreator = tm.getTypeCreator();
         if (type == null) {
             OperationInfo op = param.getMessageInfo().getOperation();
@@ -562,12 +575,13 @@
             } else {
                 info = typeCreator.createBasicClassInfo(param.getTypeClass());
             }
-            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 (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.
                 param.setProperty("minOccurs", "1");
                 param.setProperty("maxOccurs", "1");
                 param.setProperty("nillable", Boolean.TRUE);
@@ -577,7 +591,8 @@
                 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.
             if (info.nonDefaultAttributes()) {
                 tm.register(type);
             }
@@ -615,8 +630,8 @@
     public void setOverrideTypes(Set<String> types) {
         overrideTypes = types;
     }
-    
-    public void setConfiguration(Configuration configuration) {
+
+    public void setConfiguration(TypeCreationOptions configuration) {
         this.configuration = configuration;
     }
 

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java?rev=632332&r1=632331&r2=632332&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java
(original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java
Fri Feb 29 06:37:01 2008
@@ -45,7 +45,7 @@
 
     protected AbstractTypeCreator nextCreator;
 
-    private Configuration typeConfiguration;
+    private TypeCreationOptions typeConfiguration;
 
     private TypeCreator parent;
 
@@ -378,11 +378,11 @@
         return createTypeForClass(info);
     }
 
-    public Configuration getConfiguration() {
+    public TypeCreationOptions getConfiguration() {
         return typeConfiguration;
     }
 
-    public void setConfiguration(Configuration tpConfiguration) {
+    public void setConfiguration(TypeCreationOptions tpConfiguration) {
         this.typeConfiguration = tpConfiguration;
     }
 

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/Configuration.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/Configuration.java?rev=632332&r1=632331&r2=632332&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/Configuration.java
(original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/Configuration.java
Fri Feb 29 06:37:01 2008
@@ -18,44 +18,9 @@
  */
 package org.apache.cxf.aegis.type;
 
-public class Configuration {
-    private boolean defaultExtensibleElements;
-
-    private boolean defaultExtensibleAttributes;
-
-    private boolean defaultNillable = true;
-
-    private int defaultMinOccurs;
-
-    public boolean isDefaultExtensibleAttributes() {
-        return defaultExtensibleAttributes;
-    }
-
-    public void setDefaultExtensibleAttributes(boolean defaultExtensibleAttributes) {
-        this.defaultExtensibleAttributes = defaultExtensibleAttributes;
-    }
-
-    public boolean isDefaultExtensibleElements() {
-        return defaultExtensibleElements;
-    }
-
-    public void setDefaultExtensibleElements(boolean defaultExtensibleElements) {
-        this.defaultExtensibleElements = defaultExtensibleElements;
-    }
-
-    public int getDefaultMinOccurs() {
-        return defaultMinOccurs;
-    }
-
-    public void setDefaultMinOccurs(int defaultMinOccurs) {
-        this.defaultMinOccurs = defaultMinOccurs;
-    }
-
-    public boolean isDefaultNillable() {
-        return defaultNillable;
-    }
-
-    public void setDefaultNillable(boolean defaultNillable) {
-        this.defaultNillable = defaultNillable;
-    }
+/**
+ * This class is preserved for compatibility. Please use {@link TypeCreationOptions}.
+ * @deprecated 2.1
+ */
+public class Configuration extends TypeCreationOptions {
 }

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeCreator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeCreator.java?rev=632332&r1=632331&r2=632332&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeCreator.java
(original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/DefaultTypeCreator.java
Fri Feb 29 06:37:01 2008
@@ -30,7 +30,7 @@
     public DefaultTypeCreator() {
     }
 
-    public DefaultTypeCreator(Configuration configuration) {
+    public DefaultTypeCreator(TypeCreationOptions configuration) {
         setConfiguration(configuration);
     }
 

Added: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeCreationOptions.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeCreationOptions.java?rev=632332&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeCreationOptions.java
(added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeCreationOptions.java
Fri Feb 29 06:37:01 2008
@@ -0,0 +1,93 @@
+/**
+ * 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.
+ */
+
+/**
+ * This class contains a set of flags that control Aegis' process of mapping from Java types
to XML Schema.
+ * These options are respected by the standard Aegis type creation classes. An application
that replaces
+ * these with custom creators will make its own arrangements.
+ * 
+ * @see AbstractTypeCreator
+ * @see DefaultTypeCreator
+ * @see XMLTypeCreator
+ * @see Java5TypeCreator
+ * 
+ * @since 2.1
+ */
+package org.apache.cxf.aegis.type;
+
+public class TypeCreationOptions {
+
+    private boolean defaultExtensibleElements;
+    private boolean defaultExtensibleAttributes;
+    private boolean defaultNillable = true;
+    private int defaultMinOccurs;
+
+    public TypeCreationOptions() {
+        super();
+    }
+
+    /**
+     * Should all elements permit 'any attribute'?
+     * @return
+     */
+    public boolean isDefaultExtensibleAttributes() {
+        return defaultExtensibleAttributes;
+    }
+
+    public void setDefaultExtensibleAttributes(boolean defaultExtensibleAttributes) {
+        this.defaultExtensibleAttributes = defaultExtensibleAttributes;
+    }
+
+    /**
+     * Should all complex types include an xsd:any to allow for future expansion?
+     * @return
+     */
+    public boolean isDefaultExtensibleElements() {
+        return defaultExtensibleElements;
+    }
+
+    public void setDefaultExtensibleElements(boolean defaultExtensibleElements) {
+        this.defaultExtensibleElements = defaultExtensibleElements;
+    }
+
+    /**
+     * Absent any annotations of XML mapping, the value of the minOccurs attribute on elements.
+     * @return
+     */
+    public int getDefaultMinOccurs() {
+        return defaultMinOccurs;
+    }
+
+    public void setDefaultMinOccurs(int defaultMinOccurs) {
+        this.defaultMinOccurs = defaultMinOccurs;
+    }
+    /**
+     * Absent any annotations of XML mapping, the value of the nillable attribute on elements.
+     * @return
+     */
+
+    public boolean isDefaultNillable() {
+        return defaultNillable;
+    }
+
+    public void setDefaultNillable(boolean defaultNillable) {
+        this.defaultNillable = defaultNillable;
+    }
+
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeCreationOptions.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/TypeCreationOptions.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/DuplicateArrayTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/DuplicateArrayTest.java?rev=632332&r1=632331&r2=632332&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/DuplicateArrayTest.java
(original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/array/DuplicateArrayTest.java
Fri Feb 29 06:37:01 2008
@@ -23,7 +23,7 @@
 
 import org.apache.cxf.aegis.AbstractAegisTest;
 import org.apache.cxf.aegis.databinding.AegisDatabinding;
-import org.apache.cxf.aegis.type.Configuration;
+import org.apache.cxf.aegis.type.TypeCreationOptions;
 import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
 import org.junit.Test;
 
@@ -36,7 +36,7 @@
         JaxWsServerFactoryBean serviceFactory = new JaxWsServerFactoryBean();
         serviceFactory.getServiceFactory().setDataBinding(binder);
 
-        Configuration configuration = binder.getAegisContext().getConfiguration();
+        TypeCreationOptions configuration = binder.getAegisContext().getTypeCreationOptions();
         configuration.setDefaultMinOccurs(1);
         configuration.setDefaultNillable(false);
 

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java?rev=632332&r1=632331&r2=632332&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java
(original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java
Fri Feb 29 06:37:01 2008
@@ -29,8 +29,8 @@
 import org.apache.cxf.aegis.AegisContext;
 import org.apache.cxf.aegis.Context;
 import org.apache.cxf.aegis.services.SimpleBean;
-import org.apache.cxf.aegis.type.Configuration;
 import org.apache.cxf.aegis.type.Type;
+import org.apache.cxf.aegis.type.TypeCreationOptions;
 import org.apache.cxf.aegis.type.TypeMapping;
 import org.apache.cxf.aegis.util.jdom.StaxBuilder;
 import org.apache.cxf.aegis.xml.jdom.JDOMReader;
@@ -315,10 +315,10 @@
     public void testNillableIntMinOccurs1() throws Exception {
         context = new AegisContext();
 
-        Configuration config = new Configuration();
+        TypeCreationOptions config = new TypeCreationOptions();
         config.setDefaultMinOccurs(1);
         config.setDefaultNillable(false);
-        context.setConfiguration(config);
+        context.setTypeCreationOptions(config);
         context.initialize();
         mapping = context.getTypeMapping();
 

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest.java?rev=632332&r1=632331&r2=632332&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest.java
(original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest.java
Fri Feb 29 06:37:01 2008
@@ -29,9 +29,9 @@
 import org.w3c.dom.Document;
 
 import org.apache.cxf.aegis.AbstractAegisTest;
-import org.apache.cxf.aegis.type.Configuration;
 import org.apache.cxf.aegis.type.DefaultTypeMapping;
 import org.apache.cxf.aegis.type.Type;
+import org.apache.cxf.aegis.type.TypeCreationOptions;
 import org.apache.cxf.aegis.type.collection.CollectionType;
 import org.apache.cxf.aegis.type.java5.dto.CollectionDTO;
 import org.apache.cxf.aegis.type.java5.dto.DTOService;
@@ -50,7 +50,7 @@
 
         tm = new DefaultTypeMapping(SOAPConstants.XSD);
         creator = new Java5TypeCreator();
-        creator.setConfiguration(new Configuration());
+        creator.setConfiguration(new TypeCreationOptions());
         tm.setTypeCreator(creator);
     }
 
@@ -121,7 +121,7 @@
     public void testCollectionDTO() {
         tm = new DefaultTypeMapping(SOAPConstants.XSD);
         creator = new Java5TypeCreator();
-        creator.setConfiguration(new Configuration());
+        creator.setConfiguration(new TypeCreationOptions());
         tm.setTypeCreator(creator);
 
         Type dto = creator.createType(CollectionDTO.class);
@@ -144,7 +144,7 @@
     public void testObjectDTO() {
         tm = new DefaultTypeMapping(SOAPConstants.XSD);
         creator = new Java5TypeCreator();
-        creator.setConfiguration(new Configuration());
+        creator.setConfiguration(new TypeCreationOptions());
         tm.setTypeCreator(creator);
 
         Type dto = creator.createType(ObjectDTO.class);

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/ConfigurationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/ConfigurationTest.java?rev=632332&r1=632331&r2=632332&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/ConfigurationTest.java
(original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/ConfigurationTest.java
Fri Feb 29 06:37:01 2008
@@ -22,9 +22,9 @@
 
 import org.apache.cxf.aegis.AbstractAegisTest;
 import org.apache.cxf.aegis.AegisContext;
-import org.apache.cxf.aegis.type.Configuration;
 import org.apache.cxf.aegis.type.DefaultTypeMapping;
 import org.apache.cxf.aegis.type.Type;
+import org.apache.cxf.aegis.type.TypeCreationOptions;
 import org.apache.cxf.aegis.type.XMLTypeCreator;
 import org.apache.cxf.aegis.type.basic.BeanType;
 import org.apache.cxf.aegis.type.basic.BeanTypeInfo;
@@ -35,15 +35,15 @@
 
     DefaultTypeMapping tm;
 
-    Configuration config;
+    TypeCreationOptions config;
 
     @Before
     public void setUp() throws Exception {
         super.setUp();
 
         AegisContext context = new AegisContext();
-        config = new Configuration();
-        context.setConfiguration(config);
+        config = new TypeCreationOptions();
+        context.setTypeCreationOptions(config);
         context.initialize();
         XMLTypeCreator creator = new XMLTypeCreator();
         creator.setConfiguration(config);

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java?rev=632332&r1=632331&r2=632332&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java
(original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java
Fri Feb 29 06:37:01 2008
@@ -23,9 +23,9 @@
 import org.w3c.dom.Document;
 
 import org.apache.cxf.aegis.AbstractAegisTest;
-import org.apache.cxf.aegis.type.Configuration;
 import org.apache.cxf.aegis.type.DefaultTypeMapping;
 import org.apache.cxf.aegis.type.Type;
+import org.apache.cxf.aegis.type.TypeCreationOptions;
 import org.apache.cxf.aegis.type.java5.CurrencyService.Currency;
 import org.apache.cxf.aegis.xml.jdom.JDOMReader;
 import org.apache.cxf.aegis.xml.jdom.JDOMWriter;
@@ -48,7 +48,7 @@
 
         tm = new DefaultTypeMapping();
         Java5TypeCreator creator = new Java5TypeCreator();
-        creator.setConfiguration(new Configuration());
+        creator.setConfiguration(new TypeCreationOptions());
         tm.setTypeCreator(creator);
     }
     

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbXmlParamTypeTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbXmlParamTypeTest.java?rev=632332&r1=632331&r2=632332&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbXmlParamTypeTest.java
(original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/JaxbXmlParamTypeTest.java
Fri Feb 29 06:37:01 2008
@@ -24,10 +24,10 @@
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.aegis.AbstractAegisTest;
-import org.apache.cxf.aegis.type.Configuration;
 import org.apache.cxf.aegis.type.DefaultTypeCreator;
 import org.apache.cxf.aegis.type.DefaultTypeMapping;
 import org.apache.cxf.aegis.type.Type;
+import org.apache.cxf.aegis.type.TypeCreationOptions;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -42,7 +42,7 @@
         tm = new DefaultTypeMapping();
         creator = new Java5TypeCreator();
         creator.setNextCreator(new DefaultTypeCreator());
-        creator.setConfiguration(new Configuration());
+        creator.setConfiguration(new TypeCreationOptions());
         tm.setTypeCreator(creator);
     }
 

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/MapTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/MapTest.java?rev=632332&r1=632331&r2=632332&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/MapTest.java
(original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/MapTest.java
Fri Feb 29 06:37:01 2008
@@ -28,9 +28,9 @@
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.aegis.AbstractAegisTest;
-import org.apache.cxf.aegis.type.Configuration;
 import org.apache.cxf.aegis.type.DefaultTypeMapping;
 import org.apache.cxf.aegis.type.Type;
+import org.apache.cxf.aegis.type.TypeCreationOptions;
 import org.apache.cxf.aegis.type.collection.CollectionType;
 import org.apache.cxf.aegis.type.collection.MapType;
 import org.apache.cxf.aegis.type.java5.dto.MapDTO;
@@ -48,7 +48,7 @@
 
         tm = new DefaultTypeMapping();
         creator = new Java5TypeCreator();
-        creator.setConfiguration(new Configuration());
+        creator.setConfiguration(new TypeCreationOptions());
         tm.setTypeCreator(creator);
     }
 
@@ -124,7 +124,7 @@
     public void testMapDTO() {
         tm = new DefaultTypeMapping();
         creator = new Java5TypeCreator();
-        creator.setConfiguration(new Configuration());
+        creator.setConfiguration(new TypeCreationOptions());
         tm.setTypeCreator(creator);
 
         Type dto = creator.createType(MapDTO.class);

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XmlParamTypeTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XmlParamTypeTest.java?rev=632332&r1=632331&r2=632332&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XmlParamTypeTest.java
(original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/XmlParamTypeTest.java
Fri Feb 29 06:37:01 2008
@@ -25,10 +25,10 @@
 import org.w3c.dom.Document;
 
 import org.apache.cxf.aegis.AbstractAegisTest;
-import org.apache.cxf.aegis.type.Configuration;
 import org.apache.cxf.aegis.type.DefaultTypeCreator;
 import org.apache.cxf.aegis.type.DefaultTypeMapping;
 import org.apache.cxf.aegis.type.Type;
+import org.apache.cxf.aegis.type.TypeCreationOptions;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -43,7 +43,7 @@
         tm = new DefaultTypeMapping();
         creator = new Java5TypeCreator();
         creator.setNextCreator(new DefaultTypeCreator());
-        creator.setConfiguration(new Configuration());
+        creator.setConfiguration(new TypeCreationOptions());
         tm.setTypeCreator(creator);
     }
 



Mime
View raw message