Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.XMLConfiguration$XMLBuilderVisitor


   
    public FileConfiguration getConfig() {
      if (config == null) {
          try {
//                config = new XMLConfiguration(Constant.FILE_CONFIG);
                config = new XMLConfiguration(Constant.getInstance().FILE_CONFIG);

            } catch (ConfigurationException e) {
                e.printStackTrace();
            }
      }
View Full Code Here


    @Override
    protected void setUp() throws Exception
    {  
        // Fill config file with stuff
        configXml = new XMLConfiguration();
        configXml.setRootElementName("virtualhosts");
        configXml.addProperty("virtualhost(-1).name", "test");
    }
View Full Code Here

        tmpFile.deleteOnExit();
        BufferedWriter out = new BufferedWriter(new FileWriter(tmpFile));
        out.write("<security><queueDenier>notyet</queueDenier><exchangeDenier>yes</exchangeDenier></security>");
        out.close();
       
        _conf = new SecurityConfiguration(new XMLConfiguration(tmpFile));
       
        // Create ACLManager
       
        _pluginManager = new MockPluginManager("");
        _authzManager = new ACLManager(_conf, _pluginManager);
View Full Code Here

        buf.write("</firewall>");
        buf.close();
       
        // Configure plugin
        FirewallPlugin plugin = new FirewallPlugin();
        plugin.setConfiguration(new XMLConfiguration(confFile));
        return plugin;
    }
View Full Code Here

    private XMLConfiguration _config;

    @Override
    public void setUp()
    {
        _config = new XMLConfiguration();
    }
View Full Code Here

    public void testnewParserOutputVsOldParserOutput() throws ConfigurationException
    {
        String configDir = System.getProperty("QPID_HOME")+"/etc";
       
        XMLConfiguration oldConfig = new XMLConfiguration(configDir +"/sample-parsed-config.xml");
        Configuration newConfig = new ServerConfiguration(new File(configDir+"/persistent_config-config-test.xml")).getConfig();
       
        Iterator xmlKeys = oldConfig.getKeys();
        while (xmlKeys.hasNext())
        {
            String key = (String) xmlKeys.next();
            assertEquals("Incorrect value for "+key, oldConfig.getProperty(key), newConfig.getProperty(key));
        }
    }
View Full Code Here

        if (!_configFile.exists())
        {
            fail("Unable to test without config file:" + _configFile);
        }

        XMLConfiguration configuration = new XMLConfiguration(_configFile);
        configuration.setProperty("virtualhosts.virtualhost." + VIRTUALHOST+".store.class", "org.apache.qpid.server.store.SlowMessageStore");
        configuration.setProperty("virtualhosts.virtualhost." + VIRTUALHOST+".store.delays.commitTran.post", POST_COMMIT_DELAY);
        configuration.setProperty("management.enabled", "false");

       
        File tmpFile = File.createTempFile("configFile", "test");
        tmpFile.deleteOnExit();
        configuration.save(tmpFile);
       
        _configFile = tmpFile;

        startBroker(1);
View Full Code Here

        CompositeConfiguration finalConfig = new CompositeConfiguration(config);
       
        List subFiles = config.getList("xml[@fileName]");
        for (Object subFile : subFiles)
        {
            finalConfig.addConfiguration(new XMLConfiguration((String) subFile));
        }

        // all rules must have an access attribute
        int numRules = finalConfig.getList("rule[@access]").size();
        _rules = new FirewallRule[numRules];
View Full Code Here

        while (i.hasNext())
        {
            Object thing = i.next();
            if (thing instanceof String)
            {
                XMLConfiguration vhostConfiguration = new XMLConfiguration((String) thing);
                List hosts = vhostConfiguration.getList("virtualhost.name");
                for (int j = 0; j < hosts.size(); j++)
                {
                    String name = (String) hosts.get(j);
                    // Add the keys of the virtual host to the main config then bail out
                   
                    Configuration myConf = vhostConfiguration.subset("virtualhost." + name);
                    Iterator k = myConf.getKeys();
                    while (k.hasNext())
                    {
                        String key = (String) k.next();
                        conf.setProperty("virtualhosts.virtualhost."+name+"."+key, myConf.getProperty(key));
                    }
                    VirtualHostConfiguration vhostConfig = new VirtualHostConfiguration(name, conf.subset("virtualhosts.virtualhost."+name));
                    _virtualHosts.put(vhostConfig.getName(), vhostConfig);
                }
                // Grab things other than the virtualhosts themselves
                Iterator keys = vhostConfiguration.getKeys();
                while (keys.hasNext())
                {
                    String key = (String) keys.next();
                    conf.setProperty("virtualhosts."+key, vhostConfiguration.getProperty(key));
                }
            }
        }
    }
View Full Code Here

            protected String interpolate(String o)
            {
                return conf.interpolate(o);
            }
        });
        conf.addConfiguration(new XMLConfiguration(file)
        {
            protected String interpolate(String o)
            {
                return conf.interpolate(o);
            }
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration.XMLConfiguration$XMLBuilderVisitor

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.