Author: asoldano
Date: 2014-09-11 10:28:47 -0400 (Thu, 11 Sep 2014)
New Revision: 18923
Modified:
common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/WSConsumeTask.java
common-tools/trunk/src/main/java/org/jboss/ws/tools/cmd/WSConsume.java
common-tools/trunk/src/test/java/org/jboss/test/ws/tools/CmdConsumeTracker.java
Log:
[JBWS-3826] Adding encoding option to WSConsume Ant task and script
Modified: common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/WSConsumeTask.java
===================================================================
--- common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/WSConsumeTask.java 2014-09-11
14:27:43 UTC (rev 18922)
+++ common-tools/trunk/src/main/java/org/jboss/ws/tools/ant/WSConsumeTask.java 2014-09-11
14:28:47 UTC (rev 18923)
@@ -89,6 +89,7 @@
private File catalog;
private File clientjar;
private String wsdlLocation;
+ private String encoding;
private String targetPackage;
private boolean keep;
private boolean extension;
@@ -185,6 +186,11 @@
this.wsdlLocation = wsdlLocation;
}
+ public void setEncoding(String encoding)
+ {
+ this.encoding = encoding;
+ }
+
public void addConfiguredBinding(FileSet fs)
{
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
@@ -218,6 +224,8 @@
consumer.setWsdlLocation(wsdlLocation);
if (clientjar != null)
consumer.setClientJar(clientjar);
+ if (encoding != null)
+ consumer.setEncoding(encoding);
if (catalog != null)
{
if (catalog.exists() && catalog.isFile())
@@ -342,6 +350,12 @@
command.createArgument().setValue("-w");
command.createArgument().setValue(wsdlLocation);
}
+
+ if (encoding != null)
+ {
+ command.createArgument().setValue("--encoding");
+ command.createArgument().setValue(encoding);
+ }
if (destdir != null)
{
Modified: common-tools/trunk/src/main/java/org/jboss/ws/tools/cmd/WSConsume.java
===================================================================
--- common-tools/trunk/src/main/java/org/jboss/ws/tools/cmd/WSConsume.java 2014-09-11
14:27:43 UTC (rev 18922)
+++ common-tools/trunk/src/main/java/org/jboss/ws/tools/cmd/WSConsume.java 2014-09-11
14:28:47 UTC (rev 18923)
@@ -49,17 +49,18 @@
* <tr><td>-k, --keep
</td><td>Keep/Generate Java source</td></tr>
* <tr><td>-c, --catalog=<file>
</td><td>Oasis XML Catalog file for entity resolution</td></tr>
* <tr><td>-p, --package=<name> </td><td>The
target package for generated source</td></tr>
- * <tr><td>-j, --clientjar=<name>
</td><td>Create a jar file of the generated artifacts for calling the
webservice</td></tr>
+ * <tr><td>-j, --clientjar=<name>
</td><td>Create a jar file of the generated artifacts for calling the
webservice</td></tr>
* <tr><td>-w, --wsdlLocation=<loc>
</td><td>Value to use for @(a)WebService.wsdlLocation</td></tr>
* <tr><td>-o, --output=<directory> </td><td>The
directory to put generated artifacts</td></tr>
* <tr><td>-s, --source=<directory> </td><td>The
directory to put Java source</td></tr>
- * <tr><td>-t, --target=<2.1|2.2></td><td>The
target specification target</td></tr>
+ * <tr><td>-t, --target=<2.1|2.2> </td><td>The
target specification target</td></tr>
* <tr><td>-n, --nocompile </td><td>Do not
compile generated sources</td></tr>
* <tr><td>-q, --quiet </td><td>Be somewhat
more quiet</td></tr>
* <tr><td>-v, --verbose </td><td>Show full
exception stack traces</td></tr>
* <tr><td>-l, --load-consumer </td><td>Load the
consumer and exit (debug utility)</td></tr>
* <tr><td>-e, --extension </td><td>Enable SOAP
1.2 binding extension</td></tr>
- * <tr><td>-a, --additionalHeaders </td><td>Enable SOAP
1.2 binding extension</td></tr>
+ * <tr><td>-a, --additionalHeaders </td><td>Enable
processing of implicit SOAP headers</td></tr>
+ * <tr><td>-d, --encoding=<charset> </td><td>The
charset encoding to use for generated sources</td></tr>
* </table>
* </pre>
*
@@ -73,6 +74,7 @@
private File catalog;
private String targetPackage;
private String wsdlLocation;
+ private String encoding;
private boolean quiet;
private boolean verbose;
private boolean loadConsumer;
@@ -108,7 +110,7 @@
private URL parseArguments(String[] args)
{
- String shortOpts = "b:c:p:w:o:s:t:j:khqvlnea";
+ String shortOpts = "b:c:p:w:d:o:s:t:j:khqvlnea";
LongOpt[] longOpts =
{
new LongOpt("binding", LongOpt.REQUIRED_ARGUMENT, null, 'b'),
@@ -127,6 +129,7 @@
new LongOpt("additionalHeaders", LongOpt.NO_ARGUMENT, null,
'a'),
new LongOpt("load-consumer", LongOpt.NO_ARGUMENT, null, 'l'),
new LongOpt("clientjar", LongOpt.REQUIRED_ARGUMENT, null,
'j'),
+ new LongOpt("encoding", LongOpt.REQUIRED_ARGUMENT, null,
'd'),
};
Getopt getopt = new Getopt(PROGRAM_NAME, args, shortOpts, longOpts);
@@ -150,6 +153,9 @@
case 'w':
wsdlLocation = getopt.getOptarg();
break;
+ case 'd':
+ encoding = getopt.getOptarg();
+ break;
case 'o':
outputDir = new File(getopt.getOptarg());
break;
@@ -274,6 +280,9 @@
if (wsdlLocation != null)
consumer.setWsdlLocation(wsdlLocation);
+
+ if (encoding != null)
+ consumer.setEncoding(encoding);
if (bindingFiles != null && bindingFiles.size() > 0)
consumer.setBindingFiles(bindingFiles);
@@ -333,6 +342,7 @@
out.println(" -l, --load-consumer Load the consumer and exit (debug
utility)");
out.println(" -e, --extension Enable SOAP 1.2 binding
extension");
out.println(" -a, --additionalHeaders Enable processing of implicit
SOAP headers");
+ out.println(" -d --encoding=<charset> The charset encoding to use
for generated sources");
out.println(" -n, --nocompile Do not compile generated
sources");
out.flush();
}
Modified: common-tools/trunk/src/test/java/org/jboss/test/ws/tools/CmdConsumeTracker.java
===================================================================
---
common-tools/trunk/src/test/java/org/jboss/test/ws/tools/CmdConsumeTracker.java 2014-09-11
14:27:43 UTC (rev 18922)
+++
common-tools/trunk/src/test/java/org/jboss/test/ws/tools/CmdConsumeTracker.java 2014-09-11
14:28:47 UTC (rev 18923)
@@ -76,6 +76,12 @@
{
LAST_EVENT += "setWsdlLocation";
}
+
+ @Override
+ public void setEncoding(String encoding)
+ {
+ LAST_EVENT += "setEncoding";
+ }
@Override
public void setMessageStream(PrintStream messageStream)