Search in sources :

Example 1 with ConfigTranslator

use of org.onap.aai.setup.ConfigTranslator in project aai-aai-common by onap.

the class NodeIngestor method translateAll.

private void translateAll(Translator translator) throws ExceptionInInitializerError {
    if (translator instanceof ConfigTranslator) {
        this.localSchema = "true";
    }
    Boolean retrieveLocalSchema = Boolean.parseBoolean(this.localSchema);
    /*
         * Set this to default schemaVersion
         */
    this.schemaVersions = translator.getSchemaVersions();
    List<SchemaVersion> schemaVersionList = translator.getSchemaVersions().getVersions();
    try {
        for (SchemaVersion version : schemaVersionList) {
            LOGGER.debug("Version being processed" + version);
            List<InputStream> inputStreams = retrieveOXM(version, translator);
            LOGGER.debug("Retrieved OXMs from SchemaService");
            /*
                 * IOUtils.copy and copy the inputstream
                 */
            if (inputStreams.isEmpty()) {
                continue;
            }
            final DynamicJAXBContext ctx = ingest(inputStreams);
            versionContextMap.put(version, ctx);
            setAllTypesAndProperties(version, inputStreams);
            schemaPerVersion.put(version, createCombinedSchema(inputStreams, version, retrieveLocalSchema));
        }
    } catch (JAXBException | ParserConfigurationException | SAXException | IOException e) {
        throw new ExceptionInInitializerError(e);
    }
}
Also used : SchemaVersion(org.onap.aai.setup.SchemaVersion) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) JAXBException(javax.xml.bind.JAXBException) IOException(java.io.IOException) SAXException(org.xml.sax.SAXException) DynamicJAXBContext(org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) ConfigTranslator(org.onap.aai.setup.ConfigTranslator)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 JAXBException (javax.xml.bind.JAXBException)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 DynamicJAXBContext (org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext)1 ConfigTranslator (org.onap.aai.setup.ConfigTranslator)1 SchemaVersion (org.onap.aai.setup.SchemaVersion)1 SAXException (org.xml.sax.SAXException)1