cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r593682 - in /incubator/cxf/branches/2.0.x-fixes: ./ common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Date Fri, 09 Nov 2007 22:55:53 GMT
Author: dkulp
Date: Fri Nov  9 14:55:51 2007
New Revision: 593682

URL: http://svn.apache.org/viewvc?rev=593682&view=rev
Log:
Merged part of revisions 593243 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/cxf/trunk

........
  r593243 | dkulp | 2007-11-08 13:30:36 -0500 (Thu, 08 Nov 2007) | 3 lines
  
  Fix some issues with not generating imports into schemas
........

Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
    incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java

Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?rev=593682&r1=593681&r2=593682&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
Fri Nov  9 14:55:51 2007
@@ -254,6 +254,10 @@
      * @throws XMLStreamException
      */
     public static void copy(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException
{
+        copy(reader, writer, false);
+    }
+    public static void copy(XMLStreamReader reader, XMLStreamWriter writer,
+                            boolean fragment) throws XMLStreamException {
         // number of elements read in
         int read = 0;
         int event = reader.getEventType();
@@ -267,7 +271,7 @@
             case XMLStreamConstants.END_ELEMENT:
                 writer.writeEndElement();
                 read--;
-                if (read <= 0) {
+                if (read <= 0 && !fragment) {
                     return;
                 }
                 break;

Modified: incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=593682&r1=593681&r2=593682&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Fri Nov  9 14:55:51 2007
@@ -692,6 +692,9 @@
                 if (!oldEl.getQName().equals(qname)) {
                     el.setSchemaTypeName(oldEl.getSchemaTypeName());
                     el.setSchemaType(oldEl.getSchemaType());
+                    if (oldEl.getSchemaTypeName() != null) {
+                        addImport(schema, oldEl.getSchemaTypeName().getNamespaceURI());
+                    }
                 }
                 mpi.setXmlSchema(el);
                 mpi.setElementQName(qname);
@@ -699,14 +702,7 @@
                 continue;
             } else {
                 el.setSchemaTypeName(mpi.getTypeQName());
-                String ns = mpi.getTypeQName().getNamespaceURI();
-                if (!ns.equals(schema.getTargetNamespace()) && !ns.equals(WSDLConstants.NU_SCHEMA_XSD))
{
-                    XmlSchemaImport is = new XmlSchemaImport();
-                    is.setNamespace(ns);
-                    if (!isExistImport(schema, ns)) {
-                        schema.getItems().add(is);
-                    }
-                }
+                addImport(schema, mpi.getTypeQName().getNamespaceURI());
             }
 
             schemaInfo.setSchema(schema);
@@ -717,6 +713,16 @@
         }
     }
 
+    private void addImport(XmlSchema schema, String ns) {
+        if (!ns.equals(schema.getTargetNamespace()) 
+            && !ns.equals(WSDLConstants.NS_SCHEMA_XSD)
+            && !isExistImport(schema, ns)) {
+            
+            XmlSchemaImport is = new XmlSchemaImport();
+            is.setNamespace(ns);
+            schema.getItems().add(is);
+        }
+    }
     private boolean isExistImport(XmlSchema schema, String ns) {
         boolean isExist = false;
 
@@ -767,7 +773,7 @@
         
         if (!isAnonymousWrapperTypes()) {
             ct.setName(wrapperName.getLocalPart());
-            el.setSchemaTypeName(wrapperName);
+            el.setSchemaTypeName(wrapperName);            
             schema.addType(ct);
             schema.getItems().add(ct);
         }
@@ -783,9 +789,14 @@
             el.setName(mpi.getName().getLocalPart());
             el.setQName(mpi.getName());
             if (mpi.isElement()) {
+                addImport(schema, mpi.getElementQName().getNamespaceURI());
                 el.setRefName(mpi.getElementQName());
             } else {
-                el.setSchemaTypeName(mpi.getTypeQName());
+                if (mpi.getTypeQName() != null) {
+                    el.setSchemaTypeName(mpi.getTypeQName());
+                    addImport(schema, mpi.getTypeQName().getNamespaceURI());
+                }
+
                 el.setSchemaType((XmlSchemaType)mpi.getXmlSchema());
                 if (schema.getElementFormDefault().getValue().equals(XmlSchemaForm.UNQUALIFIED))
{
                     mpi.setConcreteName(new QName(null, mpi.getName().getLocalPart()));



Mime
View raw message