geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r703174 - in /geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder: JAXWSTools.java WsdlGenerator.java
Date Thu, 09 Oct 2008 14:44:03 GMT
Author: gawor
Date: Thu Oct  9 07:44:03 2008
New Revision: 703174

URL: http://svn.apache.org/viewvc?rev=703174&view=rev
Log:
get wsgen working ok when invoked in non-forked mode

Modified:
    geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSTools.java
    geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/WsdlGenerator.java

Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSTools.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSTools.java?rev=703174&r1=703173&r2=703174&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSTools.java
(original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/JAXWSTools.java
Thu Oct  9 07:44:03 2008
@@ -22,13 +22,13 @@
 import java.lang.reflect.Method;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.net.URLClassLoader;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.SortedSet;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.apache.geronimo.kernel.classloader.JarFileClassLoader;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ListableRepository;
 import org.apache.geronimo.kernel.repository.Repository;
@@ -70,6 +70,7 @@
 
     private Artifact saajImpl;
     private boolean overrideContextClassLoader;
+    private ClassLoader parentClassLoader;
     
     public JAXWSTools() {
     }
@@ -90,6 +91,14 @@
         return this.overrideContextClassLoader;
     }
        
+    public void setParentClassLoader(ClassLoader parentClassLoader) {
+        this.parentClassLoader = parentClassLoader;    
+    }
+    
+    public ClassLoader getParentClassLoader() {
+        return this.parentClassLoader;
+    }
+    
     public static URL[] toURL(File[] jars) throws MalformedURLException {
         URL [] urls = new URL[jars.length];
         for (int i = 0; i < jars.length; i++) {
@@ -177,8 +186,9 @@
         return invoke("wsimport", jars, os, arguments);
     }
     
-    private boolean invoke(String toolName, URL[] jars, OutputStream os, String[] arguments)
throws Exception {        
-        URLClassLoader loader = new URLClassLoader(jars, ClassLoader.getSystemClassLoader());
+    private boolean invoke(String toolName, URL[] jars, OutputStream os, String[] arguments)
throws Exception {
+        ClassLoader parent = (this.parentClassLoader == null) ? getClass().getClassLoader()
: this.parentClassLoader;
+        JarFileClassLoader loader = new JarFileClassLoader(null, jars, parent);
         if (this.overrideContextClassLoader) {
             ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
             Thread.currentThread().setContextClassLoader(loader);
@@ -186,9 +196,14 @@
                 return invoke(toolName, loader, os, arguments);
             } finally {
                 Thread.currentThread().setContextClassLoader(oldClassLoader);
+                loader.destroy();
             }            
         } else {
-            return invoke(toolName, loader, os, arguments);
+            try {
+                return invoke(toolName, loader, os, arguments);
+            } finally {
+                loader.destroy();
+            }
         }
     }
     

Modified: geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/WsdlGenerator.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/WsdlGenerator.java?rev=703174&r1=703173&r2=703174&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/WsdlGenerator.java
(original)
+++ geronimo/server/trunk/plugins/jaxws/geronimo-jaxws-builder/src/main/java/org/apache/geronimo/jaxws/builder/WsdlGenerator.java
Thu Oct  9 07:44:03 2008
@@ -103,6 +103,7 @@
     
     public WsdlGenerator() {
         this.jaxwsTools = new JAXWSTools();
+        this.jaxwsTools.setOverrideContextClassLoader(true);
     }
     
     public void setSunSAAJ() {



Mime
View raw message