Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.PropertiesConfiguration.load()


    if (defaultsFile != null)
    {
      PropertiesConfiguration defaultsConf = new PropertiesConfiguration();
      FileObject fo = VFSUtils.resolveFile(".", defaultsFile);
      InputStream in = fo.getContent().getInputStream();
      defaultsConf.load(in);
      in.close();
      for (Iterator it = defaultsConf.getKeys(); it.hasNext();)
      {
        String key = (String) it.next();
        if (jnlpConf.containsKey(key))
View Full Code Here


   
      try {
       
        PropertiesConfiguration fileConfig = new PropertiesConfiguration();
        fileConfig.setListDelimiter(';');
        fileConfig.load(configFile);
        data.setConfig(fileConfig);
       
      } catch (ConfigurationException e) {
       
        JOptionPane.showMessageDialog(viewerFrame,
View Full Code Here

    if (representativeArgs.isConfig()) {
      try {
        configFile = representativeArgs.getConfig();
        PropertiesConfiguration fileConfig = new PropertiesConfiguration();
        fileConfig.setListDelimiter(';');
        fileConfig.load(configFile);
        config = fileConfig;
      } catch (ConfigurationException e) {
        System.err.println("could not read config, ignoring it: ");
        System.err.println(e);
      }
View Full Code Here

        {
            InputStream is = new FileInputStream(configLocation);
            config.load(is);
            is.close();
            InputStream tis = new FileInputStream(ttsLocation);
            tconfig.load(tis);
            tis.close();           
            MultiFacetedAuthentication mfa = new MultiFacetedAuthenticationImpl(config, tconfig);
            MFA.setInstance(mfa);
        }
        catch (Exception e)
View Full Code Here

       
        try
        {
            InputStream is = event.getServletContext().getResourceAsStream(configLocation);
            PropertiesConfiguration config = new PropertiesConfiguration();
            config.load(is);
            is.close();

            InputStream tis = event.getServletContext().getResourceAsStream(ttsConfigLocation);           
            PropertiesConfiguration ttsConfig = new PropertiesConfiguration();
            ttsConfig.load(tis);
View Full Code Here

            config.load(is);
            is.close();

            InputStream tis = event.getServletContext().getResourceAsStream(ttsConfigLocation);           
            PropertiesConfiguration ttsConfig = new PropertiesConfiguration();
            ttsConfig.load(tis);
            tis.close();
           
            String rootPath = event.getServletContext().getRealPath("/");
            MultiFacetedAuthentication mfa = new MultiFacetedAuthenticationImpl(config, ttsConfig, rootPath);
            MFA.setInstance(mfa);
View Full Code Here

        InputStream input = null;
       
        try
        {
            input = Thread.currentThread().getContextClassLoader().getResourceAsStream("mfa.properties");
            config.load(input);
        }
        finally
        {
            IOUtils.closeQuietly(input);
        }
View Full Code Here

  public void testMergeConfigurations() throws Exception {
    Configuration one = new BaseConfiguration();
    one.setProperty("foo", "bar");
    PropertiesConfiguration two = new PropertiesConfiguration();
    String properties = "## some header \n" + "foo = bar1\n" + "bar = foo\n";
    two.load(new StringReader(properties));

    configurationFactory.setConfigurations(new Configuration[] { one, two });
    configurationFactory.afterPropertiesSet();
    Properties props = (Properties) configurationFactory.getObject();
    assertEquals("foo", props.getProperty("bar"));
View Full Code Here

     */
    public void testFromClassPath() throws Exception
    {
        PropertiesConfiguration config = new PropertiesConfiguration();
        config.setFileName(TEST_FILE);
        config.load();
        assertTrue(config.getBoolean("configuration.loaded"));
        FileChangedReloadingStrategy strategy = new FileChangedReloadingStrategy();
        config.setReloadingStrategy(strategy);
        assertEquals(config.getURL().toExternalForm(), strategy.getFile().toURI().toURL().toExternalForm());
    }
View Full Code Here

     */
    public void testFromClassPath() throws Exception
    {
        PropertiesConfiguration config = new PropertiesConfiguration();
        config.setFileName("test.properties");
        config.load();
        assertTrue(config.getBoolean("configuration.loaded"));
        FileChangedReloadingStrategy strategy = new FileChangedReloadingStrategy();
        config.setReloadingStrategy(strategy);
        assertEquals(config.getURL(), strategy.getFile().toURL());
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.