You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2006/10/15 09:39:08 UTC

svn commit: r464143 - /webservices/axis2/branches/java/1_1/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLTask.java

Author: dims
Date: Sun Oct 15 00:39:06 2006
New Revision: 464143

URL: http://svn.apache.org/viewvc?view=rev&rev=464143
Log:
support for embedded classpath tags in ant, get rid of classpathURI"

Modified:
    webservices/axis2/branches/java/1_1/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLTask.java

Modified: webservices/axis2/branches/java/1_1/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLTask.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLTask.java?view=diff&rev=464143&r1=464142&r2=464143
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLTask.java (original)
+++ webservices/axis2/branches/java/1_1/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLTask.java Sun Oct 15 00:39:06 2006
@@ -3,6 +3,8 @@
 import org.apache.tools.ant.AntClassLoader;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Reference;
 import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption;
 
 import java.util.HashMap;
@@ -28,14 +30,13 @@
 
     private String className = null;
     private String outputLocation = null;
-    private String classpathURI = null;
     private String targetNamespace = null;
     private String targetNamespacePrefix = null;
     private String schemaTargetNamespace = null;
     private String schemaTargetNamespacePrefix = null;
     private String serviceName = null;
     private String outputFileName = null;
-    private String classPath = null;
+    private Path classpath = null;
 
     /**
      *
@@ -69,9 +70,6 @@
                 Java2WSDLConstants.OUTPUT_LOCATION_OPTION,
                 outputLocation);
 
-        String[] jars = classpathURI.split(";");
-        optionMap.put(Java2WSDLConstants.CLASSPATH_OPTION, new Java2WSDLCommandLineOption(Java2WSDLConstants.CLASSPATH_OPTION, jars));
-
         // Target namespace
         addToOptionMap(optionMap,
                 Java2WSDLConstants.TARGET_NAMESPACE_OPTION,
@@ -134,27 +132,20 @@
 
     public void execute() throws BuildException {
         try {
-            /**
-             * <comment borrowed from AntCodegenTask>
-             *
-             * This needs the ClassLoader we use to load the task have all the dependancies set, hope that
-             * is ok for now
-             *
-             * todo look into this further!!!!!
-             */
 
+            Map commandLineOptions = this.fillOptionMap();
 
-            AntClassLoader cl = new AntClassLoader(
-                    null,
+            AntClassLoader cl = new AntClassLoader(getClass().getClassLoader(),
                     getProject(),
-                    null,
+                    classpath == null ? createClasspath() : classpath,
                     false);
 
+            commandLineOptions.put(Java2WSDLConstants.CLASSPATH_OPTION, new Java2WSDLCommandLineOption(Java2WSDLConstants.CLASSPATH_OPTION, classpath.list()));
+
             Thread.currentThread().setContextClassLoader(cl);
 
             if (outputLocation != null) cl.addPathElement(outputLocation);
 
-            Map commandLineOptions = this.fillOptionMap();
             new Java2WSDLCodegenEngine(commandLineOptions).generate();
 
         } catch (Throwable e) {
@@ -171,10 +162,6 @@
         this.outputLocation = outputLocation;
     }
 
-    public void setClassPathURI(String classpathURI) {
-        this.classpathURI = classpathURI;
-    }
-
     public void setTargetNamespace(String targetNamespace) {
         this.targetNamespace = targetNamespace;
     }
@@ -199,6 +186,36 @@
         this.outputFileName = outputFileName;
     }
 
+    /**
+     * Set the optional classpath
+     *
+     * @param classpath the classpath to use when loading class
+     */
+    public void setClasspath(Path classpath) {
+        createClasspath().append(classpath);
+    }
+
+    /**
+     * Set the optional classpath
+     *
+     * @return a path instance to be configured by the Ant core.
+     */
+    public Path createClasspath() {
+        if (classpath == null) {
+            classpath = new Path(getProject());
+            classpath = classpath.concatSystemClasspath();
+        }
+        return classpath.createPath();
+    }
+
+    /**
+     * Set the reference to an optional classpath
+     *
+     * @param r the id of the Ant path instance to act as the classpath
+     */
+    public void setClasspathRef(Reference r) {
+        createClasspath().setRefid(r);
+    }
 
 }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org