Package org.apache.commons.configuration

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


 
  private static final Logger logger = Logger.getLogger(ConfigPlugins.class);

  public static XMLConfiguration getPluginConfig(IPlugin inPlugin) {
    String file = "plugin_" + inPlugin.getClass().getSimpleName() + ".xml";
    XMLConfiguration config;
    try {
      config = new XMLConfiguration(new Helper().getGoobiConfigDirectory() + file);
    } catch (ConfigurationException e) {
      logger.error(e);
      config = new XMLConfiguration();
    }
    config.setListDelimiter('&');
    config.setReloadingStrategy(new FileChangedReloadingStrategy());
    return config;
  }
View Full Code Here


  public ConfigProjects(String projectTitle, String configPfad) throws IOException {
    if (!(new File(configPfad)).exists()) {
      throw new IOException("File not found: " + configPfad);
    }
    try {
      this.config = new XMLConfiguration(configPfad);
    } catch (ConfigurationException e) {
      logger.error(e);
      this.config = new XMLConfiguration();
    }
    this.config.setListDelimiter('&');
    this.config.setReloadingStrategy(new FileChangedReloadingStrategy());

    int countProjects = this.config.getMaxIndex("project");
View Full Code Here

      File mFile = new File(ACUHOME, metricsFileName);
      if (mFile.exists()) {
        if (log.isDebugEnabled())
          log.debug("Loading config file: " + mFile.getAbsolutePath());
        try {
          xConfig = new XMLConfiguration(mFile);
          xConfig.append(getEnvironmentConfiguration());
          xConfig.addConfigurationListener(new MetricsConfigListener());
          xConfig.setReloadingStrategy(new FileChangedReloadingStrategy());
         
          // Start a background Thread that checks a property from the XMLConfiguration
View Full Code Here

      if (!(new File(configPfad)).exists()) {
    throw new IOException("File not found: " + configPfad);
  }
      try {
         this.config = new XMLConfiguration(configPfad);
      } catch (ConfigurationException e) {
         e.printStackTrace();
         this.config = new XMLConfiguration();
      }
      this.config.setListDelimiter('&');
      this.config.setReloadingStrategy(new FileChangedReloadingStrategy());
   }
View Full Code Here

   private Configuration getConfiguration(File file)
   {
      try
      {
         XMLConfiguration commonsConfig = new XMLConfiguration(file);
         commonsConfig.setEncoding("UTF-8");
         commonsConfig.setReloadingStrategy(new FileChangedReloadingStrategy());
         commonsConfig.setAutoSave(true);
         return new ConfigurationAdapter().setDelegate(commonsConfig);
      }
      catch (org.apache.commons.configuration.ConfigurationException e)
      {
         throw new ConfigurationException("Error while creating configuration from " + file, e);
View Full Code Here

   @Override
   public Configuration getProjectConfig(Project project)
   {
      ScopedConfigurationAdapter projectConfig = new ScopedConfigurationAdapter();
      XMLConfiguration projectLocalConfig;
      try
      {
         projectLocalConfig = new XMLConfiguration(getProjectSettings(project).getUnderlyingResourceObject());
         projectLocalConfig.setEncoding("UTF-8");
      }
      catch (org.apache.commons.configuration.ConfigurationException e)
      {
         throw new ConfigurationException(e);
      }
      projectLocalConfig.setReloadingStrategy(new FileChangedReloadingStrategy());
      projectLocalConfig.setAutoSave(true);

      ConfigurationAdapter adapter = BeanManagerUtils.getContextualInstance(bm, ConfigurationAdapter.class,
               new ConfigAdapterQualifierLiteral());
      adapter.setParent(projectConfig);
      adapter.setDelegate(projectLocalConfig);
View Full Code Here

   public Configuration getUserConfig() throws ConfigurationException
   {
      // FIXME NPE caused when no project exists because config param is null
      if (userConfig == null)
      {
         XMLConfiguration globalXml;
         try
         {
            globalXml = new XMLConfiguration(environment.getUserConfiguration().getUnderlyingResourceObject());
            globalXml.setEncoding("UTF-8");
         }
         catch (org.apache.commons.configuration.ConfigurationException e)
         {
            throw new ConfigurationException(e);
         }
         globalXml.setReloadingStrategy(new FileChangedReloadingStrategy());
         globalXml.setAutoSave(true);

         ConfigurationAdapter adapter = BeanManagerUtils.getContextualInstance(bm, ConfigurationAdapter.class,
                  new ConfigAdapterQualifierLiteral());
         adapter.setDelegate(globalXml);
         adapter.setBeanManager(bm);
View Full Code Here

      File mFile = new File(ACUHOME, metricsFileName);
      if (mFile.exists()) {
        if (log.isDebugEnabled())
          log.debug("Loading config file: " + mFile.getAbsolutePath());
        try {
          xConfig = new XMLConfiguration(mFile);
          xConfig.append(getEnvironmentConfiguration());
          xConfig.addConfigurationListener(new MetricsConfigListener());
          xConfig.setReloadingStrategy(new FileChangedReloadingStrategy());
         
          // Start a background Thread that checks a property from the XMLConfiguration
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

    @Override
    protected void setUp() throws Exception
    {

        XMLConfiguration configuration = new XMLConfiguration(_configFile);
        configuration.setProperty("virtualhosts.virtualhost.test.store.class", "org.apache.qpid.server.store.DerbyMessageStore");
        configuration.setProperty("virtualhosts.virtualhost.test.store."+ DerbyMessageStore.ENVIRONMENT_PATH_PROPERTY,
                                  System.getProperty("QPID_WORK", System.getProperty("java.io.tmpdir")) + File.separator + "derbyDB-NoLocalAfterRecoveryTest");

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

        _configFile = tmpFile;
        _connectionURL = getConnectionURL();

        BrokerDetails details = _connectionURL.getBrokerDetails(0);
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.