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 2009/06/22 18:01:05 UTC

svn commit: r787293 - in /cxf/branches/2.1.x-fixes: ./ rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/ tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/

Author: dkulp
Date: Mon Jun 22 16:01:05 2009
New Revision: 787293

URL: http://svn.apache.org/viewvc?rev=787293&view=rev
Log:
Merged revisions 787276 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.2.x-fixes

................
  r787276 | dkulp | 2009-06-22 11:39:54 -0400 (Mon, 22 Jun 2009) | 10 lines
  
  Merged revisions 787269 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r787269 | dkulp | 2009-06-22 11:17:42 -0400 (Mon, 22 Jun 2009) | 2 lines
    
    Update xmlbeans tooling to support passing xsdconfig files in as well as
    provide better error reporting
  ........
................

Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java
    cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jun 22 16:01:05 2009
@@ -1,2 +1,2 @@
-/cxf/branches/2.2.x-fixes:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027,773049,773146,773581,773691,773693,774446-774496,774558,774760,774851,774979,775423,776024-776025,776218,776429,776459,777189,777224,777243,777481,777505,777572,777580,780033,780184,780213,780421,780664,780800,780902,780911,781497,781841,782733,782735-782736,783099,783407,784064,784197,785293,785296,785298-785299,785301,785656,786158,786587,786589,786591-786592,786640,787272
-/cxf/trunk:782181,782728-782730,783097,783396,784059,784181,784895,785279-785282,785468,786142,786271,786395,786582-786583,786638,786647
+/cxf/branches/2.2.x-fixes:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027,773049,773146,773581,773691,773693,774446-774496,774558,774760,774851,774979,775423,776024-776025,776218,776429,776459,777189,777224,777243,777481,777505,777572,777580,780033,780184,780213,780421,780664,780800,780902,780911,781497,781841,782733,782735-782736,783099,783407,784064,784197,785293,785296,785298-785299,785301,785656,786158,786587,786589,786591-786592,786640,787272,787276
+/cxf/trunk:782181,782728-782730,783097,783396,784059,784181,784895,785279-785282,785468,786142,786271,786395,786582-786583,786638,786647,787269

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

Modified: cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java?rev=787293&r1=787292&r2=787293&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java (original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java Mon Jun 22 16:01:05 2009
@@ -21,6 +21,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.Writer;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -28,14 +29,20 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
 import javax.xml.namespace.QName;
 
+import org.w3c.dom.Document;
+
 import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
 
+import org.apache.cxf.helpers.XMLUtils;
+import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolException;
@@ -47,6 +54,7 @@
 import org.apache.xmlbeans.SchemaTypeSystem;
 import org.apache.xmlbeans.SimpleValue;
 import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlError;
 import org.apache.xmlbeans.XmlErrorCodes;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
@@ -78,11 +86,12 @@
     
     SchemaTypeSystem typeSystem;
     Map<String, String> sourcesToCopyMap = new HashMap<String, String>();
-    XmlErrorWatcher errorListener = new XmlErrorWatcher(null);
+    List<XmlError> errors = new LinkedList<XmlError>();
+    XmlErrorWatcher errorListener = new XmlErrorWatcher(errors);
     PathResourceLoader cpResourceLoader = new PathResourceLoader(CodeGenUtil.systemClasspath());
-
+    StscState state;
+    
     public void initialize(ToolContext context) throws ToolException {
-        // TODO Auto-generated method stub
         String wsdl = (String)context.get(ToolConstants.CFG_WSDLLOCATION);
         String catalog = (String)context.get(ToolConstants.CFG_CATALOG);
         Object o = context.get(ToolConstants.CFG_BINDING);
@@ -94,6 +103,10 @@
         }
 
         // build the in-memory type system
+        state = StscState.start();
+        // construct the state (have to initialize early in case of errors)
+        state.setErrorListener(errorListener);
+
         EntityResolver cmdLineEntRes = ResolverUtil.resolverForCatalog(catalog);
         typeSystem = loadTypeSystem(wsdl, 
                                      bindingFiles, 
@@ -101,7 +114,7 @@
                                      null, 
                                      null, 
                                      cmdLineEntRes);
-        
+        StscState.end();
     }
 
     public DefaultValueWriter createDefaultValueWriter(QName qn, boolean element) {
@@ -202,8 +215,24 @@
             */
         }
 
-        if (!result && verbose) {
-            System.out.println("BUILD FAILED");
+        if (!result) {
+            if (verbose) {
+                System.out.println("BUILD FAILED");
+            }
+            StringBuilder sb = new StringBuilder("Error generating XMLBeans types\n");
+            for (XmlError err : errors) {
+                if (err.getSeverity() != XmlError.SEVERITY_INFO) {
+                    sb.append(err.toString());
+                    if (err.getLine() != -1) {
+                        sb.append(": ").append(err.getSourceName());
+                        sb.append('[').append(Integer.toString(err.getLine()))
+                            .append(',').append(Integer.toString(err.getColumn()))
+                            .append(']');
+                    }
+                    sb.append('\n');
+                }
+            }
+            throw new ToolException(sb.toString());
         }
 
         if (cpResourceLoader != null) {
@@ -220,9 +249,6 @@
                                            File schemasDir,
                                            EntityResolver entResolver) {
 
-        // construct the state (have to initialize early in case of errors)
-        StscState state = StscState.start();
-        state.setErrorListener(errorListener);
 
         SchemaTypeLoader loader = XmlBeans.typeLoaderForClassLoader(SchemaDocument.class.getClassLoader());
 
@@ -236,6 +262,9 @@
                 .singletonMap("http://schemas.xmlsoap.org/wsdl/",
                               "http://www.apache.org/internal/xmlbeans/wsdlsubst"));
             options.setEntityResolver(entResolver);
+            options.setGenerateJavaVersion(XmlOptions.GENERATE_JAVA_15);
+
+            
 
             XmlObject urldoc = loader.parse(url, null, options);
 
@@ -282,7 +311,16 @@
                     options.setEntityResolver(entResolver);
                     options.setLoadSubstituteNamespaces(MAP_COMPATIBILITY_CONFIG_URIS);
 
-                    XmlObject configdoc = loader.parse(configFiles[i], null, options);
+                    URI uri = new URI(configFiles[i]);
+                    XmlObject configdoc = null;
+                    if ("file".equals(uri.getRawSchemeSpecificPart())) {
+                        configdoc = loader.parse(new File(uri), null, options);                        
+                    } else {
+                        InputSource source = new InputSource(configFiles[i]);
+                        Document doc = XMLUtils.parse(source);
+                        configdoc = loader.parse(doc, null, options);                        
+                    }
+                    
                     if (!(configdoc instanceof ConfigDocument)) {
                         StscState.addError(errorListener, XmlErrorCodes.INVALID_DOCUMENT_TYPE, new Object[] {
                             configFiles[i], "xsd config"

Modified: cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java?rev=787293&r1=787292&r2=787293&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java (original)
+++ cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java Mon Jun 22 16:01:05 2009
@@ -521,9 +521,6 @@
                 jaxbBindings.add(new InputSource(bindingFile));
             }
 
-        } else {
-            Message msg = new Message("UNKNOWN_BINDING_FILE", LOG, bindingFile, reader.getName());
-            throw new ToolException(msg);
         }
     }