diff --git a/dz3r-bootstrap/src/main/java/net/sf/dz3r/runtime/config/ConfigurationContextAware.java b/dz3r-bootstrap/src/main/java/net/sf/dz3r/runtime/config/ConfigurationContextAware.java index 04f219422..fc2f4ee80 100644 --- a/dz3r-bootstrap/src/main/java/net/sf/dz3r/runtime/config/ConfigurationContextAware.java +++ b/dz3r-bootstrap/src/main/java/net/sf/dz3r/runtime/config/ConfigurationContextAware.java @@ -14,6 +14,7 @@ import java.util.Map; import java.util.Optional; +import java.util.Set; public abstract class ConfigurationContextAware { @@ -121,4 +122,8 @@ protected final UnitController getUnitController(String address) { logger.debug("getUnitController({}) = {}", address, result); return result; } + + protected final boolean isConfigured(Set names, Map.Entry d) { + return names.contains(d.getKey()); + } } diff --git a/dz3r-bootstrap/src/main/java/net/sf/dz3r/runtime/config/model/ConsoleConfigurationParser.java b/dz3r-bootstrap/src/main/java/net/sf/dz3r/runtime/config/model/ConsoleConfigurationParser.java index de6cb5776..23ed5cfad 100644 --- a/dz3r-bootstrap/src/main/java/net/sf/dz3r/runtime/config/model/ConsoleConfigurationParser.java +++ b/dz3r-bootstrap/src/main/java/net/sf/dz3r/runtime/config/model/ConsoleConfigurationParser.java @@ -1,15 +1,12 @@ package net.sf.dz3r.runtime.config.model; +import net.sf.dz3r.instrumentation.InstrumentCluster; import net.sf.dz3r.runtime.config.ConfigurationContext; import net.sf.dz3r.runtime.config.ConfigurationContextAware; -import net.sf.dz3r.instrumentation.InstrumentCluster; -import net.sf.dz3r.signal.Signal; import net.sf.dz3r.view.swing.ReactiveConsole; -import reactor.core.publisher.Flux; import java.util.Map; import java.util.Optional; -import java.util.Set; import java.util.stream.Collectors; public class ConsoleConfigurationParser extends ConfigurationContextAware { @@ -32,6 +29,7 @@ public ReactiveConsole parse(String instance, ConsoleConfig cf) { var directors = context .directors .getFlux() + .filter(d -> isConfigured(cf.directors(), d)) .map(Map.Entry::getValue) .collect(Collectors.toSet()) .block(); @@ -54,8 +52,4 @@ public ReactiveConsole parse(String instance, ConsoleConfig cf) { return null; } } - - private boolean isConfigured(Set sensors, Map.Entry>> s) { - return sensors.contains(s.getKey()); - } } diff --git a/dz3r-bootstrap/src/main/java/net/sf/dz3r/runtime/config/model/WebUiConfigurationParser.java b/dz3r-bootstrap/src/main/java/net/sf/dz3r/runtime/config/model/WebUiConfigurationParser.java index 3d9fac91f..3c4a3ce0e 100644 --- a/dz3r-bootstrap/src/main/java/net/sf/dz3r/runtime/config/model/WebUiConfigurationParser.java +++ b/dz3r-bootstrap/src/main/java/net/sf/dz3r/runtime/config/model/WebUiConfigurationParser.java @@ -1,8 +1,8 @@ package net.sf.dz3r.runtime.config.model; +import net.sf.dz3r.instrumentation.InstrumentCluster; import net.sf.dz3r.runtime.config.ConfigurationContext; import net.sf.dz3r.runtime.config.ConfigurationContextAware; -import net.sf.dz3r.instrumentation.InstrumentCluster; import net.sf.dz3r.view.webui.v2.WebUI; import java.util.Map; @@ -26,6 +26,7 @@ public WebUI parse(WebUiConfig cf) { var directors = context .directors .getFlux() + .filter(d -> isConfigured(cf.directors(), d)) .map(Map.Entry::getValue) .map(Object.class::cast) .collect(Collectors.toSet())