public String[] dumpEnvToString() { List<String> nodeEnv = new ArrayList<>(); for (Map.Entry<String, String> entry : env.entrySet()) { String envElt = String.format("%s=\"%s\"", entry.getKey(), entry.getValue()); log.debug(envElt); nodeEnv.add(envElt); } String[] envDescription = nodeEnv.toArray(new String[nodeEnv.size()]); return envDescription; }
public String[] dumpEnvToString() { List<String> nodeEnv = new ArrayList<>(); for (Map.Entry<String, String> entry : env.entrySet()) { String envElt = String.format("%s=\"%s\"", entry.getKey(), entry.getValue()); log.debug(envElt); nodeEnv.add(envElt); } String[] envDescription = nodeEnv.toArray(new String[nodeEnv.size()]); return envDescription; }
protected void setProvidedServiceRecordAttributes(MapOperations ops, ServiceRecord record) { String prefix = RoleKeys.SERVICE_RECORD_ATTRIBUTE_PREFIX; for (Map.Entry<String, String> entry : ops.entrySet()) { if (entry.getKey().startsWith( prefix)) { String key = entry.getKey().substring( prefix.length() + 1); record.set(key, entry.getValue().trim()); } } }
protected void setProvidedServiceRecordAttributes(MapOperations ops, ServiceRecord record) { String prefix = RoleKeys.SERVICE_RECORD_ATTRIBUTE_PREFIX; for (Map.Entry<String, String> entry : ops.entrySet()) { if (entry.getKey().startsWith( prefix)) { String key = entry.getKey().substring( prefix.length() + 1); record.set(key, entry.getValue().trim()); } } }
/** * Get all entries with a specific prefix * @param prefix prefix * @return a prefixed map, possibly empty */ public Map<String, String> prefixedWith(String prefix) { Map<String, String> prefixed = new HashMap<>(size()); for (Entry<String, String> entry: entrySet()) { if (entry.getKey().startsWith(prefix)) { prefixed.put(entry.getKey(), entry.getValue()); } } return prefixed; } }
/** * Get all entries with a specific prefix * @param prefix prefix * @return a prefixed map, possibly empty */ public Map<String, String> prefixedWith(String prefix) { Map<String, String> prefixed = new HashMap<>(size()); for (Entry<String, String> entry: entrySet()) { if (entry.getKey().startsWith(prefix)) { prefixed.put(entry.getKey(), entry.getValue()); } } return prefixed; } }
/** * Important: the configuration must already be fully resolved * in order to pick up global options * Copy env vars into the launch context. */ public boolean copyEnvVars(MapOperations options) { if (options == null) { return false; } for (Map.Entry<String, String> entry : options.entrySet()) { String key = entry.getKey(); if (key.startsWith(RoleKeys.ENV_PREFIX)) { key = key.substring(RoleKeys.ENV_PREFIX.length()); env.put(key, entry.getValue()); } } return true; }
/** * Important: the configuration must already be fully resolved * in order to pick up global options * Copy env vars into the launch context. */ public boolean copyEnvVars(MapOperations options) { if (options == null) { return false; } for (Map.Entry<String, String> entry : options.entrySet()) { String key = entry.getKey(); if (key.startsWith(RoleKeys.ENV_PREFIX)) { key = key.substring(RoleKeys.ENV_PREFIX.length()); env.put(key, entry.getValue()); } } return true; }
@Override public void bind(StateAccessForProviders stateAccessor, QueueAccess queueAccess, List<Container> liveContainers) { super.bind(stateAccessor, queueAccess, liveContainers); Map<String,String> dummyProps = new HashMap<String, String>(); dummyProps.put("prop1", "val1"); dummyProps.put("prop2", "val2"); log.info("publishing dummy-site.xml with values {}", dummyProps); publishApplicationInstanceData("dummy-site", "dummy configuration", dummyProps.entrySet()); // publishing global config for testing purposes publishApplicationInstanceData("global", "global configuration", stateAccessor.getAppConfSnapshot() .getGlobalOptions().entrySet()); }
@Override public void bind(StateAccessForProviders stateAccessor, QueueAccess queueAccess, List<Container> liveContainers) { super.bind(stateAccessor, queueAccess, liveContainers); Map<String,String> dummyProps = new HashMap<String, String>(); dummyProps.put("prop1", "val1"); dummyProps.put("prop2", "val2"); log.info("publishing dummy-site.xml with values {}", dummyProps); publishApplicationInstanceData("dummy-site", "dummy configuration", dummyProps.entrySet()); // publishing global config for testing purposes publishApplicationInstanceData("global", "global configuration", stateAccessor.getAppConfSnapshot() .getGlobalOptions().entrySet()); }