public static OutputProfileList getOutputProfileListType()

in src/main/java/com/netflix/imflibrary/st2067_100/OutputProfileList.java [186:249]


    public static OutputProfileList getOutputProfileListType(ResourceByteRangeProvider resourceByteRangeProvider, IMFErrorLogger imfErrorLogger) throws IOException {
        JAXBElement jaxbElement = null;
        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
        try (InputStream inputStream = resourceByteRangeProvider.getByteRangeAsStream(0, resourceByteRangeProvider.getResourceSize() - 1);
             InputStream xmldsig_core_is = contextClassLoader.getResourceAsStream(xmldsig_core_schema_path);
             InputStream dcmlTypes_is = contextClassLoader.getResourceAsStream(dcmlTypes_schema_path);
             InputStream imf_opl_100a_is = contextClassLoader.getResourceAsStream(opl_100a_schema_path);
             InputStream imf_opl_101a_is = contextClassLoader.getResourceAsStream(opl_101a_schema_path);
             InputStream imf_opl_101b_is = contextClassLoader.getResourceAsStream(opl_101b_schema_path);
             InputStream imf_opl_101c_is = contextClassLoader.getResourceAsStream(opl_101c_schema_path);
             InputStream imf_opl_101d_is = contextClassLoader.getResourceAsStream(opl_101d_schema_path);
             InputStream imf_opl_101e_is = contextClassLoader.getResourceAsStream(opl_101e_schema_path);
             InputStream imf_opl_101f_is = contextClassLoader.getResourceAsStream(opl_101f_schema_path);
             InputStream imf_opl_102a_is = contextClassLoader.getResourceAsStream(opl_102a_schema_path);
             InputStream imf_opl_103b_is = contextClassLoader.getResourceAsStream(opl_103b_schema_path)
             ) {
            StreamSource[] streamSources = new StreamSource[11];
            streamSources[0] = new StreamSource(xmldsig_core_is);
            streamSources[1] = new StreamSource(dcmlTypes_is);
            streamSources[2] = new StreamSource(imf_opl_100a_is);
            streamSources[3] = new StreamSource(imf_opl_101d_is);
            streamSources[4] = new StreamSource(imf_opl_101b_is);
            streamSources[5] = new StreamSource(imf_opl_101c_is);
            streamSources[6] = new StreamSource(imf_opl_101a_is);
            streamSources[7] = new StreamSource(imf_opl_101e_is);
            streamSources[8] = new StreamSource(imf_opl_101f_is);
            streamSources[9] = new StreamSource(imf_opl_102a_is);
            streamSources[10] = new StreamSource(imf_opl_103b_is);


            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
            Schema schema = schemaFactory.newSchema(streamSources);

            ValidationEventHandlerImpl validationEventHandlerImpl = new ValidationEventHandlerImpl(true);
            JAXBContext jaxbContext = JAXBContext.newInstance(outputProfileList_context_path);
            Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
            unmarshaller.setEventHandler(validationEventHandlerImpl);
            unmarshaller.setSchema(schema);

            jaxbElement = (JAXBElement) unmarshaller.unmarshal(inputStream);

            if (validationEventHandlerImpl.hasErrors()) {
                validationEventHandlerImpl.getErrors().stream()
                        .map(e -> new ErrorLogger.ErrorObject(
                                IMFErrorLogger.IMFErrors.ErrorCodes.IMF_OPL_ERROR,
                                e.getValidationEventSeverity(),
                                "Line Number : " + e.getLineNumber().toString() + " - " + e.getErrorMessage())
                        )
                        .forEach(imfErrorLogger::addError);

                throw new IMFException(validationEventHandlerImpl.toString(), imfErrorLogger);
            }
        } catch (SAXException | JAXBException e) {
            imfErrorLogger.addError(IMFErrorLogger.IMFErrors.ErrorCodes.IMF_OPL_ERROR, IMFErrorLogger
                            .IMFErrors.ErrorLevels.FATAL,
                    e.getMessage());
            throw new IMFException(e.getMessage(), imfErrorLogger);
        }

        org.smpte_ra.schemas._2067_100._2014.OutputProfileListType outputProfileListTypeJaxb = (org.smpte_ra.schemas._2067_100._2014.OutputProfileListType) jaxbElement.getValue();

        OutputProfileListModel_st2067_100_2014 outputProfileListModel = new OutputProfileListModel_st2067_100_2014(outputProfileListTypeJaxb, imfErrorLogger);
        return outputProfileListModel.getNormalizedOutputProfileList();
    }