private Archive buildBindingModel(String urn, String[] messages) throws IOException, SAXException, IllegalNameException, ClassNotFoundException {
ClassLoader origTCCL = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(mappingModelClassLoader);
try {
AntRunner antRunner = new AntRunner("build.xml");
EJCExecutor ejc = new EJCExecutor();
File destDir = new File("target/ejc/src");
antRunner.run("delete");
if(messages != null && messages.length != 0) {
ejc.setMessages(CollectionsUtil.toSet(messages));
}
ejc.setDestDir(destDir);
ejc.setEdiMappingModel("urn:" + urn);
ejc.setPackageName(EJCTestUtil.ORG_SMOOKS_EJC_TEST);
// Build the source...
ejc.execute();
// Compile it...
antRunner.run("compile");
// Build and return an archive instance from the compiled sources...
return new Archive(new ZipInputStream(new FileInputStream("./target/ejc/ejc.jar")));
} finally {
Thread.currentThread().setContextClassLoader(origTCCL);