sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romb...@apache.org
Subject [sling-org-apache-sling-installer-factory-configuration] 06/40: SLING-2163 : Persisting a new configuration is missing PID and factory PID
Date Tue, 07 Nov 2017 09:42:42 GMT
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 07a6bfd110c4a56f2367207b32a4dbaddddaa9fa
Author: Carsten Ziegeler <cziegeler@apache.org>
AuthorDate: Fri Jul 29 11:26:28 2011 +0000

    SLING-2163 : Persisting a new configuration is missing PID and factory PID
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/installer/factories/configuration@1152171
13f79535-47bb-0310-9956-ffa450edef68
---
 .../installer/factories/configuration/impl/ConfigRemoveTask.java   | 7 +++----
 .../installer/factories/configuration/impl/ConfigTaskCreator.java  | 5 +++++
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigRemoveTask.java
b/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigRemoveTask.java
index 0acb4b9..a7eb86c 100644
--- a/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigRemoveTask.java
+++ b/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigRemoveTask.java
@@ -51,21 +51,20 @@ public class ConfigRemoveTask extends AbstractConfigTask {
                 final Configuration cfg = getConfiguration(ca, false);
                 if (cfg == null) {
                     this.getLogger().debug("Cannot delete config , pid={} not found, ignored
({})", getCompositePid(), getResource());
-                    this.setFinishedState(ResourceState.IGNORED);
                 } else {
                     if ( !ConfigUtil.isSameData(cfg.getProperties(), this.getResource().getDictionary())
) {
-                        this.getLogger().debug("Configuration has changed after it has been
installed. Not removing!");
-                        this.setFinishedState(ResourceState.IGNORED);
+                        this.getLogger().debug("Configuration has changed after it has been
installed!");
                     } else {
                         this.getLogger().debug("Deleting config {} ({})", getCompositePid(),
getResource());
                         cfg.delete();
                         ctx.log("Deleted configuration {} from resource {}", getCompositePid(),
getResource());
-                        this.setFinishedState(ResourceState.UNINSTALLED);
                     }
                 }
             } catch (Exception e) {
                 this.getLogger().debug("Exception during removal of config " + this.getResource()
+ " : " + e.getMessage() + ". Retrying later.", e);
             }
+            // we always set to uninstalled as the resource really has been deleted
+            this.setFinishedState(ResourceState.UNINSTALLED);
         }
     }
 }
\ No newline at end of file
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 3857e27..8554f80 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
@@ -108,6 +108,11 @@ public class ConfigTaskCreator
                                 attrs = new HashMap<String, Object>();
                                 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());
+                            }
                             this.changeListener.resourceAddedOrUpdated(InstallableResource.TYPE_CONFIG,
id, null, dict, attrs);
                         }
                     }

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

Mime
View raw message