Package org.apache.commons.configuration2

Examples of org.apache.commons.configuration2.PropertiesConfiguration$DefaultIOFactory


     * @return Properties created from the Configuration
     */
    public static Properties getProperties(Configuration config)
    {
        Properties props = new Properties();
        ListDelimiterHandler listHandler;
        boolean useDelimiterHandler;

        if(config instanceof AbstractConfiguration)
        {
            listHandler = ((AbstractConfiguration) config).getListDelimiterHandler();
            useDelimiterHandler = true;
        }
        else
        {
            listHandler = null;
            useDelimiterHandler = false;
        }

        for (Iterator<String> keys = config.getKeys(); keys.hasNext();)
        {
            String key = keys.next();
            List<Object> list = config.getList(key);

            String propValue;
            if (useDelimiterHandler)
            {
                try
                {
                    propValue =
                            String.valueOf(listHandler.escapeList(list,
                                    ListDelimiterHandler.NOOP_TRANSFORMER));
                }
                catch (Exception ex)
                {
                    // obviously, the list handler does not support splitting
View Full Code Here


        conf = new PotentialErrorJNDIConfiguration(ctx);

        nonStringTestHolder = new NonStringTestHolder();
        nonStringTestHolder.setConfiguration(conf);

        listener = new ErrorListenerTestImpl(conf);
        conf.addEventListener(ConfigurationErrorEvent.ANY, listener);
    }
View Full Code Here

     */
    @Test
    public void testCloneModify()
    {
        MapConfiguration config = (MapConfiguration) getConfiguration();
        config.addEventListener(ConfigurationEvent.ANY, new EventListenerTestImpl(config));
        MapConfiguration copy = (MapConfiguration) config.clone();
        assertTrue("Event listeners were copied", copy
                .getEventListeners(ConfigurationEvent.ANY).isEmpty());

        config.addProperty("cloneTest", Boolean.TRUE);
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

                    this.value = clazz;
                }
            }
            catch (Exception e)
            {
                throw new ConfigurationRuntimeException("Unable to create " + value, e);
            }

        }
View Full Code Here

            return copy;
        }
        catch (CloneNotSupportedException cex)
        {
            // should not happen
            throw new ConfigurationRuntimeException(cex);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration2.PropertiesConfiguration$DefaultIOFactory

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.