if (baseUri == null || baseUri.length() == 0) {
throw new BuildException("baseUri attribute required", getLocation());
}
try {
ApplicationDescription ad = createApplication(classpath.list());
WRITE_OUT_WADL : {
Application a = ad.getApplication();
for(Resources resources : a.getResources())
resources.setBase(baseUri);
JAXBContext c = JAXBContext.newInstance("com.sun.research.ws.wadl",
this.getClass().getClassLoader());
Marshaller m = c.createMarshaller();
OutputStream out = new BufferedOutputStream(new FileOutputStream(wadlFile));
try {
m.marshal(a, out);
}
finally {
out.close();
}
}
WRITE_OUT_EXTERNAL_DATA : {
// TODO work out how to reconsile the different paths
File wadlChildren = new File(wadlFile.getPath() + "-/");
wadlChildren.mkdirs();
for (String key : ad.getExternalMetadataKeys()) {
// Create the next file based on the key
//
File nextFile = new File(wadlChildren, "key");
ApplicationDescription.ExternalGrammar em = ad.getExternalGrammar( key );
// Write a copy to disk
//
OutputStream out = new BufferedOutputStream(new FileOutputStream(nextFile));
try {