List of usage examples for org.apache.commons.configuration.tree ConfigurationNode getName
String getName();
From source file:org.lable.oss.dynamicconfig.core.commonsconfiguration.Objectifier.java
/** * Process a node in the Config tree, and store it with its parent node in an object tree. * <p>// ww w . j a va2 s . c o m * This method recursively calls itself to walk a Config tree. * * @param parent Parent of the current node, as represented in the Config tree. * @return An object tree. */ public static Object traverseTreeAndEmit(ConfigurationNode parent) { if (parent.getChildrenCount() == 0) { return parent.getValue(); } else { Map<String, Object> map = new LinkedHashMap<>(); for (Object o : parent.getChildren()) { ConfigurationNode child = (ConfigurationNode) o; String nodeName = child.getName(); addToMap(map, nodeName, traverseTreeAndEmit(child)); } return map; } }
From source file:org.wso2.carbon.device.mgt.iot.agent.kura.display.SequenceRunner.java
private List<ResourceType> getSequence() { List<ResourceType> sequence = new ArrayList<>(); ConfigManager configManager = ConfigManager.getInstance(); List<HierarchicalConfiguration> resources = configManager.getContentConfig() .configurationsAt("Content.DisplaySequence.Resource"); for (HierarchicalConfiguration resource : resources) { String resourceTypeHandler = resource.getString("[@handler]"); ResourceType resourceObj = null; try {// ww w .j a va 2 s . c om resourceObj = (ResourceType) Class.forName(resourceTypeHandler).newInstance(); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { log.severe("Error occurred while resolving resource type: " + e.getMessage()); } //read all init args Map<String, String> configArgs = new HashMap<>(); ConfigurationNode node = resource.getRootNode(); List<ConfigurationNode> attrs = node.getAttributes(); for (ConfigurationNode attr : attrs) { configArgs.put(attr.getName(), attr.getValue().toString()); } //initialize the resource with config args resourceObj.init(configArgs); //add it to the sequence sequence.add(resourceObj); } return sequence; }
From source file:org.zaproxy.admin.VerifyCoreZapVersionsEntries.java
private static String getHierarchicalName(ConfigurationNode node) { if (node.getParentNode() == null) { return node.getName(); }/*from w w w .j a va 2 s. c o m*/ return getHierarchicalName(node.getParentNode()) + "." + node.getName(); }