use of io.fabric8.annotations.Path in project fabric8 by jboss-fuse.
the class ZooKeeperUtils method setProperties.
public static void setProperties(CuratorFramework curator, String path, Properties properties) throws Exception {
try {
org.apache.felix.utils.properties.Properties p = new org.apache.felix.utils.properties.Properties();
if (curator.checkExists().forPath(path) == null) {
create(curator, path);
}
String org = getStringData(curator, path);
if (org != null) {
p.load(new StringReader(org));
}
List<String> keys = new ArrayList<String>();
for (String key : properties.stringPropertyNames()) {
p.put(key, properties.getProperty(key));
keys.add(key);
}
List<String> deleted = new ArrayList<String>(p.keySet());
deleted.removeAll(keys);
for (String key : deleted) {
p.remove(key);
}
StringWriter writer = new StringWriter();
p.save(writer);
setData(curator, path, writer.toString());
} catch (IOException e) {
// ignore
}
}
use of io.fabric8.annotations.Path in project fabric8 by jboss-fuse.
the class ZooKeeperUtils method getPropertiesAsMap.
public static Map<String, String> getPropertiesAsMap(TreeCacheExtended cache, String path) throws Exception {
Properties properties = getProperties(cache, path);
Map<String, String> map = new HashMap<String, String>();
for (String key : properties.stringPropertyNames()) {
map.put(key, properties.getProperty(key));
}
return map;
}
use of io.fabric8.annotations.Path in project fabric8 by jboss-fuse.
the class ZooKeeperUtils method getPropertiesAsMap.
public static Map<String, String> getPropertiesAsMap(CuratorFramework curator, String path) throws Exception {
Properties properties = getProperties(curator, path);
Map<String, String> map = new HashMap<String, String>();
for (String key : properties.stringPropertyNames()) {
map.put(key, properties.getProperty(key));
}
return map;
}
use of io.fabric8.annotations.Path in project fabric8 by jboss-fuse.
the class FileWatcherDynamicCompiler method addCompilePath.
// Implementation
// -------------------------------------------------------------------------
protected void addCompilePath(Path path) {
try {
String url = toUrlString(path);
Path old = urlMap.put(url, path);
if (old == null) {
scheduleRecompile();
}
} catch (MalformedURLException e) {
LOG.warn("Ignored path " + path + " due to: " + e, e);
}
}
use of io.fabric8.annotations.Path in project fabric8 by jboss-fuse.
the class WatcherSpringContext method removePath.
protected void removePath(Path path) {
try {
String url = toUrlString(path);
FileSystemXmlApplicationContext context = contextMap.remove(url);
closeContext(url, context);
} catch (MalformedURLException e) {
LOG.warn("Ignored path " + path + " due to: " + e, e);
}
}
Aggregations