io.scalecube.config.jmx.JmxConfigRegistry Maven / Gradle / Ivy
package io.scalecube.config.jmx;
import io.scalecube.config.ConfigPropertyInfo;
import io.scalecube.config.ConfigRegistry;
import io.scalecube.config.audit.ConfigEvent;
import io.scalecube.config.source.ConfigSourceInfo;
import java.util.Collection;
import java.util.Collections;
import java.util.stream.Collectors;
public class JmxConfigRegistry implements JmxConfigRegistryMBean {
private final ConfigRegistry configRegistry;
public JmxConfigRegistry(ConfigRegistry configRegistry) {
this.configRegistry = configRegistry;
}
@Override
public Collection getProperties() {
return configRegistry
.getConfigProperties()
.stream()
.map(ConfigPropertyInfo::toString)
.collect(Collectors.toList());
}
@Override
public Collection getSources() {
return configRegistry
.getConfigSources()
.stream()
.map(ConfigSourceInfo::toString)
.collect(Collectors.toList());
}
@Override
public Collection getEvents() {
return configRegistry
.getRecentConfigEvents()
.stream()
.map(ConfigEvent::toString)
.collect(Collectors.toList());
}
@Override
public Collection getSettings() {
return Collections.singletonList(configRegistry.getSettings().toString());
}
}