Package org.apache.commons.configuration

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


        this.name = filename;
        if (!(new File(filename).exists())) {
            createNewFile(filename, ROOT_ELEMENT);
        }
        try {
            config = new XMLConfiguration(filename);
        } catch (ConfigurationException e) {
            createNewFile(filename, ROOT_ELEMENT);
            try {
                config = new XMLConfiguration(filename);
            } catch (ConfigurationException e1) {
                throw new ChaiDBException(ErrorCode.CONFIG_FILE_READ_ERROR, e);
            }
        }
        config.setEncoding("UTF-8");
View Full Code Here


  private void loadConfiguration(String configurationFile) throws ConfigurationException {
    //Properties from system properties
    CompositeConfiguration compositeConfig = new CompositeConfiguration();
    compositeConfig.addConfiguration(new SystemConfiguration());
    //Properties from XML file
    XMLConfiguration xmlConfig = null;
    if (configurationFile!=null) {
      xmlConfig = new XMLConfiguration(configurationFile);
    } else {
      final String filename = System.getProperty(UDDI_CONFIG_FILENAME_PROPERTY);
      if (filename != null) {
        xmlConfig = new XMLConfiguration(filename);
      } else {
        xmlConfig = new XMLConfiguration(DEFAULT_UDDI_CONFIG)
      }
    }
    log.info("Reading UDDI Client properties file " + xmlConfig.getBasePath());
    long refreshDelay = xmlConfig.getLong(Property.UDDI_RELOAD_DELAY, 1000l);
    log.debug("Setting refreshDelay to " + refreshDelay);
    FileChangedReloadingStrategy fileChangedReloadingStrategy = new FileChangedReloadingStrategy();
    fileChangedReloadingStrategy.setRefreshDelay(refreshDelay);
    xmlConfig.setReloadingStrategy(fileChangedReloadingStrategy);
    compositeConfig.addConfiguration(xmlConfig);
    //Making the new configuration globally accessible.
    config = compositeConfig;
    loadManager();
  }
View Full Code Here

    XMLWriter x = new XMLWriter(w);
    try {
      x.write(el);
    } catch (IOException e) {
    }
    XMLConfiguration xmlConfig = new XMLConfiguration();
    try {
      xmlConfig.load(new StringReader(w.toString()));
    } catch (ConfigurationException e) {
      throw new JibeRuntimeException(e);
    }
    xmlConfig.setExpressionEngine(new XPathExpressionEngine());
    cc.setConfiguration(xmlConfig);
    return cc;
  }
View Full Code Here

  private java.util.List<String> parseConfigFile() {
    java.util.List<String> values = new ArrayList();

    try {
      final XMLConfiguration initial = new XMLConfiguration(gui.getConfig().getProperty("genericconffile"));
      initial.setExpressionEngine(new XPathExpressionEngine());
     
      for (final HierarchicalConfiguration subconf : (java.util.List<HierarchicalConfiguration>)
          initial.configurationsAt("/generic/template")) {
        final String name = subconf.getString("name");
        if (name != null) values.add(name);
      }
    } catch (final ConfigurationException ex) {
      log.error("Exception", ex);
View Full Code Here

  private Map<String, String> parseConfigFile(final String name) {
    Map<String, String> values = new HashMap();

    try {
      final XMLConfiguration initial = new XMLConfiguration(gui.getConfig().getProperty("genericconffile"));
      initial.setExpressionEngine(new XPathExpressionEngine());

      for (final HierarchicalConfiguration subconf : (java.util.List<HierarchicalConfiguration>)
          initial.configurationsAt("/generic/template")) {
        final String subconf_name = subconf.getString("name");
        if (subconf_name != null && subconf_name.equals(name)) {
          for (final String key : new String [] { "name", "title", "cmdline", "filename", "workdir", "unit" })
            values.put(key, subconf.getString(key));
          return values;
View Full Code Here

    }

    public void modifyClusterNodeBdbAddress(int brokerPortNumberToBeMoved, int newBdbPort)
    {
        final BrokerConfigHolder brokerConfigHolder = _brokerConfigurations.get(brokerPortNumberToBeMoved);
        final XMLConfiguration virtualHostConfig = brokerConfigHolder.getTestVirtualhosts();

        final String configKey = getConfigKey("highAvailability.nodeHostPort");
        final String oldBdbHostPort = virtualHostConfig.getString(configKey);

        final String[] oldHostAndPort = StringUtils.split(oldBdbHostPort, ":");
        final String oldHost = oldHostAndPort[0];

        final String newBdbHostPort = oldHost + ":" + newBdbPort;

        virtualHostConfig.setProperty(configKey, newBdbHostPort);
        collectConfig(brokerPortNumberToBeMoved, brokerConfigHolder.getTestConfiguration(), virtualHostConfig);
    }
View Full Code Here

    }

    private XMLConfiguration createAndSaveVirtualHostConfiguration(String hostName, File configFile, String storeLocation)
            throws ConfigurationException
    {
        XMLConfiguration testConfiguration = new XMLConfiguration();
        testConfiguration.setProperty("virtualhost." + hostName + ".store.class",
                getTestProfileMessageStoreClassName());
        testConfiguration.setProperty("virtualhost." + hostName + ".store.environment-path", storeLocation);
        testConfiguration.save(configFile);
        return testConfiguration;
    }
View Full Code Here

        _host = InetAddress.getByName("localhost").getHostAddress();
        _groupName = "group" + getName();
        _masterPort = -1;

        FileUtils.delete(new File(_workDir), true);
        _configXml = new XMLConfiguration();
        _modelVhost = mock(org.apache.qpid.server.model.VirtualHost.class);


        BrokerTestHelper.setUp();
     }
View Full Code Here

    @Override
    public void setUp() throws Exception
    {
        super.setUp();
        BrokerTestHelper.setUp();
        _configXml = new XMLConfiguration();
        _configXml.addProperty("virtualhosts.virtualhost(-1).name", getName());
        _configXml.addProperty("virtualhosts.virtualhost(-1)."+getName()+".store.class", TestableMemoryMessageStore.class.getName());
        _virtualHostRegistry = new VirtualHostRegistry();
        _broker = mock(Broker.class);
        when(_broker.getAttribute(Broker.VIRTUALHOST_HOUSEKEEPING_CHECK_PERIOD)).thenReturn(30000l);
View Full Code Here

public class AlgorithmConfig {
 
  private XMLConfiguration xmlConfig;
 
  public AlgorithmConfig(){
    xmlConfig = new XMLConfiguration();
   
  }
View Full Code Here

TOP

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

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.