use of io.fabric8.core.jmx.ZooKeeperFacade in project fabric8 by jboss-fuse.
the class GroovyPlaceholderResolver method resolveValue.
/**
* Returns the replacement of groovy expressions on the given string value.
*/
public static String resolveValue(CuratorFramework curator, String value) {
try {
Binding binding = new Binding();
ZooKeeperFacade zk = new ZooKeeperFacade(curator);
binding.setVariable("zk", zk);
binding.setVariable("env", System.getenv());
binding.setVariable("sys", System.getProperties());
GroovyShell shell = new GroovyShell(binding);
String expression = value;
if (expression.startsWith(RESOLVER_SCHEME + ":")) {
expression = expression.substring(RESOLVER_SCHEME.length() + 1);
}
Object result = shell.evaluate(expression);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("groovy expression: " + expression + " => " + result);
}
if (result != null) {
return result.toString();
}
return "";
} catch (Exception e) {
throw FabricException.launderThrowable(e);
}
}
use of io.fabric8.core.jmx.ZooKeeperFacade in project fabric8 by jboss-fuse.
the class FabricMBeanRegistrationListener method registerFabricMBeans.
private void registerFabricMBeans() {
this.healthCheck = new HealthCheck(fabricService.get());
this.managerMBean = new FabricManager((FabricServiceImpl) fabricService.get());
this.zooKeeperMBean = new ZooKeeperFacade((FabricServiceImpl) fabricService.get());
this.fileSystemMBean = new FileSystem(runtimeProperties.get());
healthCheck.registerMBeanServer(shutdownTracker, mbeanServer.get());
managerMBean.registerMBeanServer(shutdownTracker, mbeanServer.get());
fileSystemMBean.registerMBeanServer(shutdownTracker, mbeanServer.get());
zooKeeperMBean.registerMBeanServer(shutdownTracker, mbeanServer.get());
}
Aggregations