}
}
}
private void generateFactoryClass(Properties interchangeProperties) throws IOException {
FreeMarkerTemplate factoryTemplate = new FreeMarkerTemplate("templates/" + interchangeProperties.getProperty(EdiSpecificationReader.INTERCHANGE_TYPE) + "-interchange-factoryClass.ftl.xml", EJCExecutor.class);
Map<String, Object> contextObj = new HashMap<String, Object>();
String packageTokens[] = packageName.split("\\.");
String messageSetName = packageTokens[packageTokens.length - 1].toUpperCase();
contextObj.put("mappingModel", ediMappingModel);
contextObj.put("package", packageName);
contextObj.put("messageSetName", messageSetName);
contextObj.put("bindingConfig", "/" + packageName.replace('.', '/') + "/interchange-bindingconfig.xml");
File interchangeFactoryFile = new File(destDir, packageName.replace('.', '/') + "/" + messageSetName + "InterchangeFactory.java");
FileWriter interchangeBindingConfigWriter = new FileWriter(interchangeFactoryFile);
try {
factoryTemplate.apply(contextObj, interchangeBindingConfigWriter);
} finally {
try {
interchangeBindingConfigWriter.flush();
} finally {
interchangeBindingConfigWriter.close();