Example usage for java.util Properties stringPropertyNames

List of usage examples for java.util Properties stringPropertyNames

Introduction

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

Prototype

public Set<String> stringPropertyNames() 

Source Link

Document

Returns an unmodifiable set of keys from this property list where the key and its corresponding value are strings, including distinct keys in the default property list if a key of the same name has not already been found from the main properties list.

Usage

From source file:org.gdms.maven.sql.AbstractGenerateSql.java

private void printProperties(Properties p) {
    Log log = getLog();/*from   ww  w .  j av  a  2s  .  co m*/
    log.debug(" {");
    for (String key : p.stringPropertyNames()) {
        log.debug("  " + key + " = " + p.getProperty(key));
    }
    log.debug(" }");
}

From source file:org.geoserver.security.iride.entity.IrideInfoPersona.java

/**
 * Constructor.//from w w w .jav  a 2s  .  c om
 *
 * @param role
 * @param properties
 */
public IrideInfoPersona(IrideRole role, final Properties properties) {
    this(role, Maps.toMap(properties.stringPropertyNames(), new Function<String, Object>() {
        /*
         * (non-Javadoc)
         * @see com.google.common.base.Function#apply(java.lang.Object)
         */
        @Override
        public Object apply(String key) {
            return properties.getProperty(key);
        }
    }));
}

From source file:org.springframework.batch.admin.web.server.JsonIntegrationTests.java

@Test
public void testListedResourcesWithGet() throws Exception {

    Map<String, String> params = new HashMap<String, String>();
    params.put("jobName", "job2");
    // These should be there if the previous test cases worked
    params.put("jobInstanceId", "0");
    params.put("jobExecutionId", "0");
    params.put("stepExecutionId", "0");

    RestTemplate template = new RestTemplate();

    PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean();
    propertiesFactoryBean.setLocation(//from  ww  w  .j  a  va 2  s.  c om
            new ClassPathResource("/org/springframework/batch/admin/web/manager/json-resources.properties"));
    propertiesFactoryBean.afterPropertiesSet();
    Properties properties = propertiesFactoryBean.getObject();

    for (String path : properties.stringPropertyNames()) {
        if (!StringUtils.hasText(path) || !path.startsWith("GET")) {
            continue;
        }
        path = path.substring(path.indexOf("/"));
        ResponseEntity<String> result = template.exchange(serverRunning.getUrl() + path, HttpMethod.GET, null,
                String.class, params);
        JsonWrapper wrapper = new JsonWrapper(result.getBody());
        // System.err.println(wrapper);
        assertNotNull(wrapper);
    }
}

From source file:ua.com.ecotep.unianalysis.security.ConfigParamsContext.java

@Override
public ServerConfigParams getServerConfigParams() throws Exception {
    ServerConfigParams scp;//from  w  w  w. ja va2  s .co  m
    ConfigEncoder ce = new ConfigEncoderImpl();

    File f = new File("unianalysis.xml");
    Properties properties = new Properties();

    properties.loadFromXML(new FileInputStream(f));
    String serverDBPath = null;
    String serverDBUser = null;
    String serverDBPass = null;

    for (String key : properties.stringPropertyNames()) {
        if (key.equals("serverpath")) {
            serverDBPath = ce.decode(Base64.decodeBase64(properties.getProperty(key).getBytes()));
        }
        if (key.equals("user")) {
            serverDBUser = ce.decode(Base64.decodeBase64(properties.getProperty(key).getBytes()));
        }
        if (key.equals("md5")) {
            serverDBPass = ce.decode(Base64.decodeBase64(properties.getProperty(key).getBytes()));
        }
    }
    scp = new ServerConfigParamsImpl(serverDBPath, serverDBUser, serverDBPass);
    return scp;
}

From source file:org.kie.workbench.common.services.refactoring.backend.server.BaseIndexingTest.java

protected String propertiesToString(final Properties properties) {
    final StringBuilder sb = new StringBuilder();
    for (String name : properties.stringPropertyNames()) {
        sb.append(name).append("=").append(properties.getProperty(name)).append("\n");
    }/*from   www.j  a v a  2 s . c  o m*/
    return sb.toString();
}

From source file:com.mozilla.bagheera.hazelcast.persistence.ElasticSearchIndexQueueStore.java

public void init(HazelcastInstance hazelcastInstance, Properties properties, String mapName) {
    Configuration conf = HBaseConfiguration.create();
    for (String name : properties.stringPropertyNames()) {
        if (name.startsWith("hbase.") || name.startsWith("hadoop.") || name.startsWith("zookeeper.")) {
            conf.set(name, properties.getProperty(name));
        }/*from  w w  w . ja v a 2 s  .c  o  m*/
    }

    int hbasePoolSize = Integer.parseInt(properties.getProperty("hazelcast.hbase.pool.size", "10"));
    QUEUE_NAME = properties.getProperty("hazelcast.queue.name", "tasks");
    String tableName = properties.getProperty("hazelcast.hbase.table", "default");
    String family = properties.getProperty("hazelcast.hbase.column.family", "data");
    String columnQualifier = properties.getProperty("hazelcast.hbase.column.qualifier");
    String qualifier = columnQualifier == null ? "" : columnQualifier;

    pool = new HTablePool(conf, hbasePoolSize);
    table = new HBaseTableDao(pool, tableName, family, qualifier);

    String indexName = properties.getProperty("hazelcast.elasticsearch.index", "default");
    String typeName = properties.getProperty("hazelcast.elasticsearch.type.name", "data");
    try {
        es = new ElasticSearchDao(NodeClientSingleton.getInstance().getClient(), indexName, typeName);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        LOG.error("error invoking ES instance: " + e.getMessage());
    }
}

From source file:edu.cornell.mannlib.vitro.webapp.utils.developer.DeveloperSettings.java

public void updateFromProperties(Properties properties) {
    Map<Key, String> fromFile = new HashMap<>();
    for (String key : properties.stringPropertyNames()) {
        fromFile.put(Key.fromPropertyName(key), properties.getProperty(key));
    }/*from w  w w  . j  av a2 s  .  c  o m*/
    update(fromFile);
}

From source file:ezbake.groups.graph.TitanGraphConfiguration.java

public TitanGraphConfiguration(Properties ezConfiguration) {
    this.ezConfiguration = ezConfiguration;

    // Copy all the titan configurations out of the ezconfiguration
    for (String key : ezConfiguration.stringPropertyNames()) {
        String propValue = ezConfiguration.getProperty(key);
        if (propValue != null && key.startsWith(GraphDatabaseConfiguration.STORAGE_NAMESPACE)) {
            setProperty(key, propValue);
        }//from  ww w. ja  v a  2  s  .c  o m
    }

    // Update the instance number
    EzBakeApplicationConfigurationHelper appHelper = new EzBakeApplicationConfigurationHelper(ezConfiguration);
    setProperty(
            joinProperties(GraphDatabaseConfiguration.STORAGE_NAMESPACE,
                    GraphDatabaseConfiguration.INSTANCE_RID_SHORT_KEY),
            appHelper.getApplicationInstanceNumber());

    // Gather all the accumulo configurations
    AccumuloHelper ah = new AccumuloHelper(ezConfiguration);
    setProperty(
            joinProperties(GraphDatabaseConfiguration.STORAGE_NAMESPACE,
                    AccumuloStoreManager.ACCUMULO_NAMESPACE, AccumuloStoreManager.ACCUMULO_INSTANCE_KEY),
            ah.getAccumuloInstance());

    setProperty(joinProperties(GraphDatabaseConfiguration.STORAGE_NAMESPACE,
            GraphDatabaseConfiguration.HOSTNAME_KEY), ah.getAccumuloZookeepers());

    String tableNameKey = joinProperties(GraphDatabaseConfiguration.STORAGE_NAMESPACE,
            AccumuloStoreManager.TABLE_NAME_KEY);
    setProperty(tableNameKey, joinProperties(ah.getAccumuloNamespace(), getString(tableNameKey)));

    setProperty(joinProperties(GraphDatabaseConfiguration.STORAGE_NAMESPACE,
            GraphDatabaseConfiguration.AUTH_USERNAME_KEY), ah.getAccumuloUsername());

    setProperty(joinProperties(GraphDatabaseConfiguration.STORAGE_NAMESPACE,
            GraphDatabaseConfiguration.AUTH_PASSWORD_KEY), ah.getAccumuloPassword());

    // Gather elasticsearch properties
    ElasticsearchConfigurationHelper eh = new ElasticsearchConfigurationHelper(ezConfiguration);
    setProperty(joinProperties(GraphDatabaseConfiguration.STORAGE_NAMESPACE,
            GraphDatabaseConfiguration.INDEX_NAMESPACE, SEARCH_INDEX, ElasticSearchIndex.CLUSTER_NAME_KEY),
            eh.getElasticsearchClusterName());

    setProperty(joinProperties(GraphDatabaseConfiguration.STORAGE_NAMESPACE,
            GraphDatabaseConfiguration.INDEX_NAMESPACE, SEARCH_INDEX, GraphDatabaseConfiguration.HOSTNAME_KEY),
            eh.getElasticsearchHostWithPort());

}

From source file:org.georchestra.security.LdapUserDetailsRequestHeaderProvider.java

public void init() throws IOException {
    if ((georchestraConfiguration != null) && (georchestraConfiguration.activated())) {
        Properties pHmap = georchestraConfiguration.loadCustomPropertiesFile("headers-mapping");
        _headerMapping.clear();//from  w w w. j  a v a  2 s . co m
        for (String key : pHmap.stringPropertyNames()) {
            _headerMapping.put(key, pHmap.getProperty(key));
        }
    }
}

From source file:org.wisdom.bnd.plugins.ImportedPackageRangeFixer.java

private void addToRanges(Properties properties) {
    for (String key : properties.stringPropertyNames()) {
        String value = properties.getProperty(key);
        ranges.add(new Range(key, value));
    }/*w w w . j a va  2s .co  m*/
}