Package org.jconfig

Examples of org.jconfig.Category


                    if ( tmp.indexOf(" extends ") != -1 ) {
                        extend = name.substring(name.indexOf(" extends ")+9);
                        extend = extend.trim();
                        name = name.substring(0,name.indexOf(" extends "));                           
                    }
                    Category ec = new DefaultCategory(name);
                    if ( extend != null ) {
                        ec.setExtendsCategory(extend);
                    }
                    cfg.setCategory(ec);
                    currentCategoryName = name;
                }
            }
View Full Code Here


        false));

    // now we have to crate one attribute per property found
    Configuration configuration =
      ConfigurationManager.getConfiguration(configurationName);
    Category category = configuration.getCategory(categoryName);
    Properties properties = category.getProperties();
    Enumeration propertiesEnum = properties.keys();

    while (propertiesEnum.hasMoreElements()) {

      String propertyName = (String) propertiesEnum.nextElement();
View Full Code Here

    if (attributeName.equals("name")) {
      value = categoryName;
    } else {
      Configuration configuration =
        ConfigurationManager.getConfiguration(configurationName);
      Category category = configuration.getCategory(categoryName);

      if (category.getProperty(attributeName) != null) {
        value = category.getProperty(attributeName);
      }
    }

    // there is no way to know if attribute exists on Configuration....
    if (false)
View Full Code Here

    }
   

    Configuration configuration =
      ConfigurationManager.getConfiguration(configurationName);
    Category category = configuration.getCategory(categoryName);
    category.setProperty(attributeName, (String) value);
  }
View Full Code Here

                          if ( tmp.indexOf(" extends ") != -1 ) {
                              extend = name.substring(name.indexOf(" extends ")+9);
                              extend = extend.trim();
                              name = name.substring(0,name.indexOf(" extends "));                           
                          }
                          Category ec = new DefaultCategory(name);
                          if ( extend != null ) {
                              ec.setExtendsCategory(extend);
                          }
                          cfg.setCategory(ec);
                          currentCategoryName = name;
                        }
                      }
View Full Code Here

            Node n = nl.item(i);
            // and get the name attribute for this category
            NamedNodeMap curAtt = n.getAttributes();
            Node curNode = curAtt.getNamedItem("name");
            currentCategory = curNode.getNodeValue();                       
            Category ec = new DefaultCategory(currentCategory);
            configuration.setCategory(ec);
            curNode = curAtt.getNamedItem("extends");
            if ( curNode != null ) {
                ec.setExtendsCategory(curNode.getNodeValue());
            }
            // now we process all children for this category
            for (Node child = n.getFirstChild(); child != null; child = child.getNextSibling()) {
                // we take the tag name as property name               
                if ( child.getNodeType() == 1 && child.getFirstChild() != null ) {
View Full Code Here

            pstmt.setLong(1, oid);
            ResultSet result = pstmt.executeQuery();
            while(result.next()) {
                long catoid = result.getLong("OID");
                String categoryName = result.getString("NAME");
                Category cat = config.getCategory(categoryName);
                loadProperties(cat, catoid);
            }
            result.close();
            pstmt.close();
        } catch (SQLException e) {
View Full Code Here

            // this was expected
        }
        // next we check for valid jdbc settings
        Configuration configuration = handler.load("test_ls");
        assertNotNull("JDBC Configuration could not be loaded.", configuration);
        Category news = configuration.getCategory("news");
        assertNotNull("Category was <null>. This cannot be true.", news);
        assertEquals("Expected value was wrong.", "10", news.getProperty("count"));
        Category general = configuration.getCategory("general");
        assertNotNull("Category was <null>. This cannot be true", general);
        assertEquals("Expected value was wrong.", "JDBC is cool", general.getProperty("description"));
    }
View Full Code Here

    }
   
    public void testLoadAndSave() {       
        Configuration cfg = getConfig();       
        assertNotNull(cfg);               
        Category news = cfg.getCategory("news");
        assertNotNull("Category was <null>. This cannot be true.", news);
        assertEquals("Expected value was wrong.", "10", news.getProperty("count"));       
    }
View Full Code Here

TOP

Related Classes of org.jconfig.Category

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.