Package org.apache.commons.configuration.HierarchicalConfiguration

Examples of org.apache.commons.configuration.HierarchicalConfiguration.Node


     */
    public void testAddNodesForNonExistingKey()
    {
        Collection nodes = new ArrayList();
        nodes.add(createNode("usr", "scott"));
        Node nd = createNode("pwd", "tiger");
        nd.setAttribute(true);
        nodes.add(nd);
        config.addNodes("database.connection.settings", nodes);

        assertEquals("Usr node not found", "scott", config.getString("database.connection.settings.usr"));
        assertEquals("Pwd node not found", "tiger", config.getString("database.connection.settings[@pwd]"));
View Full Code Here


     */
    public void testAddNodesForNonExistingKey()
    {
        Collection nodes = new ArrayList();
        nodes.add(createNode("usr", "scott"));
        Node nd = createNode("pwd", "tiger");
        nd.setAttribute(true);
        nodes.add(nd);
        config.addNodes("database.connection.settings", nodes);

        assertEquals("Usr node not found", "scott", config.getString("database.connection.settings.usr"));
        assertEquals("Pwd node not found", "tiger", config.getString("database.connection.settings[@pwd]"));
View Full Code Here

     */
    public void testAddNodesForNonExistingKey()
    {
        Collection nodes = new ArrayList();
        nodes.add(createNode("usr", "scott"));
        Node nd = createNode("pwd", "tiger");
        nd.setAttribute(true);
        nodes.add(nd);
        config.addNodes("database.connection.settings", nodes);

        assertEquals("Usr node not found", "scott", config.getString("database.connection.settings.usr"));
        assertEquals("Pwd node not found", "tiger", config.getString("database.connection.settings[@pwd]"));
View Full Code Here

  }

  final public PropertyListConfiguration Dictionary() throws ParseException {
    PropertyListConfiguration configuration = new PropertyListConfiguration();
    List children = new ArrayList();
    Node child = null;
    jj_consume_token(DICT_BEGIN);
    label_1:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case STRING:
      case QUOTED_STRING:
        ;
        break;
      default:
        jj_la1[0] = jj_gen;
        break label_1;
      }
      child = Property();
            if (child.getValue() instanceof HierarchicalConfiguration)
            {
                // prune & graft the nested configuration to the parent configuration
                HierarchicalConfiguration conf = (HierarchicalConfiguration) child.getValue();
                Node root = conf.getRoot();
                root.setName(child.getName());
                children.add(root);
            }
            else
            {
                children.add(child);
View Full Code Here

  }

  final public Node Property() throws ParseException {
    String key = null;
    Object value = null;
    Node node = new Node();
    key = String();
      node.setName(key);
    jj_consume_token(EQUAL);
    value = Element();
      node.setValue(value);
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case DICT_SEPARATOR:
      jj_consume_token(DICT_SEPARATOR);
      break;
    default:
View Full Code Here

  }

  final public PropertyListConfiguration Dictionary() throws ParseException {
    PropertyListConfiguration configuration = new PropertyListConfiguration();
    List children = new ArrayList();
    Node child = null;
    jj_consume_token(DICT_BEGIN);
    label_1:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case STRING:
      case QUOTED_STRING:
        ;
        break;
      default:
        jj_la1[0] = jj_gen;
        break label_1;
      }
      child = Property();
            if (child.getValue() instanceof HierarchicalConfiguration)
            {
                // prune & graft the nested configuration to the parent configuration
                HierarchicalConfiguration conf = (HierarchicalConfiguration) child.getValue();
                Node root = conf.getRoot();
                root.setName(child.getName());
                children.add(root);
            }
            else
            {
                children.add(child);
View Full Code Here

  }

  final public Node Property() throws ParseException {
    String key = null;
    Object value = null;
    Node node = new Node();
    key = String();
      node.setName(key);
    jj_consume_token(EQUAL);
    value = Element();
      node.setValue(value);
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case DICT_SEPARATOR:
      jj_consume_token(DICT_SEPARATOR);
      break;
    default:
View Full Code Here

            AttributesImpl attrs = new AttributesImpl();
            List children = node.getChildren();

            for (int i = 0; i < children.size(); i++)
            {
                Node child = (Node) children.get(i);
                if (isAttributeNode(child) && child.getValue() != null)
                {
                    String attr = ConfigurationKey.attributeName(child.getName());
                    attrs.addAttribute(NS_URI, attr, attr, ATTR_TYPE, child.getValue().toString());
                }
            }

            return attrs;
        }
View Full Code Here

     */
    public void testAddNodesForNonExistingKey()
    {
        Collection nodes = new ArrayList();
        nodes.add(createNode("usr", "scott"));
        Node nd = createNode("pwd", "tiger");
        nd.setAttribute(true);
        nodes.add(nd);
        config.addNodes("database.connection.settings", nodes);

        assertEquals("Usr node not found", "scott", config.getString("database.connection.settings.usr"));
        assertEquals("Pwd node not found", "tiger", config.getString("database.connection.settings[@pwd]"));
View Full Code Here

     */
    public void testAddNodesForNonExistingKey()
    {
        Collection nodes = new ArrayList();
        nodes.add(createNode("usr", "scott"));
        Node nd = createNode("pwd", "tiger");
        nd.setAttribute(true);
        nodes.add(nd);
        config.addNodes("database.connection.settings", nodes);

        assertEquals("Usr node not found", "scott", config.getString("database.connection.settings.usr"));
        assertEquals("Pwd node not found", "tiger", config.getString("database.connection.settings[@pwd]"));
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration.HierarchicalConfiguration.Node

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.