More changes for configuration manager and email action renaming.
Original commit: elastic/x-pack-elasticsearch@1c5087e79a
This commit is contained in:
parent
d8b751f6ed
commit
920f7ea2a9
|
@ -30,9 +30,12 @@ public class ConfigurationManager extends AbstractComponent {
|
|||
public static final String CONFIG_TYPE = "config";
|
||||
public static final String CONFIG_INDEX = AlertsStore.ALERT_INDEX;
|
||||
public static final String GLOBAL_CONFIG_NAME = "global";
|
||||
private volatile boolean readyToRead = false;
|
||||
|
||||
private final CopyOnWriteArrayList<ConfigurableComponentListener> registeredComponents;
|
||||
|
||||
private volatile boolean readyToRead = false;
|
||||
|
||||
|
||||
@Inject
|
||||
public ConfigurationManager(Settings settings, Client client) {
|
||||
super(settings);
|
||||
|
@ -95,6 +98,15 @@ public class ConfigurationManager extends AbstractComponent {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers an component to receive config updates
|
||||
*/
|
||||
public void registerListener(ConfigurableComponentListener configListener) {
|
||||
if (!registeredComponents.contains(configListener)) {
|
||||
registeredComponents.add(configListener);
|
||||
}
|
||||
}
|
||||
|
||||
private void ensureReady() {
|
||||
if (!readyToRead) {
|
||||
throw new ElasticsearchException("Config index [" + CONFIG_INDEX + "] is not known to be started");
|
||||
|
@ -116,13 +128,4 @@ public class ConfigurationManager extends AbstractComponent {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers an component to receive config updates
|
||||
*/
|
||||
public void registerListener(ConfigurableComponentListener configListener) {
|
||||
if (!registeredComponents.contains(configListener)) {
|
||||
registeredComponents.add(configListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public class AlertActionRegistry extends AbstractComponent {
|
|||
public AlertActionRegistry(Settings settings, Client client, ConfigurationManager configurationManager) {
|
||||
super(settings);
|
||||
actionImplemented = ImmutableOpenMap.<String, AlertActionFactory>builder()
|
||||
.fPut("email", new SnptAlertActionFactory(configurationManager))
|
||||
.fPut("email", new SmtpAlertActionFactory(configurationManager))
|
||||
.fPut("index", new IndexAlertActionFactory(client, configurationManager))
|
||||
.build();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue