SLING-4272 : Issues in handling of configurations wrt update handling and write back

git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1648997 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigTaskCreator.java b/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigTaskCreator.java
index 23a59e0..1184c20 100644
--- a/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigTaskCreator.java
+++ b/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigTaskCreator.java
@@ -122,24 +122,27 @@
                     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);
-                        if ( persist ) {
-                            final Dictionary<String, Object> dict = ConfigUtil.cleanConfiguration(config.getProperties());
-                            final Map<String, Object> attrs = new HashMap<String, Object>();
-                            attrs.put(Constants.SERVICE_PID, event.getPid());
-                            if ( event.getFactoryPid() == null ) {
-                                attrs.put(InstallableResource.RESOURCE_URI_HINT, pid);
-                            } else {
-                                attrs.put(InstallableResource.RESOURCE_URI_HINT, event.getFactoryPid() + '-' + pid);
-                            }
-                            if ( config.getBundleLocation() != null ) {
-                                attrs.put(InstallableResource.INSTALLATION_HINT, config.getBundleLocation());
-                            }
-                            // Factory?
-                            if (event.getFactoryPid() != null) {
-                                attrs.put(ConfigurationAdmin.SERVICE_FACTORYPID, event.getFactoryPid());
-                            }
-                            this.changeListener.resourceAddedOrUpdated(InstallableResource.TYPE_CONFIG, id, null, dict, attrs);
+
+                        final Dictionary<String, Object> dict = ConfigUtil.cleanConfiguration(config.getProperties());
+                        final Map<String, Object> attrs = new HashMap<String, Object>();
+                        if ( !persist ) {
+                            attrs.put(ResourceChangeListener.RESOURCE_PERSIST, Boolean.FALSE);
                         }
+                        attrs.put(Constants.SERVICE_PID, event.getPid());
+                        if ( event.getFactoryPid() == null ) {
+                            attrs.put(InstallableResource.RESOURCE_URI_HINT, pid);
+                        } else {
+                            attrs.put(InstallableResource.RESOURCE_URI_HINT, event.getFactoryPid() + '-' + pid);
+                        }
+                        if ( config.getBundleLocation() != null ) {
+                            attrs.put(InstallableResource.INSTALLATION_HINT, config.getBundleLocation());
+                        }
+                        // Factory?
+                        if (event.getFactoryPid() != null) {
+                            attrs.put(ConfigurationAdmin.SERVICE_FACTORYPID, event.getFactoryPid());
+                        }
+                        this.changeListener.resourceAddedOrUpdated(InstallableResource.TYPE_CONFIG, id, null, dict, attrs);
+
                     } else {
                         this.logger.debug("Ignoring configuration event for {}:{}", event.getPid(), event.getFactoryPid());
                     }