cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r1023406 - in /cxf/trunk: common/common/src/main/java/org/apache/cxf/common/xmlschema/ rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/ rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/
Date Sun, 17 Oct 2010 02:27:22 GMT
Author: bimargulies
Date: Sun Oct 17 02:27:22 2010
New Revision: 1023406

URL: http://svn.apache.org/viewvc?rev=1023406&view=rev
Log:
remove misleading utility that made it seem as if a schema element could be assigned an arbitrary
qname

Modified:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaUtils.java
    cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
    cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaUtils.java?rev=1023406&r1=1023405&r2=1023406&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaUtils.java
(original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaUtils.java
Sun Oct 17 02:27:22 2010
@@ -77,37 +77,6 @@ public final class XmlSchemaUtils {
     }
 
     /**
-     * Wrapper around XmlSchemaElement.setQName that checks for inconsistency with
-     * refName.
-     * @param element
-     * @param name
-     */
-    public static void setElementQName(XmlSchemaElement element, QName name) {
-        if (name != null && element.getRef().getTarget() != null
-            && !element.getRef().getTargetQName().equals(name)) {
-            LOG.severe("Attempt to set the QName of an element with a reference name");
-            throw new
-                XmlSchemaInvalidOperation("Attempt to set the QName of an element "
-                                          + "with a reference name.");
-        }
-
-        /*
-         * An element's namespace must match the containing namespace.
-         */
-        if (!element.getParent().getTargetNamespace().equals(name.getNamespaceURI())) {
-            LOG.severe("Attempt to set the QName of an element to a namespace that "
-                       + "is outside of the containing schema");
-            throw new
-                XmlSchemaInvalidOperation("Attempt to set the QName of an element to a namespace
"
-                                          + "that is outside of the containing schema");
-        }
-
-        element.setName(name.getLocalPart());
-        // in CXF, we want them to be consistent.
-        setNameFromQName(element, name);
-    }
-
-    /**
      * Wrapper around XmlSchemaElement.setName that checks for inconsistency with
      * refName.
      * @param element

Modified: cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java?rev=1023406&r1=1023405&r2=1023406&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
(original)
+++ cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
Sun Oct 17 02:27:22 2010
@@ -42,7 +42,6 @@ import org.apache.cxf.common.i18n.Messag
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.ReflectionInvokationHandler;
 import org.apache.cxf.common.xmlschema.SchemaCollection;
-import org.apache.cxf.common.xmlschema.XmlSchemaUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.service.ServiceModelVisitor;
 import org.apache.cxf.service.model.FaultInfo;
@@ -352,7 +351,7 @@ class JAXBSchemaInitializer extends Serv
                                              MessagePartInfo part,
                                              QName typeName, SchemaInfo schemaInfo) {
         XmlSchemaElement el = new XmlSchemaElement(schema, true);
-        XmlSchemaUtils.setElementQName(el, part.getElementQName());
+        el.setName(part.getElementQName().getLocalPart());
         el.setNillable(true);
         el.setSchemaTypeName(typeName);
         part.setXmlSchema(el);
@@ -376,7 +375,7 @@ class JAXBSchemaInitializer extends Serv
                 && !isExistSchemaElement(schemaInfo.getSchema(), part.getElementQName()))
{
 
                 XmlSchemaElement el = new XmlSchemaElement(schemaInfo.getSchema(), true);
-                XmlSchemaUtils.setElementQName(el, part.getElementQName());
+                el.setName(part.getElementQName().getLocalPart());
                 el.setNillable(true);
 
                 schemaInfo.setElement(null);
@@ -408,7 +407,7 @@ class JAXBSchemaInitializer extends Serv
             }
 
             XmlSchemaElement el = new XmlSchemaElement(schemaInfo.getSchema(), true);
-            XmlSchemaUtils.setElementQName(el, part.getElementQName());
+            el.setName(part.getElementQName().getLocalPart());
 
             schemaInfo.setElement(null);
 
@@ -432,12 +431,6 @@ class JAXBSchemaInitializer extends Serv
                         if (beanInfo != null) {
                             el = new XmlSchemaElement(schemaInfo.getSchema(), false);
                             el.setName(m.getName().substring(beginIdx));
-
-                            String ns = schemaInfo.getSchema().getElementFormDefault()
-                                .equals(XmlSchemaForm.UNQUALIFIED)
-                                ? "" : part.getElementQName().getLocalPart();
-                            XmlSchemaUtils.setElementQName(el,
-                                                           new QName(ns, m.getName().substring(beginIdx)));
                             Iterator<QName> itr = beanInfo.getTypeNames().iterator();
                             if (!itr.hasNext()) {
                                 return;
@@ -495,7 +488,7 @@ class JAXBSchemaInitializer extends Serv
         }
 
         XmlSchemaElement el = new XmlSchemaElement(schema, true);
-        XmlSchemaUtils.setElementQName(el, part.getElementQName());
+        el.setName(part.getElementQName().getLocalPart());
         part.setXmlSchema(el);
 
         schema.getItems().add(ct);
@@ -556,7 +549,6 @@ class JAXBSchemaInitializer extends Serv
                               QName name, boolean isArray) {
         XmlSchemaElement el = new XmlSchemaElement(schema, false);
         el.setName(name.getLocalPart());
-        XmlSchemaUtils.setElementQName(el, name);
 
         if (isArray) {
             el.setMinOccurs(0);
@@ -571,7 +563,7 @@ class JAXBSchemaInitializer extends Serv
             QName ename = new QName(beanInfo.getElementNamespaceURI(null),
                                    beanInfo.getElementLocalName(null));
             XmlSchemaElement el2 = schemas.getElementByQName(ename);
-            XmlSchemaUtils.setElementQName(el, null);
+            el.setName(null);
             el.getRef().setTargetQName(el2.getRef().getTargetQName());
         } else {
             Iterator<QName> itr = beanInfo.getTypeNames().iterator();

Modified: cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=1023406&r1=1023405&r2=1023406&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
(original)
+++ cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Sun Oct 17 02:27:22 2010
@@ -1040,7 +1040,7 @@ public class ReflectionServiceFactoryBea
         si.setElement(null); //cached element is now invalid
 
         XmlSchemaElement el = new XmlSchemaElement(schema, true);
-        XmlSchemaUtils.setElementQName(el, mpi.getElementQName());
+        el.setName(mpi.getElementQName().getLocalPart());
         el.setNillable(true);
 
         XmlSchemaType tp = (XmlSchemaType)mpi.getXmlSchema();
@@ -1144,7 +1144,7 @@ public class ReflectionServiceFactoryBea
 
             schemaInfo.setElement(null); //cached element is now invalid
             XmlSchemaElement el = new XmlSchemaElement(schema, true);
-            XmlSchemaUtils.setElementQName(el, qname);
+            el.setName(qname.getLocalPart());
             el.setNillable(true);
 
             if (mpi.isElement()) {
@@ -1230,7 +1230,7 @@ public class ReflectionServiceFactoryBea
         XmlSchema schema = info.getSchema();
         info.setElement(null); // the cached schema will be no good
         XmlSchemaElement el = new XmlSchemaElement(schema, true);
-        XmlSchemaUtils.setElementQName(el, wrapperName);
+        el.setName(wrapperName.getLocalPart());
 
         wrappedMessage.getMessageParts().get(0).setXmlSchema(el);
 
@@ -1247,11 +1247,12 @@ public class ReflectionServiceFactoryBea
 
         for (MessagePartInfo mpi : unwrappedMessage.getMessageParts()) {
             el = new XmlSchemaElement(schema, false);
-            XmlSchemaUtils.setElementQName(el, mpi.getName());
+            // We hope that we can't have parts that differe only in namespace.
+            el.setName(mpi.getName().getLocalPart());
             Map<Class, Boolean> jaxbAnnoMap = getJaxbAnnoMap(mpi);
             if (mpi.isElement()) {
                 addImport(schema, mpi.getElementQName().getNamespaceURI());
-                XmlSchemaUtils.setElementQName(el, null);
+                el.setName(null);
                 XmlSchemaUtils.setElementRefName(el, mpi.getElementQName());
             } else {
                 if (mpi.getTypeQName() != null && !jaxbAnnoMap.containsKey(XmlList.class))
{
@@ -1296,7 +1297,7 @@ public class ReflectionServiceFactoryBea
                     mpi.setElement(true);
                     mpi.setElementQName(newName);
                     mpi.setConcreteName(newName);
-                    XmlSchemaUtils.setElementQName(el, newName);
+                    el.setName(newName.getLocalPart());
                     el.setForm(XmlSchemaForm.QUALIFIED);
                 }
 
@@ -1320,8 +1321,7 @@ public class ReflectionServiceFactoryBea
             }
             if (Boolean.TRUE.equals(mpi.getProperty(HEADER))) {
                 QName qn = (QName)mpi.getProperty(ELEMENT_NAME);
-
-                XmlSchemaUtils.setElementQName(el, qn);
+                el.setName(qn.getLocalPart());
 
                 SchemaInfo headerSchemaInfo = getOrCreateSchema(serviceInfo, qn.getNamespaceURI(),
                                                                 getQualifyWrapperSchema());



Mime
View raw message