Methods Summary |
---|
public void | execute(org.apache.tools.ant.ProjectComponent owner, java.util.HashMap map, boolean packageIsKey)execute the mapping
validate();
if (mappingFile != null) {
mapFile(owner, map,packageIsKey);
} else {
map(owner, map, packageName, namespace, packageIsKey);
}
|
private java.util.Properties | loadMappingPropertiesFile()load a file containing properties
Properties props = new Properties();
FileInputStream instr = null;
try {
instr = new FileInputStream(mappingFile);
props.load(new BufferedInputStream(instr));
} catch (IOException e) {
throw new BuildException("Failed to load " + mappingFile, e);
} finally {
if (instr != null) {
try {
instr.close();
} catch (IOException e) {
}
}
}
return props;
|
protected void | map(org.apache.tools.ant.ProjectComponent owner, java.util.HashMap map, java.lang.String packName, java.lang.String nspace, boolean packageIsKey)map a namespace to a package
owner.log("mapping "+nspace+" to "+packName, Project.MSG_VERBOSE);
if(packageIsKey) {
map.put(packName,nspace);
} else {
map.put(nspace, packName);
}
|
protected void | mapFile(org.apache.tools.ant.ProjectComponent owner, java.util.HashMap map, boolean packageIsKey)Load a mapping file and save it to the map
Properties props = loadMappingPropertiesFile();
Enumeration keys = props.keys();
while (keys.hasMoreElements()) {
String packageName = (String) keys.nextElement();
String namespace = props.getProperty(packageName);
map(owner, map, packageName, namespace, packageIsKey);
}
|
public void | setFile(java.io.File file)name of a property file that contains mappings in
package=namespace format
mappingFile = file;
|
public void | setNamespace(java.lang.String value)the namespace in the WSDL. Required.
namespace = value;
|
public void | setPackage(java.lang.String value)the Java package to bind to. Required.
packageName = value;
|
private void | validate()validate the option set
if (mappingFile != null) {
if (namespace != null || packageName != null) {
throw new BuildException(
"Namespace or Package cannot be used with a File attribute");
}
} else {
if (namespace == null) {
throw new BuildException("namespace must be defined");
}
if (packageName == null) {
throw new BuildException("package must be defined");
}
}
|