messageFiles = new HashMap<String, byte[]>();
readDefinitionEntries(specificationInStream, new ZipDirectoryEntry("eded.", definitionFiles), new ZipDirectoryEntry("edcd.", definitionFiles), new ZipDirectoryEntry("edsd.", definitionFiles), new ZipDirectoryEntry("edmd.", "*", messageFiles));
if (versions.size() != 1) {
if (versions.size() == 0) {
throw new EdiParseException("Seems that we have a directory containing 0 parseable version inside: " + versions + ".\n All messages:\n\t" + messages);
}
throw new EdiParseException("Seems that we have a directory containing more than one parseable version inside: " + versions + ".\n All messages:\n\t" + messages);
}
String version = versions.iterator().next();
// Read Definition Configuration
definitionModel = parseEDIDefinitionFiles();
addMissingDefinitions(definitionModel);
definitionModel.getDescription().setNamespace(ControlBlockHandlerFactory.NAMESPACE_ROOT + ":un:" + version + ":common");
//Interchange envelope is inserted into the definitions. Handcoded at the moment.
try {
String interchangeSegmentDefinitions = INTERCHANGE_DEFINITION_SHORTNAME;
if (!useShortName) {
interchangeSegmentDefinitions = INTERCHANGE_DEFINITION;
}
EdifactModel interchangeEnvelope = new EdifactModel(ClassUtil.getResourceAsStream(interchangeSegmentDefinitions, this.getClass()));
definitionModel.getSegments().getSegments().addAll(interchangeEnvelope.getEdimap().getSegments().getSegments());
} catch (Exception e) {
throw new EdiParseException(e.getMessage(), e);
}
}