Package org.apache.commons.configuration2.event

Examples of org.apache.commons.configuration2.event.EventSource


        builder.addEventListener(ConfigurationEvent.ANY, listener);
        EasyMock.replay(builder);

        BuilderConfigurationWrapperFactory factory =
                new BuilderConfigurationWrapperFactory(EventSourceSupport.BUILDER);
        EventSource src =
                (EventSource) factory.createBuilderConfigurationWrapper(
                        HierarchicalConfiguration.class, builder);
        src.addEventListener(ConfigurationEvent.ANY, listener);
        EasyMock.verify(builder);
    }
View Full Code Here


    public void testAsEventSourceUnsupportedMock()
    {
        @SuppressWarnings("unchecked")
        EventListener<ConfigurationEvent> cl = EasyMock.createMock(EventListener.class);
        EasyMock.replay(cl);
        EventSource source = ConfigurationUtils.asEventSource(this, true);
        source.addEventListener(ConfigurationEvent.ANY, cl);
        assertFalse("Wrong result (1)", source.removeEventListener(ConfigurationEvent.ANY, cl));
        source.addEventListener(ConfigurationEvent.ANY, null);
    }
View Full Code Here

     *
     * @param obj the object to initialize
     */
    private void registerEventListeners(T obj)
    {
        EventSource evSrc = ConfigurationUtils.asEventSource(obj, true);
        for (EventListenerRegistrationData<?> regData : eventListeners
                .getRegistrations())
        {
            registerListener(evSrc, regData);
        }
View Full Code Here

     *
     * @param obj the affected result object
     */
    private void removeEventListeners(T obj)
    {
        EventSource evSrc = ConfigurationUtils.asEventSource(obj, true);
        for (EventListenerRegistrationData<?> regData : eventListeners
                .getRegistrations())
        {
            removeListener(evSrc, regData);
        }
View Full Code Here

        {
            transformer.transform(source, result);
        }
        catch (TransformerException tex)
        {
            throw new ConfigurationException(tex);
        }
    }
View Full Code Here

        {
            return factory.newTransformer();
        }
        catch (TransformerConfigurationException tex)
        {
            throw new ConfigurationException(tex);
        }
    }
View Full Code Here

        {
            return factory.newDocumentBuilder();
        }
        catch (ParserConfigurationException pcex)
        {
            throw new ConfigurationException(pcex);
        }
    }
View Full Code Here

            }
        }

        if (url == null)
        {
            throw new ConfigurationException("Cannot resolve include file "
                    + fileName);
        }

        FileHandler fh = new FileHandler(this);
        fh.load(url);
View Full Code Here

     */
    private FileBased fetchFileBased() throws ConfigurationException
    {
        if (!(config instanceof FileBased))
        {
            throw new ConfigurationException(
                    "Wrapped configuration does not implement FileBased!"
                            + " No I/O operations are supported.");
        }
        return (FileBased) config;
    }
View Full Code Here

            xmlReader.setContentHandler(new XMLPropertiesHandler());
            xmlReader.parse(new InputSource(in));
        }
        catch (Exception e)
        {
            throw new ConfigurationException("Unable to parse the configuration file", e);
        }

        // todo: support included properties ?
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration2.event.EventSource

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.