// default cmext
setCmext(CMEXT_DEFAULT);
}
}
WSDLReader reader = null;
// create a reader (with specified implementation if given).
try {
//If an implementation name is given use that to test against, else use the default one.
if (implName != null && !implName.equals("")) {
logger.info("Using woden with implementation from " + implName);
WSDLFactory factory = WSDLFactory.newInstance(implName);
reader = factory.newWSDLReader();
} else {
logger.info("Using default woden implementation.");
WSDLFactory factory = WSDLFactory.newInstance();
reader = factory.newWSDLReader();
}
} catch (WSDLException e) {
// fail if unable to create a reader
throw new BuildException(e);
}
// set the features but continue even if they are not supported yet
try {
// always enable WSDL 2.0 validation since this is a validation task
reader.setFeature(WSDLReader.FEATURE_VALIDATION, true);
// enable verbose output
reader.setFeature(WSDLReader.FEATURE_VERBOSE, isVerbose());
// enable continue on error (opposite of fail on error)
reader.setFeature(WSDLReader.FEATURE_CONTINUE_ON_ERROR,
!isFailOnError());
} catch (IllegalArgumentException e) {
logger.warn("warning: " + e.getMessage());
}
if (isVerbose()) {
logger.info("File dir = " + dir.getAbsolutePath());
Project project = getProject();
File baseDir = project.getBaseDir();
logger.info("File baseDir = " + baseDir.getAbsolutePath());
}
DirectoryScanner directoryScanner = getDirectoryScanner(dir);
String[] files = directoryScanner.getIncludedFiles();
reportWriter = Report.openReport(report);
reader.getErrorReporter().setErrorHandler(reportWriter);
// use the same reader for all the WSDL files
for (int i = 0; i < files.length; i++) {
File file = new File(dir, files[i]);
// make a URL for the file
String wsdlLoc = file.toURI().toString();
logger.info("validating " + wsdlLoc);
reportWriter.beginWsdl(wsdlLoc);
try {
// <-- the Description component
Description descComp = reader.readWSDL(wsdlLoc);
if (isCm()) {
// write the Component Model interchange format output file
writeCm(descComp, files[i]);
}