cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r590644 - in /incubator/cxf/branches/2.0.x-fixes: ./ tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ tools/validator/src/main/java/org/apache/cxf/tools/validator/ tools/validator/src/main/java/org/apache/cxf/tools/validator...
Date Wed, 31 Oct 2007 12:22:05 GMT
Author: dkulp
Date: Wed Oct 31 05:22:01 2007
New Revision: 590644

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

........
  r590585 | mmao | 2007-10-31 04:03:08 -0400 (Wed, 31 Oct 2007) | 6 lines
  
  CXF-1057
   * WsdlValidator support catalog
   * Share the Bus among the toolsContainer
   * Validator get the toolsContext from the container
........

Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/AbstractToolContainer.java
    incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java
    incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/AbstractDefinitionValidator.java
    incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java
    incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
    incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java

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

Modified: incubator/cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/AbstractToolContainer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/AbstractToolContainer.java?rev=590644&r1=590643&r2=590644&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/AbstractToolContainer.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/AbstractToolContainer.java
Wed Oct 31 05:22:01 2007
@@ -22,16 +22,23 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.PrintStream;
+import java.net.URI;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.catalog.OASISCatalogManager;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.common.toolspec.parser.BadUsageException;
 import org.apache.cxf.tools.common.toolspec.parser.CommandDocument;
 import org.apache.cxf.tools.common.toolspec.parser.CommandLineParser;
+import org.apache.cxf.tools.util.URIParserUtil;
 
 public abstract class AbstractToolContainer implements ToolContainer {
     private static final Logger LOG = LogUtils.getL7dLogger(AbstractToolContainer.class);
@@ -174,5 +181,26 @@
             System.setErr(stdErrorStream);
         }
     }
+    
+    public Bus getBus() {
+        Bus bus = BusFactory.getDefaultBus();
+
+        OASISCatalogManager catalogManager = bus.getExtension(OASISCatalogManager.class);
+        
+        String catalogLocation = getCatalogURL();
+        if (!StringUtils.isEmpty(catalogLocation)) {
+            try {
+                catalogManager.loadCatalog(new URI(catalogLocation).toURL());
+            } catch (Exception e) {
+                e.printStackTrace();
+                throw new ToolException(new Message("FOUND_NO_FRONTEND", LOG, catalogLocation));
+            }
+        }
 
+        return bus;
+    }
+    protected String getCatalogURL() {
+        String catalogLocation = (String) context.get(ToolConstants.CFG_CATALOG);
+        return URIParserUtil.getAbsoluteURI(catalogLocation);
+    }    
 }

Modified: incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java?rev=590644&r1=590643&r2=590644&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/WSDLValidator.java
Wed Oct 31 05:22:01 2007
@@ -52,7 +52,7 @@
         try {
             super.execute(exitOnFinish);
             if (!hasInfoOption()) {
-                ToolContext env = new ToolContext();
+                ToolContext env = getContext();
                 env.setParameters(getParametersMap(getArrayKeys()));
                 if (isVerboseOn()) {
                     env.put(ToolConstants.CFG_VERBOSE, Boolean.TRUE);
@@ -61,7 +61,7 @@
                 env.put(ToolConstants.CFG_CMD_ARG, getArgument());
 
               
-                WSDL11Validator wsdlValidator = new WSDL11Validator(null, env);
+                WSDL11Validator wsdlValidator = new WSDL11Validator(null, env, getBus());
                 if (wsdlValidator.isValid()) {
                     System.out.println("Passed Validation : Valid WSDL ");
                 }

Modified: incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/AbstractDefinitionValidator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/AbstractDefinitionValidator.java?rev=590644&r1=590643&r2=590644&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/AbstractDefinitionValidator.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/AbstractDefinitionValidator.java
Wed Oct 31 05:22:01 2007
@@ -21,30 +21,45 @@
 
 import javax.wsdl.Definition;
 import javax.xml.stream.Location;
+
+import org.apache.cxf.Bus;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.validator.AbstractValidator;
 
 public abstract class AbstractDefinitionValidator extends AbstractValidator {
+    
     protected final Definition def;
     protected ToolContext env;
+    
+    private final Bus bus;
 
     public AbstractDefinitionValidator() {
         super();
         this.def = null;
+        this.bus = null;
     }
 
     public AbstractDefinitionValidator(final Definition definition) {
-        this.def = definition;
+        this(definition, null, null);
+    }
+
+    public AbstractDefinitionValidator(final Definition definition, final Bus b) {
+        this(definition, null, b);
     }
 
-    public AbstractDefinitionValidator(final Definition definition, ToolContext pEnv) {
+    public AbstractDefinitionValidator(final Definition definition, final ToolContext pEnv,
final Bus b) {
         this.def = definition;
         this.env = pEnv;
+        this.bus = b;
     }
 
     public void addError(Location loc, String msg) {
         String errMsg = loc != null ? "line " + loc.getLineNumber() + " of " : "";
         errMsg = errMsg + def.getDocumentBaseURI() + " " + msg;
         addErrorMessage(errMsg);
+    }
+
+    public Bus getBus() {
+        return this.bus;
     }
 }

Modified: incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java?rev=590644&r1=590643&r2=590644&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDL11Validator.java
Wed Oct 31 05:22:01 2007
@@ -41,6 +41,7 @@
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
 
+import org.apache.cxf.Bus;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
@@ -57,11 +58,15 @@
     private final List<AbstractValidator> validators = new ArrayList<AbstractValidator>();
 
     public WSDL11Validator(final Definition definition) {
-        super(definition);
+        this(definition, null);
     }
 
-    public WSDL11Validator(final Definition definition, ToolContext pe) {
-        super(definition, pe);
+    public WSDL11Validator(final Definition definition, final ToolContext pe) {
+        this(definition, pe, null);
+    }
+
+    public WSDL11Validator(final Definition definition, final ToolContext pe, final Bus b)
{
+        super(definition, pe, b);
     }
 
     private Document getWSDLDoc(String wsdl) {
@@ -91,7 +96,7 @@
         if (doc == null) {
             return true;
         }
-        WSDLRefValidator wsdlRefValidator = new WSDLRefValidator(wsdl, doc);
+        WSDLRefValidator wsdlRefValidator = new WSDLRefValidator(wsdl, doc, getBus());
         wsdlRefValidator.setSuppressWarnings(env.optionSet(ToolConstants.CFG_SUPPRESS_WARNINGS));
         Definition wsdlDef = wsdlRefValidator.getDefinition();        
         validators.add(wsdlRefValidator);

Modified: incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java?rev=590644&r1=590643&r2=590644&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSDLRefValidator.java
Wed Oct 31 05:22:01 2007
@@ -45,6 +45,7 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 
+import org.apache.cxf.Bus;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
@@ -94,7 +95,15 @@
     }
 
     public WSDLRefValidator(final String wsdl, final Document doc) {
+        this(wsdl, doc, null);
+    }
+
+    public WSDLRefValidator(final String wsdl, final Document doc, final Bus b) {
         WSDLDefinitionBuilder wsdlBuilder = new WSDLDefinitionBuilder();
+        if (b != null) {
+            wsdlBuilder.setBus(b);
+        }
+
         try {
             this.definition = wsdlBuilder.build(wsdl);
             if (wsdlBuilder.getImportedDefinitions().size() > 0) {

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java?rev=590644&r1=590643&r2=590644&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
Wed Oct 31 05:22:01 2007
@@ -22,7 +22,6 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.URI;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -40,8 +39,6 @@
 import org.w3c.dom.Element;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.BusFactory;
-import org.apache.cxf.catalog.OASISCatalogManager;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.PropertiesLoaderUtils;
@@ -71,9 +68,6 @@
 import org.apache.cxf.wsdl11.WSDLServiceBuilder;
 
 
-
-
-
 public class WSDLToJavaContainer extends AbstractCXFToolContainer {
 
     protected static final Logger LOG = LogUtils.getL7dLogger(WSDLToJavaContainer.class);
@@ -98,29 +92,6 @@
         return WSDLConstants.getVersion(version);
     }
 
-    public Bus getBus() {
-        Bus bus = BusFactory.getDefaultBus();
-
-        OASISCatalogManager catalogManager = bus.getExtension(OASISCatalogManager.class);
-        
-        String catalogLocation = getCatalogURL();
-        if (!StringUtils.isEmpty(catalogLocation)) {
-            try {
-                catalogManager.loadCatalog(new URI(catalogLocation).toURL());
-            } catch (Exception e) {
-                e.printStackTrace();
-                throw new ToolException(new Message("FOUND_NO_FRONTEND", LOG, catalogLocation));
-            }
-        }
-
-        return bus;
-    }
-
-    protected String getCatalogURL() {
-        String catalogLocation = (String) context.get(ToolConstants.CFG_CATALOG);
-        return URIParserUtil.getAbsoluteURI(catalogLocation);
-    }
-
     @SuppressWarnings("unchecked")
     public void execute() throws ToolException {
         if (!hasInfoOption()) {
@@ -154,10 +125,7 @@
 
                     context.put(Definition.class, definition);
 
-                    // Revisit validator doesn't support catalog
-                    if (!context.optionSet(ToolConstants.CFG_CATALOG)) {
-                        builder.validate(definition);
-                    }
+                    builder.validate(definition);
 
                     WSDLServiceBuilder serviceBuilder = new WSDLServiceBuilder(getBus());
                     serviceBuilder.setCatalogResolvedMap(builder.getCataLogResolvedMap());

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java?rev=590644&r1=590643&r2=590644&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/wsdl11/JAXWSDefinitionBuilder.java
Wed Oct 31 05:22:01 2007
@@ -195,7 +195,7 @@
 
 
     public boolean validate(final Definition def) throws ToolException {
-        return new WSDL11Validator(def, context).isValid();
+        return new WSDL11Validator(def, context, bus).isValid();
     }
     
     



Mime
View raw message