cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r787276 - in /cxf/branches/2.2.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/
Date Mon, 22 Jun 2009 15:39:54 GMT
Author: dkulp
Date: Mon Jun 22 15:39:54 2009
New Revision: 787276

URL: http://svn.apache.org/viewvc?rev=787276&view=rev
Log:
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.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java
    cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jun 22 15:39:54 2009
@@ -1 +1 @@
-/cxf/trunk:782728-782730,783097,783294,783396,784059,784181-784184,784893,784895,785279-785282,785468,785621,785624,785651,785734,785866,786142,786271-786272,786395,786512,786514,786582-786583,786638,786647,786850,787200
+/cxf/trunk:782728-782730,783097,783294,783396,784059,784181-784184,784893,784895,785279-785282,785468,785621,785624,785651,785734,785866,786142,786271-786272,786395,786512,786514,786582-786583,786638,786647,786850,787200,787269

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Jun 22 15:39:54 2009
@@ -1 +1 @@
-/cxf/trunk:1-782619,782728-782730,783097,783294,783396,784059,784181-784184,784893-785866,785932,786142,786271-786272,786395,786512,786514,786582-786583,786638,786647,786850,787200
+/cxf/trunk:1-782619,782728-782730,783097,783294,783396,784059,784181-784184,784893-785866,785932,786142,786271-786272,786395,786512,786514,786582-786583,786638,786647,786850,787200,787269

Modified: cxf/branches/2.2.x-fixes/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java?rev=787276&r1=787275&r2=787276&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/tools/XMLBeansToolingDataBinding.java
Mon Jun 22 15:39:54 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.2.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.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java?rev=787276&r1=787275&r2=787276&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
(original)
+++ cxf/branches/2.2.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java
Mon Jun 22 15:39:54 2009
@@ -505,9 +505,6 @@
             } else {
                 jaxbBindings.add(new InputSource(bindingFile));
             } 
-        } else {
-            Message msg = new Message("UNKNOWN_BINDING_FILE", LOG, bindingFile, reader.getName());
-            throw new ToolException(msg);
         }
     }
 



Mime
View raw message