cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1068011 - /cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java
Date Mon, 07 Feb 2011 16:54:31 GMT
Author: dkulp
Date: Mon Feb  7 16:54:30 2011
New Revision: 1068011

URL: http://svn.apache.org/viewvc?rev=1068011&view=rev
Log:
[CXF-3311] Incremental generation for XMLBeans
Patch from petekol at mail dot ru applied.

Modified:
    cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java

Modified: cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java?rev=1068011&r1=1068010&r2=1068011&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java
(original)
+++ cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java
Mon Feb  7 16:54:30 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);



Mime
View raw message