use of org.apache.knox.gateway.topology.discovery.ClusterConfigurationMonitor in project knox by apache.
the class AmbariServiceDiscovery method getConfigurationChangeMonitor.
/**
* Get the Ambari configuration change monitor from the associated gateway service.
*/
private AmbariConfigurationMonitor getConfigurationChangeMonitor() {
AmbariConfigurationMonitor ambariMonitor = null;
try {
Class<?> clazz = Class.forName(GATEWAY_SERVICES_ACCESSOR_CLASS);
if (clazz != null) {
Method m = clazz.getDeclaredMethod(GATEWAY_SERVICES_ACCESSOR_METHOD);
if (m != null) {
Object obj = m.invoke(null);
if (GatewayServices.class.isAssignableFrom(obj.getClass())) {
ClusterConfigurationMonitorService clusterMonitorService = ((GatewayServices) obj).getService(GatewayServices.CLUSTER_CONFIGURATION_MONITOR_SERVICE);
ClusterConfigurationMonitor monitor = clusterMonitorService.getMonitor(AmbariConfigurationMonitor.getType());
if (monitor != null) {
if (AmbariConfigurationMonitor.class.isAssignableFrom(monitor.getClass())) {
ambariMonitor = (AmbariConfigurationMonitor) monitor;
}
}
}
}
}
} catch (Exception e) {
log.errorAccessingConfigurationChangeMonitor(e);
}
return ambariMonitor;
}
Aggregations