// Now output the generated archive...
archive.toFileSystem(modelSetOutFolder);
}
private static Archive createArchive(EdiSpecificationReader ediSpecificationReader, String urn, String... messages) throws IOException {
Archive archive = new Archive();
StringBuilder modelListBuilder = new StringBuilder();
StringWriter messageEntryWriter = new StringWriter();
String pathPrefix = urn.replace(".", "_").replace(":", "/");
EdiDirectory ediDirectory = ediSpecificationReader.getEdiDirectory(messages);
// Add the common model...
addModel(ediDirectory.getCommonModel(), pathPrefix, modelListBuilder, messageEntryWriter, archive);
// Add each of the messages...
for(Edimap messageModel : ediDirectory.getMessageModels()) {
addModel(messageModel, pathPrefix, modelListBuilder, messageEntryWriter, archive);
}
// Now create XML Schemas
Set<EPackage> packages = new ECoreGenerator().generatePackages(ediDirectory);
String pluginID = "org.milyn.edi.unedifact.unknown";
if (urn.lastIndexOf(':') > 0) {
pluginID = urn.substring(0, urn.lastIndexOf(':')).replace(':', '.').toLowerCase();
}
Archive schemas = SchemaConverter.INSTANCE.createArchive(packages, pluginID, pathPrefix);
archive.merge(schemas);
// Add the generated mapping model to the archive...
archive.addEntry(EDIUtils.EDI_MAPPING_MODEL_ZIP_LIST_FILE, modelListBuilder.toString());