Fields Summary |
---|
private static final org.apache.tools.ant.util.FileUtils | FILE_UTILSused for timestamp checking |
private File | destFilename of output file (required) |
private String | languagelanguage; defaults to C# |
private boolean | serverflag set to true to generate server side skeleton |
private String | namespacenamespace |
private boolean | failOnErrorflag to control action on execution trouble |
protected String | extraOptionsany extra command options? |
private String | protocolprotocol string. Exact value set depends on SOAP stack version. |
private boolean | ideErrorsshould errors come in an IDE format. This
is WSE only. |
private Vector | schemasfilesets of file to compile |
private Schema | wsdlour WSDL file. |
private Compiler | compilercompiler |
public static final String | ERROR_DEST_FILE_IS_DIRerror message: dest file is a directory |
public static final String | ERROR_NO_DEST_FILEerror message: no dest file |
Methods Summary |
---|
public void | addSchema(org.apache.tools.ant.taskdefs.optional.dotnet.WsdlToDotnet$Schema source)add a new source schema to the compilation
schemas.add(source);
|
public void | execute()do the work by building the command line and then calling it
log("This task is deprecated and will be removed in a future version\n"
+ "of Ant. It is now part of the .NET Antlib:\n"
+ "http://ant.apache.org/antlibs/dotnet/index.html",
Project.MSG_WARN);
if (compiler == null) {
compiler = Compiler.createDefaultCompiler();
}
validate();
NetCommand command = new NetCommand(this,
"WSDL",
compiler.getCommand());
command.setFailOnError(failOnError);
//fill in args
compiler.applyExtraArgs(command);
command.addArgument("/nologo");
command.addArgument("/out:" + destFile);
command.addArgument("/language:", language);
if (server) {
command.addArgument("/server");
}
command.addArgument("/namespace:", namespace);
if (protocol != null) {
command.addArgument("/protocol:" + protocol);
}
if (ideErrors) {
command.addArgument("/parsableErrors");
}
command.addArgument(extraOptions);
//set source and rebuild options
boolean rebuild = true;
long destLastModified = -1;
//rebuild unless the dest file is newer than the source file
if (destFile.exists()) {
destLastModified = destFile.lastModified();
rebuild = isRebuildNeeded(wsdl, destLastModified);
}
String path;
//mark for a rebuild if the dest file is newer
path = wsdl.evaluate();
if (!compiler.supportsAbsoluteFiles() && wsdl.getFile() != null) {
// Mono 1.0's wsdl doesn't deal with absolute paths
File f = wsdl.getFile();
command.setDirectory(f.getParentFile());
path = f.getName();
}
command.addArgument(path);
//add in any extra files.
//this is an error in mono, but we do not warn on it as they may fix that outside
//the ant build cycle.
Iterator it = schemas.iterator();
while (it.hasNext()) {
Schema schema = (Schema) it.next();
//mark for a rebuild if we are newer
rebuild |= isRebuildNeeded(schema, destLastModified);
command.addArgument(schema.evaluate());
}
//conditionally compile
if (rebuild) {
command.runCommand();
}
|
private boolean | isRebuildNeeded(org.apache.tools.ant.taskdefs.optional.dotnet.WsdlToDotnet$Schema schema, long destLastModified)checks for a schema being out of data
if (destLastModified == -1) {
return true;
}
return !FILE_UTILS.isUpToDate(schema.getTimestamp(), destLastModified);
|
public void | setCompiler(org.apache.tools.ant.taskdefs.optional.dotnet.WsdlToDotnet$Compiler compiler)identify the compiler
this.compiler = compiler;
|
public void | setDestFile(java.io.File destFile)Name of the file to generate. Required
this.destFile = destFile;
|
public void | setExtraOptions(java.lang.String extraOptions)Any extra WSDL.EXE options which aren't explicitly
supported by the ant wrapper task; optional
this.extraOptions = extraOptions;
|
public void | setFailOnError(boolean failOnError)Whether or not a failure should halt the build.
Optional - default is true .
this.failOnError = failOnError;
|
public void | setIdeErrors(boolean ideErrors)Defines wether errors are machine parseable.
Optional, default=true
this.ideErrors = ideErrors;
|
public void | setLanguage(java.lang.String language)set the language; one of "CS", "JS", or "VB"
optional, default is CS for C# source
this.language = language;
|
public void | setMakeURL(boolean b)flag to trigger turning a filename into a file:url
ignored for the mono compiler.
wsdl.setMakeURL(b);
|
public void | setNamespace(java.lang.String namespace)namespace to place the source in.
optional; default ""
this.namespace = namespace;
|
public void | setProtocol(java.lang.String protocol)what protocol to use. SOAP, SOAP1.2, HttpPost and HttpGet
are the base options. Different version and implementations may.
offer different options.
this.protocol = protocol;
|
public void | setServer(boolean server)flag to enable server side code generation;
optional, default=false
this.server = server;
|
public void | setSrcFile(java.io.File srcFile)The local WSDL file to parse; either url or srcFile is required.
wsdl.setFile(srcFile);
|
public void | setUrl(java.lang.String url)Sets the URL to fetch. Fetching is by wsdl.exe; Ant proxy settings
are ignored; either url or srcFile is required.
wsdl.setUrl(url);
|
protected void | validate()validation code
if (destFile == null) {
throw new BuildException(ERROR_NO_DEST_FILE);
}
if (destFile.isDirectory()) {
throw new BuildException(
ERROR_DEST_FILE_IS_DIR);
}
wsdl.validate();
|