Author: thomas.diesler(a)jboss.com
Date: 2007-07-06 06:19:18 -0400 (Fri, 06 Jul 2007)
New Revision: 3807
Modified:
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/tools/WSContractConsumer.java
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/tools/ant/WSConsumeTask.java
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/tools/cmd/WSConsume.java
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/jaxws/impl/SunRIConsumerImpl.java
Log:
Fix --target switch for wsconsume
Modified:
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/tools/WSContractConsumer.java
===================================================================
---
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/tools/WSContractConsumer.java 2007-07-06
09:32:59 UTC (rev 3806)
+++
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/tools/WSContractConsumer.java 2007-07-06
10:19:18 UTC (rev 3807)
@@ -153,9 +153,9 @@
/**
* Set the target JAX-WS specification revision. Defaults to
<code>2.0</code>
- * @param version the JAX-WS specification version. Allowed values are 2.0, 2.1
+ * @param target the JAX-WS specification version. Allowed values are 2.0, 2.1
*/
- public abstract void setRevision(String version);
+ public abstract void setTarget(String target);
/**
* Generate the required artifacts using the specified WSDL URL. This method
Modified:
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/tools/ant/WSConsumeTask.java
===================================================================
---
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/tools/ant/WSConsumeTask.java 2007-07-06
09:32:59 UTC (rev 3806)
+++
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/tools/ant/WSConsumeTask.java 2007-07-06
10:19:18 UTC (rev 3807)
@@ -1,27 +1,37 @@
/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
package org.jboss.wsf.spi.tools.ant;
-import org.apache.tools.ant.*;
+import java.io.File;
+import java.io.PrintStream;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tools.ant.AntClassLoader;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.ExecuteJava;
import org.apache.tools.ant.taskdefs.LogOutputStream;
import org.apache.tools.ant.types.Commandline;
@@ -30,12 +40,6 @@
import org.apache.tools.ant.types.Path;
import org.jboss.wsf.spi.tools.WSContractConsumer;
-import java.io.File;
-import java.io.PrintStream;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* Ant task which consumes a Web Service contract.
*
@@ -76,25 +80,25 @@
public class WSConsumeTask extends Task
{
private CommandlineJava command = new CommandlineJava();
- private String wsdl = null;
- private File destdir = null;
- private File sourcedestdir = null;
+ private String wsdl;
+ private File destdir;
+ private File sourcedestdir;
private List<File> bindingFiles = new ArrayList<File>();
- private File catalog = null;
- private String wsdlLocation = null;
- private String targetPackage = null;
- private boolean keep = false;
- private boolean verbose = false;
- private boolean fork = false;
- private boolean debug = false;
- private String revision = null;
-
+ private File catalog;
+ private String wsdlLocation;
+ private String targetPackage;
+ private boolean keep;
+ private boolean verbose;
+ private boolean fork;
+ private boolean debug;
+ private String target;
+
// Not actually used right now
public void setDebug(boolean debug)
{
this.debug = debug;
}
-
+
public Commandline.Argument createJvmarg()
{
return command.createVmArgument();
@@ -130,9 +134,9 @@
this.sourcedestdir = sourcedestdir;
}
- public void setRevision(String revision)
+ public void setTarget(String target)
{
- this.revision = revision;
+ this.target = target;
}
public void setPackage(String targetPackage)
@@ -154,7 +158,7 @@
{
this.wsdlLocation = wsdlLocation;
}
-
+
public void addConfiguredBinding(FileSet fs)
{
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
@@ -186,19 +190,19 @@
importer.setCatalog(catalog);
if (bindingFiles != null && bindingFiles.size() > 0)
importer.setBindingFiles(bindingFiles);
- if(revision!=null)
- importer.setRevision(revision);
-
+ if (target != null)
+ importer.setTarget(target);
+
log("Consuming wsdl: " + wsdl, Project.MSG_INFO);
-
+
if (verbose)
{
importer.setMessageStream(new PrintStream(new LogOutputStream(this,
Project.MSG_INFO)));
}
-
+
try
{
- importer.setAdditionalCompilerClassPath(getTaskClassPathStrings());
+ importer.setAdditionalCompilerClassPath(getTaskClassPathStrings());
importer.consume(wsdl);
}
catch (MalformedURLException e)
@@ -216,13 +220,12 @@
{
if (wsdl == null)
throw new BuildException("The wsdl attribute must be specified!",
getLocation());
-
+
if (fork)
executeForked();
- else
- executeNonForked();
+ else executeNonForked();
}
-
+
private Path getTaskClassPath()
{
// Why is everything in the Ant API a big hack???
@@ -231,10 +234,10 @@
{
return new Path(getProject(), ((AntClassLoader)cl).getClasspath());
}
-
+
return new Path(getProject());
}
-
+
private List<String> getTaskClassPathStrings()
{
// Why is everything in the Ant API a big hack???
@@ -245,66 +248,70 @@
for (String string :
((AntClassLoader)cl).getClasspath().split(File.pathSeparator))
strings.add(string);
}
-
+
return strings;
}
private void executeForked() throws BuildException
{
command.setClassname(org.jboss.wsf.spi.tools.cmd.WSConsume.class.getName());
-
+
Path path = command.createClasspath(getProject());
path.append(getTaskClassPath());
-
+
if (keep)
command.createArgument().setValue("-k");
-
+
for (File file : bindingFiles)
{
command.createArgument().setValue("-b");
command.createArgument().setFile(file);
}
-
+
if (catalog != null)
{
command.createArgument().setValue("-c");
command.createArgument().setFile(catalog);
}
-
+
if (targetPackage != null)
{
command.createArgument().setValue("-p");
command.createArgument().setValue(targetPackage);
}
-
+
if (wsdlLocation != null)
{
command.createArgument().setValue("-w");
command.createArgument().setValue(wsdlLocation);
}
-
+
if (destdir != null)
{
command.createArgument().setValue("-o");
command.createArgument().setFile(destdir);
}
-
+
if (sourcedestdir != null)
{
command.createArgument().setValue("-s");
command.createArgument().setFile(sourcedestdir);
}
-
- if (!verbose)
- command.createArgument().setValue("-q");
-
- // Always dump traces
- command.createArgument().setValue("-t");
+
+ if (target != null)
+ {
+ command.createArgument().setValue("-t");
+ command.createArgument().setValue(target);
+ }
+
+ if (verbose)
+ command.createArgument().setValue("-v");
+
command.createArgument().setValue(wsdl);
-
+
if (verbose)
log("Command invoked: " + command.getJavaCommand().toString());
-
+
ExecuteJava execute = new ExecuteJava();
execute.setClasspath(path);
execute.setJavaCommand(command.getJavaCommand());
Modified:
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/tools/cmd/WSConsume.java
===================================================================
---
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/tools/cmd/WSConsume.java 2007-07-06
09:32:59 UTC (rev 3806)
+++
branches/jbossws-2.0/integration/spi/src/main/java/org/jboss/wsf/spi/tools/cmd/WSConsume.java 2007-07-06
10:19:18 UTC (rev 3807)
@@ -30,6 +30,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
/**
@@ -39,18 +40,18 @@
* <pre>
* usage: WSConsumeTask [options] <wsdl-url>
* options:
- * -h, --help Show this help message
- * -b, --binding=<file> One or more JAX-WS or JAXB binding files
- * -k, --keep Keep/Generate Java source
- * -c --catalog=<file> Oasis XML Catalog file for entity
resolution
- * -p --package=<name> The target package for generated source
- * -w --wsdlLocation=<loc> Value to use for @(a)WebService.wsdlLocation
- * -o, --output=<directory> The directory to put generated artifacts
- * -s, --source=<directory> The directory to put Java source
- * -r, --revision=<2.0|2.1> The target specification target
- * -q, --quiet Be somewhat more quiet
- * -t, --show-traces Show full exception stack traces
- * -l, --load-consumer Load the consumer and exit (debug utility)
+ * -h, --help Show this help message
+ * -b, --binding=<file> One or more JAX-WS or JAXB binding files
+ * -k, --keep Keep/Generate Java source
+ * -c --catalog=<file> Oasis XML Catalog file for entity resolution
+ * -p --package=<name> The target package for generated source
+ * -w --wsdlLocation=<loc> Value to use for @(a)WebService.wsdlLocation
+ * -o, --output=<directory> The directory to put generated artifacts
+ * -s, --source=<directory> The directory to put Java source
+ * -t, --target=<2.0|2.1> The target specification target
+ * -q, --quiet Be somewhat more quiet
+ * -v, --verbose Show full exception stack traces
+ * -l, --load-consumer Load the consumer and exit (debug utility)
* </pre>
*
* @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
@@ -64,11 +65,11 @@
private String targetPackage = null;
private String wsdlLocation = null;
private boolean quiet = false;
- private boolean showTraces = false;
+ private boolean verbose = false;
private boolean loadConsumer = false;
private File outputDir = new File("output");
private File sourceDir = null;
- private String revision = null;
+ private String target = null;
public static String PROGRAM_NAME = System.getProperty("program.name",
WSConsume.class.getName());
@@ -81,20 +82,20 @@
private URL parseArguments(String[] args)
{
- String shortOpts = "hb:kc:p:w:o:sr:qtl";
+ String shortOpts = "b:c:p:w:o:s:t:khqvl";
LongOpt[] longOpts =
{
- new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h'),
new LongOpt("binding", LongOpt.REQUIRED_ARGUMENT, null, 'b'),
- new LongOpt("keep", LongOpt.NO_ARGUMENT, null, 'k'),
new LongOpt("catalog", LongOpt.REQUIRED_ARGUMENT, null, 'c'),
new LongOpt("package", LongOpt.REQUIRED_ARGUMENT, null, 'p'),
new LongOpt("wsdlLocation", LongOpt.REQUIRED_ARGUMENT, null,
'w'),
new LongOpt("output", LongOpt.REQUIRED_ARGUMENT, null, 'o'),
new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'),
- new LongOpt("revision", LongOpt.NO_ARGUMENT, null, 'r'),
+ new LongOpt("target", LongOpt.REQUIRED_ARGUMENT, null, 't'),
+ new LongOpt("keep", LongOpt.NO_ARGUMENT, null, 'k'),
+ new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h'),
new LongOpt("quiet", LongOpt.NO_ARGUMENT, null, 'q'),
- new LongOpt("show-traces", LongOpt.NO_ARGUMENT, null, 't'),
+ new LongOpt("verbose", LongOpt.NO_ARGUMENT, null, 'v'),
new LongOpt("load-consumer", LongOpt.NO_ARGUMENT, null, 'l'),
};
@@ -125,14 +126,14 @@
case 's':
sourceDir = new File(getopt.getOptarg());
break;
- case 'r':
- revision = getopt.getOptarg();
+ case 't':
+ target = getopt.getOptarg();
break;
case 'q':
quiet = true;
break;
- case 't':
- showTraces = true;
+ case 'v':
+ verbose = true;
break;
case 'l':
loadConsumer = true;
@@ -208,8 +209,8 @@
if (bindingFiles != null && bindingFiles.size() > 0)
importer.setBindingFiles(bindingFiles);
- if(revision!=null)
- importer.setRevision(revision);
+ if(target!=null)
+ importer.setTarget(target);
try
{
@@ -218,8 +219,8 @@
}
catch (Throwable t)
{
- System.err.println("Error: Could not import. (use --show-traces to see full
traces)");
- if (!showTraces)
+ System.err.println("Error: Could not import. (use --verbose to see full
traces)");
+ if (!verbose)
{
String message = t.getMessage();
if (message == null)
@@ -250,9 +251,9 @@
out.println(" -w --wsdlLocation=<loc> Value to use for
@WebService.wsdlLocation");
out.println(" -o, --output=<directory> The directory to put
generated artifacts");
out.println(" -s, --source=<directory> The directory to put Java
source");
- out.println(" -r, --revision=<2.0|2.1> The JAX-WS specification
target");
+ out.println(" -t, --target=<2.0|2.1> The JAX-WS specification
target");
out.println(" -q, --quiet Be somewhat more quiet");
- out.println(" -t, --show-traces Show full exception stack
traces");
+ out.println(" -v, --verbose Show full exception stack
traces");
out.println(" -l, --load-consumer Load the consumer and exit (debug
utility)");
out.flush();
}
Modified:
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/jaxws/impl/SunRIConsumerImpl.java
===================================================================
---
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/jaxws/impl/SunRIConsumerImpl.java 2007-07-06
09:32:59 UTC (rev 3806)
+++
branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/tools/jaxws/impl/SunRIConsumerImpl.java 2007-07-06
10:19:18 UTC (rev 3807)
@@ -48,7 +48,7 @@
private PrintStream messageStream;
private String wsdlLocation;
private List<String> additionalCompilerClassPath;
- private String version = "2.0";
+ private String target = "2.0";
@Override
public void setBindingFiles(List<File> bindingFiles)
@@ -103,9 +103,9 @@
this.additionalCompilerClassPath = additionalCompilerClassPath;
}
- public void setRevision(String version)
+ public void setTarget(String target)
{
- this.version = version;
+ this.target = target;
}
@Override
@@ -170,12 +170,13 @@
args.add("-d");
args.add(outputDir.getAbsolutePath());
+ // Always set the target
args.add("-target");
- args.add(version);
+ args.add(target);
// finally the WSDL file
args.add(wsdl.toString());
-
+
try
{
// enforce woodstox
@@ -183,7 +184,7 @@
System.setProperty("javax.xml.stream.XMLInputFactory",
"com.ctc.wstx.stax.WstxInputFactory");
WsimportTool compileTool = new WsimportTool(stream);
- boolean success = compileTool.run(args.toArray(new String[0]));
+ boolean success = compileTool.run(args.toArray(new String[args.size()]));
if (!success)
throw new IllegalStateException("WsImport invocation failed");