Example usage for org.apache.commons.configuration Configuration isEmpty

List of usage examples for org.apache.commons.configuration Configuration isEmpty

Introduction

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

Prototype

boolean isEmpty();

Source Link

Document

Check if the configuration is empty.

Usage

From source file:org.seedstack.seed.security.internal.realms.ConfigurationRealm.java

/**
 * Reads the configuration props to initialize authorized users and their rights.
 * /*from  w w w .ja va 2s.c o  m*/
 * @param securityConfiguration the configuration concerning security
 */
@Inject
public void readConfiguration(@Named("seed-security-config") Configuration securityConfiguration) {
    Configuration usersConfig = securityConfiguration.subset(USER_SECTION_NAME);
    if (usersConfig.isEmpty()) {
        LOGGER.warn("{} defined, but the configuration defines no user", getClass().getSimpleName());
        return;
    }
    users.clear();
    processUsersConfiguration(usersConfig);
}

From source file:org.wso2.andes.configuration.qpid.TopicConfiguration.java

@Override
public void validateConfiguration() throws ConfigurationException {
    if (_configuration.isEmpty()) {
        throw new ConfigurationException("Topics section cannot be empty.");
    }/*w  w  w  .  j a  va2s  . c o  m*/

    int topics = _configuration.getList("topic.name").size()
            + _configuration.getList("topic.subscriptionName").size();

    for (int index = 0; index < topics; index++) {
        Configuration topicSubset = _configuration.subset("topic(" + index + ")");

        // This will occur when we have a subscriptionName that is bound to a
        // topic.
        if (topicSubset.isEmpty()) {
            break;
        }

        TopicConfig topic = new TopicConfig();

        topic.setConfiguration(VIRTUALHOSTS_VIRTUALHOST_TOPICS + ".topic", topicSubset);

        String name = _configuration.getString("topic(" + index + ").name");
        String subscriptionName = _configuration.getString("topic(" + index + ").subscriptionName");

        // Record config if subscriptionName is there
        if (subscriptionName != null) {
            processSubscription(subscriptionName, topic);
        } else {
            // Otherwise record config as topic if we have the name
            if (name != null) {
                processTopic(name, topic);
            }
        }
    }
}

From source file:uk.ac.ebi.fg.jobs.JobController.java

private Configuration loadProperties(Configuration properties) {
    if (properties.getString("persistence-location") == null)
        throw new RuntimeException("ae.similarity.persistence-location doesn't exist");

    if (properties != null && !properties.isEmpty()) {
        properties = properties.subset("properties");
        return properties;
    } else {/*from w w w .  j  a  v a 2 s . c  o m*/
        for (int i = 0; i < defaultProperties.length; i++) {
            properties.addProperty(defaultProperties[i][0], defaultProperties[i][1]);
        }
        logger.error("Default properties loaded.");

        return properties;
    }
}

From source file:uk.org.openeyes.oink.facade.FacadeRoutingServiceFactory.java

private int getNumberOfMappingsGiven(Configuration facadeConfig) {
    if (facadeConfig.isEmpty()) {
        log.error("No mapping entries are in the program's config file. The facade will not map any requests!");
        return 0;
    }/*from www  .  java 2s  . c o m*/

    int numOfMappings = 0;

    while (facadeConfig.getKeys(++numOfMappings + ".").hasNext()) {
        numOfMappings++;
    }

    log.info("Found " + numOfMappings + " mapping entries");

    return numOfMappings;
}