ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1719517 - in /webservices/axiom/trunk/buildutils/shade-axiom-xml/src/main/java/org/apache/axiom/buildutils/shade/axiomxml: AxiomXmlResourceTransformer.java DOMUtils.java
Date Fri, 11 Dec 2015 19:58:13 GMT
Author: veithen
Date: Fri Dec 11 19:58:13 2015
New Revision: 1719517

URL: http://svn.apache.org/viewvc?rev=1719517&view=rev
Log:
Modify shade-axiom-xml so that it supports relocations in addition to file merging.

Modified:
    webservices/axiom/trunk/buildutils/shade-axiom-xml/src/main/java/org/apache/axiom/buildutils/shade/axiomxml/AxiomXmlResourceTransformer.java
    webservices/axiom/trunk/buildutils/shade-axiom-xml/src/main/java/org/apache/axiom/buildutils/shade/axiomxml/DOMUtils.java

Modified: webservices/axiom/trunk/buildutils/shade-axiom-xml/src/main/java/org/apache/axiom/buildutils/shade/axiomxml/AxiomXmlResourceTransformer.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/buildutils/shade-axiom-xml/src/main/java/org/apache/axiom/buildutils/shade/axiomxml/AxiomXmlResourceTransformer.java?rev=1719517&r1=1719516&r2=1719517&view=diff
==============================================================================
--- webservices/axiom/trunk/buildutils/shade-axiom-xml/src/main/java/org/apache/axiom/buildutils/shade/axiomxml/AxiomXmlResourceTransformer.java
(original)
+++ webservices/axiom/trunk/buildutils/shade-axiom-xml/src/main/java/org/apache/axiom/buildutils/shade/axiomxml/AxiomXmlResourceTransformer.java
Fri Dec 11 19:58:13 2015
@@ -27,7 +27,9 @@ import java.util.jar.JarOutputStream;
 import org.apache.maven.plugins.shade.relocation.Relocator;
 import org.apache.maven.plugins.shade.resource.ResourceTransformer;
 import org.w3c.dom.Document;
+import org.w3c.dom.Element;
 import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 
 /**
  * Merges <tt>META-INF/axiom.xml</tt> files.
@@ -48,6 +50,17 @@ public class AxiomXmlResourceTransformer
     public void processResource(String resource, InputStream is, List<Relocator> relocators)
throws IOException {
         Document axiomXml = DOMUtils.parse(is);
         is.close();
+        NodeList implementations = axiomXml.getElementsByTagNameNS("http://ws.apache.org/axiom/",
"implementation");
+        for (int i=0; i<implementations.getLength(); i++) {
+            Element implementation = (Element)implementations.item(i);
+            String loader = implementation.getAttributeNS(null, "loader");
+            for (Relocator relocator : relocators) {
+                if (relocator.canRelocateClass(loader)) {
+                    implementation.setAttributeNS(null, "loader", relocator.relocateClass(loader));
+                    break;
+                }
+            }
+        }
         if (mergedAxiomXml == null) {
             mergedAxiomXml = axiomXml;
         } else {

Modified: webservices/axiom/trunk/buildutils/shade-axiom-xml/src/main/java/org/apache/axiom/buildutils/shade/axiomxml/DOMUtils.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/buildutils/shade-axiom-xml/src/main/java/org/apache/axiom/buildutils/shade/axiomxml/DOMUtils.java?rev=1719517&r1=1719516&r2=1719517&view=diff
==============================================================================
--- webservices/axiom/trunk/buildutils/shade-axiom-xml/src/main/java/org/apache/axiom/buildutils/shade/axiomxml/DOMUtils.java
(original)
+++ webservices/axiom/trunk/buildutils/shade-axiom-xml/src/main/java/org/apache/axiom/buildutils/shade/axiomxml/DOMUtils.java
Fri Dec 11 19:58:13 2015
@@ -37,7 +37,9 @@ public final class DOMUtils {
     
     public static Document parse(InputStream is) throws IOException {
         try {
-            return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(is);
+            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            factory.setNamespaceAware(true);
+            return factory.newDocumentBuilder().parse(is);
         } catch (SAXException ex) {
             throw toIOException(ex);
         } catch (ParserConfigurationException ex) {



Mime
View raw message