Package org.apache.commons.configuration2.io

Examples of org.apache.commons.configuration2.io.FileHandler


     * @param fileName the file name
     * @throws ConfigurationException if an error occurs
     */
    private void load(String fileName) throws ConfigurationException
    {
        FileHandler handler = new FileHandler(config);
        handler.load(fileName);
    }
View Full Code Here


        ExprLookup.Variables vars = new ExprLookup.Variables();
        vars.add(new ExprLookup.Variable("String", org.apache.commons.lang3.StringUtils.class));
        vars.add(new ExprLookup.Variable("Util", new Utility("Hello")));
        vars.add(new ExprLookup.Variable("System", "Class:java.lang.System"));
        XMLConfiguration config = new XMLConfiguration();
        FileHandler handler = new FileHandler(config);
        handler.load(TEST_FILE);
        config.setLogger(log);
        ExprLookup lookup = new ExprLookup(vars);
        lookup.setInterpolator(config.getInterpolator());
        lookup.setLogger(log);
        String str = lookup.lookup(PATTERN1);
View Full Code Here

     */
    protected BaseHierarchicalConfiguration createCombinedConfiguration()
            throws ConfigurationException
    {
        XMLConfiguration conf1 = new XMLConfiguration();
        new FileHandler(conf1).load(CONF1);
        XMLConfiguration conf2 = new XMLConfiguration();
        new FileHandler(conf2).load(CONF2);
        ImmutableNode cn =
                combiner.combine(conf1.getNodeModel().getNodeHandler()
                        .getRootNode(), conf2.getNodeModel().getNodeHandler()
                        .getRootNode());

View Full Code Here

    {
        FileBasedConfiguration config =
                fileName.endsWith(".xml") ? new XMLPropertiesConfiguration()
                        : new PropertiesConfiguration();

        FileHandler handler = new FileHandler(config);
        handler.setBasePath(basePath);
        handler.setFileName(fileName);
        handler.load();
        setSystemProperties(config);
    }
View Full Code Here

     *
     * @param handler the associated {@code FileHandler} (can be <b>null</b>)
     */
    public FileBasedBuilderParametersImpl(FileHandler handler)
    {
        fileHandler = (handler != null) ? handler : new FileHandler();
    }
View Full Code Here

    public FileBasedBuilderParametersImpl clone()
    {
        FileBasedBuilderParametersImpl copy =
                (FileBasedBuilderParametersImpl) super.clone();
        copy.fileHandler =
                new FileHandler(fileHandler.getContent(), fileHandler);
        return copy;
    }
View Full Code Here

     * initialized.
     */
    @Test
    public void testUpdateFileHandler()
    {
        FileHandler handler = EasyMock.createMock(FileHandler.class);
        FileHandler handler2 = EasyMock.createMock(FileHandler.class);
        handler.addFileHandlerListener(listener);
        handler.removeFileHandlerListener(listener);
        handler2.addFileHandlerListener(listener);
        EasyMock.replay(handler, handler2);
        listener.updateFileHandler(handler);
        listener.updateFileHandler(handler2);
        EasyMock.verify(handler, handler2);
    }
View Full Code Here

     * for removing the listener when it is no longer needed.
     */
    @Test
    public void testUpdateFileHandlerNull()
    {
        FileHandler handler = EasyMock.createMock(FileHandler.class);
        handler.addFileHandlerListener(listener);
        handler.removeFileHandlerListener(listener);
        EasyMock.replay(handler);
        listener.updateFileHandler(handler);
        listener.updateFileHandler(null);
        EasyMock.verify(handler);
    }
View Full Code Here

     */
    @Test
    public void testConfigurationChangedWhileLoading()
    {
        EasyMock.replay(builder);
        listener.loading(new FileHandler());
        fireChangeEvent(false);
    }
View Full Code Here

    {
        String simpleConfigurationFile = ConfigurationAssert.getTestFile("testSequence.properties").getAbsolutePath();
        String compositeConfigurationFile = ConfigurationAssert.getTestFile("testSequenceDigester.xml").getAbsolutePath();

        PropertiesConfiguration simpleConfiguration = new PropertiesConfiguration();
        FileHandler handler = new FileHandler(simpleConfiguration);
        handler.setFileName(simpleConfigurationFile);
        handler.load();

        CombinedConfigurationBuilder builder = new CombinedConfigurationBuilder();
        builder.configure(new FileBasedBuilderParametersImpl().setFileName(compositeConfigurationFile));
        Configuration compositeConfiguration = builder.getConfiguration();
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration2.io.FileHandler

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.