_bpelFiles.add(u);
}
public void execute(CommandContext cc) throws ExecutionException {
if (_bpelFiles.size() == 0) {
throw new ExecutionException(__msgs.msgAtLeastOneProcessRequired());
}
if (_outputDir == null) {
_outputDir = new File(SystemUtils.userDirectory());
}
_cc = cc;
CompileListener myListener = new CompileListener() {
public void onCompilationMessage(CompilationMessage m) {
if (m.severity >= _minSeverity) {
_cc.outln(m.toErrorString());
}
if (_compileListener != null) {
_compileListener.onCompilationMessage(m);
}
}
};
URI u = null;
if (_wsdlUri != null) {
try {
u = new URI(FileUtils.encodePath(_wsdlUri));
}
catch (URISyntaxException use) {
throw new ExecutionException(__msgs.msgInvalidWsdlUrl(_wsdlUri));
}
}
for (String bpelURI : _bpelFiles) {
BpelC compiler = BpelC.newBpelCompiler();
if (u != null) {
compiler.setProcessWSDL(u);
}
compiler.setCompileListener(myListener);
File bpelFile = new File(bpelURI);
if (!bpelFile.exists()) {
_cc.debug("File does not exist: " + bpelFile);
throw new ExecutionException(__msgs.msgInvalidBpelUrl(bpelURI));
}
try {
long start = System.currentTimeMillis();
compiler.compile(bpelFile);
long t = System.currentTimeMillis() - start;
_cc.info("Compilation completed in " + t + "ms");
}
catch (IOException ioe) {
throw new ExecutionException(__msgs.msgIoExReadingStreamWithMsg(bpelFile, ioe.getMessage()));
} catch (CompilationException e) {
throw new ExecutionException(e.toErrorMessage(), e);
}
}
}