Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.BaseConfiguration


        super(name);

        ServiceManager serviceManager = TurbineServices.getInstance();
        serviceManager.setApplicationRoot(".");

        Configuration cfg = new BaseConfiguration();
        cfg.setProperty(PREFIX + "classname",
                        TurbineCryptoService.class.getName());

        cfg.setProperty(PREFIX + "algorithm.unix",
                        UnixCrypt.class.getName());
        cfg.setProperty(PREFIX + "algorithm.clear",
                        ClearCrypt.class.getName());
        cfg.setProperty(PREFIX + "algorithm.java",
                        JavaCrypt.class.getName());
        cfg.setProperty(PREFIX + "algorithm.oldjava",
                        OldJavaCrypt.class.getName());

        /* Do _not_ configure a default! We want to test explicitly */

        cfg.setProperty(PREFIX + "algorithm.default",
                        "none");

        /* Ugh */

        cfg.setProperty("services." + FactoryService.SERVICE_NAME + ".classname",
                        TurbineFactoryService.class.getName());

        serviceManager.setConfiguration(cfg);

        try
View Full Code Here


     * @exception IOException, if there was an I/O problem.
     */
    public static void setPropertiesFileName(String propertiesFileName)
        throws TurbineException
    {
        Configuration mappings = (Configuration) new BaseConfiguration();

        mappings.setProperty(ResourceService.SERVICE_NAME,
            TurbineResourceService.class.getName());

        TurbineServices services = (TurbineServices) TurbineServices.getInstance();
View Full Code Here

     * @exception TurbineException, if there was an I/O problem.
     */
    public static void setProperties(Properties properties)
        throws TurbineException
    {
        Configuration mappings = (Configuration) new BaseConfiguration();

        mappings.setProperty(ResourceService.SERVICE_NAME,
            TurbineResourceService.class.getName());

        TurbineServices services = (TurbineServices) TurbineServices.getInstance();
View Full Code Here

     * @param name The name of the service.
     * @return Properties of requested Service.
     */
    public Configuration getConfiguration( String name )
    {
        return (Configuration) new BaseConfiguration();
    }
View Full Code Here

    if (!f.exists()) {
      f.mkdirs();
    }

    BaseConfiguration conf = new BaseConfiguration();
    conf.addProperty(Engine.CONFIG_PACKAGES, packages);
    conf.addProperty(Engine.CONFIG_INPUT_PLUGINS, inputPlugins);
    conf.addProperty(Engine.CONFIG_OUTPUT_PLUGINS, outputPlugins);
    conf.addProperty(Engine.CONFIG_BASE_OUTPUT_DIR, f.getAbsolutePath());
    Engine eng = new Engine(conf);
    List<PackageContainer> parsedPackages = eng.execute();
    getLog().info(
        String.format("Parsed %d packages", parsedPackages.size()));
  }
View Full Code Here

        // test the postgresql variation
        c = new Criteria();
        Criteria.Criterion cc =
            c.getNewCriterion("TABLE.COLUMN", Boolean.TRUE, Criteria.EQUAL);

        Configuration conf = new BaseConfiguration();
        conf.addProperty("driver", "org.postgresql.Driver");
        try
        {
            cc.setDB(DBFactory.create("org.postgresql.Driver"));
        }
        catch (Exception e)
View Full Code Here

        // test the postgresql variation
        c = new Criteria();
        Criteria.Criterion cc =
            c.getNewCriterion("TABLE.COLUMN", Boolean.TRUE, Criteria.EQUAL);

        Configuration conf = new BaseConfiguration();
        conf.addProperty("driver", "org.postgresql.Driver");
        try
        {
            cc.setDB(DBFactory.create("org.postgresql.Driver"));
        }
        catch (Exception e)
View Full Code Here

        }

        triggerEvent( ConfigurationEvent.SAVED );

        Registry section = registry.getSection( KEY + ".user" );
        return section == null ? new CommonsConfigurationRegistry( new BaseConfiguration() ) : section;
    }
View Full Code Here

            fail("NPE expected");
        } catch (NullPointerException e) {
            assertNotNull(e);
        }
        DynamicBooleanProperty prop = DynamicPropertyFactory.getInstance().getBooleanProperty("abc", false);
        BaseConfiguration baseConfig = new BaseConfiguration();
        DynamicPropertyFactory.initWithConfigurationSource(baseConfig);
        baseConfig.setProperty("abc", "true");
        assertTrue(prop.get());
    }
View Full Code Here

    @Test
    public void testInstall() {
        ConfigurationManager.getConfigInstance().setProperty("prop1", "abc");
        assertEquals("abc", ConfigurationManager.getConfigInstance().getProperty("prop1"));
        assertEquals("abc", prop1.get());
        BaseConfiguration newConfig = new BaseConfiguration();
        newConfig.setProperty("prop1", "fromNewConfig");
        ConfigurationManager.install(newConfig);
        assertEquals("fromNewConfig", ConfigurationManager.getConfigInstance().getProperty("prop1"));
        assertEquals("fromNewConfig", prop1.get());
        newConfig.setProperty("prop1", "changed");
        assertEquals("changed", ConfigurationManager.getConfigInstance().getProperty("prop1"));
        assertEquals("changed", prop1.get());
        try {
            ConfigurationManager.install(new BaseConfiguration());
            fail("IllegalStateExceptionExpected");
        } catch (IllegalStateException e) {
            assertNotNull(e);
        }
        try {
            DynamicPropertyFactory.initWithConfigurationSource(new BaseConfiguration());
            fail("IllegalStateExceptionExpected");
        } catch (IllegalStateException e) {
            assertNotNull(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration.BaseConfiguration

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.