incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r805850 - in /sling/trunk/installer/osgi/installer/src: main/java/org/apache/sling/osgi/installer/impl/tasks/ test/java/org/apache/sling/osgi/installer/impl/ test/java/org/apache/sling/osgi/installer/impl/tasks/
Date Wed, 19 Aug 2009 15:47:21 GMT
Author: bdelacretaz
Date: Wed Aug 19 15:47:20 2009
New Revision: 805850

URL: http://svn.apache.org/viewvc?rev=805850&view=rev
Log:
SLING-1078 - obsolete classes removed

Removed:
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleInstallRemoveTask.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/InstallRemoveTask.java
    sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/tasks/BundleInstallRemoveIgnoreTest.java
Modified:
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleInstallTask.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleRemoveTask.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleStartTask.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleUpdateTask.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/ConfigInstallRemoveTask.java
    sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/SynchronousRefreshPackagesTask.java
    sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/TaskOrderingTest.java

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleInstallTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleInstallTask.java?rev=805850&r1=805849&r2=805850&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleInstallTask.java
(original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleInstallTask.java
Wed Aug 19 15:47:20 2009
@@ -24,6 +24,8 @@
 import org.apache.sling.osgi.installer.impl.RegisteredResource;
 import org.osgi.framework.Bundle;
 
+/** Install a bundle supplied as a RegisteredResource.
+ *  Creates a BundleStartTask to start the bundle */
 public class BundleInstallTask extends OsgiInstallerTask {
 
     private final RegisteredResource resource;
@@ -46,7 +48,7 @@
 
     @Override
     public String getSortKey() {
-        return TaskOrder.BUNDLE_INSTALL_ORDER;
+        return TaskOrder.BUNDLE_INSTALL_ORDER + resource.getUrl();
     }
 
 }

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleRemoveTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleRemoveTask.java?rev=805850&r1=805849&r2=805850&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleRemoveTask.java
(original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleRemoveTask.java
Wed Aug 19 15:47:20 2009
@@ -25,8 +25,9 @@
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
 
-/** Remove a bundle from a RegisteredResource. Creates
- *  a refresh packages task when executed.
+/** Remove a bundle from a RegisteredResource. 
+ *  Creates a SynchronousRefreshPackagesTask when 
+ *  executed.
  */
 public class BundleRemoveTask extends OsgiInstallerTask {
 
@@ -56,7 +57,7 @@
 
     @Override
     public String getSortKey() {
-        return TaskOrder.BUNDLE_REMOVE_ORDER;
+        return TaskOrder.BUNDLE_REMOVE_ORDER + resource.getUrl();
     }
 
 }

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleStartTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleStartTask.java?rev=805850&r1=805849&r2=805850&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleStartTask.java
(original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleStartTask.java
Wed Aug 19 15:47:20 2009
@@ -28,7 +28,11 @@
 import org.osgi.framework.BundleException;
 import org.osgi.service.log.LogService;
 
-/** Task that starts a bundle */
+/** Start a bundle given its bundle ID
+ *  Restarts if the bundle does not start on the first try,
+ *  but only after receiving a bundle or framework event,
+ *  indicating that it's worth retrying
+ */
 public class BundleStartTask extends OsgiInstallerTask {
 
 	private final long bundleId;

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleUpdateTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleUpdateTask.java?rev=805850&r1=805849&r2=805850&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleUpdateTask.java
(original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/BundleUpdateTask.java
Wed Aug 19 15:47:20 2009
@@ -58,7 +58,7 @@
 
     @Override
     public String getSortKey() {
-        return TaskOrder.BUNDLE_UPDATE_ORDER;
+        return TaskOrder.BUNDLE_UPDATE_ORDER + resource.getUrl();
     }
 
 }

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/ConfigInstallRemoveTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/ConfigInstallRemoveTask.java?rev=805850&r1=805849&r2=805850&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/ConfigInstallRemoveTask.java
(original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/ConfigInstallRemoveTask.java
Wed Aug 19 15:47:20 2009
@@ -18,22 +18,17 @@
  */
 package org.apache.sling.osgi.installer.impl.tasks;
 
-import java.util.Dictionary;
-import java.util.Map;
-
-import org.apache.sling.osgi.installer.impl.ConfigurationPid;
-import org.apache.sling.osgi.installer.impl.OsgiInstallerContext;
-import org.apache.sling.osgi.installer.impl.RegisteredResource;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.log.LogService;
-
-/** Install/remove task for configurations */
-public class ConfigInstallRemoveTask extends InstallRemoveTask {
+/** Install/remove task for configurations 
+ *  TODO split into install / remove tasks and reimplement
+ * */
+public class ConfigInstallRemoveTask {
 
     static final String ALIAS_KEY = "_alias_factory_pid";
     static final String CONFIG_PATH_KEY = "_jcr_config_path";
     public static final String [] CONFIG_EXTENSIONS = { ".cfg", ".properties" };
     
+    /**
+    
 	public ConfigInstallRemoveTask(String uri, RegisteredResource data, OsgiInstallerContext
ocs) {
 		super(uri, data, ocs);
 	}
@@ -106,4 +101,5 @@
             cfg.delete();
         }
 	}
+	*/
 }
\ No newline at end of file

Modified: sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/SynchronousRefreshPackagesTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/SynchronousRefreshPackagesTask.java?rev=805850&r1=805849&r2=805850&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/SynchronousRefreshPackagesTask.java
(original)
+++ sling/trunk/installer/osgi/installer/src/main/java/org/apache/sling/osgi/installer/impl/tasks/SynchronousRefreshPackagesTask.java
Wed Aug 19 15:47:20 2009
@@ -25,7 +25,7 @@
 import org.osgi.framework.FrameworkListener;
 import org.osgi.service.log.LogService;
 
-/** Task that executes an OSGi "refresh packages" operation, synchronously */
+/** Execute an OSGi "refresh packages" operation, synchronously */
 public class SynchronousRefreshPackagesTask extends OsgiInstallerTask implements FrameworkListener
{
 
     /** Max time allowed to refresh packages (TODO configurable??) */

Modified: sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/TaskOrderingTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/TaskOrderingTest.java?rev=805850&r1=805849&r2=805850&view=diff
==============================================================================
--- sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/TaskOrderingTest.java
(original)
+++ sling/trunk/installer/osgi/installer/src/test/java/org/apache/sling/osgi/installer/impl/TaskOrderingTest.java
Wed Aug 19 15:47:20 2009
@@ -27,15 +27,16 @@
 import java.util.TreeSet;
 
 import org.apache.sling.osgi.installer.InstallableResource;
-import org.apache.sling.osgi.installer.impl.tasks.BundleInstallRemoveTask;
+import org.apache.sling.osgi.installer.impl.tasks.BundleInstallTask;
+import org.apache.sling.osgi.installer.impl.tasks.BundleRemoveTask;
 import org.apache.sling.osgi.installer.impl.tasks.BundleStartTask;
-import org.apache.sling.osgi.installer.impl.tasks.ConfigInstallRemoveTask;
+import org.apache.sling.osgi.installer.impl.tasks.BundleUpdateTask;
 import org.apache.sling.osgi.installer.impl.tasks.SynchronousRefreshPackagesTask;
 
 /** Test the ordering and duplicates elimination of
  * 	OsgiControllerTasks
  */
-// TODO add bundleUpdateTask and others
+// TODO add config-related tasks
 public class TaskOrderingTest {
 
 	private Set<OsgiInstallerTask> taskSet;
@@ -64,17 +65,15 @@
 	public void testBasicOrdering() throws Exception {
 		int testIndex = 1;
 		final OsgiInstallerTask [] tasksInOrder = {
-			new ConfigInstallRemoveTask("someURI.cfg", null, null),
-			new ConfigInstallRemoveTask("someURI.cfg", getRegisteredResource("someURI.cfg"), null),
-			new BundleInstallRemoveTask("someURI.jar", null, new MockOsgiControllerContext()),
-			new BundleInstallRemoveTask("someURI", getRegisteredResource("someURI.cfg"), new MockOsgiControllerContext()),
+		    new BundleRemoveTask(getRegisteredResource("url")),
+		    new BundleUpdateTask(getRegisteredResource("url")),
+		    new BundleInstallTask(getRegisteredResource("url")),
 			new SynchronousRefreshPackagesTask(),
 			new BundleStartTask(0),
 		};
 	
 		taskSet.clear();
-		taskSet.add(tasksInOrder[5]);
-		taskSet.add(tasksInOrder[4]);
+        taskSet.add(tasksInOrder[4]);
 		taskSet.add(tasksInOrder[3]);
 		taskSet.add(tasksInOrder[2]);
 		taskSet.add(tasksInOrder[1]);
@@ -88,7 +87,6 @@
 		taskSet.add(tasksInOrder[2]);
 		taskSet.add(tasksInOrder[3]);
 		taskSet.add(tasksInOrder[4]);
-		taskSet.add(tasksInOrder[5]);
 		
 		assertOrder(testIndex++, taskSet, tasksInOrder);
 		
@@ -97,7 +95,6 @@
 		taskSet.add(tasksInOrder[0]);
 		taskSet.add(tasksInOrder[3]);
 		taskSet.add(tasksInOrder[2]);
-		taskSet.add(tasksInOrder[5]);
 		taskSet.add(tasksInOrder[4]);
 		
 		assertOrder(testIndex++, taskSet, tasksInOrder);
@@ -106,7 +103,6 @@
 		taskSet.add(tasksInOrder[2]);
 		taskSet.add(tasksInOrder[3]);
 		taskSet.add(tasksInOrder[4]);
-		taskSet.add(tasksInOrder[5]);
 		taskSet.add(tasksInOrder[0]);
 		taskSet.add(tasksInOrder[1]);
 		
@@ -117,14 +113,8 @@
 	public void testMultipleConfigAndBundles() throws Exception {
 		int testIndex = 1;
 		final OsgiInstallerTask [] tasksInOrder = {
-			new ConfigInstallRemoveTask("someURIa.cfg", null, null),
-			new ConfigInstallRemoveTask("someURIb.cfg", null, null),
-			new ConfigInstallRemoveTask("someURIa.cfg", getRegisteredResource("someURIa.cfg"), null),
-			new ConfigInstallRemoveTask("someURIb.cfg", getRegisteredResource("someURIb.cfg"), null),
-			new BundleInstallRemoveTask("someURIa.nothing", null, new MockOsgiControllerContext()),
-			new BundleInstallRemoveTask("someURIb.nothing", null, new MockOsgiControllerContext()),
-			new BundleInstallRemoveTask("someURIa.nothing", getRegisteredResource("someURIa.nothing"),
new MockOsgiControllerContext()),
-			new BundleInstallRemoveTask("someURIb.nothing", getRegisteredResource("someURIb.nothing"),
new MockOsgiControllerContext()),
+			new BundleInstallTask(getRegisteredResource("someURIa.nothing")),
+            new BundleInstallTask(getRegisteredResource("someURIb.nothing")),
 			new SynchronousRefreshPackagesTask(),
 			new BundleStartTask(0),
 		};
@@ -135,32 +125,35 @@
 		}
 		
 		assertOrder(testIndex++, taskSet, tasksInOrder);
+		
+        taskSet.clear();
+        for(int i = 0 ; i < tasksInOrder.length; i++) {
+            taskSet.add(tasksInOrder[i]);
+        }
+        
+        assertOrder(testIndex++, taskSet, tasksInOrder);
 	}
 	
 	@org.junit.Test 
 	public void testMultipleRefreshAndStart() throws Exception {
 		int testIndex = 1;
 		final OsgiInstallerTask [] tasksInOrder = {
-			new ConfigInstallRemoveTask("someURI.cfg", null, null),
-			new ConfigInstallRemoveTask("someURI.cfg", getRegisteredResource("someURI.cfg"), null),
-			new BundleInstallRemoveTask("someURI", null, new MockOsgiControllerContext()),
-			new BundleInstallRemoveTask("someURI", getRegisteredResource("someURI.nothing"), new MockOsgiControllerContext()),
+		    new BundleRemoveTask(getRegisteredResource("url")),
 			new SynchronousRefreshPackagesTask(),
 			new BundleStartTask(0),
 			new BundleStartTask(1),
 		};
 		
 		taskSet.clear();
-		taskSet.add(tasksInOrder[6]);
-		taskSet.add(tasksInOrder[6]);
+		taskSet.add(tasksInOrder[3]);
+		taskSet.add(tasksInOrder[3]);
 		taskSet.add(new SynchronousRefreshPackagesTask());
-		taskSet.add(tasksInOrder[5]);
-		taskSet.add(tasksInOrder[5]);
-		taskSet.add(tasksInOrder[4]);
+		taskSet.add(tasksInOrder[2]);
+		taskSet.add(tasksInOrder[2]);
+		taskSet.add(tasksInOrder[1]);
 		taskSet.add(new SynchronousRefreshPackagesTask());
 		taskSet.add(new SynchronousRefreshPackagesTask());
-		taskSet.add(tasksInOrder[4]);
-		taskSet.add(tasksInOrder[4]);
+		taskSet.add(tasksInOrder[0]);
 		taskSet.add(tasksInOrder[3]);
 		taskSet.add(new SynchronousRefreshPackagesTask());
 		taskSet.add(tasksInOrder[3]);
@@ -171,9 +164,6 @@
 		taskSet.add(new SynchronousRefreshPackagesTask());
 		taskSet.add(tasksInOrder[1]);
 		taskSet.add(new SynchronousRefreshPackagesTask());
-		taskSet.add(tasksInOrder[0]);
-		taskSet.add(new SynchronousRefreshPackagesTask());
-		taskSet.add(tasksInOrder[0]);
 		
 		assertOrder(testIndex++, taskSet, tasksInOrder);
 	}
@@ -194,5 +184,12 @@
 			taskSet.add(tasksInOrder[i]);
 		}
 		assertOrder(testIndex++, taskSet, tasksInOrder);
+		
+        taskSet.clear();
+        for(int i = 0 ; i < tasksInOrder.length; i++) {
+            taskSet.add(tasksInOrder[i]);
+        }
+        
+        assertOrder(testIndex++, taskSet, tasksInOrder);
 	}
 }



Mime
View raw message