private void configure()

in fop-core/src/main/java/org/apache/fop/apps/FopConfParser.java [173:340]


    private void configure(final URI baseURI, final ResourceResolver resourceResolver,
            Configuration cfg) throws FOPException {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Initializing FopFactory Configuration");
        }

        // strict fo validation
        if (cfg.getChild("strict-validation", false) != null) {
            try {
                boolean strict = cfg.getChild("strict-validation").getValueAsBoolean();
                fopFactoryBuilder.setStrictFOValidation(strict);
            } catch (ConfigurationException e) {
                LogUtil.handleException(LOG, e, false);
            }
        }

        boolean strict = false;
        if (cfg.getChild("strict-configuration", false) != null) {
            try {
                strict = cfg.getChild("strict-configuration").getValueAsBoolean();
                fopFactoryBuilder.setStrictUserConfigValidation(strict);
            } catch (ConfigurationException e) {
                LogUtil.handleException(LOG, e, false);
            }
        }

        if (cfg.getChild(ACCESSIBILITY, false) != null) {
            try {
                fopFactoryBuilder.setAccessibility(cfg.getChild(ACCESSIBILITY).getValueAsBoolean());
                fopFactoryBuilder.setStaticRegionsPerPageForAccessibility(
                        cfg.getChild(ACCESSIBILITY).getAttributeAsBoolean(Accessibility.STATIC_REGION_PER_PAGE, false));
                fopFactoryBuilder.setKeepEmptyTags(
                        cfg.getChild(ACCESSIBILITY).getAttributeAsBoolean(Accessibility.KEEP_EMPTY_TAGS, true));
            } catch (ConfigurationException e) {
                LogUtil.handleException(LOG, e, false);
            }
        }

        // base definitions for relative path resolution
        if (cfg.getChild("base", false) != null) {
            try {
                URI confUri = InternalResourceResolver.getBaseURI(cfg.getChild("base").getValue(null));
                fopFactoryBuilder.setBaseURI(baseURI.resolve(confUri));
            } catch (URISyntaxException use) {
                LogUtil.handleException(LOG, use, strict);
            }
        }

        // renderer options
        if (cfg.getChild("source-resolution", false) != null) {
            float srcRes = cfg.getChild("source-resolution").getValueAsFloat(
                    FopFactoryConfig.DEFAULT_SOURCE_RESOLUTION);
            fopFactoryBuilder.setSourceResolution(srcRes);
            if (LOG.isDebugEnabled()) {
                LOG.debug("source-resolution set to: " + srcRes + "dpi");
            }
        }
        if (cfg.getChild("target-resolution", false) != null) {
            float targetRes = cfg.getChild("target-resolution").getValueAsFloat(
                    FopFactoryConfig.DEFAULT_TARGET_RESOLUTION);
            fopFactoryBuilder.setTargetResolution(targetRes);
            if (LOG.isDebugEnabled()) {
                LOG.debug("target-resolution set to: " + targetRes + "dpi");
            }
        }
        if (cfg.getChild("break-indent-inheritance", false) != null) {
            try {
                fopFactoryBuilder.setBreakIndentInheritanceOnReferenceAreaBoundary(
                             cfg.getChild("break-indent-inheritance").getValueAsBoolean());
            } catch (ConfigurationException e) {
                LogUtil.handleException(LOG, e, strict);
            }
        }
        Configuration pageConfig = cfg.getChild("default-page-settings");
        if (pageConfig.getAttribute("height", null) != null) {
            String pageHeight = pageConfig.getAttribute("height",
                    FopFactoryConfig.DEFAULT_PAGE_HEIGHT);
            fopFactoryBuilder.setPageHeight(pageHeight);
            if (LOG.isInfoEnabled()) {
                LOG.info("Default page-height set to: " + pageHeight);
            }
        }
        if (pageConfig.getAttribute("width", null) != null) {
            String pageWidth = pageConfig.getAttribute("width",
                    FopFactoryConfig.DEFAULT_PAGE_WIDTH);
            fopFactoryBuilder.setPageWidth(pageWidth);
            if (LOG.isInfoEnabled()) {
                LOG.info("Default page-width set to: " + pageWidth);
            }
        }

        if (cfg.getChild("complex-scripts") != null) {
            Configuration csConfig = cfg.getChild("complex-scripts");
            fopFactoryBuilder.setComplexScriptFeatures(!csConfig.getAttributeAsBoolean("disabled",
                    false));
        }

        setHyphenationBase(cfg, resourceResolver, baseURI, fopFactoryBuilder);
        setHyphPatNames(cfg, fopFactoryBuilder, strict);

        // prefer Renderer over IFDocumentHandler
        if (cfg.getChild(PREFER_RENDERER, false) != null) {
            try {
                fopFactoryBuilder.setPreferRenderer(
                             cfg.getChild(PREFER_RENDERER).getValueAsBoolean());
            } catch (ConfigurationException e) {
                LogUtil.handleException(LOG, e, strict);
            }
        }

        if (cfg.getChild(TABLE_BORDER_OVERPAINT, false) != null) {
            try {
                fopFactoryBuilder.setTableBorderOverpaint(
                        cfg.getChild(TABLE_BORDER_OVERPAINT).getValueAsBoolean());
            } catch (ConfigurationException e) {
                LogUtil.handleException(LOG, e, false);
            }
        }

        if (cfg.getChild(SIMPLE_LINE_BREAKING, false) != null) {
            try {
                fopFactoryBuilder.setSimpleLineBreaking(
                        cfg.getChild(SIMPLE_LINE_BREAKING).getValueAsBoolean());
            } catch (ConfigurationException e) {
                LogUtil.handleException(LOG, e, false);
            }
        }

        if (cfg.getChild(SKIP_PAGE_POSITION_ONLY_ALLOWED, false) != null) {
            try {
                fopFactoryBuilder.setSkipPagePositionOnlyAllowed(
                        cfg.getChild(SKIP_PAGE_POSITION_ONLY_ALLOWED).getValueAsBoolean());
            } catch (ConfigurationException e) {
                LogUtil.handleException(LOG, e, false);
            }
        }
        if (cfg.getChild(LEGACY_SKIP_PAGE_POSITION_ONLY, false) != null) {
            try {
                fopFactoryBuilder.setLegacySkipPagePositionOnly(
                        cfg.getChild(LEGACY_SKIP_PAGE_POSITION_ONLY).getValueAsBoolean());
            } catch (ConfigurationException e) {
                LogUtil.handleException(LOG, e, false);
            }
        }
        if (cfg.getChild(LEGACY_LAST_PAGE_CHANGE_IPD, false) != null) {
            try {
                fopFactoryBuilder.setLegacyLastPageChangeIPD(
                        cfg.getChild(LEGACY_LAST_PAGE_CHANGE_IPD).getValueAsBoolean());
            } catch (ConfigurationException e) {
                LogUtil.handleException(LOG, e, false);
            }
        }
        if (cfg.getChild(LEGACY_FO_WRAPPER, false) != null) {
            try {
                fopFactoryBuilder.setLegacyFoWrapper(
                        cfg.getChild(LEGACY_FO_WRAPPER).getValueAsBoolean());
            } catch (ConfigurationException e) {
                LogUtil.handleException(LOG, e, false);
            }
        }

        // configure font manager
        new FontManagerConfigurator(cfg, baseURI, fopFactoryBuilder.getBaseURI(), resourceResolver)
                .configure(fopFactoryBuilder.getFontManager(), strict);

        // configure image loader framework
        configureImageLoading(cfg.getChild("image-loading", false), strict);
    }