@Override public void update(String pid, Map<String, Object> properties) throws IOException { try { LOGGER.trace("Updating configuration {}", pid); Configuration cfg = configAdmin.getConfiguration(pid, "?"); Dictionary<String, Object> dict = cfg.getProperties(); TypedProperties props = new TypedProperties(); File file = getCfgFileFromProperties(dict); if (file != null) { props.load(file); props.putAll(properties); props.keySet().retainAll(properties.keySet()); props.save(file); props.clear(); props.load(file); props.put(FILEINSTALL_FILE_NAME, file.toURI().toString()); } else { file = new File(System.getProperty("karaf.etc"), pid + ".cfg"); props.putAll(properties); props.keySet().retainAll(properties.keySet()); props.save(file); props.put(FILEINSTALL_FILE_NAME, file.toURI().toString()); } cfg.update(new Hashtable<>(props)); } catch (URISyntaxException e) { throw new IOException("Error updating config", e); } }
@Override public void update(String pid, Map<String, Object> properties) throws IOException { try { LOGGER.trace("Updating configuration {}", pid); Configuration cfg = configAdmin.getConfiguration(pid, "?"); Dictionary<String, Object> dict = cfg.getProperties(); TypedProperties props = new TypedProperties(); File file = getCfgFileFromProperties(dict); if (file != null) { props.load(file); props.putAll(properties); props.keySet().retainAll(properties.keySet()); props.save(file); props.clear(); props.load(file); props.put(FILEINSTALL_FILE_NAME, file.toURI().toString()); } else { file = new File(System.getProperty("karaf.etc"), pid + ".cfg"); props.putAll(properties); props.keySet().retainAll(properties.keySet()); props.save(file); props.put(FILEINSTALL_FILE_NAME, file.toURI().toString()); } cfg.update(new Hashtable<>(props)); } catch (URISyntaxException e) { throw new IOException("Error updating config", e); } }
Map<String, Object> overrides = new LinkedHashMap<>(); Map<String, Object> optionals = new LinkedHashMap<>(); for (String key : properties.keySet()) { Object v = properties.get(key); if (key.equals(PARENTS)) {
for (String k : p.keySet()) { ht.put(k, p.get(k));
Map<String, Object> overrides = new LinkedHashMap<>(); Map<String, Object> optionals = new LinkedHashMap<>(); for (String key : properties.keySet()) { Object v = properties.get(key); if (key.equals(PARENTS)) {
for( String key : props.keySet() )
props.load(etcFile); props.putAll(c); props.keySet().retainAll(c.keySet()); props.save(etcFile); props.clear();
TypedProperties properties = new TypedProperties(); properties.load(cfgFile); for (String key : props.keySet()) { if (!isInternalKey(key)) { List<String> comments = props.getComments(key); for (String key : properties.keySet()) { if (!props.containsKey(key) && !isInternalKey(key)) { propertiesToRemove.add(key);
boolean update = false; Dictionary<String, Object> properties = cfg.getProperties(); for (String key : props.keySet()) { if (properties.get(key) == null) { properties.put(key, props.get(key));