Author: bimargulies
Date: Sat Nov  7 20:18:02 2009
New Revision: 833749

URL: http://svn.apache.org/viewvc?rev=833749&view=rev
Log:
XmlSchemaComplexContentExtension modernization.

Modified:
    
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
    
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContentExtension.java
    
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java

Modified: 
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java?rev=833749&r1=833748&r2=833749&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
 (original)
+++ 
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
 Sat Nov  7 20:18:02 2009
@@ -1225,7 +1225,7 @@
 
         if (extEl.hasAttribute("base")) {
             String name = extEl.getAttribute("base");
-            ext.baseTypeName = getRefQName(name, extEl);
+            ext.setBaseTypeName(getRefQName(name, extEl));
         }
 
         for (Element el = XDOMUtil.getFirstChildElementNS(extEl,
@@ -1233,19 +1233,19 @@
                 .getNextSiblingElementNS(el, XmlSchema.SCHEMA_NS)) {
 
             if (el.getLocalName().equals("sequence")) {
-                ext.particle = handleSequence(schema, el, schemaEl);
+                ext.setParticle(handleSequence(schema, el, schemaEl));
             } else if (el.getLocalName().equals("choice")) {
-                ext.particle = handleChoice(schema, el, schemaEl);
+                ext.setParticle(handleChoice(schema, el, schemaEl));
             } else if (el.getLocalName().equals("all")) {
-                ext.particle = handleAll(schema, el, schemaEl);
+                ext.setParticle(handleAll(schema, el, schemaEl));
             } else if (el.getLocalName().equals("attribute")) {
-                ext.attributes.add(handleAttribute(schema, el, schemaEl));
+                ext.getAttributes().add(handleAttribute(schema, el, schemaEl));
             } else if (el.getLocalName().equals("attributeGroup")) {
-                ext.attributes.add(handleAttributeGroupRef(schema, el));
+                ext.getAttributes().add(handleAttributeGroupRef(schema, el));
             } else if (el.getLocalName().equals("group")) {
-                ext.particle = handleGroupRef(schema, el, schemaEl);
+                ext.setParticle(handleGroupRef(schema, el, schemaEl));
             } else if (el.getLocalName().equals("anyAttribute")) {
-                ext.anyAttribute = handleAnyAttribute(schema, el, schemaEl);
+                ext.setAnyAttribute(handleAnyAttribute(schema, el, schemaEl));
             } else if (el.getLocalName().equals("annotation")) {
                 ext.setAnnotation(handleAnnotation(el));
             }

Modified: 
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContentExtension.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContentExtension.java?rev=833749&r1=833748&r2=833749&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContentExtension.java
 (original)
+++ 
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContentExtension.java
 Sat Nov  7 20:18:02 2009
@@ -19,6 +19,10 @@
 
 package org.apache.ws.commons.schema;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
 import javax.xml.namespace.QName;
 
 /**
@@ -30,24 +34,23 @@
 public class XmlSchemaComplexContentExtension extends XmlSchemaContent {
 
     /* Allows an XmlSchemaAnyAttribute to be used for the attribute value. */
-    XmlSchemaAnyAttribute anyAttribute;
+    private XmlSchemaAnyAttribute anyAttribute;
     /*
      * Contains XmlSchemaAttribute and XmlSchemaAttributeGroupRef. Collection 
of attributes for the simple
      * type.
      */
-    XmlSchemaObjectCollection attributes;
+    private List<XmlSchemaAttributeOrGroupRef> attributes;
     /* Name of the built-in data type, simple type, or complex type. */
-    QName baseTypeName;
+    private QName baseTypeName;
 
     /* One of the XmlSchemaGroupRef, XmlSchemaChoice, XmlSchemaAll, or 
XmlSchemaSequence classes. */
-    XmlSchemaParticle particle;
+    private XmlSchemaParticle particle;
 
     /**
      * Creates new XmlSchemaComplexContentExtension
      */
     public XmlSchemaComplexContentExtension() {
-        attributes = new XmlSchemaObjectCollection();
-
+        attributes = Collections.synchronizedList(new 
ArrayList<XmlSchemaAttributeOrGroupRef>());
     }
 
     public void setAnyAttribute(XmlSchemaAnyAttribute anyAttribute) {
@@ -58,7 +61,7 @@
         return this.anyAttribute;
     }
 
-    public XmlSchemaObjectCollection getAttributes() {
+    public List<XmlSchemaAttributeOrGroupRef> getAttributes() {
         return this.attributes;
     }
 
@@ -77,4 +80,8 @@
     public void setParticle(XmlSchemaParticle particle) {
         this.particle = particle;
     }
+
+    void setAttributes(List<XmlSchemaAttributeOrGroupRef> attributes) {
+        this.attributes = attributes;
+    }
 }

Modified: 
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java?rev=833749&r1=833748&r2=833749&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
 (original)
+++ 
webservices/commons/trunk/modules/XmlSchema/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
 Sat Nov  7 20:18:02 2009
@@ -708,8 +708,8 @@
 
         Element extension = createNewElement(doc, "extension", 
schema.getSchemaNamespacePrefix(),
                                              XmlSchema.SCHEMA_NS);
-        if (extensionObj.baseTypeName != null) {
-            String baseType = resolveQName(extensionObj.baseTypeName, schema);
+        if (extensionObj.getBaseTypeName() != null) {
+            String baseType = resolveQName(extensionObj.getBaseTypeName(), 
schema);
             extension.setAttribute("base", baseType);
         }
         if (extensionObj.getAnnotation() != null) {
@@ -717,25 +717,26 @@
             extension.appendChild(annotation);
         }
 
-        if (extensionObj.particle instanceof XmlSchemaSequence) {
-            Element sequenceParticle = serializeSequence(doc, 
(XmlSchemaSequence)extensionObj.particle,
+        if (extensionObj.getParticle() instanceof XmlSchemaSequence) {
+            Element sequenceParticle = serializeSequence(doc, 
(XmlSchemaSequence)extensionObj.getParticle(),
                                                          schema);
             extension.appendChild(sequenceParticle);
-        } else if (extensionObj.particle instanceof XmlSchemaChoice) {
-            Element choiceParticle = serializeChoice(doc, 
(XmlSchemaChoice)extensionObj.particle, schema);
+        } else if (extensionObj.getParticle() instanceof XmlSchemaChoice) {
+            Element choiceParticle = serializeChoice(doc, 
+                                                     
(XmlSchemaChoice)extensionObj.getParticle(), schema);
             extension.appendChild(choiceParticle);
-        } else if (extensionObj.particle instanceof XmlSchemaAll) {
-            Element allParticle = serializeAll(doc, 
(XmlSchemaAll)extensionObj.particle, schema);
+        } else if (extensionObj.getParticle() instanceof XmlSchemaAll) {
+            Element allParticle = serializeAll(doc, 
(XmlSchemaAll)extensionObj.getParticle(), schema);
             extension.appendChild(allParticle);
-        } else if (extensionObj.particle instanceof XmlSchemaGroupRef) {
-            Element groupRefParticle = serializeGroupRef(doc, 
(XmlSchemaGroupRef)extensionObj.particle,
+        } else if (extensionObj.getParticle() instanceof XmlSchemaGroupRef) {
+            Element groupRefParticle = serializeGroupRef(doc, 
(XmlSchemaGroupRef)extensionObj.getParticle(),
                                                          schema);
             extension.appendChild(groupRefParticle);
         }
 
-        int attributesLength = extensionObj.attributes.getCount();
+        int attributesLength = extensionObj.getAttributes().size();
         for (int i = 0; i < attributesLength; i++) {
-            XmlSchemaObject obj = extensionObj.attributes.getItem(i);
+            XmlSchemaObject obj = extensionObj.getAttributes().get(i);
 
             if (obj instanceof XmlSchemaAttribute) {
                 Element attr = serializeAttribute(doc, 
(XmlSchemaAttribute)obj, schema);
@@ -746,8 +747,8 @@
             }
         }
 
-        if (extensionObj.anyAttribute != null) {
-            Element anyAttribute = serializeAnyAttribute(doc, 
extensionObj.anyAttribute, schema);
+        if (extensionObj.getAnyAttribute() != null) {
+            Element anyAttribute = serializeAnyAttribute(doc, 
extensionObj.getAnyAttribute(), schema);
             extension.appendChild(anyAttribute);
         }
 


Reply via email to