cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1513219 - in /cxf/trunk: common/ common/xerces-xsd-validation/ common/xerces-xsd-validation/src/main/java/org/apache/cxf/xsdvalidation/ common/xerces-xsd-validation/src/main/resources/META-INF/cxf/ core/src/main/java/org/apache/cxf/common/...
Date Mon, 12 Aug 2013 18:35:28 GMT
Author: dkulp
Date: Mon Aug 12 18:35:28 2013
New Revision: 1513219

URL: http://svn.apache.org/r1513219
Log:
Get rid of the xerces-xsd-validation module (integrate into the only place using it)

Added:
    cxf/trunk/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/XercesSchemaValidationUtils.java
      - copied, changed from r1513193, cxf/trunk/common/xerces-xsd-validation/src/main/java/org/apache/cxf/xsdvalidation/XercesSchemaValidationUtils.java
    cxf/trunk/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/XercesXsdValidationImpl.java
      - copied, changed from r1513193, cxf/trunk/common/xerces-xsd-validation/src/main/java/org/apache/cxf/xsdvalidation/XercesXsdValidationImpl.java
Removed:
    cxf/trunk/common/xerces-xsd-validation/pom.xml
    cxf/trunk/common/xerces-xsd-validation/src/main/java/org/apache/cxf/xsdvalidation/DOMLSInput.java
    cxf/trunk/common/xerces-xsd-validation/src/main/java/org/apache/cxf/xsdvalidation/XercesSchemaValidationUtils.java
    cxf/trunk/common/xerces-xsd-validation/src/main/java/org/apache/cxf/xsdvalidation/XercesXsdValidationImpl.java
    cxf/trunk/common/xerces-xsd-validation/src/main/resources/META-INF/cxf/bus-extensions.txt
    cxf/trunk/core/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaValidationManager.java
Modified:
    cxf/trunk/common/pom.xml
    cxf/trunk/core/src/test/java/org/apache/cxf/common/xmlschema/DOMLSInput.java
    cxf/trunk/rt/frontend/simple/pom.xml
    cxf/trunk/rt/wsdl/pom.xml
    cxf/trunk/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/ReflectionServiceFactoryBean.java

Modified: cxf/trunk/common/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/common/pom.xml?rev=1513219&r1=1513218&r2=1513219&view=diff
==============================================================================
--- cxf/trunk/common/pom.xml (original)
+++ cxf/trunk/common/pom.xml Mon Aug 12 18:35:28 2013
@@ -34,7 +34,6 @@
 
     <modules>
         <module>wstx-msv-validation</module>
-        <module>xerces-xsd-validation</module>
     </modules>
 
 </project>

Modified: cxf/trunk/core/src/test/java/org/apache/cxf/common/xmlschema/DOMLSInput.java
URL: http://svn.apache.org/viewvc/cxf/trunk/core/src/test/java/org/apache/cxf/common/xmlschema/DOMLSInput.java?rev=1513219&r1=1513218&r2=1513219&view=diff
==============================================================================
--- cxf/trunk/core/src/test/java/org/apache/cxf/common/xmlschema/DOMLSInput.java (original)
+++ cxf/trunk/core/src/test/java/org/apache/cxf/common/xmlschema/DOMLSInput.java Mon Aug 12
18:35:28 2013
@@ -21,19 +21,15 @@ package org.apache.cxf.common.xmlschema;
 
 import java.io.InputStream;
 import java.io.Reader;
-import java.io.StringWriter;
 import java.util.logging.Logger;
 
-import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.ls.LSInput;
 
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.staxutils.StaxUtils;
 
 /**
  * 
@@ -45,14 +41,7 @@ class DOMLSInput implements LSInput {
     
     DOMLSInput(Document doc, String systemId) throws TransformerException {
         this.systemId = systemId;
-        TransformerFactory factory = TransformerFactory.newInstance();
-        Transformer transformer = factory.newTransformer();
-        DOMSource source = new DOMSource(doc);
-        source.setSystemId(systemId);
-        StringWriter writer = new StringWriter();
-        StreamResult result = new StreamResult(writer);
-        transformer.transform(source, result);
-        data = writer.toString();
+        data = StaxUtils.toString(doc);
         LOG.fine(systemId + ": " + data);
         
     }

Modified: cxf/trunk/rt/frontend/simple/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/pom.xml?rev=1513219&r1=1513218&r2=1513219&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/pom.xml (original)
+++ cxf/trunk/rt/frontend/simple/pom.xml Mon Aug 12 18:35:28 2013
@@ -122,15 +122,6 @@
             <version>${project.version}</version>
             <optional>true</optional>
         </dependency>
-
-        <!-- if this is present, then the validation feature
-             will check W3C schema if Xerces is available. -->
-        <dependency>
-            <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-xerces-xsd-validation</artifactId>
-            <version>${project.version}</version>
-            <optional>true</optional>
-        </dependency>
     </dependencies>
 
 

Modified: cxf/trunk/rt/wsdl/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/wsdl/pom.xml?rev=1513219&r1=1513218&r2=1513219&view=diff
==============================================================================
--- cxf/trunk/rt/wsdl/pom.xml (original)
+++ cxf/trunk/rt/wsdl/pom.xml Mon Aug 12 18:35:28 2013
@@ -75,6 +75,12 @@
             <artifactId>spring-context</artifactId>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>xerces</groupId>
+            <artifactId>xercesImpl</artifactId>
+            <scope>provided</scope>
+            <optional>true</optional>
+        </dependency>
     </dependencies>
     
     <build>

Modified: cxf/trunk/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/ReflectionServiceFactoryBean.java?rev=1513219&r1=1513218&r2=1513219&view=diff
==============================================================================
--- cxf/trunk/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/ReflectionServiceFactoryBean.java
(original)
+++ cxf/trunk/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/ReflectionServiceFactoryBean.java
Mon Aug 12 18:35:28 2013
@@ -71,7 +71,6 @@ import org.apache.cxf.common.util.String
 import org.apache.cxf.common.util.SystemPropertyAction;
 import org.apache.cxf.common.xmlschema.SchemaCollection;
 import org.apache.cxf.common.xmlschema.XmlSchemaUtils;
-import org.apache.cxf.common.xmlschema.XmlSchemaValidationManager;
 import org.apache.cxf.databinding.DataBinding;
 import org.apache.cxf.databinding.source.mime.MimeAttribute;
 import org.apache.cxf.databinding.source.mime.MimeSerializer;
@@ -560,12 +559,8 @@ public class ReflectionServiceFactoryBea
 
     public void validateServiceModel() {
 
-        XmlSchemaValidationManager xsdValidator = getBus().getExtension(XmlSchemaValidationManager.class);
-
         for (ServiceInfo si : getService().getServiceInfos()) {
-            if (xsdValidator != null) {
-                validateSchemas(xsdValidator, si.getXmlSchemaCollection());
-            }
+            validateSchemas(si.getXmlSchemaCollection());
 
             for (OperationInfo opInfo : si.getInterface().getOperations()) {
                 for (MessagePartInfo mpi : opInfo.getInput().getMessageParts()) {
@@ -622,10 +617,10 @@ public class ReflectionServiceFactoryBea
         }
     }
 
-    private void validateSchemas(XmlSchemaValidationManager xsdValidator,
-                                 SchemaCollection xmlSchemaCollection) {
+    private void validateSchemas(SchemaCollection xmlSchemaCollection) {
         final StringBuilder errorBuilder = new StringBuilder();
-        xsdValidator.validateSchemas(xmlSchemaCollection.getXmlSchemaCollection(), new DOMErrorHandler()
{
+        XercesXsdValidationImpl v = new XercesXsdValidationImpl();
+        v.validateSchemas(xmlSchemaCollection.getXmlSchemaCollection(), new DOMErrorHandler()
{
             public boolean handleError(DOMError error) {
                 errorBuilder.append(error.getMessage());
                 LOG.warning(error.getMessage());

Copied: cxf/trunk/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/XercesSchemaValidationUtils.java
(from r1513193, cxf/trunk/common/xerces-xsd-validation/src/main/java/org/apache/cxf/xsdvalidation/XercesSchemaValidationUtils.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/XercesSchemaValidationUtils.java?p2=cxf/trunk/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/XercesSchemaValidationUtils.java&p1=cxf/trunk/common/xerces-xsd-validation/src/main/java/org/apache/cxf/xsdvalidation/XercesSchemaValidationUtils.java&r1=1513193&r2=1513219&rev=1513219&view=diff
==============================================================================
--- cxf/trunk/common/xerces-xsd-validation/src/main/java/org/apache/cxf/xsdvalidation/XercesSchemaValidationUtils.java
(original)
+++ cxf/trunk/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/XercesSchemaValidationUtils.java
Mon Aug 12 18:35:28 2013
@@ -17,8 +17,10 @@
  * under the License.
  */
 
-package org.apache.cxf.xsdvalidation;
+package org.apache.cxf.wsdl.service.factory;
 
+import java.io.InputStream;
+import java.io.Reader;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -32,6 +34,7 @@ import org.w3c.dom.Document;
 import org.w3c.dom.ls.LSInput;
 import org.w3c.dom.ls.LSResourceResolver;
 
+import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.XmlSchemaCollection;
 import org.apache.ws.commons.schema.XmlSchemaSerializer;
@@ -64,6 +67,89 @@ class XercesSchemaValidationUtils {
         }
     }
     
+    class DOMLSInput implements LSInput {
+        private String systemId;
+        private String data;
+        
+        DOMLSInput(Document doc, String systemId) throws TransformerException {
+            this.systemId = systemId;
+            data = StaxUtils.toString(doc);           
+        }
+
+        /** {@inheritDoc}*/
+        public String getBaseURI() {
+            return null;
+        }
+
+        /** {@inheritDoc}*/
+        public InputStream getByteStream() {
+            return null;
+        }
+
+        /** {@inheritDoc}*/
+        public boolean getCertifiedText() {
+            return false;
+        }
+
+        /** {@inheritDoc}*/
+        public Reader getCharacterStream() {
+            return null;
+        }
+
+        /** {@inheritDoc}*/
+        public String getEncoding() {
+            return "utf-8";
+        }
+
+        /** {@inheritDoc}*/
+        public String getPublicId() {
+            return null;
+        }
+
+        /** {@inheritDoc}*/
+        public String getStringData() {
+            return data;
+        }
+
+        /** {@inheritDoc}*/
+        public String getSystemId() {
+            return systemId;
+        }
+
+        /** {@inheritDoc}*/
+        public void setBaseURI(String baseURI) {
+        }
+
+        /** {@inheritDoc}*/
+        public void setByteStream(InputStream byteStream) {
+        }
+
+        /** {@inheritDoc}*/
+        public void setCertifiedText(boolean certifiedText) {
+        }
+
+        /** {@inheritDoc}*/
+        public void setCharacterStream(Reader characterStream) {
+        }
+
+        /** {@inheritDoc}*/
+        public void setEncoding(String encoding) {
+        }
+
+        /** {@inheritDoc}*/
+        public void setPublicId(String publicId) {
+        }
+
+        /** {@inheritDoc}*/
+        public void setStringData(String stringData) {
+        }
+
+        /** {@inheritDoc}*/
+        public void setSystemId(String systemId) {
+        }
+    }
+    
+    
     private XSImplementation impl;
 
     XercesSchemaValidationUtils() {

Copied: cxf/trunk/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/XercesXsdValidationImpl.java
(from r1513193, cxf/trunk/common/xerces-xsd-validation/src/main/java/org/apache/cxf/xsdvalidation/XercesXsdValidationImpl.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/XercesXsdValidationImpl.java?p2=cxf/trunk/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/XercesXsdValidationImpl.java&p1=cxf/trunk/common/xerces-xsd-validation/src/main/java/org/apache/cxf/xsdvalidation/XercesXsdValidationImpl.java&r1=1513193&r2=1513219&rev=1513219&view=diff
==============================================================================
--- cxf/trunk/common/xerces-xsd-validation/src/main/java/org/apache/cxf/xsdvalidation/XercesXsdValidationImpl.java
(original)
+++ cxf/trunk/rt/wsdl/src/main/java/org/apache/cxf/wsdl/service/factory/XercesXsdValidationImpl.java
Mon Aug 12 18:35:28 2013
@@ -17,58 +17,37 @@
  * under the License.
  */
 
-package org.apache.cxf.xsdvalidation;
+package org.apache.cxf.wsdl.service.factory;
 
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import javax.annotation.Resource;
 import javax.xml.transform.TransformerException;
 
 import org.w3c.dom.DOMErrorHandler;
 
-import org.apache.cxf.Bus;
-import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.common.xmlschema.XmlSchemaValidationManager;
 import org.apache.ws.commons.schema.XmlSchemaCollection;
 import org.apache.ws.commons.schema.XmlSchemaSerializer.XmlSchemaSerializerException;
 
-/**
- * 
- */
-@NoJSR250Annotations(unlessNull = "bus")
-public class XercesXsdValidationImpl implements XmlSchemaValidationManager {
+class XercesXsdValidationImpl  {
     private static final Logger LOG = LogUtils.getL7dLogger(XercesXsdValidationImpl.class);
-
-    private Bus bus;
     private XercesSchemaValidationUtils utils;
 
     public XercesXsdValidationImpl() {
-    }
-    
-    public XercesXsdValidationImpl(Bus b) {
-        setBus(b);
-    }
-    
-    @Resource
-    public final void setBus(Bus b) {
-        bus = b;
-
         try {
             utils = new XercesSchemaValidationUtils();
-        } catch (Exception e) {
+        } catch (Throwable e) {
             /* If the dependencies are missing ... */
             return;
         }
-
-        if (null != bus) {
-            bus.setExtension(this, XmlSchemaValidationManager.class);
-        }
     }
 
     /** {@inheritDoc} */
     public void validateSchemas(XmlSchemaCollection schemas, DOMErrorHandler errorHandler)
{
+        if (utils == null) {
+            return;
+        }
         try {
             utils.tryToParseSchemas(schemas, errorHandler);
         } catch (XmlSchemaSerializerException e) {



Mime
View raw message