/** * Returns the edimap containing the parser logic. * @return edi-message-mapping. */ public Edimap getEdimap() { if(edimap == null) { // Lazy parsing of the Edimap configuration... try { parseSequence(); } catch (Exception e) { throw new EDIConfigurationException("Error parsing EDI Mapping Model [" + mappingConfig + "].", e); } } return edimap; }
/** * Returns the edimap containing the parser logic. * @return edi-message-mapping. */ public Edimap getEdimap() { if(edimap == null) { // Lazy parsing of the Edimap configuration... try { parseSequence(); } catch (Exception e) { throw new EDIConfigurationException("Error parsing EDI Mapping Model [" + mappingConfig + "].", e); } } return edimap; }
/** * Returns the edimap containing the parser logic. * @return edi-message-mapping. */ public Edimap getEdimap() { if(edimap == null) { // Lazy parsing of the Edimap configuration... try { parseSequence(); } catch (Exception e) { throw new EDIConfigurationException("Error parsing EDI Mapping Model [" + mappingConfig + "].", e); } } return edimap; }
/** * Returns the edimap containing the parser logic. * @return edi-message-mapping. */ public Edimap getEdimap() { if(edimap == null) { // Lazy parsing of the Edimap configuration... try { parseSequence(); } catch (Exception e) { throw new EDIConfigurationException("Error parsing EDI Mapping Model [" + mappingConfig + "].", e); } } return edimap; }
/** * Retrives the namespaceprefix from edimap element in edi-message-mapping. * @param documentElement the edimap element. * @param schemaName the schema uri. * @return the namespaceprefix used in the edi-message-mapping. * @throws org.milyn.edisax.EDIConfigurationException is thrown when no namespace exists in configuration. */ private static String retrieveNamespace(Element documentElement, String schemaName) throws EDIConfigurationException { NamedNodeMap attributes = documentElement.getAttributes(); Node node; for (int i = 0; i < attributes.getLength(); i++) { node = attributes.item(i); if (node.getNodeValue().equals(schemaName)) { String prefix = node.getNodeName(); if (prefix.startsWith("xmlns:")) { return node.getNodeName().replace("xmlns:", "") + NAMESPACE_SUFFIX; } else if (prefix.startsWith("xmlns")) { return node.getNodeName().replace("xmlns", ""); } else { throw new EDIConfigurationException("No namespace exists in edi-message-mapping. A namespace must be declared in order to digest configuration file."); } } } return ""; } }
/** * Retrives the namespaceprefix from edimap element in edi-message-mapping. * @param documentElement the edimap element. * @param schemaName the schema uri. * @return the namespaceprefix used in the edi-message-mapping. * @throws org.milyn.edisax.EDIConfigurationException is thrown when no namespace exists in configuration. */ private static String retrieveNamespace(Element documentElement, String schemaName) throws EDIConfigurationException { NamedNodeMap attributes = documentElement.getAttributes(); Node node; for (int i = 0; i < attributes.getLength(); i++) { node = attributes.item(i); if (node.getNodeValue().equals(schemaName)) { String prefix = node.getNodeName(); if (prefix.startsWith("xmlns:")) { return node.getNodeName().replace("xmlns:", "") + NAMESPACE_SUFFIX; } else if (prefix.startsWith("xmlns")) { return node.getNodeName().replace("xmlns", ""); } else { throw new EDIConfigurationException("No namespace exists in edi-message-mapping. A namespace must be declared in order to digest configuration file."); } } } return ""; } }
/** * Retrives the namespaceprefix from edimap element in edi-message-mapping. * @param documentElement the edimap element. * @param schemaName the schema uri. * @return the namespaceprefix used in the edi-message-mapping. * @throws org.milyn.edisax.EDIConfigurationException is thrown when no namespace exists in configuration. */ private static String retrieveNamespace(Element documentElement, String schemaName) throws EDIConfigurationException { NamedNodeMap attributes = documentElement.getAttributes(); Node node; for (int i = 0; i < attributes.getLength(); i++) { node = attributes.item(i); if (node.getNodeValue().equals(schemaName)) { String prefix = node.getNodeName(); if (prefix.startsWith("xmlns:")) { return node.getNodeName().replace("xmlns:", "") + NAMESPACE_SUFFIX; } else if (prefix.startsWith("xmlns")) { return node.getNodeName().replace("xmlns", ""); } else { throw new EDIConfigurationException("No namespace exists in edi-message-mapping. A namespace must be declared in order to digest configuration file."); } } } return ""; } }
/** * Retrives the namespaceprefix from edimap element in edi-message-mapping. * @param documentElement the edimap element. * @param schemaName the schema uri. * @return the namespaceprefix used in the edi-message-mapping. * @throws org.milyn.edisax.EDIConfigurationException is thrown when no namespace exists in configuration. */ private static String retrieveNamespace(Element documentElement, String schemaName) throws EDIConfigurationException { NamedNodeMap attributes = documentElement.getAttributes(); Node node; for (int i = 0; i < attributes.getLength(); i++) { node = attributes.item(i); if (node.getNodeValue().equals(schemaName)) { String prefix = node.getNodeName(); if (prefix.startsWith("xmlns:")) { return node.getNodeName().replace("xmlns:", "") + NAMESPACE_SUFFIX; } else if (prefix.startsWith("xmlns")) { return node.getNodeName().replace("xmlns", ""); } else { throw new EDIConfigurationException("No namespace exists in edi-message-mapping. A namespace must be declared in order to digest configuration file."); } } } return ""; } }
private static List<String> getMappingModelList(String urn) throws IOException, EDIConfigurationException { InputStream mappingModelListStream = getMappingModelConfigStream(urn, EDI_MAPPING_MODEL_ZIP_LIST_FILE); if(mappingModelListStream == null) { throw new EDIConfigurationException("Failed to locate jar file for EDI Mapping Model URN '" + urn + "'. Jar must be available on classpath."); } return getMappingModelList(mappingModelListStream); }
private static List<String> getMappingModelList(String urn) throws IOException, EDIConfigurationException { InputStream mappingModelListStream = getMappingModelConfigStream(urn, EDI_MAPPING_MODEL_ZIP_LIST_FILE); if(mappingModelListStream == null) { throw new EDIConfigurationException("Failed to locate jar file for EDI Mapping Model URN '" + urn + "'. Jar must be available on classpath."); } return getMappingModelList(mappingModelListStream); }
private static List<String> getMappingModelList(String urn) throws IOException, EDIConfigurationException { InputStream mappingModelListStream = getMappingModelConfigStream(urn, EDI_MAPPING_MODEL_ZIP_LIST_FILE); if(mappingModelListStream == null) { throw new EDIConfigurationException("Failed to locate jar file for EDI Mapping Model URN '" + urn + "'. Jar must be available on classpath."); } return getMappingModelList(mappingModelListStream); }
private static List<String> getMappingModelList(String urn) throws IOException, EDIConfigurationException { InputStream mappingModelListStream = getMappingModelConfigStream(urn, EDI_MAPPING_MODEL_ZIP_LIST_FILE); if(mappingModelListStream == null) { throw new EDIConfigurationException("Failed to locate jar file for EDI Mapping Model URN '" + urn + "'. Jar must be available on classpath."); } return getMappingModelList(mappingModelListStream); }
public static void loadMappingModels(Map<String, EdifactModel> mappingModels, URI baseURI, List<String> rootMappingModels) throws IOException, SAXException, EDIConfigurationException { for (String rootMappingModel : rootMappingModels) { try { EdifactModel mappingModel = EDIParser.parseMappingModel(rootMappingModel, baseURI); mappingModel.setAssociateModels(mappingModels.values()); mappingModels.put(toLookupName(mappingModel.getDescription()), mappingModel); } catch(Exception e) { throw new EDIConfigurationException("Error parsing EDI Mapping Model '" + rootMappingModel + "'.", e); } } }
public static void loadMappingModels(Map<String, EdifactModel> mappingModels, URI baseURI, List<String> rootMappingModels) throws IOException, SAXException, EDIConfigurationException { for (String rootMappingModel : rootMappingModels) { try { EdifactModel mappingModel = EDIParser.parseMappingModel(rootMappingModel, baseURI); mappingModel.setAssociateModels(mappingModels.values()); mappingModels.put(toLookupName(mappingModel.getDescription()), mappingModel); } catch(Exception e) { throw new EDIConfigurationException("Error parsing EDI Mapping Model '" + rootMappingModel + "'.", e); } } }
public static void loadMappingModels(Map<String, EdifactModel> mappingModels, URI baseURI, List<String> rootMappingModels) throws IOException, SAXException, EDIConfigurationException { for (String rootMappingModel : rootMappingModels) { try { EdifactModel mappingModel = EDIParser.parseMappingModel(rootMappingModel, baseURI); mappingModel.setAssociateModels(mappingModels.values()); mappingModels.put(toLookupName(mappingModel.getDescription()), mappingModel); } catch(Exception e) { throw new EDIConfigurationException("Error parsing EDI Mapping Model '" + rootMappingModel + "'.", e); } } }
public static void loadMappingModels(Map<String, EdifactModel> mappingModels, URI baseURI, List<String> rootMappingModels) throws IOException, SAXException, EDIConfigurationException { for (String rootMappingModel : rootMappingModels) { try { EdifactModel mappingModel = EDIParser.parseMappingModel(rootMappingModel, baseURI); mappingModel.setAssociateModels(mappingModels.values()); mappingModels.put(toLookupName(mappingModel.getDescription()), mappingModel); } catch(Exception e) { throw new EDIConfigurationException("Error parsing EDI Mapping Model '" + rootMappingModel + "'.", e); } } }
private Edimap digestEDIConfig(Document configDoc) throws SAXException, EDIConfigurationException, IOException { XsdDOMValidator validator = new XsdDOMValidator(configDoc); if (validator.getNamespaces().size() == 0) { throw new EDIConfigurationException("The edi-message-mapping configuration must contain a namespace."); } if (validator.getNamespaces().size() > 1) { throw new EDIConfigurationException("Unsupported use of multiple configuration namespaces from inside the edi-message-mapping configuration."); } String ediNS = validator.getNamespaces().get(0).toString(); validator.validate(); Edimap edimap = new Edimap(modelURI); if(assertValidXSD(ediNS)) { digestXSDValidatedConfig(configDoc, edimap, ediNS); } else { throw new SAXException("Cannot parse edi-message-mapping configuration. Unsupported default Namespace '" + ediNS + "'."); } return edimap; }
private Edimap digestEDIConfig(Document configDoc) throws SAXException, EDIConfigurationException, IOException { XsdDOMValidator validator = new XsdDOMValidator(configDoc); if (validator.getNamespaces().size() == 0) { throw new EDIConfigurationException("The edi-message-mapping configuration must contain a namespace."); } if (validator.getNamespaces().size() > 1) { throw new EDIConfigurationException("Unsupported use of multiple configuration namespaces from inside the edi-message-mapping configuration."); } String ediNS = validator.getNamespaces().get(0).toString(); validator.validate(); Edimap edimap = new Edimap(modelURI); if(assertValidXSD(ediNS)) { digestXSDValidatedConfig(configDoc, edimap, ediNS); } else { throw new SAXException("Cannot parse edi-message-mapping configuration. Unsupported default Namespace '" + ediNS + "'."); } return edimap; }
private Edimap digestEDIConfig(Document configDoc) throws SAXException, EDIConfigurationException, IOException { XsdDOMValidator validator = new XsdDOMValidator(configDoc); if (validator.getNamespaces().size() == 0) { throw new EDIConfigurationException("The edi-message-mapping configuration must contain a namespace."); } if (validator.getNamespaces().size() > 1) { throw new EDIConfigurationException("Unsupported use of multiple configuration namespaces from inside the edi-message-mapping configuration."); } String ediNS = validator.getNamespaces().get(0).toString(); validator.validate(); Edimap edimap = new Edimap(modelURI); if(assertValidXSD(ediNS)) { digestXSDValidatedConfig(configDoc, edimap, ediNS); } else { throw new SAXException("Cannot parse edi-message-mapping configuration. Unsupported default Namespace '" + ediNS + "'."); } return edimap; }
private Edimap digestEDIConfig(Document configDoc) throws SAXException, EDIConfigurationException, IOException { XsdDOMValidator validator = new XsdDOMValidator(configDoc); if (validator.getNamespaces().size() == 0) { throw new EDIConfigurationException("The edi-message-mapping configuration must contain a namespace."); } if (validator.getNamespaces().size() > 1) { throw new EDIConfigurationException("Unsupported use of multiple configuration namespaces from inside the edi-message-mapping configuration."); } String ediNS = validator.getNamespaces().get(0).toString(); validator.validate(); Edimap edimap = new Edimap(modelURI); if(assertValidXSD(ediNS)) { digestXSDValidatedConfig(configDoc, edimap, ediNS); } else { throw new SAXException("Cannot parse edi-message-mapping configuration. Unsupported default Namespace '" + ediNS + "'."); } return edimap; }