in src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigTaskCreator.java [142:189]
public void configurationEvent(final ConfigurationEvent event) {
synchronized (Coordinator.SHARED) {
if (event.getType() == ConfigurationEvent.CM_DELETED) {
final Coordinator.Operation op = Coordinator.SHARED.get(event.getPid(), event.getFactoryPid(), true);
if (op == null) {
this.changeListener.resourceRemoved(InstallableResource.TYPE_CONFIG, event.getPid());
} else {
this.logger.debug("Ignoring configuration event for {}:{}", event.getPid(), event.getFactoryPid());
}
} else if (event.getType() == ConfigurationEvent.CM_UPDATED) {
try {
// we just need to pass in the pid as we're using named factory configs
final Configuration config = ConfigUtil.getConfiguration(configAdmin, null, event.getPid());
final Coordinator.Operation op =
Coordinator.SHARED.get(event.getPid(), event.getFactoryPid(), false);
if (config != null && op == null) {
final boolean persist = ConfigUtil.toBoolean(
config.getProperties().get(ConfigurationConstants.PROPERTY_PERSISTENCE), true);
final Dictionary<String, Object> dict = ConfigUtil.cleanConfiguration(config.getProperties());
final Map<String, Object> attrs = new HashMap<>();
if (!persist) {
attrs.put(ResourceChangeListener.RESOURCE_PERSIST, Boolean.FALSE);
}
attrs.put(Constants.SERVICE_PID, event.getPid());
attrs.put(InstallableResource.RESOURCE_URI_HINT, event.getPid());
if (config.getBundleLocation() != null) {
attrs.put(InstallableResource.INSTALLATION_HINT, config.getBundleLocation());
}
// Factory?
if (event.getFactoryPid() != null) {
attrs.put(ConfigurationAdmin.SERVICE_FACTORYPID, event.getFactoryPid());
}
removeDefaultProperties(this.infoProvider, event.getPid(), dict);
this.changeListener.resourceAddedOrUpdated(
InstallableResource.TYPE_CONFIG, event.getPid(), null, dict, attrs);
} else {
this.logger.debug(
"Ignoring configuration event for {}:{}", event.getPid(), event.getFactoryPid());
}
} catch (final Exception ignore) {
// ignore for now
}
}
}
}