incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r996539 - in /sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl: OsgiInstallerImpl.java config/ConfigTaskCreator.java
Date Mon, 13 Sep 2010 14:04:45 GMT
Author: cziegeler
Date: Mon Sep 13 14:04:45 2010
New Revision: 996539

URL: http://svn.apache.org/viewvc?rev=996539&view=rev
Log:
SLING-1737 : Add state management for resources

Modified:
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerImpl.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/config/ConfigTaskCreator.java

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerImpl.java?rev=996539&r1=996538&r2=996539&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerImpl.java
(original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/OsgiInstallerImpl.java
Mon Sep 13 14:04:45 2010
@@ -138,10 +138,10 @@ public class OsgiInstallerImpl
     public void run() {
         this.init();
         while (active) {
-            this.mergeNewResources();
+            final boolean tasksToDo = this.hasOpenTasks();
             final SortedSet<OsgiInstallerTask> tasks = this.computeTasks();
 
-            if (tasks.isEmpty() && !retriesScheduled) {
+            if (tasks.isEmpty() && !tasksToDo && !retriesScheduled) {
                 // No tasks to execute - wait until new resources are
                 // registered
                 this.cleanupInstallableResources();
@@ -392,6 +392,22 @@ public class OsgiInstallerImpl
         }
     }
 
+    private boolean hasOpenTasks() {
+        // check if there is something to do
+        for(final String entityId : this.persistentList.getEntityIds()) {
+            final EntityResourceList group = this.persistentList.getEntityResourceList(entityId);
+            if ( !group.isEmpty() ) {
+                final RegisteredResource first = group.getFirst();
+
+                if ( first != null &&
+                     (first.getState() == RegisteredResource.State.UNINSTALL || first.getState()
== RegisteredResource.State.INSTALL) ) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
     private void printResources(String hint) {
         if ( !logger.isDebugEnabled() ) {
             return;

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/config/ConfigTaskCreator.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/config/ConfigTaskCreator.java?rev=996539&r1=996538&r2=996539&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/config/ConfigTaskCreator.java
(original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/config/ConfigTaskCreator.java
Mon Sep 13 14:04:45 2010
@@ -59,9 +59,9 @@ public class ConfigTaskCreator {
 	 */
 	public OsgiInstallerTask createTask(final RegisteredResource toActivate) {
 	    // if there is no config admin, just return
-	//    if ( this.configAdminServiceTracker.getService() == null ) {
-    //        return null;
-	//    }
+	    if ( this.configAdminServiceTracker.getService() == null ) {
+            return null;
+	    }
 	    final OsgiInstallerTask result;
 		if (toActivate.getState() == RegisteredResource.State.UNINSTALL) {
 		    result = new ConfigRemoveTask(toActivate, this.configAdminServiceTracker);



Mime
View raw message