You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by va...@apache.org on 2009/01/06 16:27:12 UTC

svn commit: r731972 - /geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/EmbeddedRuntimeGBean.java

Author: vamsic007
Date: Tue Jan  6 07:27:11 2009
New Revision: 731972

URL: http://svn.apache.org/viewvc?rev=731972&view=rev
Log:
Update composite so that stop composite stops components in the Domain composite.
Explicitly remove components from domain composite as getIncludes().remove does not remove components.

Modified:
    geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/EmbeddedRuntimeGBean.java

Modified: geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/EmbeddedRuntimeGBean.java
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/EmbeddedRuntimeGBean.java?rev=731972&r1=731971&r2=731972&view=diff
==============================================================================
--- geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/EmbeddedRuntimeGBean.java (original)
+++ geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/EmbeddedRuntimeGBean.java Tue Jan  6 07:27:11 2009
@@ -31,6 +31,7 @@
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.repository.Repository;
+import org.apache.tuscany.sca.assembly.Component;
 import org.apache.tuscany.sca.assembly.Composite;
 import org.apache.tuscany.sca.contribution.Artifact;
 import org.apache.tuscany.sca.contribution.Contribution;
@@ -135,6 +136,19 @@
             // has broken "clean" stop of individual contributions.
             // Stop the composites
             for(Composite composite: composites) {
+                // The components in the composite computed from contribution are not the same instances
+                // as the ones in domain composite. Replace the components with those from domain composite
+                // so that stopping the composite stops the corresponding components in the domain composite.
+                for(int i = 0; i < composite.getComponents().size(); ++i) {
+                    Component component = null;
+                    for(Component temp : eScaDomain.getDomainComposite().getComponents()) {
+                        if(temp.getName().equals(composite.getComponents().get(i).getName())) {
+                            component = temp;
+                            break;
+                        }
+                    }
+                    composite.getComponents().set(i, component);
+                }
                 eScaDomain.getCompositeActivator().stop(composite);
             }
             
@@ -147,6 +161,14 @@
             for(Composite composite: composites) {
                 eScaDomain.getDomainComposite().getIncludes().remove(composite);
             }
+            // FIXME: The above is actually expected(?) to remove the components in the composite from domain composite.
+            // Since it does not really work, remove components explicitly from the domain composite
+            // TODO: Anything other than the components to be removed from the domain composite?
+            for(Composite composite: composites) {
+                for(Component component: composite.getComponents()) {
+                    eScaDomain.getDomainComposite().getComponents().remove(component);
+                }
+            }
 
             // Remove contribution
             eScaDomain.getContributionService().remove(contributionRoot);