Example usage for org.apache.commons.configuration SubsetConfiguration SubsetConfiguration

List of usage examples for org.apache.commons.configuration SubsetConfiguration SubsetConfiguration

Introduction

In this page you can find the example usage for org.apache.commons.configuration SubsetConfiguration SubsetConfiguration.

Prototype

public SubsetConfiguration(Configuration parent, String prefix, String delimiter) 

Source Link

Document

Create a subset of the specified configuration

Usage

From source file:com.liferay.portal.configuration.easyconf.ClassLoaderAggregateProperties.java

public ClassLoaderAggregateProperties(ClassLoader classLoader, String companyId, String componentName) {

    super(companyId, componentName);

    _classLoader = classLoader;// ww  w . j ava 2s .  c o m
    _companyId = companyId;
    _componentName = componentName;

    _prefixedSystemConfiguration = new SubsetConfiguration(_systemConfiguration, _getPrefix(), null);
}

From source file:com.zavakid.mushroom.impl.ConfigBuilder.java

/**
 * Return a subset configuration (so getParent() can be used.)
 * /*w ww.  j  a  v a  2  s.c  o  m*/
 * @param prefix of the subset
 * @return the subset config
 */
public SubsetConfiguration subset(String prefix) {
    return new SubsetConfiguration(config, prefix, ".");
}

From source file:de.xirp.settings.SettingsPage.java

/**
 * Adds an option to this page./*  w ww  . jav  a2  s  . c  om*/
 * 
 * @param optionKey
 *            the key for translating the name of this option.
 *            <br>
 *            If you have an option key of the form
 *            <code>test.page1.option</code> you have to give
 *            only <code>option</code> to this parameter,
 *            because the other values come from the preferences
 *            page.
 * @param type
 *            the type of this option, which may be
 *            <code>null</code> if an other renderer is
 *            specified
 * @return the created option
 */
public Option addOption(String optionKey, OptionType type) {
    SubsetConfiguration sub2 = null;
    if (sub != null) {
        sub2 = new SubsetConfiguration(sub, optionKey, "."); //$NON-NLS-1$
    }
    if (options.containsKey(optionKey)) {
        throw new IllegalStateException(I18n.getString("Option key has to be unique.")); //$NON-NLS-1$
    }
    Option option = new Option(this, sub2, bundle, key + "." + optionKey, //$NON-NLS-1$
            type);
    options.put(optionKey, option);
    optionOrder.add(option);
    return option;
}

From source file:de.xirp.settings.Settings.java

/**
 * Adds a new page to this preferences.<br>
 * The resource bundle and properties for saving are inherited
 * from this preferences object./*from ww  w. ja v  a  2 s .c om*/
 * 
 * @param subKey
 *            the sub-key used for translation and saving.<br>
 *            If you have some preferences called
 *            <code>test</code> and a page called
 *            <code>page1</code>, then the key for saving is
 *            <code>test.[uniqueyKey].page1</code> and the key
 *            for translation is <code>test.page1</code>.
 * @param shortDescriptionKey
 *            The translation key for a short description of the
 *            page.<br>
 *            The key in the file has to be
 *            <code>[mainKey].[subKey].[shortDescriptionKey]</code>
 * @param longDescriptionKey
 *            The translation key for a long description of the
 *            page.<br>
 *            The key in the file has to be
 *            <code>[mainKey].[subKey].[longDescriptionKey]</code>
 * @return the created page
 */
public SettingsPage addPage(String subKey, String shortDescriptionKey, String longDescriptionKey) {

    initListener();

    SubsetConfiguration sub = null;
    if (config != null) {
        sub = new SubsetConfiguration(config, mainKey + "." //$NON-NLS-1$
                + uniqueKey + "." + subKey, "."); //$NON-NLS-1$ //$NON-NLS-2$
    }
    SettingsPage page = new SettingsPage(this, sub, handler, mainKey + "." //$NON-NLS-1$
            + subKey, mainKey + "." + subKey + (shortDescriptionKey != null ? "." + shortDescriptionKey : ""), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            (longDescriptionKey != null ? mainKey + "." + subKey + "." + longDescriptionKey : null)); //$NON-NLS-1$ //$NON-NLS-2$
    pages.add(page);
    return page;
}