You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2011/02/07 18:06:15 UTC

svn commit: r1068014 - in /cxf/branches/2.3.x-fixes: ./ rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java

Author: dkulp
Date: Mon Feb  7 17:06:14 2011
New Revision: 1068014

URL: http://svn.apache.org/viewvc?rev=1068014&view=rev
Log:
Merged revisions 1068011 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1068011 | dkulp | 2011-02-07 11:54:30 -0500 (Mon, 07 Feb 2011) | 2 lines
  
  [CXF-3311] Incremental generation for XMLBeans
  Patch from petekol at mail dot ru applied.
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java

Propchange: cxf/branches/2.3.x-fixes/
            ('svn:mergeinfo' removed)

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

Modified: cxf/branches/2.3.x-fixes/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java?rev=1068014&r1=1068013&r2=1068014&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java (original)
+++ cxf/branches/2.3.x-fixes/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java Mon Feb  7 17:06:14 2011
@@ -50,6 +50,7 @@ import org.apache.cxf.tools.common.ToolE
 import org.apache.cxf.tools.common.model.DefaultValueWriter;
 import org.apache.cxf.tools.util.ClassCollector;
 import org.apache.cxf.tools.wsdlto.core.DataBindingProfile;
+import org.apache.xmlbeans.SchemaGlobalElement;
 import org.apache.xmlbeans.SchemaType;
 import org.apache.xmlbeans.SchemaTypeLoader;
 import org.apache.xmlbeans.SchemaTypeSystem;
@@ -89,6 +90,7 @@ public class XMLBeansToolingDataBinding 
     }    
     
     SchemaTypeSystem typeSystem;
+    SchemaTypeLoader typeLoader;
     Map<String, String> sourcesToCopyMap = new HashMap<String, String>();
     List<XmlError> errors = new LinkedList<XmlError>();
     XmlErrorWatcher errorListener = new XmlErrorWatcher(errors);
@@ -137,18 +139,35 @@ public class XMLBeansToolingDataBinding 
     public String getType(QName qn, boolean element) {
         String ret;
         if (element) {
-            ret = typeSystem.findDocumentType(qn).getFullJavaName();                  
+            SchemaType type = typeSystem.findDocumentType(qn);
+            if (type == null)  {
+                type = typeLoader.findDocumentType(qn);
+            }
+
+            ret = type.getFullJavaName();
             if (ret.contains("$")) {
                 ret = ret.substring(0, ret.indexOf('$'));
             }
             return ret;
         }
-        ret = typeSystem.findType(qn).getFullJavaName();
+
+        SchemaType type = typeSystem.findType(qn);
+        if (type == null) {
+            type = typeLoader.findType(qn);
+        }
+
+        ret = type.getFullJavaName();
         return ret.replace('$', '.');
     }
 
     public String getWrappedElementType(QName wrapperElement, QName item) {        
-        SchemaType st = typeSystem.findElement(wrapperElement).getType();
+        SchemaGlobalElement elem = typeSystem.findElement(wrapperElement);
+
+        if (elem == null)  {
+            elem = typeLoader.findElement(wrapperElement);
+        }
+
+        SchemaType st = elem.getType();
         SchemaType partType = st.getElementProperty(item).getType();        
         return XMLBeansSchemaTypeUtils.getNaturalJavaClassName(partType);        
     }
@@ -379,6 +398,9 @@ public class XMLBeansToolingDataBinding 
         params.setConfig(BindingConfigImpl.forConfigDocuments(cdocs, 
                                                               javaFiles.toArray(new File[javaFiles.size()]), 
                                                               CodeGenUtil.systemClasspath()));
+
+        typeLoader = loader;
+
         params.setLinkTo(linkTo);
         params.setOptions(opts);
         params.setErrorListener(errorListener);