Package org.apache.commons.configuration2.builder.combined

Examples of org.apache.commons.configuration2.builder.combined.CombinedConfigurationBuilder


     */
    public void load(Element element) throws ConfigurationException
    {
        if (!element.getNodeName().equals("properties"))
        {
            throw new ConfigurationException(MALFORMED_XML_EXCEPTION);
        }
        NodeList childNodes = element.getChildNodes();
        for (int i = 0; i < childNodes.getLength(); i++)
        {
            Node item = childNodes.item(i);
            if (item instanceof Element)
            {
                if (item.getNodeName().equals("comment"))
                {
                    setHeader(item.getTextContent());
                }
                else if (item.getNodeName().equals("entry"))
                {
                    String key = ((Element) item).getAttribute("key");
                    addProperty(key, item.getTextContent());
                }
                else
                {
                    throw new ConfigurationException(MALFORMED_XML_EXCEPTION);
                }
            }
        }
    }
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

                        inUnicode = false;
                        hadSlash = false;
                    }
                    catch (NumberFormatException nfe)
                    {
                        throw new ConfigurationRuntimeException("Unable to parse unicode value: " + unicode, nfe);
                    }
                }
                continue;
            }
View Full Code Here

        beginWrite(true);
        try
        {
            if (name != null && namedConfigurations.containsKey(name))
            {
                throw new ConfigurationRuntimeException(
                        "A configuration with the name '"
                                + name
                                + "' already exists in this combined configuration!");
            }
View Full Code Here

    @Test
    public void testLockHandlingWithExceptionWhenConstructingRootNode()
    {
        SynchronizerTestImpl sync = setUpSynchronizerTest();
        final RuntimeException testEx =
                new ConfigurationRuntimeException("Test exception");
        BaseHierarchicalConfiguration childEx =
                new BaseHierarchicalConfiguration()
                {
                    @Override
                    public NodeModel<ImmutableNode> getModel() {
View Full Code Here

        {
            return Collections.singletonList((Object) value.toString());
        }
        else
        {
            throw new ConversionException('\'' + key + "' doesn't map to a List object: " + value + ", a "
                    + value.getClass().getName());
        }
        return list;
    }
View Full Code Here

                    defaultValue);
        }
        catch (ConversionException cex)
        {
            // improve error message
            throw new ConversionException(
                    String.format(
                            "Key '%s' cannot be converted to class %s. Value is: '%s'.",
                            key, cls.getName(), String.valueOf(value)));
        }
    }
View Full Code Here

    {
        parent.addProperty("tablespaces.tablespace.name", "default");
        parent.addProperty("tablespaces.tablespace(-1).name", "test");
        parent.addProperty("tables.table(0).var", "${brackets:x}");

        ConfigurationInterpolator interpolator = parent.getInterpolator();
        interpolator.registerLookup("brackets", new Lookup() {

            public String lookup(String key) {
                return "(" + key + ")";
            }
View Full Code Here

     * @param value the value to interpolate
     * @return the value with variables substituted
     */
    protected Object interpolate(Object value)
    {
        ConfigurationInterpolator ci = getInterpolator();
        return (ci != null) ? ci.interpolate(value) : value;
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration2.builder.combined.CombinedConfigurationBuilder

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.