incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1152171 - in /sling/trunk: installer/core/src/main/java/org/apache/sling/installer/core/impl/ installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/impl/ launchpad/builder/src/main/bundles/
Date Fri, 29 Jul 2011 11:26:29 GMT
Author: cziegeler
Date: Fri Jul 29 11:26:28 2011
New Revision: 1152171

URL: http://svn.apache.org/viewvc?rev=1152171&view=rev
Log:
SLING-2163 : Persisting a new configuration is missing PID and factory PID

Modified:
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
    sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigRemoveTask.java
    sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigTaskCreator.java
    sling/trunk/launchpad/builder/src/main/bundles/list.xml

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java?rev=1152171&r1=1152170&r2=1152171&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
(original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
Fri Jul 29 11:26:28 2011
@@ -710,6 +710,9 @@ public class OsgiInstallerImpl
                                     final TransformationResult transRes = new TransformationResult();
                                     transRes.setId(entityId);
                                     transRes.setResourceType(resourceType);
+                                    if ( attributes != null ) {
+                                        transRes.setAttributes(attributes);
+                                    }
                                     this.persistentList.transform(rr, new TransformationResult[]
{
                                             transRes
                                     });
@@ -766,6 +769,9 @@ public class OsgiInstallerImpl
                                 final TransformationResult transRes = new TransformationResult();
                                 transRes.setId(entityId);
                                 transRes.setResourceType(resourceType);
+                                if ( attributes != null ) {
+                                    transRes.setAttributes(attributes);
+                                }
                                 this.persistentList.transform(rr, new TransformationResult[]
{
                                         transRes
                                 });

Modified: sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigRemoveTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigRemoveTask.java?rev=1152171&r1=1152170&r2=1152171&view=diff
==============================================================================
--- sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigRemoveTask.java
(original)
+++ sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigRemoveTask.java
Fri Jul 29 11:26:28 2011
@@ -51,21 +51,20 @@ public class ConfigRemoveTask extends Ab
                 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

Modified: sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigTaskCreator.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigTaskCreator.java?rev=1152171&r1=1152170&r2=1152171&view=diff
==============================================================================
--- sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigTaskCreator.java
(original)
+++ sling/trunk/installer/factories/configuration/src/main/java/org/apache/sling/installer/factories/configuration/impl/ConfigTaskCreator.java
Fri Jul 29 11:26:28 2011
@@ -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);
                         }
                     }

Modified: sling/trunk/launchpad/builder/src/main/bundles/list.xml
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/builder/src/main/bundles/list.xml?rev=1152171&r1=1152170&r2=1152171&view=diff
==============================================================================
--- sling/trunk/launchpad/builder/src/main/bundles/list.xml (original)
+++ sling/trunk/launchpad/builder/src/main/bundles/list.xml Fri Jul 29 11:26:28 2011
@@ -223,7 +223,7 @@
         <bundle>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.installer.factory.configuration</artifactId>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
         </bundle>
         <bundle>
             <groupId>org.apache.sling</groupId>



Mime
View raw message