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:00 UTC

[sling-org-apache-sling-installer-factory-configuration] 24/40: SLING-2450 : JcrInstaller generates incorrect node name in /apps/system/config (or else the installer doesn't process the nodename properly)

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.0.10
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-factory-configuration.git

commit 6a4fc7e8bd19025aba085479612053b1e0c810b4
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Mar 30 00:08:56 2012 +0000

    SLING-2450 : JcrInstaller generates incorrect node name in /apps/system/config (or else the installer doesn't process the nodename properly)
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/installer/factories/configuration@1307172 13f79535-47bb-0310-9956-ffa450edef68
---
 .../configuration/impl/ConfigTaskCreator.java          | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 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 4072e83..3ee9fde 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
@@ -91,7 +91,16 @@ public class ConfigTaskCreator
     @SuppressWarnings("unchecked")
     public void configurationEvent(final ConfigurationEvent event) {
         synchronized ( ConfigTaskCreator.getLock() ) {
-            final String id = (event.getFactoryPid() == null ? "" : event.getFactoryPid() + ".") + event.getPid();
+            final String id;
+            final String pid;
+            if (event.getFactoryPid() == null ) {
+                id = event.getPid();
+                pid = id;
+            } else {
+                pid = (event.getPid().startsWith(event.getFactoryPid() + '.') ?
+                        event.getPid().substring(event.getFactoryPid().length() + 1) : event.getPid());
+                id = event.getFactoryPid() + '.' + event.getPid();
+            }
             if ( event.getType() == ConfigurationEvent.CM_DELETED ) {
                 this.changeListener.resourceRemoved(InstallableResource.TYPE_CONFIG, id);
             } else {
@@ -113,10 +122,15 @@ public class ConfigTaskCreator
                         }
                         if ( persist ) {
                             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());
                             }
-                            attrs.put(Constants.SERVICE_PID, event.getPid());
                             // Factory?
                             if (event.getFactoryPid() != null) {
                                 attrs.put(ConfigurationAdmin.SERVICE_FACTORYPID, event.getFactoryPid());

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