You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2012/02/10 13:29:14 UTC

svn commit: r1242752 - in /sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl: OsgiInstallerImpl.java tasks/BundleUpdateTask.java

Author: cziegeler
Date: Fri Feb 10 12:29:14 2012
New Revision: 1242752

URL: http://svn.apache.org/viewvc?rev=1242752&view=rev
Log:
SLING-2417 : Start level should be changed for upgrades

Modified:
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
    sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUpdateTask.java

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=1242752&r1=1242751&r2=1242752&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 Feb 10 12:29:14 2012
@@ -227,6 +227,7 @@ public class OsgiInstallerImpl
      * Wake up the run cycle.
      */
     private void wakeUp() {
+        this.listener.start();
         synchronized (this.resourcesLock) {
             this.resourcesLock.notify();
         }
@@ -310,9 +311,7 @@ public class OsgiInstallerImpl
     public void updateResources(final String scheme,
                                 final InstallableResource[] resources,
                                 final String[] ids) {
-        synchronized ( this.resourcesLock ) {
-            this.listener.start();
-        }
+        this.listener.start();
         try {
             final List<InternalResource> updatedResources = this.createResources(scheme, resources);
 
@@ -363,9 +362,7 @@ public class OsgiInstallerImpl
      * @see org.apache.sling.installer.api.OsgiInstaller#registerResources(java.lang.String, org.apache.sling.installer.api.InstallableResource[])
      */
     public void registerResources(final String scheme, final InstallableResource[] resources) {
-        synchronized ( this.resourcesLock ) {
-            this.listener.start();
-        }
+        this.listener.start();
         try {
             List<InternalResource> registeredResources = this.createResources(scheme, resources);
             if ( registeredResources == null ) {
@@ -723,6 +720,7 @@ public class OsgiInstallerImpl
      * @see org.apache.sling.installer.api.tasks.RetryHandler#scheduleRetry()
      */
     public void scheduleRetry() {
+        this.listener.start();
         synchronized ( this.resourcesLock ) {
             this.retryDuringTaskExecution = true;
         }

Modified: sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUpdateTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUpdateTask.java?rev=1242752&r1=1242751&r2=1242752&view=diff
==============================================================================
--- sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUpdateTask.java (original)
+++ sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleUpdateTask.java Fri Feb 10 12:29:14 2012
@@ -90,6 +90,15 @@ public class BundleUpdateTask extends Ab
                 b.stop();
             }
 
+            // start level handling
+            final StartLevel startLevelService = this.getStartLevel();
+            if ( startLevelService != null ) {
+                final int newStartLevel = this.getBundleStartLevel();
+                final int oldStartLevel = startLevelService.getBundleStartLevel(b);
+                if ( newStartLevel != oldStartLevel && newStartLevel != 0 ) {
+                    startLevelService.setBundleStartLevel(b, newStartLevel);
+                }
+            }
             b.update(getResource().getInputStream());
             ctx.log("Updated bundle {} from resource {}", b, getResource());