You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by bi...@apache.org on 2010/09/20 21:49:08 UTC

svn commit: r999089 - /webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/

Author: bimargulies
Date: Mon Sep 20 19:49:07 2010
New Revision: 999089

URL: http://svn.apache.org/viewvc?rev=999089&view=rev
Log:
Back out WSCOMMONS-559

Modified:
    webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
    webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttribute.java
    webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttributeGroupRef.java
    webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContentExtension.java
    webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContentRestriction.java
    webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexType.java
    webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaContent.java
    webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaSimpleContentExtension.java
    webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaSimpleContentRestriction.java
    webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaSimpleType.java

Modified: webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java?rev=999089&r1=999088&r2=999089&view=diff
==============================================================================
--- webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java (original)
+++ webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/SchemaBuilder.java Mon Sep 20 19:49:07 2010
@@ -661,7 +661,7 @@ public class SchemaBuilder {
 			} else if (el.getLocalName().equals("attribute")) {
 				ct.attributes.add(handleAttribute(schema, el, schemaEl));
 			} else if (el.getLocalName().equals("attributeGroup")) {
-				ct.attributes.add(handleAttributeGroupRef(schema, el));
+				ct.attributes.add(handleAttributeGroupRef(el));
 			} else if (el.getLocalName().equals("group")) {
 				XmlSchemaGroupRef group = handleGroupRef(schema, el, schemaEl);
 				ct.particle = (group.particle == null) ? (XmlSchemaParticle) group
@@ -775,7 +775,7 @@ public class SchemaBuilder {
 	private XmlSchemaSimpleContentRestriction handleSimpleContentRestriction(
 			XmlSchema schema, Element restrictionEl, Element schemaEl) {
 
-		XmlSchemaSimpleContentRestriction restriction = new XmlSchemaSimpleContentRestriction(schema);
+		XmlSchemaSimpleContentRestriction restriction = new XmlSchemaSimpleContentRestriction();
 
 		if (restrictionEl.hasAttribute("base")) {
 			String name = restrictionEl.getAttribute("base");
@@ -794,7 +794,7 @@ public class SchemaBuilder {
 				XmlSchemaAttribute attr = handleAttribute(schema, el, schemaEl);
 				restriction.attributes.add(attr);
 			} else if (el.getLocalName().equals("attributeGroup")) {
-				XmlSchemaAttributeGroupRef attrGroup = handleAttributeGroupRef(schema, el);
+				XmlSchemaAttributeGroupRef attrGroup = handleAttributeGroupRef(el);
 				restriction.attributes.add(attrGroup);
 			} else if (el.getLocalName().equals("simpleType")) {
 				restriction.baseType = handleSimpleType(schema, el, schemaEl);
@@ -818,7 +818,7 @@ public class SchemaBuilder {
 	private XmlSchemaSimpleContentExtension handleSimpleContentExtension(
 			XmlSchema schema, Element extEl, Element schemaEl) {
 
-		XmlSchemaSimpleContentExtension ext = new XmlSchemaSimpleContentExtension(schema);
+		XmlSchemaSimpleContentExtension ext = new XmlSchemaSimpleContentExtension();
 
 		if (extEl.hasAttribute("base")) {
 			String name = extEl.getAttribute("base");
@@ -833,7 +833,7 @@ public class SchemaBuilder {
 				XmlSchemaAttribute attr = handleAttribute(schema, el, schemaEl);
 				ext.attributes.add(attr);
 			} else if (el.getLocalName().equals("attributeGroup")) {
-				XmlSchemaAttributeGroupRef attrGroup = handleAttributeGroupRef(schema, el);
+				XmlSchemaAttributeGroupRef attrGroup = handleAttributeGroupRef(el);
 				ext.attributes.add(attrGroup);
 			} else if (el.getLocalName().equals("anyAttribute")) {
 				ext.anyAttribute = handleAnyAttribute(schema, el, schemaEl);
@@ -848,7 +848,7 @@ public class SchemaBuilder {
 	private XmlSchemaComplexContentRestriction handleComplexContentRestriction(
 			XmlSchema schema, Element restrictionEl, Element schemaEl) {
 
-		XmlSchemaComplexContentRestriction restriction = new XmlSchemaComplexContentRestriction(schema);
+		XmlSchemaComplexContentRestriction restriction = new XmlSchemaComplexContentRestriction();
 
 		if (restrictionEl.hasAttribute("base")) {
 			String name = restrictionEl.getAttribute("base");
@@ -868,7 +868,7 @@ public class SchemaBuilder {
 				restriction.attributes
 						.add(handleAttribute(schema, el, schemaEl));
 			} else if (el.getLocalName().equals("attributeGroup")) {
-				restriction.attributes.add(handleAttributeGroupRef(schema, el));
+				restriction.attributes.add(handleAttributeGroupRef(el));
 			} else if (el.getLocalName().equals("group")) {
 				restriction.particle = handleGroupRef(schema, el, schemaEl);
 			} else if (el.getLocalName().equals("anyAttribute")) {
@@ -884,7 +884,7 @@ public class SchemaBuilder {
 	private XmlSchemaComplexContentExtension handleComplexContentExtension(
 			XmlSchema schema, Element extEl, Element schemaEl) {
 
-		XmlSchemaComplexContentExtension ext = new XmlSchemaComplexContentExtension(schema);
+		XmlSchemaComplexContentExtension ext = new XmlSchemaComplexContentExtension();
 
 		if (extEl.hasAttribute("base")) {
 			String name = extEl.getAttribute("base");
@@ -904,7 +904,7 @@ public class SchemaBuilder {
 			} else if (el.getLocalName().equals("attribute")) {
 				ext.attributes.add(handleAttribute(schema, el, schemaEl));
 			} else if (el.getLocalName().equals("attributeGroup")) {
-				ext.attributes.add(handleAttributeGroupRef(schema, el));
+				ext.attributes.add(handleAttributeGroupRef(el));
 			} else if (el.getLocalName().equals("group")) {
 				ext.particle = handleGroupRef(schema, el, schemaEl);
 			} else if (el.getLocalName().equals("anyAttribute")) {
@@ -916,10 +916,10 @@ public class SchemaBuilder {
 		return ext;
 	}
 
-	private XmlSchemaAttributeGroupRef handleAttributeGroupRef(XmlSchema schema,
+	private XmlSchemaAttributeGroupRef handleAttributeGroupRef(
 			Element attrGroupEl) {
 
-		XmlSchemaAttributeGroupRef attrGroup = new XmlSchemaAttributeGroupRef(schema);
+		XmlSchemaAttributeGroupRef attrGroup = new XmlSchemaAttributeGroupRef();
 
 		if (attrGroupEl.hasAttribute("ref")) {
 			String ref = attrGroupEl.getAttribute("ref");
@@ -1110,7 +1110,7 @@ public class SchemaBuilder {
 				XmlSchemaAttribute attr = handleAttribute(schema, el, schemaEl);
 				attrGroup.attributes.add(attr);
 			} else if (el.getLocalName().equals("attributeGroup")) {
-				XmlSchemaAttributeGroupRef attrGroupRef = handleAttributeGroupRef(schema, el);
+				XmlSchemaAttributeGroupRef attrGroupRef = handleAttributeGroupRef(el);
 				attrGroup.attributes.add(attrGroupRef);
 			} else if (el.getLocalName().equals("anyAttribute")) {
 				attrGroup.anyAttribute = handleAnyAttribute(schema, el,

Modified: webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttribute.java
URL: http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttribute.java?rev=999089&r1=999088&r2=999089&view=diff
==============================================================================
--- webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttribute.java (original)
+++ webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttribute.java Mon Sep 20 19:49:07 2010
@@ -136,23 +136,4 @@ public class XmlSchemaAttribute extends 
 
         return xml;
     }
-
-    static final XmlSchemaAttribute getAttribute(final XmlSchemaObjectCollection attributes, final QName name) {
-        if ((attributes == null) || (name == null)) return null;
-        for (int i = 0; i < attributes.getCount(); i++) {
-            final XmlSchemaObject attrItem = attributes.getItem(i);
-            if (attrItem instanceof XmlSchemaAttributeGroupRef) {
-                final XmlSchemaAttributeGroup attrGroup = ((XmlSchemaAttributeGroupRef)attrItem).resolve();
-                if (attrGroup == null) continue;
-                final XmlSchemaAttribute attr = getAttribute(attrGroup.getAttributes(), name);
-                if (attr != null) return attr;
-            } else if (attrItem instanceof XmlSchemaAttribute) {
-                final XmlSchemaAttribute attr = (XmlSchemaAttribute)attrItem;
-                final QName attrQName = attr.getQName();
-                if ((attrQName != null) && (attrQName.equals(name))) return attr;
-            }
-        }
-        return null;
-    }
-
 }

Modified: webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttributeGroupRef.java
URL: http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttributeGroupRef.java?rev=999089&r1=999088&r2=999089&view=diff
==============================================================================
--- webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttributeGroupRef.java (original)
+++ webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaAttributeGroupRef.java Mon Sep 20 19:49:07 2010
@@ -28,13 +28,10 @@ import javax.xml.namespace.QName;
  */
 public class XmlSchemaAttributeGroupRef extends XmlSchemaAnnotated {
 
-    XmlSchema schema;
-
     /**
      * Creates new XmlSchemaAttributeGroupRef
      */
-    public XmlSchemaAttributeGroupRef(XmlSchema schema) {
-      this.schema = schema;
+    public XmlSchemaAttributeGroupRef() {
     }
 
     QName refName;
@@ -47,8 +44,4 @@ public class XmlSchemaAttributeGroupRef 
         this.refName = refName;
     }
 
-    public XmlSchemaAttributeGroup resolve() {
-        return (XmlSchemaAttributeGroup)schema.getAttributeGroups().getItem(refName);
-    }
-
 }

Modified: webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContentExtension.java
URL: http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContentExtension.java?rev=999089&r1=999088&r2=999089&view=diff
==============================================================================
--- webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContentExtension.java (original)
+++ webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContentExtension.java Mon Sep 20 19:49:07 2010
@@ -33,8 +33,7 @@ public class XmlSchemaComplexContentExte
     /**
      * Creates new XmlSchemaComplexContentExtension
      */
-    public XmlSchemaComplexContentExtension(XmlSchema schema) {
-        super(schema);
+    public XmlSchemaComplexContentExtension() {
         attributes = new XmlSchemaObjectCollection();
 
     }
@@ -97,18 +96,4 @@ public class XmlSchemaComplexContentExte
         xml += "</" + prefix + "extension>\n";
         return xml;
     }
-
-    public XmlSchemaComplexType resolveBaseComplexType() {
-        return (XmlSchemaComplexType)resolveBaseType();
-    }
-
-    XmlSchemaAttribute getAttribute(QName name) {
-        XmlSchemaAttribute attr = super.getAttribute(name);
-        if (attr == null) {
-            XmlSchemaComplexType baseType = resolveBaseComplexType();
-            if (baseType != null) attr = baseType.getAttribute(name);
-        }
-        return attr;
-    }
-
 }

Modified: webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContentRestriction.java
URL: http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContentRestriction.java?rev=999089&r1=999088&r2=999089&view=diff
==============================================================================
--- webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContentRestriction.java (original)
+++ webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexContentRestriction.java Mon Sep 20 19:49:07 2010
@@ -34,8 +34,7 @@ public class XmlSchemaComplexContentRest
     /**
      * Creates new XmlSchemaComplexContentRestriction
      */
-    public XmlSchemaComplexContentRestriction(XmlSchema schema) {
-        super(schema);
+    public XmlSchemaComplexContentRestriction() {
         attributes = new XmlSchemaObjectCollection();
     }
 
@@ -101,19 +100,5 @@ public class XmlSchemaComplexContentRest
         xml += "</" + prefix + "restriction>\n";
         return xml;
     }
-
-    public XmlSchemaComplexType resolveBaseComplexType() {
-        return (XmlSchemaComplexType)resolveBaseType();
-    }
-
-    XmlSchemaAttribute getAttribute(QName name) {
-        XmlSchemaAttribute attr = super.getAttribute(name);
-        if (attr == null) {
-            XmlSchemaComplexType baseType = resolveBaseComplexType();
-            if (baseType != null) attr = baseType.getAttribute(name);
-        }
-        return attr;
-    }
-
 }
 

Modified: webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexType.java
URL: http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexType.java?rev=999089&r1=999088&r2=999089&view=diff
==============================================================================
--- webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexType.java (original)
+++ webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaComplexType.java Mon Sep 20 19:49:07 2010
@@ -177,11 +177,5 @@ public class XmlSchemaComplexType extend
 		return ext.getBaseTypeName();
 	}
 
-    public XmlSchemaAttribute getAttribute(QName name) {
-        XmlSchemaAttribute attr = XmlSchemaAttribute.getAttribute(attributes, name);
-        if (attr != null) return attr;
-        if (contentModel != null) return contentModel.getContent().getAttribute(name);
-        return null;
-    }
 
 }

Modified: webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaContent.java
URL: http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaContent.java?rev=999089&r1=999088&r2=999089&view=diff
==============================================================================
--- webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaContent.java (original)
+++ webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaContent.java Mon Sep 20 19:49:07 2010
@@ -19,8 +19,6 @@
 
 package org.apache.ws.commons.schema;
 
-import javax.xml.namespace.QName;
-
 /**
  * An abstract class for schema content.
  *
@@ -28,26 +26,10 @@ import javax.xml.namespace.QName;
 
 public abstract class XmlSchemaContent extends XmlSchemaAnnotated {
 
-    XmlSchema schema;
-
     /**
      * Creates new XmlSchemaContent
      */
-    protected XmlSchemaContent(XmlSchema schema) {
-        this.schema = schema;
-    }
-
-    public abstract XmlSchemaObjectCollection getAttributes();
-
-    public abstract QName getBaseTypeName();
-
-    public XmlSchemaType resolveBaseType() {
-        QName baseTypeName = getBaseTypeName();
-        return (baseTypeName != null) ? schema.getTypeByName(baseTypeName) : null;
-    }
-
-    XmlSchemaAttribute getAttribute(QName name) {
-      return XmlSchemaAttribute.getAttribute(getAttributes(), name);
+    protected XmlSchemaContent() {
     }
 
 }

Modified: webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaSimpleContentExtension.java
URL: http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaSimpleContentExtension.java?rev=999089&r1=999088&r2=999089&view=diff
==============================================================================
--- webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaSimpleContentExtension.java (original)
+++ webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaSimpleContentExtension.java Mon Sep 20 19:49:07 2010
@@ -33,8 +33,7 @@ public class XmlSchemaSimpleContentExten
     /**
      * Creates new XmlSchemaSimpleContentExtension
      */
-    public XmlSchemaSimpleContentExtension(XmlSchema schema) {
-        super(schema);
+    public XmlSchemaSimpleContentExtension() {
         attributes = new XmlSchemaObjectCollection();
 
     }
@@ -68,9 +67,5 @@ public class XmlSchemaSimpleContentExten
         return this.baseTypeName;
     }
 
-    public XmlSchemaSimpleType resolveBaseSimpleType() {
-        return (XmlSchemaSimpleType)resolveBaseType();
-    }
-
 }
 

Modified: webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaSimpleContentRestriction.java
URL: http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaSimpleContentRestriction.java?rev=999089&r1=999088&r2=999089&view=diff
==============================================================================
--- webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaSimpleContentRestriction.java (original)
+++ webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaSimpleContentRestriction.java Mon Sep 20 19:49:07 2010
@@ -33,8 +33,7 @@ public class XmlSchemaSimpleContentRestr
     /**
      * Creates new XmlSchemaSimpleContentRestriction
      */
-    public XmlSchemaSimpleContentRestriction(XmlSchema schema) {
-        super(schema);
+    public XmlSchemaSimpleContentRestriction() {
         facets = new XmlSchemaObjectCollection();
         attributes = new XmlSchemaObjectCollection();
     }
@@ -86,14 +85,5 @@ public class XmlSchemaSimpleContentRestr
         return this.facets;
     }
 
-    public XmlSchemaType resolveBaseType() {
-        if (baseType != null) return baseType;
-        return resolveBaseType();
-    }
-
-    public XmlSchemaSimpleType resolveBaseSimpleType() {
-        return (XmlSchemaSimpleType)resolveBaseType();
-    }
-
 }
 			

Modified: webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaSimpleType.java
URL: http://svn.apache.org/viewvc/webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaSimpleType.java?rev=999089&r1=999088&r2=999089&view=diff
==============================================================================
--- webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaSimpleType.java (original)
+++ webservices/commons/branches/modules/XmlSchema/1_4_X_BRANCH/src/main/java/org/apache/ws/commons/schema/XmlSchemaSimpleType.java Mon Sep 20 19:49:07 2010
@@ -19,9 +19,6 @@
 
 package org.apache.ws.commons.schema;
 
-import javax.xml.namespace.QName;
-
-
 /**
  * Class defines a simple type that determines the information and
  * constraints for the values of attributes or elements with text-only
@@ -69,13 +66,5 @@ public class XmlSchemaSimpleType extends
         return xml;
     }
 
-    public QName getRootTypeName() {
-        if (content == null) return getQName();
-        if (!(content instanceof XmlSchemaSimpleTypeRestriction)) return null;
-        XmlSchemaSimpleTypeRestriction typeRestriction = (XmlSchemaSimpleTypeRestriction)content;
-        if (typeRestriction.getBaseType() != null) return typeRestriction.getBaseType().getRootTypeName();
-        return typeRestriction.getBaseTypeName();
-    }
-
 }