public PollResult poll(boolean b, Object o) throws Exception { Map<String, Object> configurations = new LinkedHashMap<>(); for (ConfigModel configModel : configModels) { configurations.putAll(YAMLUtil.retrieveItems("", configModel.getConfig())); } return PollResult.createFull(configurations); } }
public class XMLPolledConfigurationSource implements PolledConfigurationSource { @SuppressWarnings("static-access") @Override public PollResult poll(boolean inital, Object checkPoint) throws Exception { PollResult pollResult = null; Map<String, Object> map = new HashMap<>(); // Code to read content from the resource return pollResult.createFull(map); } }
@Override public PollResult poll(boolean initial, Object checkPoint) throws Exception { // implement logic to retrieve properties from DB Map<String, Object> map = load(); return PollResult.createFull(map); }
@Override public PollResult poll(boolean initial, Object checkPoint) throws Exception { // implement logic to retrieve properties from DB Map<String, Object> map = load(); return PollResult.createFull(map); }
/** * Retrieve the content of the property files. For each poll, it always * returns the complete union of properties defined in all URLs. If one * property is defined in content of more than one URL, the value in file later on the * list will override the value in the previous one. * * @param initial this parameter is ignored by the implementation * @param checkPoint this parameter is ignored by the implementation * @throws IOException IOException occurred in file operation */ @Override public PollResult poll(boolean initial, Object checkPoint) throws IOException { if (configUrls == null || configUrls.length == 0) { return PollResult.createFull(null); } Map<String, Object> map = new HashMap<String, Object>(); for (URL url: configUrls) { Properties props = new Properties(); InputStream fin = url.openStream(); props.load(fin); fin.close(); for (Entry<Object, Object> entry: props.entrySet()) { map.put((String) entry.getKey(), entry.getValue()); } } return PollResult.createFull(map); }
/** * Retrieve the content of the property files. For each poll, it always * returns the complete union of properties defined in all URLs. If one * property is defined in content of more than one URL, the value in file later on the * list will override the value in the previous one. * * @param initial this parameter is ignored by the implementation * @param checkPoint this parameter is ignored by the implementation * @throws IOException IOException occurred in file operation */ @Override public PollResult poll(boolean initial, Object checkPoint) throws IOException { if (configUrls == null || configUrls.length == 0) { return PollResult.createFull(null); } Map<String, Object> map = new HashMap<String, Object>(); for (URL url: configUrls) { InputStream fin = url.openStream(); Properties props = ConfigurationUtils.loadPropertiesFromInputStream(fin); for (Entry<Object, Object> entry: props.entrySet()) { map.put((String) entry.getKey(), entry.getValue()); } } return PollResult.createFull(map); }
public PollResult poll(boolean b, Object o) throws Exception { Map<String, Object> configurations = new LinkedHashMap<>(); for (ConfigModel configModel : configModels) { configurations.putAll(YAMLUtil.retrieveItems("", configModel.getConfig())); } return PollResult.createFull(configurations); } }
@Override public PollResult poll(boolean initial, Object checkPoint) throws Exception { String table = tableName.get(); Map<String, Object> map = loadPropertiesFromTable(table); log.info("Successfully polled Dynamo for a new configuration based on table:" + table); return PollResult.createFull(map); } }
/** {@inheritDoc} */ @Override public PollResult poll(boolean check, Object arg1) throws Exception { if (getFf4jStore() == null) { throw new IllegalStateException("PropertyStore should not be null (to poll it !)"); } // Cannot convert to Map < String, Object > Map < String, Object > properties = new HashMap<String, Object>(); for(Map.Entry<String, Property<?>> property : getFf4jStore().readAllProperties().entrySet()) { // All properties are String in commons-configuration properties.put(property.getKey(), property.getValue().asString()); } return PollResult.createFull(properties); }
@Override public PollResult poll(boolean initial, Object checkPoint) throws Exception { Map<String, Object> result = new HashMap<>(); environment.getPropertySources().iterator().forEachRemaining(source -> { if (source instanceof EnumerablePropertySource) { EnumerablePropertySource<?> enumerable = (EnumerablePropertySource<?>) source; for (String key : enumerable.getPropertyNames()) { result.putIfAbsent(key, enumerable.getProperty(key)); } } }); return PollResult.createFull(result); } }
@Override public PollResult poll(boolean initial, Object checkPoint) throws Exception { if (source == null) { return PollResult.createFull(new HashMap<String, Object>()); } try { return source.poll(initial, checkPoint); } catch (SQLException e) { if (firstLoad) { return checkInitial(initial, checkPoint); } throw e; } finally { firstLoad = false; } }
@Override public PollResult poll(boolean initial, Object checkPoint) throws IOException, AmazonServiceException { GetObjectRequest s3request = new GetObjectRequest(bucketName, key); InputStream is = null; try { S3Object result = client.getObject(s3request); is = result.getObjectContent(); Map<String,Object> resultMap = inputStreamToMap(is); return PollResult.createFull(resultMap); } finally { if (is!=null) is.close(); } }
return PollResult.createFull(new HashMap<String, Object>()); } else { return source.poll(initial, checkPoint);
@Override public PollResult poll(boolean initial, Object checkPoint) throws Exception { String container = containerName.get(); BlobMap blobs = ctx.createBlobMap(container); Map<String, Object> props = ImmutableMap.copyOf(filterValues(transformEntries(blobs, toStringOrNull), notNull())); log.info("{}: {} properties in container {}", new Object[] { ctx.unwrap().getName(), props.size(), container }); return PollResult.createFull(props); }
@Override public PollResult poll(boolean initial, Object checkPoint) throws Exception { Map<String, Object> map = new HashMap<String, Object>(); for(PropertyWithDeploymentContext prop: tableCache.getProperties()){ if(prop.getContextKey() == contextKey && prop.getContextValue() == null){ map.put(prop.getPropertyName(), prop.getPropertyValue()); } else if(prop.getContextKey() == contextKey && prop.getContextValue().equalsIgnoreCase(deploymentContext.getValue(contextKey))){ map.put(prop.getPropertyName(), prop.getPropertyValue()); } } return PollResult.createFull(map); } }
@Override public PollResult poll(boolean initial, Object checkPoint) throws Exception { return PollResult.createFull( secretsGroup.stream().filter(Config.active()).reverse().uniquePrimaryKey().toJavaStream(). collect(Collectors.toMap(e -> secretsGroup.srn(e.secretIdentifier).toSrn(), e -> e.toJsonBlob()) )); }