You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:43:47 UTC

[sling-org-apache-sling-installer-factory-configuration] 07/10: SLING-4272 : Issues in handling of configurations wrt update handling and write back

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.installer.factory.configuration-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-factory-configuration.git

commit 5ce4ecd817bc819f5df8dd419502c8197add56ad
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Jan 2 11:05:28 2015 +0000

    SLING-4272 : Issues in handling of configurations wrt update handling and write back
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/installer/factories/configuration@1648997 13f79535-47bb-0310-9956-ffa450edef68
---
 .../configuration/impl/ConfigTaskCreator.java      | 37 ++++++++++++----------
 1 file changed, 20 insertions(+), 17 deletions(-)

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 @@ public class ConfigTaskCreator
                     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());
                     }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.