Example usage for org.apache.commons.configuration.tree TreeUtils printTree

List of usage examples for org.apache.commons.configuration.tree TreeUtils printTree

Introduction

In this page you can find the example usage for org.apache.commons.configuration.tree TreeUtils printTree.

Prototype

public static void printTree(PrintStream stream, ConfigurationNode result) 

Source Link

Document

Print out the data in the configuration.

Usage

From source file:org.ssh.test.conf.IConfiguration.java

/**
 * Creates the root node of this combined configuration.
 * //from   w ww  . ja  va 2 s  .  c  o  m
 * @return the combined root node
 */
private ConfigurationNode constructCombinedNode() {
    if (getNumberOfConfigurations() < 1) {
        if (getLogger().isDebugEnabled()) {
            getLogger().debug("No configurations defined for " + this);
        }
        return new ViewNode();
    }

    else {
        Iterator<ConfigData> it = configurations.iterator();
        ConfigurationNode node = it.next().getTransformedRoot();
        while (it.hasNext()) {
            node = getNodeCombiner().combine(node, it.next().getTransformedRoot());
        }
        if (getLogger().isDebugEnabled()) {
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            PrintStream stream = new PrintStream(os);
            TreeUtils.printTree(stream, node);
            getLogger().debug(os.toString());
        }
        return node;
    }
}