Package org.apache.beehive.netui.util.config.bean

Examples of org.apache.beehive.netui.util.config.bean.NetUIConfig


        return map;
    }

    private static Map/*<String, String>*/ readFromConfig() {
        NetUIConfig config = ConfigUtil.getConfig();
        if(config == null)
            return null;

        TypeConverterConfig[] typeConverters = config.getTypeConverters();

        if(typeConverters != null) {
            LinkedHashMap/*<String, String>*/ map = new LinkedHashMap/*<String, String>*/();
            for(int i = 0; i < typeConverters.length; i++) {
                map.put(typeConverters[i].getType(), typeConverters[i].getConverterClass());
View Full Code Here


        }
    };

    public NetUIConfig parse(final XmlInputStreamResolver xmlResolver) {

        NetUIConfig configBean = null;
        InputStream xmlInputStream = null;
        XmlInputStreamResolver theXmlResolver = xmlResolver;
        try {
            /* use the default XmlInputStream */
            if(theXmlResolver == null)
View Full Code Here

    }

    private NetUIConfig parse(final String resourcePath, final InputStream is) {
        assert is != null;

        NetUIConfig netuiConfig = null;
        InputStream xsdInputStream = null;
        try {
            /* parse the config document */
            xsdInputStream = SCHEMA_RESOLVER.getInputStream();
            final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
            final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
            final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";

            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            dbf.setValidating(true);
            dbf.setNamespaceAware(true);
            dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
            dbf.setAttribute(JAXP_SCHEMA_SOURCE, xsdInputStream);

            DocumentBuilder db = dbf.newDocumentBuilder();
            db.setErrorHandler(new ErrorHandler() {
                public void warning(SAXParseException exception) {
                    if(LOGGER.isInfoEnabled())
                        LOGGER.info("Validation warning validating config file \"" + resourcePath +
                            "\" against XML Schema \"" + SCHEMA_RESOLVER.getResourcePath());
                }

                public void error(SAXParseException exception) {
                        throw new ConfigInitializationException("Validation errors occurred parsing the config file \"" +
                            resourcePath + "\".  Cause: " + exception, exception);
                }

                public void fatalError(SAXParseException exception) {
                    throw new ConfigInitializationException("Validation errors occurred parsing the config file \"" +
                        resourcePath + "\".  Cause: " + exception, exception);
                }
            });

            db.setEntityResolver(new EntityResolver() {
                public InputSource resolveEntity(String publicId, String systemId) {
                    if(systemId.endsWith("/beehive-netui-config.xsd")) {
                        InputStream inputStream = NetUIConfigParser.class.getClassLoader().getResourceAsStream(CONFIG_SCHEMA);
                        return new InputSource(inputStream);
                    }
                    else return null;
                }
            });

            Document document = db.parse(is);

            PageFlowActionInterceptorsConfig pfActionInterceptorsConfig = parsePfActionInterceptorsConfig(document);
            PageFlowHandlersConfig pfHandlersConfig = parsePfHandlersConfig(document);
            PageFlowConfig pfConfig = parsePfConfig(document);
            PageFlowFactoriesConfig pfFactoriesConfig = parsePfFactoriesConfig(document);
            SharedFlowRefConfig[] sharedFlowRefConfigs = parseSharedFlowRefConfigs(document);
            RequestInterceptorsConfig requestInterceptorsConfig = parseRequestInterceptorsConfig(document);

            JspTagConfig jspTagConfig = parseJspTagConfig(document);
            ExpressionLanguagesConfig elConfig = parseExpressionLanguageConfig(document);
            TypeConverterConfig[] typeConvertersConfig = parseTypeConvertersConfig(document);
            UrlConfig urlConfig = parseUrlConfig(document);
            IteratorFactoryConfig[] iteratorFactories = parseIteratorFactoryConfig(document);
            PrefixHandlerConfig[] prefixHandlers = parsePrefixHandlerConfig(document);

            Element catalogElement = DomUtils.getChildElementByName(document.getDocumentElement(), "catalog");
            CatalogConfig catalogConfig = parseCatalogs(catalogElement);

            netuiConfig = new NetUIConfig(
                pfActionInterceptorsConfig,
                pfHandlersConfig,
                pfConfig,
                pfFactoriesConfig,
                sharedFlowRefConfigs,
                requestInterceptorsConfig,
                jspTagConfig,
                prefixHandlers,
                elConfig,
                iteratorFactories,
                typeConvertersConfig,
                urlConfig
                );
            netuiConfig.setCatalogConfig(catalogConfig);
        }
        catch(ParserConfigurationException e) {
            throw new ConfigInitializationException("Error occurred parsing the config file \"" + resourcePath + "\"", e);
        }
        catch(IOException e) {
View Full Code Here

    }

    private static ExpressionEngineFactory initialize(Map factoryMap) {
        assert factoryMap != null;

        NetUIConfig config = ConfigUtil.getConfig();

        ExpressionLanguagesConfig elConfig = config.getExpressionLanguages();
        assert elConfig != null;

        ExpressionLanguageConfig[] els = elConfig.getExpressionLanguages();
        assert els != null;
       
View Full Code Here

TOP

Related Classes of org.apache.beehive.netui.util.config.bean.NetUIConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.