FELIX-3042 committed the supplied patch
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1202539 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyActivatorBase.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyActivatorBase.java
index eaae36a..b1649b2 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyActivatorBase.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyActivatorBase.java
@@ -20,7 +20,6 @@
import java.util.List;
-import org.apache.felix.dm.impl.ComponentImpl;
import org.apache.felix.dm.impl.Logger;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
@@ -87,7 +86,7 @@
*/
public void stop(BundleContext context) throws Exception {
destroy(m_context, m_manager);
- cleanup(m_manager);
+ m_manager.clear();
m_manager = null;
m_context = null;
}
@@ -286,25 +285,8 @@
*
* @return the factory configuration adapter service
*/
- public Component createFactoryConfigurationAdapterService(String factoryPid, String update, boolean propagate, String heading, String desc, String localization, PropertyMetaData[] propertiesMetaData) {
- return m_manager.createFactoryConfigurationAdapterService(factoryPid, update, propagate, heading, desc, localization, propertiesMetaData);
- }
-
- /**
- * Cleans up all components and their dependencies.
- *
- * @param manager the dependency manager
- */
- private void cleanup(DependencyManager manager) {
- List services = manager.getComponents();
- for (int i = services.size() - 1; i >= 0; i--) {
- Component service = (Component) services.get(i);
- manager.remove(service);
- // remove any state listeners that are still registered
- if (service instanceof ComponentImpl) {
- ComponentImpl si = (ComponentImpl) service;
- si.removeStateListeners();
- }
- }
+ public Component createFactoryConfigurationAdapterService(String factoryPid, String update, boolean propagate, String heading, String desc, String localization, PropertyMetaData[] propertiesMetaData) {
+ return m_manager.createFactoryConfigurationAdapterService(factoryPid, update, propagate, heading, desc, localization, propertiesMetaData);
}
+
}
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyManager.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyManager.java
index aaf8c0c..c6032eb 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyManager.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyManager.java
@@ -551,4 +551,21 @@
public List getComponents() {
return Collections.unmodifiableList(m_components);
}
+
+ /**
+ * Removes all components and their dependencies.
+ */
+ public void clear() {
+ List services = getComponents();
+ for (int i = services.size() - 1; i >= 0; i--) {
+ Component service = (Component) services.get(i);
+ remove(service);
+ // remove any state listeners that are still registered
+ if (service instanceof ComponentImpl) {
+ ComponentImpl si = (ComponentImpl) service;
+ si.removeStateListeners();
+ }
+ }
+ }
+
}