/** * Creates a {@code ConfigurationEvent} object based on the passed in * parameters. This is called by {@code fireEvent()} if it decides * that an event needs to be generated. * * @param type the event's type * @param propName the name of the affected property (can be <b>null</b>) * @param propValue the value of the affected property (can be <b>null</b>) * @param before the before update flag * @return the newly created event object */ protected ConfigurationEvent createEvent(int type, String propName, Object propValue, boolean before) { return new ConfigurationEvent(this, type, propName, propValue, before); }
/** * Creates a {@code ConfigurationEvent} object based on the passed in * parameters. This is called by {@code fireEvent()} if it decides * that an event needs to be generated. * * @param type the event's type * @param propName the name of the affected property (can be <b>null</b>) * @param propValue the value of the affected property (can be <b>null</b>) * @param before the before update flag * @return the newly created event object */ protected ConfigurationEvent createEvent(int type, String propName, Object propValue, boolean before) { return new ConfigurationEvent(this, type, propName, propValue, before); }
@Override public void onApplicationEvent(EnvironmentChangeEvent event) { AbstractConfiguration manager = ConfigurationManager.getConfigInstance(); for (String key : event.getKeys()) { for (ConfigurationListener listener : manager .getConfigurationListeners()) { Object source = event.getSource(); // TODO: Handle add vs set vs delete? int type = AbstractConfiguration.EVENT_SET_PROPERTY; String value = this.env.getProperty(key); boolean beforeUpdate = false; listener.configurationChanged(new ConfigurationEvent(source, type, key, value, beforeUpdate)); } } } }
@Override public void onApplicationEvent(EnvironmentChangeEvent event) { AbstractConfiguration manager = ConfigurationManager.getConfigInstance(); for (String key : event.getKeys()) { for (ConfigurationListener listener : manager .getConfigurationListeners()) { Object source = event.getSource(); // TODO: Handle add vs set vs delete? int type = AbstractConfiguration.EVENT_SET_PROPERTY; String value = this.env.getProperty(key); boolean beforeUpdate = false; listener.configurationChanged(new ConfigurationEvent(source, type, key, value, beforeUpdate)); } } } }
flumeConfigListener.configurationChanged(new ConfigurationEvent(this, AbstractConfiguration.EVENT_SET_PROPERTY, FlumeLoggerLoader.FLUME_LOGGER_ENABLED_PROPERTY, config.getProperty(FlumeLoggerLoader.FLUME_LOGGER_ENABLED_PROPERTY), false));