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:com.axiomine.largecollections.utilities.KryoUtils.java

public static void registerDefaultKryoClasses(Kryo kryo) throws Exception {
    final Properties props = new Properties();
    props.load(KryoUtils.class.getClassLoader().getResourceAsStream("KryoRegistration.properties"));
    Set ks = props.keySet();
    for (Object k : ks) {
        //            System.out.println(k);
        Class c = Class.forName((String) k);
        Class s = Class.forName(props.getProperty((String) k));
        kryo.register(c, (Serializer) s.newInstance());
    }/*w w  w .  j a v  a2s  . com*/

}

From source file:ddf.security.common.util.PropertiesLoader.java

@SuppressWarnings("unchecked")
public static <K, V> Map<K, V> toMap(Properties properties) {
    if (properties != null) {
        Set<K> keySet = (Set<K>) properties.keySet();
        Map<K, V> map = new HashMap<K, V>(keySet.size() * 2);
        for (K obj : keySet) {
            map.put(obj, (V) properties.get(obj));
        }//  w w w.  j  a  v  a2  s  .co  m
        return map;
    }
    return new HashMap<K, V>();
}

From source file:com.bt.aloha.batchtest.WeekendBatchTest.java

protected static void addBatchScenarios(BatchTest batchTest) throws Exception {
    Properties properties = new Properties();
    InputStream is = new FileInputStream(SCENARIO_FILE);
    properties.load(is);//w w w.  j av a 2  s . co  m
    is.close();
    for (Object scenarioName : properties.keySet()) {
        String name = (String) scenarioName;
        String value = properties.getProperty(name);
        batchTest.addBatchTestScenario(name + "," + value);
    }
}

From source file:com.glaf.core.jdbc.connection.ConnectionProviderFactory.java

private static boolean c3p0ConfigDefined(Properties properties) {
    Iterator<?> iter = properties.keySet().iterator();
    while (iter.hasNext()) {
        String property = (String) iter.next();
        if (property.startsWith("c3p0")) {
            return true;
        }//from  w w w. j  a v  a2s. c o m
    }
    return false;
}

From source file:com.glaf.core.jdbc.connection.ConnectionProviderFactory.java

private static boolean druidConfigDefined(Properties properties) {
    Iterator<?> iter = properties.keySet().iterator();
    while (iter.hasNext()) {
        String property = (String) iter.next();
        if (property.startsWith("druid")) {
            return true;
        }/*from   ww  w. ja v  a  2  s  .  co  m*/
    }
    return false;
}

From source file:com.glaf.core.jdbc.connection.ConnectionProviderFactory.java

protected static Properties getConnectionProperties(Properties properties) {
    Iterator<?> iter = properties.keySet().iterator();
    Properties result = new Properties();
    while (iter.hasNext()) {
        String prop = (String) iter.next();
        if (prop.startsWith(DBConfiguration.JDBC_DRIVER) && !SPECIAL_PROPERTIES.contains(prop)) {
            result.setProperty(prop.substring(DBConfiguration.JDBC_PREFIX.length() + 1),
                    properties.getProperty(prop));
        }//from w  w  w.  j  a  v a 2 s.  c om
    }
    String userName = properties.getProperty(DBConfiguration.JDBC_USER);
    if (userName != null) {
        result.setProperty("user", userName);
    }
    String pwd = properties.getProperty(DBConfiguration.JDBC_PASSWORD);
    if (pwd != null) {
        result.setProperty("password", pwd);
    }
    return result;
}

From source file:com.squid.kraken.v4.auth.KrakenClientConfig.java

private static void load(InputStream in, Properties target) {
    Properties properties = new Properties();
    try {//from   ww  w  .  j  a  v  a 2 s.  com
        properties.loadFromXML(in);
        for (Object key : properties.keySet()) {
            Object value = properties.get(key);
            target.put(key, value);
            logger.debug(key + ":" + value);
        }
    } catch (Exception e) {
        logger.warn("Could not load Kraken config file for stream : " + in, e);
    }

}

From source file:com.netflix.config.WebApplicationProperties.java

protected static void initApplicationProperties() throws ConfigurationException, MalformedURLException {
    File appPropFile = new File(appConfFolder + "/" + baseConfigFileName + ".properties");
    File appEnvPropOverrideFile = new File(
            appConfFolder + "/" + baseConfigFileName + getEnvironment() + ".properties");

    // TODO awang, how do we add this to archaius default config?
    PropertiesConfiguration appConf = new PropertiesConfiguration(appPropFile);
    // apply env overrides
    PropertiesConfiguration overrideConf = new PropertiesConfiguration(appEnvPropOverrideFile);
    Properties overrideprops = ConfigurationUtils.getProperties(overrideConf);
    for (Object prop : overrideprops.keySet()) {
        appConf.setProperty("" + prop, overrideprops.getProperty("" + prop));
    }/*from w ww.j  a  va 2 s .co m*/
    String path = appPropFile.toURI().toURL().toString();
    System.setProperty(URLConfigurationSource.CONFIG_URL, path);
    ConfigurationManager.loadPropertiesFromConfiguration(appConf);

}

From source file:org.apache.geode.management.internal.cli.commands.StartMemberUtils.java

static void addGemFireSystemProperties(final List<String> commandLine, final Properties gemfireProperties) {
    for (final Object property : gemfireProperties.keySet()) {
        final String propertyName = property.toString();
        final String propertyValue = gemfireProperties.getProperty(propertyName);
        if (StringUtils.isNotBlank(propertyValue)) {
            commandLine.add("-D" + DistributionConfig.GEMFIRE_PREFIX + "" + propertyName + "=" + propertyValue);
        }//from  w w w .ja v a  2  s .  co  m
    }
}

From source file:com.wavemaker.common.util.SystemUtils.java

/**
 * Add all properties from p that are not set in org.
 *///from w ww. j  a  va 2 s  .  co  m
public static void addAllUnlessSet(Properties org, Properties p) {
    for (String s : CastUtils.<String>cast(p.keySet())) {
        if (!org.containsKey(s)) {
            org.setProperty(s, p.getProperty(s));
        }
    }
}