@Test public void testGetSubset() { Map<String, String> subset = configuration.getSubset("rabbitmq.addr"); assertEquals(3, subset.size()); assertTrue(subset.keySet().contains("0.host")); assertTrue(subset.keySet().contains("1.host")); assertTrue(subset.keySet().contains("2.host")); assertEquals("10.0.1.101", subset.get("0.host")); assertEquals("10.0.1.102", subset.get("1.host")); assertEquals("10.0.1.103", subset.get("2.host")); }
public Map<String, String> getSubset(String keyPrefix) { Map<String, String> subset = new HashMap<>(); for (Map.Entry<String, String> entry : this.config.entrySet()) { if (!entry.getKey().startsWith(keyPrefix + ".") && !entry.getKey().equals(keyPrefix)) { continue; } String newKey = entry.getKey().substring(keyPrefix.length()); if (newKey.startsWith(".")) { newKey = newKey.substring(1); } subset.put(newKey, entry.getValue()); } return subset; }
Configuration { public Map<String, String> getSubset(String keyPrefix) { Map<String, String> subset = new HashMap<>(); for (Map.Entry<String, String> entry : this.config.entrySet()) { if (!entry.getKey().startsWith(keyPrefix + ".") && !entry.getKey().equals(keyPrefix)) { continue; } String newKey = entry.getKey().substring(keyPrefix.length()); if (newKey.startsWith(".")) { newKey = newKey.substring(1); } subset.put(newKey, entry.getValue()); } return subset; } }
Configuration { public Map<String, String> getSubset(String keyPrefix) { Map<String, String> subset = new HashMap<>(); for (Map.Entry<String, String> entry : this.config.entrySet()) { if (!entry.getKey().startsWith(keyPrefix + ".") && !entry.getKey().equals(keyPrefix)) { continue; } String newKey = entry.getKey().substring(keyPrefix.length()); if (newKey.startsWith(".")) { newKey = newKey.substring(1); } subset.put(newKey, entry.getValue()); } return subset; } Configuration(final ConfigurationLoader configurationLoader, final Map<?, ?> config); }
Configuration { public Map<String, String> getSubset(String keyPrefix) { Map<String, String> subset = new HashMap<>(); for (Map.Entry<String, String> entry : this.config.entrySet()) { if (!entry.getKey().startsWith(keyPrefix + ".") && !entry.getKey().equals(keyPrefix)) { continue; } String newKey = entry.getKey().substring(keyPrefix.length()); if (newKey.startsWith(".")) { newKey = newKey.substring(1); } subset.put(newKey, entry.getValue()); } return subset; } Configuration(final ConfigurationLoader configurationLoader, final Map<?, ?> config); String get(String propertyKey, String defaultValue); boolean getBoolean(String propertyKey, boolean defaultValue); Integer getInt(String propertyKey, Integer defaultValue); Integer getInt(String propertyKey); Class<? extends T> getClass(String propertyKey); Map<String, String> getSubset(String keyPrefix); void setConfigurables(Object o, String keyPrefix); void setConfigurables(Object o, Map<String, String> config); Map toMap(); Iterable<String> getKeys(); Iterable<String> getKeys(String keyPrefix); void set(String propertyKey, Object value); @Override String toString(); org.apache.hadoop.conf.Configuration toHadoopConfiguration(); org.apache.hadoop.conf.Configuration toHadoopConfiguration(org.apache.hadoop.conf.Configuration additionalConfiguration); File resolveFileName(String fileName); JSONObject toJSON(Locale locale); JSONObject toJSON(ResourceBundle resourceBundle); Map<String, Map<String, String>> getMultiValue(String prefix); static Map<String, Map<String, String>> getMultiValue(Iterable<Map.Entry<String, String>> config, String prefix); }
Configuration { public Map<String, String> getSubset(String keyPrefix) { Map<String, String> subset = new HashMap<>(); for (Map.Entry<String, String> entry : this.config.entrySet()) { if (!entry.getKey().startsWith(keyPrefix + ".") && !entry.getKey().equals(keyPrefix)) { continue; } String newKey = entry.getKey().substring(keyPrefix.length()); if (newKey.startsWith(".")) { newKey = newKey.substring(1); } subset.put(newKey, entry.getValue()); } return subset; } Configuration(final ConfigurationLoader configurationLoader, final Map<?, ?> config); String get(String propertyKey, String defaultValue); boolean getBoolean(String propertyKey, boolean defaultValue); Integer getInt(String propertyKey, Integer defaultValue); Integer getInt(String propertyKey); Class<? extends T> getClass(String propertyKey); Map<String, String> getSubset(String keyPrefix); void setConfigurables(Object o, String keyPrefix); void setConfigurables(Object o, Map<String, String> config); Map toMap(); Iterable<String> getKeys(); Iterable<String> getKeys(String keyPrefix); void set(String propertyKey, Object value); @Override String toString(); org.apache.hadoop.conf.Configuration toHadoopConfiguration(); org.apache.hadoop.conf.Configuration toHadoopConfiguration(org.apache.hadoop.conf.Configuration additionalConfiguration); File resolveFileName(String fileName); JSONObject toJSON(Locale locale); JSONObject toJSON(ResourceBundle resourceBundle); Map<String, Map<String, String>> getMultiValue(String prefix); static Map<String, Map<String, String>> getMultiValue(Iterable<Map.Entry<String, String>> config, String prefix); static final String BASE_URL; static final String HADOOP_URL; static final String HDFS_LIB_CACHE_SOURCE_DIRECTORY; static final String HDFS_LIB_CACHE_TEMP_DIRECTORY; static final String HDFS_LIB_CACHE_HDFS_USER; static final String LIB_DIRECTORY; static final String ZK_SERVERS; static final String MODEL_PROVIDER; static final String USER_REPOSITORY; static final String WORKSPACE_REPOSITORY; static final String AUTHORIZATION_REPOSITORY; static final String ONTOLOGY_REPOSITORY; static final String AUDIT_REPOSITORY; static final String ARTIFACT_THUMBNAIL_REPOSITORY; static final String WORK_QUEUE_REPOSITORY; static final String LONG_RUNNING_PROCESS_REPOSITORY; static final String SYSTEM_NOTIFICATION_REPOSITORY; static final String WEB_APP_EMBEDDED_LONG_RUNNING_PROCESS_RUNNER_ENABLED; static final boolean WEB_APP_EMBEDDED_LONG_RUNNING_PROCESS_RUNNER_ENABLED_DEFAULT; static final String WEB_APP_EMBEDDED_LONG_RUNNING_PROCESS_RUNNER_THREAD_COUNT; static final int WEB_APP_EMBEDDED_LONG_RUNNING_PROCESS_RUNNER_THREAD_COUNT_DEFAULT; static final String WEB_APP_EMBEDDED_GRAPH_PROPERTY_WORKER_RUNNER_ENABLED; static final boolean WEB_APP_EMBEDDED_GRAPH_PROPERTY_WORKER_RUNNER_ENABLED_DEFAULT; static final String WEB_APP_EMBEDDED_GRAPH_PROPERTY_WORKER_RUNNER_THREAD_COUNT; static final int WEB_APP_EMBEDDED_GRAPH_PROPERTY_WORKER_RUNNER_THREAD_COUNT_DEFAULT; static final String USER_NOTIFICATION_REPOSITORY; static final String ONTOLOGY_REPOSITORY_OWL; static final String GRAPH_PROVIDER; static final String VISIBILITY_TRANSLATOR; static final String AUDIT_VISIBILITY_LABEL; static final String DEFAULT_PRIVILEGES; static final String WEB_PROPERTIES_PREFIX; static final String WEB_GEOCODER_ENABLED; static final String DEV_MODE; static final String DEFAULT_SEARCH_RESULT_COUNT; static final String LOCK_REPOSITORY_PATH_PREFIX; static final String USER_SESSION_COUNTER_PATH_PREFIX; static final String DEFAULT_TIME_ZONE; static final String RABBITMQ_PREFETCH_COUNT; static final String QUEUE_PREFIX; }