Package org.sf.bee.commons.xml

Examples of org.sf.bee.commons.xml.XmlNode


        this.initializeFromDocument(document, false);
    }

    private void initializeFromDocument(XmlDocument document,
            boolean isFromWatchDog) throws LogConfigurationException {
        XmlNode root = document.getDocumentElement();
        if (null == root) {
            throw new LogConfigurationException("Invalid configuration file! Root node should not be NULL.");
        }
        // common properties
        this.setCommonProperties(root);

        // check if is enabled or not
        if (!_enabled) {
            _logger.info(String.format("%s is not enabled. Logging is managed from container.", this.getClass().getSimpleName()));
            return;
        } else {
            _logger.info(String.format("%s is enabled and will manage application logging.", this.getClass().getSimpleName()));
        }

        // global formatters
        this.clearFormatterElementCache();
        XmlNode formattersNode = root.getChild(ConfigurationTags.formatters.toString());
        if (null != formattersNode) {
            this.initFormattersCache(formattersNode.getChilds(ConfigurationTags.formatter.toString()));
        }
        // global handlers
        this.clearHandlerElementCache();
        XmlNode handlersNode = root.getChild(ConfigurationTags.handlers.toString());
        if (null != handlersNode) {
            this.initHandlersCache(handlersNode.getChilds(ConfigurationTags.handler.toString()));
        }
        // initialized loggers
        this.clearLoggerElementCache();
        XmlNode loggersNode = root.getChild(ConfigurationTags.loggers.toString());
        if (null != loggersNode) {
            this.initLoggersCache(loggersNode.getChilds(ConfigurationTags.logger.toString()));
        }
        // if watchdog is enabled, configure loggers using watchdog
        if (_enableWatchDog) {
            // init WATCH DOG
            this.initWatchDog(_enableWatchDog);
View Full Code Here


                props.getProperty(ConfigurationTags.level.toString(),
                _defaultLevel.toString()));


        // create formatter if any
        XmlNode hndlrsNode = node.getChild(ConfigurationTags.handlers.toString());
        if (null != hndlrsNode) {
            List<XmlNode> handlers = hndlrsNode.getChilds(ConfigurationTags.handler.toString());
            for (XmlNode handler : handlers) {
                synchronized (_handlers) {
                    HandlerElement hndlrElem = new HandlerElement(handler, _defaultLevel, _root);
                    if (null != hndlrElem) {
                        _handlers.put(hndlrElem.getName(), hndlrElem);
View Full Code Here

     *
     * @return The duplicate node.
     */
    public ConfigurationNode cloneNode(){
        if(null!=_xmlnode){
            final XmlNode node = _xmlnode.cloneNode();
            final ConfigurationNode result = new ConfigurationNode(
                    _configuration, node);
            super.add(result);
            return result;
        }
View Full Code Here

            value = this.checkValue(name, value);
            super.setProperty(name, value);
        }
       
        // create formatter if any
        XmlNode fmtNode = node.getChild(ConfigurationTags.formatter.toString());
        if (null!=fmtNode)
            _fmt = new FormatterElement(fmtNode);
    }
View Full Code Here

                content = BeeBase64.decode(text);
            } else {
                content = text.getBytes();
            }
            _document = new XmlDocument(content);
            final XmlNode root = _document.getDocumentElement();
            if (null != root) {
                _items = new ConfigurationNode(this, root);
            }
        }
    }
View Full Code Here

        }
        if (null == document) {
            this.getLogger().severe("Invalid document: " + file.getAbsoluteFile());
            throw new TaskConfigurationException("Invalid document: " + file.getAbsoluteFile());
        }
        XmlNode documentRoot = document.getDocumentElement();
        if (null == documentRoot) {
            this.getLogger().severe("Invalid document root: " + file.getAbsoluteFile());
            throw new TaskConfigurationException("Invalid document root: " + file.getAbsoluteFile());
        }
View Full Code Here

TOP

Related Classes of org.sf.bee.commons.xml.XmlNode

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.