Example usage for java.util Properties keySet

List of usage examples for java.util Properties keySet

Introduction

In this page you can find the example usage for java.util Properties keySet.

Prototype

@Override
    public Set<Object> keySet() 

Source Link

Usage

From source file:de.ecclesia.kipeto.RepositoryResolver.java

/**
 * Ermittelt anhand der lokalen IP-Adresse und der bergebenen
 * Konfiguration, welches Repository fr den Update-Vorgang verwendet werden
 * soll.// w  w w. ja v  a 2s.  co  m
 */
private String resolveRepos(String localIp, Properties config) {
    for (Object key : config.keySet()) {
        String ipPraefix = (String) key;
        String repos = config.getProperty(ipPraefix);

        if (localIp.startsWith(ipPraefix)) {
            log.info("Local IP " + localIp + " starts with '{}', selecting [{}]", ipPraefix, repos);
            return repos;
        } else {
            log.debug("Local IP " + localIp + " does not start with '{}' --> {}", ipPraefix, repos);
        }
    }

    log.warn("No matching config-entry found for {}, falling back to default-repository {}", localIp,
            defaultRepositoryUrl);

    return defaultRepositoryUrl;
}

From source file:com.enonic.cms.core.security.userstore.connector.config.UserStoreConnectorConfigLoader.java

private Set<String> doGetAllUserStoreConnectorNames() {
    if (userStoreConnectorNames != null) {
        return userStoreConnectorNames;
    }/*from w  ww  . j ava  2 s  .c om*/
    userStoreConnectorNames = new HashSet<String>();

    final Properties allProperties = getSubSet("cms.userstore.connector.");
    for (final Object propertyName : allProperties.keySet()) {
        final String configName = ((String) propertyName).replaceAll("^(cms\\.userstore\\.)?(.*?)\\..*$", "$2");
        userStoreConnectorNames.add(configName);
    }
    return userStoreConnectorNames;
}

From source file:edu.duke.cabig.c3pr.web.DashboardController.java

private void addLinks(Set<Lov> lovs, Properties properties) {
    for (Object key : properties.keySet()) {
        lovs.add(new Lov(key.toString(), properties.getProperty(key.toString())));
    }/*from w  w  w. jav a  2 s .  com*/
}

From source file:net.geoprism.FileMerger.java

public void mergeProperties(File base, File override, File export) throws IOException {
    if (!export.exists()) {
        export.createNewFile();/*from ww w.ja  va 2s . c o m*/
    }
    if (!base.exists()) {
        if (override != export) {
            FileUtils.copyFile(override, export);
        }
        return;
    }

    Properties baseProps = new Properties();
    baseProps.load(new FileInputStream(base));

    Properties overrideProps = new Properties();
    overrideProps.load(new FileInputStream(override));

    Iterator<Object> i = overrideProps.keySet().iterator();
    while (i.hasNext()) {
        String key = (String) i.next();

        String value = overrideProps.getProperty(key);
        if (value.equals("$REMOVE$")) {
            baseProps.remove(key);
        } else {
            baseProps.setProperty(key, value);
        }
    }

    baseProps.store(new FileOutputStream(export), null);
}

From source file:org.apache.openjpa.jdbc.meta.PropertiesReverseCustomizer.java

public void setConfiguration(Properties props) {
    _props = props;
    _unaccessed = new TreeSet(props.keySet());
}

From source file:ro.nextreports.server.web.themes.ThemesManager.java

private Map<String, String> createValues(InputStream is) {
    Map<String, String> valuesMap = new HashMap<String, String>();
    Properties prop = new Properties();
    try {//w ww .j a  v a2  s  .c o  m
        prop.load(is);
        for (Object o : prop.keySet()) {
            valuesMap.put((String) o, prop.getProperty((String) o));
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return valuesMap;
}

From source file:it.doqui.index.ecmengine.business.publishing.util.SystemPropertyFilters.java

/**
 * Costruttore privato.// www  .j  a v  a2s.c  o m
 * 
 * @throws EcmEngineException
 *             Se si verifica un errore durante il caricamento del file di
 *             property.
 */
private SystemPropertyFilters() throws EcmEngineException {
    try {
        Properties properties = new Properties();
        properties.load(getClass().getResourceAsStream(ECMENGINE_SYSTEM_PROPERTY_FILTERS_PROPERTY_FILE));
        for (Object key : properties.keySet()) {
            filteredSystemProperties.add("" + key);
        }
    } catch (Exception e) {
        throw new EcmEngineException("Errore nella lettura dei filtri delle system property", e);
    }
}

From source file:org.apache.falcon.resource.admin.AdminResource.java

private PropertyList getProperties(Properties properties) {
    List<Property> props = new ArrayList<Property>();

    for (Object key : properties.keySet()) {
        Property property = new Property();
        property.key = key.toString();/*w w  w .ja v  a 2  s.co  m*/
        property.value = properties.getProperty(key.toString());
        props.add(property);
    }
    PropertyList propertyList = new PropertyList();
    propertyList.properties = props;
    return propertyList;
}

From source file:com.jdom.word.playdough.model.gamepack.GamePackFileParser.java

private Map<String, List<Bonus>> setupBonusesMap(Properties properties) {
    Map<String, List<Bonus>> bonusesMap = new HashMap<String, List<Bonus>>();

    for (Bonus bonus : Bonus.AVAILABLE_BONUSES) {
        for (Object propertyKey : properties.keySet()) {
            String key = (String) propertyKey;

            if (key.endsWith(bonus.getLookupSuffix())) {
                String originalWord = key.substring(0, key.indexOf(bonus.getLookupSuffix()));
                String answersApplicableToBonusString = properties.getProperty(key);
                if (answersApplicableToBonusString != null) {
                    String[] answersApplicableToBonus = StringUtils.split(answersApplicableToBonusString,
                            PropertiesUtil.SEPARATOR);

                    for (String answer : answersApplicableToBonus) {
                        String bonusesMapKey = GamePack.getBonusesLookupKey(originalWord, answer);
                        List<Bonus> bonusesForAnswer = CollectionUtil.getOrPutAndGetList(bonusesMap,
                                bonusesMapKey);
                        bonusesForAnswer.add(bonus);
                    }/*  www  . jav  a 2 s  . c  o m*/
                }
            }
        }
    }

    return bonusesMap;
}