tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r1104140 - in /tuscany/sca-java-2.x/trunk/modules/domain-node: ./ src/main/java/org/apache/tuscany/sca/ src/main/java/org/apache/tuscany/sca/impl/ src/test/java/org/apache/tuscany/sca/impl/ src/test/java/org/apache/tuscany/sca/runtime/
Date Tue, 17 May 2011 11:09:38 GMT
Author: antelder
Date: Tue May 17 11:09:38 2011
New Revision: 1104140

URL: http://svn.apache.org/viewvc?rev=1104140&view=rev
Log:
Merege the refactoring in nodeImpl2 back into NodeImpl

Removed:
    tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl2.java
Modified:
    tuscany/sca-java-2.x/trunk/modules/domain-node/pom.xml
    tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/Node.java
    tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java
    tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java
    tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/Node2TestCase.java
    tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DeployerTestCase.java
    tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java
    tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/NodeXMLTestCase.java
    tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/PerfTest.java
    tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TuscanyRuntimeTestCase.java
    tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TwoNodesTestCase.java

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/pom.xml?rev=1104140&r1=1104139&r2=1104140&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/pom.xml Tue May 17 11:09:38 2011
@@ -37,6 +37,11 @@
             <artifactId>tuscany-node-impl</artifactId>
             <version>2.0-SNAPSHOT</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-assembly-xml</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>
         
          <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
@@ -60,12 +65,6 @@
         </dependency>         
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-assembly-xml</artifactId>
-            <version>2.0-SNAPSHOT</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>tuscany-binding-ws-wsdlgen</artifactId>
             <version>2.0-SNAPSHOT</version>
             <scope>test</scope>

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/Node.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/Node.java?rev=1104140&r1=1104139&r2=1104140&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/Node.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/Node.java Tue May 17 11:09:38 2011
@@ -21,6 +21,7 @@ package org.apache.tuscany.sca;
 
 import java.io.Reader;
 import java.util.List;
+import java.util.Map;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
@@ -48,32 +49,33 @@ public interface Node {
      *               of the Assembly Specification. May be null.
      * @param dependentContributionURIs  specifies the contributions that are used to resolve the dependencies of the 
      *               root contribution and other dependent contributions. May be null.
-     * @param startDeployables  true if the composites defined as deployable in the contribution's sca-contribution.xml
-     *               file or supplied metaData file should be started, false if they should not be. 
      * @return the URI of the installed contribution
      * 
      * @throws ContributionReadException 
      * @throws ActivationException 
      * @throws ValidationException 
      */
-    String installContribution(String uri, String contributionURL, String metaDataURL, List<String> dependentContributionURIs, boolean startDeployables) throws ContributionReadException, ActivationException, ValidationException;
+    String installContribution(String uri, String contributionURL, String metaDataURL, List<String> dependentContributionURIs) throws ContributionReadException, ActivationException, ValidationException;
 
-    /**
-     * Creates an installed contribution from a supplied Contribution object.
-     * See section 10.5.1 of the Assembly Specification.
-     * 
-     * @param contribution  the Contribution object
-     * @param dependentContributionURIs  specifies the contributions that are used to resolve the dependencies of the 
-     *               root contribution and other dependent contributions. May be null.
-     * @param startDeployables  true if the composites defined as deployable in the contribution's sca-contribution.xml
-     *               file or supplied metaData file should be started, false if they should not be. 
-     * @return the URI of the installed contribution
-     * 
-     * @throws ContributionReadException 
-     * @throws ActivationException 
-     * @throws ValidationException 
-     */
-    String installContribution(Contribution contribution, List<String> dependentContributionURIs, boolean startDeployables) throws ContributionReadException, ActivationException, ValidationException;
+    void installContribution(Contribution contribution, List<String> dependentContributionURIs);
+
+// TODO: I'd still like this one but not in NodeImpl/registry yet    
+//    /**
+//     * Creates an installed contribution from a supplied Contribution object.
+//     * See section 10.5.1 of the Assembly Specification.
+//     * 
+//     * @param contribution  the Contribution object
+//     * @param dependentContributionURIs  specifies the contributions that are used to resolve the dependencies of the 
+//     *               root contribution and other dependent contributions. May be null.
+//     * @param startDeployables  true if the composites defined as deployable in the contribution's sca-contribution.xml
+//     *               file or supplied metaData file should be started, false if they should not be. 
+//     * @return the URI of the installed contribution
+//     * 
+//     * @throws ContributionReadException 
+//     * @throws ActivationException 
+//     * @throws ValidationException 
+//     */
+//    String installContribution(Contribution contribution, List<String> dependentContributionURIs, boolean startDeployables) throws ContributionReadException, ActivationException, ValidationException;
 
     /**
      * Creates an installed contribution from a supplied root contribution URL.
@@ -111,7 +113,7 @@ public interface Node {
      * @throws ActivationException 
      * @throws ValidationException 
      */
-    String start(String contributionURI, Reader compositeXML) throws ContributionReadException, XMLStreamException, ActivationException, ValidationException;
+    String addDeploymentComposite(String contributionURI, Reader compositeXML) throws ContributionReadException, XMLStreamException, ActivationException, ValidationException;
 
     /**
      * 4599 10.5.2 add Deployment Composite & update Deployment Composite
@@ -135,7 +137,7 @@ public interface Node {
      * @throws ActivationException 
      * @throws ValidationException 
      */
-    String start(String contributionURI, Composite composite) throws ActivationException, ValidationException;
+    String addDeploymentComposite(String contributionURI, Composite composite) throws ActivationException, ValidationException;
 
     /**
      * 4611 11.4.310.5.3 remove Contribution
@@ -145,7 +147,7 @@ public interface Node {
      * @return List of contribution URIs (includes dependent contributions) which were removed
      * @throws ActivationException 
      */
-    List<String> removeContribution(String contributionURI) throws ActivationException;
+    void uninstallContribution(String contributionURI) throws ActivationException;
 
     /**
      * 4677 10.7.1 add To Domain-Level Composite
@@ -164,7 +166,9 @@ public interface Node {
      * @throws ValidationException 
      * @throws ContributionReadException 
      */
-    void start(String contributionURI, String compositeURI) throws ActivationException, ValidationException, ContributionReadException;
+    void startComposite(String contributionURI, String compositeURI) throws ActivationException, ValidationException, ContributionReadException;
+
+    List<String> startDeployables(String contributionURI) throws ActivationException, ValidationException, ContributionReadException;
     
     /**
      * 4687 10.7.2 remove From Domain-Level Composite
@@ -175,7 +179,7 @@ public interface Node {
      * @param compositeURI
      * @throws ActivationException 
      */
-    void stop(String contributionURI, String compositeURI) throws ActivationException;
+    void stopComposite(String contributionURI, String compositeURI) throws ActivationException;
 
     /**
      * 10.7.3 get Domain-Level Composite
@@ -185,10 +189,7 @@ public interface Node {
      * 
      * @return
      */
-    Composite getDomainLevelComposite();
-    
-    /* that previous one returns a Composte object but not sure what would be most appropriate, and having one return a string seems convenient: */
-    String getDomainLevelCompositeAsString();
+    Composite getDomainComposite();
     
     /**
      * 4695 10.7.4 get QName Definition
@@ -207,9 +208,9 @@ public interface Node {
      */
     Object getQNameDefinition(String contributionURI, QName definition, QName symbolSpace);
 
-    /**
-     * Probably want to be able to stop it all at once so a method called stop or shutdown or destroy
-     */
+//    /**
+//     * Probably want to be able to stop it all at once so a method called stop or shutdown or destroy
+//     */
     void stop();
 
     /**
@@ -222,7 +223,8 @@ public interface Node {
      * @param contributionURI  the contribution URI
      * @return the List of started composite URIs
      */
-    List<String> getStartedCompositeURIs(String contributionURI);
+//    List<String> getStartedCompositeURIs(String contributionURI);
+    Map<String, List<QName>> getStartedComposites();
 
     /**
      * Get the URIs of all the contributions installed on this Node
@@ -234,8 +236,10 @@ public interface Node {
      * Get an installed Contribution
      * @param uri  the URI of the contribution
      * @return the Contribution
+     * @throws ValidationException 
+     * @throws ContributionReadException 
      */
-    Contribution getInstalledContribution(String uri);
+    Contribution getContribution(String uri) throws ContributionReadException, ValidationException;
     
     String getDomainName();
 
@@ -289,5 +293,9 @@ public interface Node {
 //     */
 //    String updateDeploymentComposite(String uri, Reader compositeXML);
 //    String updateDeploymentComposite(String uri, Composite composite);
+    
+    List<String> getDeployableCompositeURIs(String contributionURI);
+
+    void validateContribution(String string) throws ContributionReadException, ValidationException;
 
 }

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java?rev=1104140&r1=1104139&r2=1104140&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java Tue May 17 11:09:38 2011
@@ -38,7 +38,6 @@ import org.apache.tuscany.sca.core.Utili
 import org.apache.tuscany.sca.core.assembly.RuntimeAssemblyFactory;
 import org.apache.tuscany.sca.deployment.Deployer;
 import org.apache.tuscany.sca.impl.NodeImpl;
-import org.apache.tuscany.sca.impl.NodeImpl2;
 import org.apache.tuscany.sca.monitor.ValidationException;
 import org.apache.tuscany.sca.node.configuration.ContributionConfiguration;
 import org.apache.tuscany.sca.node.configuration.NodeConfiguration;
@@ -103,19 +102,23 @@ public class TuscanyRuntime {
     public static Node runComposite(URI domainURI, String compositeURI, String contributionURL, String... dependentContributionURLs) {
         try {
             TuscanyRuntime runtime = newInstance();
-        	String domain = domainURI == null ? "default" : domainURI.toString();
+            String domain = domainURI == null ? "default" : domainURI.toString();
             DomainRegistry domainRegistry = runtime.domainRegistryFactory.getEndpointRegistry(domain, getDomainName(domain));
             NodeImpl node = new NodeImpl(domain, runtime.deployer, runtime.compositeActivator, domainRegistry, runtime.extensionPointRegistry, runtime);
 
             if (dependentContributionURLs != null) {
                 for (int i=dependentContributionURLs.length-1; i>-1; i--) {
-                    node.installContribution(null, dependentContributionURLs[i], null, null, false);
+                    node.installContribution(null, dependentContributionURLs[i], null, null);
                 }
             }
 
-            String curi = node.installContribution(null, contributionURL, null, null, compositeURI == null);
+            String curi = node.installContribution(null, contributionURL, null, null);
             if (compositeURI != null) {
-                node.start(curi, compositeURI);
+                node.startComposite(curi, compositeURI);
+            } else {
+                for (String compURI : node.getDeployableCompositeURIs(curi)) {
+                    node.startComposite(curi, compURI);
+                }
             }
             return node;
             
@@ -150,15 +153,6 @@ public class TuscanyRuntime {
         return new NodeImpl(domainName, deployer, compositeActivator, domainRegistry, extensionPointRegistry, null);
     }
 
-    public NodeImpl2 createNode2(String domainURI) {
-        String domainName = "default";
-        if (domainURI != null){
-            domainName = getDomainName(domainURI);
-        }
-        DomainRegistry domainRegistry = domainRegistryFactory.getEndpointRegistry(domainURI, domainName);
-        return new NodeImpl2(domainName, deployer, compositeActivator, domainRegistry, extensionPointRegistry, null);
-    }
-    
     /**
      * Creates a Node from an XML configuration file
      * @param configURL  the URL to the XML configuration file
@@ -166,9 +160,14 @@ public class TuscanyRuntime {
      */
     public Node createNodeFromXML(String configURL) throws ContributionReadException, ActivationException, ValidationException {
         NodeConfiguration configuration = loadConfiguration(configURL);
-        Node node = createNode(configuration.getDomainURI());
+        NodeImpl node = (NodeImpl)createNode(configuration.getDomainURI());
         for ( ContributionConfiguration c : configuration.getContributions()) {
-            node.installContribution(c.getURI(), c.getLocation(), c.getMetaDataURL(), c.getDependentContributionURIs(), c.isStartDeployables());
+            String curi = node.installContribution(c.getURI(), c.getLocation(), c.getMetaDataURL(), c.getDependentContributionURIs());
+            if (c.isStartDeployables()) {
+                for (String compURI : node.getDeployableCompositeURIs(curi)) {
+                    node.startComposite(curi, compURI);
+                }
+            }
         }
         return node;
     }

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java?rev=1104140&r1=1104139&r2=1104140&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java Tue May 17 11:09:38 2011
@@ -19,63 +19,41 @@
 
 package org.apache.tuscany.sca.impl;
 
-import java.io.ByteArrayOutputStream;
-import java.io.File;
 import java.io.Reader;
+import java.io.StringReader;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 
 import javax.xml.namespace.QName;
-import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.tuscany.sca.Node;
 import org.apache.tuscany.sca.TuscanyRuntime;
 import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.Base;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
 import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.assembly.Multiplicity;
-import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.xml.Utils;
 import org.apache.tuscany.sca.common.java.io.IOHelper;
-import org.apache.tuscany.sca.context.CompositeContext;
-import org.apache.tuscany.sca.contribution.Artifact;
 import org.apache.tuscany.sca.contribution.Contribution;
 import org.apache.tuscany.sca.contribution.ContributionMetadata;
+import org.apache.tuscany.sca.contribution.Import;
+import org.apache.tuscany.sca.contribution.java.JavaImport;
+import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
 import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
-import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint;
 import org.apache.tuscany.sca.deployment.Deployer;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
 import org.apache.tuscany.sca.monitor.Monitor;
 import org.apache.tuscany.sca.monitor.ValidationException;
 import org.apache.tuscany.sca.runtime.ActivationException;
 import org.apache.tuscany.sca.runtime.CompositeActivator;
+import org.apache.tuscany.sca.runtime.ContributionListener;
 import org.apache.tuscany.sca.runtime.DomainRegistry;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
+import org.apache.tuscany.sca.runtime.InstalledContribution;
 import org.oasisopen.sca.NoSuchServiceException;
-import org.oasisopen.sca.ServiceRuntimeException;
 
 public class NodeImpl implements Node {
 
@@ -85,179 +63,204 @@ public class NodeImpl implements Node {
     private DomainRegistry domainRegistry;
     private ExtensionPointRegistry extensionPointRegistry;
     private TuscanyRuntime tuscanyRuntime;
-    private Map<String, InstalledContribution> locallyInstalledContributions = new HashMap<String, InstalledContribution>();
     
-    public NodeImpl(String domainName, Deployer deployer, CompositeActivator compositeActivator, DomainRegistry domainRegistry, ExtensionPointRegistry extensionPointRegistry, TuscanyRuntime tuscanyRuntime) {
+    private Map<String, Contribution> loadedContributions = new ConcurrentHashMap<String, Contribution>();
+
+    private Map<String, DeployedComposite> startedComposites = new HashMap<String, DeployedComposite>();
+    private Map<String, DeployedComposite> stoppedComposites = new HashMap<String, DeployedComposite>();
+
+    public NodeImpl(String domainName,
+                     Deployer deployer,
+                     CompositeActivator compositeActivator,
+                     DomainRegistry domainRegistry,
+                     ExtensionPointRegistry extensionPointRegistry,
+                     TuscanyRuntime tuscanyRuntime) {
         this.domainName = domainName;
         this.deployer = deployer;
         this.compositeActivator = compositeActivator;
         this.domainRegistry = domainRegistry;
         this.extensionPointRegistry = extensionPointRegistry;
         this.tuscanyRuntime = tuscanyRuntime;
+        
+        domainRegistry.addContributionListener(new ContributionListener() {
+            public void contributionUpdated(String uri) {
+                loadedContributions.remove(uri);
+            }
+            public void contributionRemoved(String uri) {
+                loadedContributions.remove(uri);
+            }
+        });
     }
 
     public String installContribution(String contributionURL) throws ContributionReadException, ActivationException, ValidationException {
-        return installContribution(null, contributionURL, null, null, true);
+        return installContribution(null, contributionURL, null, null);
     }
 
-    public String installContribution(String uri, String contributionURL, String metaDataURL, List<String> dependentContributionURIs, boolean startDeployables) throws ContributionReadException, ActivationException, ValidationException {
-        // TODO: sort out deployables and exports
-        org.apache.tuscany.sca.runtime.InstalledContribution ic = new org.apache.tuscany.sca.runtime.InstalledContribution(uri, contributionURL);
+    public String installContribution(String uri, String contributionURL) throws ContributionReadException, ActivationException, ValidationException {
+        return installContribution(uri, contributionURL, null, null);
+    }
+
+    public String installContribution(String uri, String contributionURL, String metaDataURL, List<String> dependentContributionURIs) throws ContributionReadException, ActivationException, ValidationException {
+        InstalledContribution ic = new InstalledContribution(uri, contributionURL);
+
+        if (dependentContributionURIs != null) {
+            ic.getDependentContributionURIs().addAll(dependentContributionURIs);
+        }
+        
+        if (metaDataURL != null) {
+            mergeContributionMetaData(metaDataURL, loadContribution(ic));
+        }
+
         peekIntoContribution(ic);
+
         domainRegistry.installContribution(ic);
-        if (startDeployables) {
-            for (String compositeURI : ic.getDeployables()) {
-                start(ic.getURI(), compositeURI);
-            }
-            // TODO: sort out metadata and dependents in distributed
-            localInstall(ic.getURI(), contributionURL, metaDataURL, dependentContributionURIs, startDeployables);
-        }
+
         return ic.getURI();
     }
-
+    
+    public void installContribution(Contribution contribution, List<String> dependentContributionURIs) {
+        InstalledContribution ic = new InstalledContribution(contribution.getURI(), contribution.getLocation());
+        if (dependentContributionURIs != null) {
+            ic.getDependentContributionURIs().addAll(dependentContributionURIs);
+        }
+        ic.configureMetaData(contribution);
+        domainRegistry.installContribution(ic);
+        loadedContributions.put(ic.getURI(), contribution);
+    }
+    
+    public void uninstallContribution(String contributionURI) {
+        domainRegistry.uninstallContribution(contributionURI);
+    }
+    
+    protected void mergeContributionMetaData(String metaDataURL, Contribution contribution) throws ValidationException {
+        ContributionMetadata metaData;
+        Monitor monitor = deployer.createMonitor();
+        try {
+            metaData = deployer.loadXMLDocument(IOHelper.getLocationAsURL(metaDataURL), monitor);
+        } catch (Exception e) {
+            throw new ValidationException(e);
+        }
+        monitor.analyzeProblems();
+        contribution.mergeMetaData(metaData);
+    }
+    
     /**
+     * Peek into the contribution to find its attributes.
      * ASM12032 and ASM12033 say no error checking should be done during install and that should happen later, but 
-     * we would still like to know about deployables and exports so peek into the contribution to try to get those,
+     * we need to know about deployables and exports so peek into the contribution to try to get those,
      * and just ignore any errors they might happen while doing that. 
      */
-    protected void peekIntoContribution(org.apache.tuscany.sca.runtime.InstalledContribution ic) {
+    protected void peekIntoContribution(InstalledContribution ic) {
         Contribution contribution = null;
         try {
-            contribution = deployer.loadContribution(IOHelper.createURI(ic.getURI()), IOHelper.getLocationAsURL(ic.getURI()), deployer.createMonitor());
+            contribution = loadContribution(ic);
         } catch (Exception e) {
-            // ignore any errors
+            // ignore it
         }
+        
         if (contribution != null) {
-            for (Composite composite : contribution.getDeployables()) {
-                ic.getDeployables().add(composite.getURI());
-            }
-            // TODO: need to sort out if Export or xml goes in the reg
-//            for (Export e : contribution.getExports()) {
-//            }
+            ic.configureMetaData(contribution);
         }
     }
+    
+    public List<String> getInstalledContributionURIs() {
+        return new ArrayList<String>(domainRegistry.getInstalledContributionURIs());
+    }
 
-    private void localInstall(String uri, String contributionURL, String metaDataURL, List<String> dependentContributionURIs, boolean startDeployables) throws ContributionReadException, ValidationException, ActivationException {
-        Monitor monitor = deployer.createMonitor();
-        Contribution contribution = deployer.loadContribution(IOHelper.createURI(uri), IOHelper.getLocationAsURL(contributionURL), monitor);
-        monitor.analyzeProblems();
-        if (metaDataURL != null) {
-            mergeContributionMetaData(metaDataURL, contribution);
-        }
-        installContribution(contribution, dependentContributionURIs, startDeployables);
+    public Contribution getContribution(String contributionURI) throws ContributionReadException, ValidationException {
+        return loadContribution(getInstalledContribution(contributionURI));
     }
 
-    private void mergeContributionMetaData(String metaDataURL, Contribution contribution) throws ValidationException {
-        ContributionMetadata metaData;
-        Monitor monitor = deployer.createMonitor();
-        try {
-            metaData = deployer.loadXMLDocument(IOHelper.getLocationAsURL(metaDataURL), monitor);
-        } catch (Exception e) {
-            throw new ValidationException(e);
-        }
-        monitor.analyzeProblems();
-        contribution.mergeMetaData(metaData);
+    public List<String> getDeployableCompositeURIs(String contributionURI) {
+        InstalledContribution ic = domainRegistry.getInstalledContribution(contributionURI);
+        return new ArrayList<String>(ic.getDeployables());
     }
     
-    public String installContribution(Contribution contribution, List<String> dependentContributionURIs, boolean startDeployables) throws ContributionReadException, ActivationException, ValidationException {
-        InstalledContribution ic = new InstalledContribution(contribution.getURI(), contribution.getLocation(), contribution, dependentContributionURIs);
-        locallyInstalledContributions.put(contribution.getURI(), ic);
-        if (startDeployables) {
-            for (Composite c : ic.getDefaultDeployables()) {
-                startComposite(c, ic);
-            }
-        } else {
-            contribution.getDeployables().clear();
-            
-            List<Contribution> dependentContributions = calculateDependentContributions(ic);
+    public String addDeploymentComposite(String contributionURI, Reader compositeXML) throws ContributionReadException, XMLStreamException, ValidationException {
+        InstalledContribution ic = getInstalledContribution(contributionURI);
+        
+        // load it to check its valid composite XML
+        Composite composite = deployer.loadXMLDocument(compositeXML);
+        
+        return addDeploymentComposite(ic, composite);
+    }
 
-            Monitor monitor = deployer.createMonitor();
-            try {
-                deployer.resolve(contribution, dependentContributions, monitor);
-            } catch (Exception e) {
-                throw new RuntimeException(e);
-            }
-            monitor.analyzeProblems();
-        }
-        return ic.getURI();
+    public String addDeploymentComposite(String contributionURI, Composite composite) {
+        InstalledContribution ic = getInstalledContribution(contributionURI);
+        return addDeploymentComposite(ic, composite);
     }
 
-    protected List<Contribution> calculateDependentContributions(InstalledContribution ic) {
-        List<Contribution> dependentContributions = new ArrayList<Contribution>();
-        if (ic.getDependentContributionURIs() != null) {
-            // if the install specified dependent uris use just those contributions
-            for (String uri : ic.getDependentContributionURIs()) {
-                InstalledContribution dependee = locallyInstalledContributions.get(uri);
-                if (dependee != null) {
-                    dependentContributions.add(dependee.getContribution());
-                }
-            }
-        } else {
-            // otherwise use all available contributions for dependents
-            for (InstalledContribution ics : locallyInstalledContributions.values()) {
-                dependentContributions.add(ics.getContribution());
-            }
+    protected String addDeploymentComposite(InstalledContribution ic, Composite composite) {
+        if (composite.getURI() == null || composite.getURI().length() < 1) {
+            composite.setURI(composite.getName().getLocalPart() + ".composite");
         }
-        return dependentContributions;
+        ic.getAdditionalDeployables().put(composite.getURI(), Utils.modelToXML(composite, false, extensionPointRegistry));
+        domainRegistry.updateInstalledContribution(ic);
+        return composite.getURI();
     }
 
-    public String start(String contributionURI, Reader compositeXML) throws ContributionReadException, XMLStreamException, ActivationException, ValidationException {
-        Monitor monitor = deployer.createMonitor();
-        Composite composite = deployer.loadXMLDocument(compositeXML, monitor);
-        monitor.analyzeProblems();
-        return start(contributionURI, composite);
-    }
+    public void validateContribution(String contributionURI) throws ContributionReadException, ValidationException {
+        InstalledContribution ic = getInstalledContribution(contributionURI);
+        Contribution contribution = loadContribution(ic);
 
-    public String start(String contributionURI, Composite composite) throws ActivationException, ValidationException {
-        InstalledContribution ic = locallyInstalledContributions.get(contributionURI);
-        if (ic == null) {
-            throw new IllegalArgumentException("contribution not installed: " + contributionURI);
+        Monitor monitor = deployer.createMonitor();
+        try {
+            deployer.resolve(contribution, calculateDependentContributions(ic), monitor);
+        } catch (Exception e) {
+            loadedContributions.remove(ic.getURI());
+            throw new RuntimeException(e);
         }
-        String compositeArtifcatURI = deployer.attachDeploymentComposite(ic.getContribution(), composite, true);
-        startComposite(composite, ic);
-        return compositeArtifcatURI;
+        try {
+            monitor.analyzeProblems();
+        } catch (ValidationException e) {
+            loadedContributions.remove(ic.getURI());
+            throw e;
+        }
+    }
+    
+    public Map<String, List<QName>> getStartedComposites() {
+        return domainRegistry.getRunningCompositeNames();
     }
 
-    public void start(String contributionURI, String compositeURI) throws ActivationException, ValidationException, ContributionReadException {
-        InstalledContribution ic = locallyInstalledContributions.get(contributionURI);
-        if (ic == null) {
-            
-            org.apache.tuscany.sca.runtime.InstalledContribution icx = domainRegistry.getInstalledContribution(contributionURI);
-            String url = null;
-            if (icx != null) {
-                url  = icx.getURL();
-            }
-            if (url == null) {
-                throw new IllegalArgumentException("Contribution not installed: " + contributionURI);
-            }
-            localInstall(contributionURI, url, null, null, false);
-            ic = locallyInstalledContributions.get(contributionURI);
+    public void startComposite(String contributionURI, String compositeURI) throws ActivationException, ValidationException, ContributionReadException {
+        String key = contributionURI+"/"+compositeURI;
+        if (startedComposites.containsKey(key)) {
+            throw new IllegalStateException("composite already started: " + compositeURI);
+        }
+        DeployedComposite dc = stoppedComposites.remove(key);
+        if (dc != null) {
+            dc.start();
+            startedComposites.put(key, dc);
+        } else {
+            InstalledContribution ic = getInstalledContribution(contributionURI);
+            Contribution contribution = loadContribution(ic);
+            Composite composite = contribution.getArtifactModel(compositeURI);
+            List<Contribution> dependentContributions = calculateDependentContributions(ic);
+            dc = new DeployedComposite(composite, contribution, dependentContributions, deployer, compositeActivator, domainRegistry, extensionPointRegistry);
+            dc.start();
+            startedComposites.put(key, dc);
         }
-        if (!ic.restart(compositeURI)) {
-            for (Artifact a : ic.getContribution().getArtifacts()) {
-                if (a.getURI().equals(compositeURI)) {
-                    startComposite((Composite) a.getModel(), ic);
-                    return;
-                }
-            }
-            throw new IllegalArgumentException("composite not found: " + compositeURI);
+    }
+    
+    public void stopComposite(String contributionURI, String compositeURI) throws ActivationException {
+        String key = contributionURI+"/"+compositeURI;
+        DeployedComposite dc = startedComposites.remove(key);
+        if (dc == null) {
+            throw new IllegalStateException("composite not started: " + compositeURI);
         }
+        dc.stop();
+        stoppedComposites.put(key, dc);
     }
 
-    @Override
-    public void stop(String contributionURI, String compositeURI) throws ActivationException {
-        InstalledContribution ic = locallyInstalledContributions.get(contributionURI);
-        if (ic == null) {
-            throw new IllegalArgumentException("Contribution not installed: " + contributionURI);
-        }
-        ic.stop(compositeURI);
+    public String getDomainName() {
+        return domainName;
     }
 
-    public Composite getDomainLevelComposite() {
+    public Composite getDomainComposite() {
         FactoryExtensionPoint factories = extensionPointRegistry.getExtensionPoint(FactoryExtensionPoint.class);
         AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
         Composite domainComposite = assemblyFactory.createComposite();
-        domainComposite.setName(new QName(Base.SCA11_TUSCANY_NS, "domainComposite"));
+        domainComposite.setName(new QName(Base.SCA11_TUSCANY_NS, domainName));
         domainComposite.setAutowire(false);
         domainComposite.setLocal(false);
         List<Composite> domainIncludes = domainComposite.getIncludes();
@@ -270,292 +273,113 @@ public class NodeImpl implements Node {
         return domainComposite;
     }
 
-    public String getDomainLevelCompositeAsString() {
-        StAXArtifactProcessorExtensionPoint xmlProcessors = extensionPointRegistry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-        StAXArtifactProcessor<Composite> compositeProcessor = xmlProcessors.getProcessor(Composite.class);
-        XMLOutputFactory outputFactory = extensionPointRegistry.getExtensionPoint(FactoryExtensionPoint.class).getFactory(XMLOutputFactory.class);
-
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        try {
-            XMLStreamWriter sw = outputFactory.createXMLStreamWriter(bos);
-            compositeProcessor.write(getDomainLevelComposite(), sw, new ProcessorContext(extensionPointRegistry));
-            sw.close();
-        } catch(Exception e) {
-            throw new RuntimeException(e);
-        }
-
-        return  bos.toString();
-    }
-    public Object getQNameDefinition(String contributionURI, QName definition, QName symbolSpace) {
-        // TODO Auto-generated method stub
-        return null;
+    public <T> T getService(Class<T> interfaze, String serviceURI) throws NoSuchServiceException {
+        return ServiceHelper.getService(interfaze, serviceURI, domainRegistry, extensionPointRegistry, deployer);
     }
-
-    public List<String> removeContribution(String contributionURI) throws ActivationException {
-        domainRegistry.uninstallContribution(contributionURI);
-
-        // TODO: should this next bit happen?
-        List<String> removedContributionURIs = new ArrayList<String>();
-        InstalledContribution ic = locallyInstalledContributions.get(contributionURI);
-        if (ic != null) {
-            removedContributionURIs.add(ic.getURI());
-            for (String dependent : getDependentContributions(contributionURI)) {
-                removedContributionURIs.addAll(removeContribution(dependent));
-            }
-            locallyInstalledContributions.remove(contributionURI);
-            for (String compositeURI : ic.getStartedCompositeURIs()) {
-                ic.stop(compositeURI);
-            }
+    
+    protected InstalledContribution getInstalledContribution(String contributionURI) {
+        InstalledContribution ic = domainRegistry.getInstalledContribution(contributionURI);
+        if (ic == null) {
+            throw new IllegalArgumentException("Contribution not installed: " + contributionURI);
         }
-        return removedContributionURIs;
-    }
-
-    public void updateContribution(String uri, String contributionURL) {
-        // TODO Auto-generated method stub
-        // is this just removeContribution/installContribution?
-    }
-    public void updateContribution(Contribution contribution) {
-        // TODO Auto-generated method stub
+        return ic;
     }
 
-    public String updateDeploymentComposite(String uri, Reader compositeXML) {
-        // TODO Auto-generated method stub
-        // is this removeFromDomainLevelComposite/addDeploymentComposite
-        return null;
-    }
-    public String updateDeploymentComposite(String uri, Composite composite) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    public void stop() {
-        ArrayList<String> ics = new ArrayList<String>(locallyInstalledContributions.keySet());
-        for (String uri : ics) {
-            try {
-                removeContribution(uri);
-            } catch (Exception e) {
-                // TODO: log
-                e.printStackTrace();
+    protected Contribution loadContribution(InstalledContribution ic) throws ContributionReadException, ValidationException {
+        Contribution contribution = loadedContributions.get(ic.getURI());
+        if (contribution == null) {
+            Monitor monitor = deployer.createMonitor();
+            contribution = deployer.loadContribution(IOHelper.createURI(ic.getURI()), IOHelper.getLocationAsURL(ic.getURL()), monitor);
+            monitor.analyzeProblems();
+            if (ic.getAdditionalDeployables().size() > 0) {
+                for (String uri : ic.getAdditionalDeployables().keySet()) {
+                    String compositeXML = ic.getAdditionalDeployables().get(uri);
+                    Composite composite;
+                    try {
+                        composite = deployer.loadXMLDocument(new StringReader(compositeXML));
+                    } catch (XMLStreamException e) {
+                        throw new ContributionReadException(e);
+                    }
+                    composite.setURI(composite.getName().getLocalPart() + ".composite");
+                    contribution.addComposite(composite);
+                }
             }
+            loadedContributions.put(ic.getURI(), contribution);
         }
-        if (tuscanyRuntime != null) {
-            tuscanyRuntime.stop();
-        }
+        return contribution;
     }
 
-    public <T> T getService(Class<T> interfaze, String serviceURI) throws NoSuchServiceException {
-
-        List<Endpoint> endpoints = domainRegistry.findEndpoint(serviceURI);
-        if (endpoints.size() < 1) {
-            throw new NoSuchServiceException(serviceURI);
-        }
-
-        String serviceName = null;
-        if (serviceURI.contains("/")) {
-            int i = serviceURI.indexOf("/");
-            if (i < serviceURI.length() - 1) {
-                serviceName = serviceURI.substring(i + 1);
+    protected List<Contribution> calculateDependentContributions(InstalledContribution ic) throws ContributionReadException, ValidationException {
+        List<Contribution> dependentContributions = new ArrayList<Contribution>();
+        if (ic.getDependentContributionURIs() != null && ic.getDependentContributionURIs().size() > 0) {
+            // if the install specified dependent uris use just those contributions
+            for (String uri : ic.getDependentContributionURIs()) {
+                InstalledContribution dependee = domainRegistry.getInstalledContribution(uri);
+                if (dependee != null) {
+                    dependentContributions.add(loadContribution(dependee));
+                }
             }
-        }
-
-        Endpoint ep = endpoints.get(0);
-        if (((RuntimeComponent)ep.getComponent()).getComponentContext() != null) {
-            return ((RuntimeComponent)ep.getComponent()).getServiceReference(interfaze, serviceName).getService();
         } else {
-            return getRemoteProxy(interfaze, ep);
-        }
-    }
-
-    private <T> T getRemoteProxy(Class<T> serviceInterface, Endpoint endpoint) throws NoSuchServiceException {
-        FactoryExtensionPoint factories = extensionPointRegistry.getExtensionPoint(FactoryExtensionPoint.class);
-        AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
-        JavaInterfaceFactory javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class);
-        ProxyFactory proxyFactory =
-            new ExtensibleProxyFactory(extensionPointRegistry.getExtensionPoint(ProxyFactoryExtensionPoint.class));
-
-        CompositeContext compositeContext =
-            new CompositeContext(extensionPointRegistry, domainRegistry, null, null, null,
-                                 deployer.getSystemDefinitions());
-
-        RuntimeEndpointReference epr;
-        try {
-            epr =
-                createEndpointReference(javaInterfaceFactory,
-                                        compositeContext,
-                                        assemblyFactory,
-                                        endpoint,
-                                        serviceInterface);
-        } catch (Exception e) {
-            throw new ServiceRuntimeException(e);
-        }
-
-        return proxyFactory.createProxy(serviceInterface, epr);
-    }
-
-    private RuntimeEndpointReference createEndpointReference(JavaInterfaceFactory javaInterfaceFactory,
-                                                             CompositeContext compositeContext,
-                                                             AssemblyFactory assemblyFactory,
-                                                             Endpoint endpoint,
-                                                             Class<?> businessInterface)
-        throws CloneNotSupportedException, InvalidInterfaceException {
-        Component component = endpoint.getComponent();
-        ComponentService service = endpoint.getService();
-        ComponentReference componentReference = assemblyFactory.createComponentReference();
-        componentReference.setName("sca.client." + service.getName());
-
-        componentReference.setCallback(service.getCallback());
-        componentReference.getTargets().add(service);
-        componentReference.getPolicySets().addAll(service.getPolicySets());
-        componentReference.getRequiredIntents().addAll(service.getRequiredIntents());
-        componentReference.getBindings().add(endpoint.getBinding());
-
-        InterfaceContract interfaceContract = service.getInterfaceContract();
-        Service componentTypeService = service.getService();
-        if (componentTypeService != null && componentTypeService.getInterfaceContract() != null) {
-            interfaceContract = componentTypeService.getInterfaceContract();
-        }
-        interfaceContract = getInterfaceContract(javaInterfaceFactory, interfaceContract, businessInterface);
-        componentReference.setInterfaceContract(interfaceContract);
-        componentReference.setMultiplicity(Multiplicity.ONE_ONE);
-        // component.getReferences().add(componentReference);
-
-        // create endpoint reference
-        EndpointReference endpointReference = assemblyFactory.createEndpointReference();
-        endpointReference.setComponent(component);
-        endpointReference.setReference(componentReference);
-        endpointReference.setBinding(endpoint.getBinding());
-        endpointReference.setUnresolved(false);
-        endpointReference.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED);
-
-        endpointReference.setTargetEndpoint(endpoint);
-
-        componentReference.getEndpointReferences().add(endpointReference);
-        ((RuntimeComponentReference)componentReference).setComponent((RuntimeComponent)component);
-        ((RuntimeEndpointReference)endpointReference).bind(compositeContext);
-
-        return (RuntimeEndpointReference)endpointReference;
-    }
-
-    private InterfaceContract getInterfaceContract(JavaInterfaceFactory javaInterfaceFactory,
-                                                   InterfaceContract interfaceContract,
-                                                   Class<?> businessInterface) throws CloneNotSupportedException,
-        InvalidInterfaceException {
-        if (businessInterface == null) {
-            return interfaceContract;
-        }
-        boolean compatible = false;
-        if (interfaceContract != null && interfaceContract.getInterface() != null) {
-            Interface interfaze = interfaceContract.getInterface();
-            if (interfaze instanceof JavaInterface) {
-                Class<?> cls = ((JavaInterface)interfaze).getJavaClass();
-                if (cls != null && businessInterface.isAssignableFrom(cls)) {
-                    compatible = true;
+            for (Import imprt : loadContribution(ic).getImports()) {
+                for (InstalledContribution exportingIC : findExportingContributions(imprt)) {
+                    dependentContributions.add(loadContribution(exportingIC));
                 }
             }
         }
-
-        if (!compatible) {
-            // The interface is not assignable from the interface contract
-            interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
-            JavaInterface callInterface = javaInterfaceFactory.createJavaInterface(businessInterface);
-            interfaceContract.setInterface(callInterface);
-            if (callInterface.getCallbackClass() != null) {
-                interfaceContract.setCallbackInterface(javaInterfaceFactory.createJavaInterface(callInterface
-                    .getCallbackClass()));
-            }
-        }
-
-        return interfaceContract;
-    }
-   
-    public String getDomainName() {
-        return domainName;
+        // TODO: there is also the location attribute on the import which should be taken into account
+        return dependentContributions;
     }
 
-    public List<String> getStartedCompositeURIs(String contributionURI) {
-        InstalledContribution ic = locallyInstalledContributions.get(contributionURI);
-        if (ic == null) {
-            throw new IllegalArgumentException("no contribution found for: " + contributionURI);
+    private List<InstalledContribution> findExportingContributions(Import imprt) {
+        List<InstalledContribution> ics = new ArrayList<InstalledContribution>();
+        // TODO: Handle Imports in a more extensible way
+        for (String curi : domainRegistry.getInstalledContributionURIs()) {
+            InstalledContribution ic = domainRegistry.getInstalledContribution(curi);
+            if (imprt instanceof JavaImport) {
+                for (String s : ic.getJavaExports()) {
+                    if (s.startsWith(((JavaImport)imprt).getPackage())) {
+                        ics.add(ic);
+                    }
+                }
+            } else if (imprt instanceof NamespaceImport) {
+                if (ic.getNamespaceExports().contains(((NamespaceImport)imprt).getNamespace())) {
+                    ics.add(ic);
+                }
+            } 
         }
-        return ic.getStartedCompositeURIs();
+        return ics;
     }
-
-    public List<String> getInstalledContributionURIs() {
-        Set<String> ls = new HashSet<String>(domainRegistry.getInstalledContributionURIs());
-        ls.addAll(locallyInstalledContributions.keySet());
-        return new ArrayList<String>(ls);
-    }
-
-    public Contribution getInstalledContribution(String uri) {
-        if (locallyInstalledContributions.containsKey(uri)) {
-            return locallyInstalledContributions.get(uri).getContribution();
-        }
-        throw new IllegalArgumentException("no contribution found for: " + uri);
+    
+    @Override
+    public Object getQNameDefinition(String contributionURI, QName definition, QName symbolSpace) {
+        // TODO Auto-generated method stub
+        return null;
     }
 
-    protected String getContributionUriForArtifact(String artifactURI) {
-        String contributionURI = null;
-        for (String uri : locallyInstalledContributions.keySet()) {
-            if (artifactURI.startsWith(uri)) {
-                contributionURI = uri;
-                break;
-            }
-        }
-        if (contributionURI == null) {
-            throw new IllegalArgumentException("no contribution found for: " + artifactURI);
+    @Override
+    public List<String> startDeployables(String contributionURI) throws ActivationException, ValidationException, ContributionReadException {
+        List<String> dcURIs = getDeployableCompositeURIs(contributionURI);
+        for (String dcURI : dcURIs) {
+            startComposite(contributionURI, dcURI);
         }
-        return contributionURI;
+        return dcURIs;
     }
 
-    protected void startComposite(Composite c, InstalledContribution ic) throws ActivationException, ValidationException {
-        List<Contribution> dependentContributions = calculateDependentContributions(ic);
-        DeployedComposite dc = new DeployedComposite(c, ic.getContribution(), dependentContributions, deployer, compositeActivator, domainRegistry, extensionPointRegistry);
-        ic.start(dc);
+    // TODO: this is used by the shell to endpoint detail, should it be on the Node interface?
+    public DomainRegistry getEndpointRegistry() {
+        return domainRegistry;
     }
     
-    public Set<String> getDependentContributions(String contributionURI) {
-        InstalledContribution ic = locallyInstalledContributions.get(contributionURI);
-        if (ic == null) {
-            throw new IllegalArgumentException("Contribution not installed: " + contributionURI);
-        }
-        Set<String> dependentContributionURIs = new HashSet<String>();
-        for (InstalledContribution icx : locallyInstalledContributions.values()) {
-            if (ic != icx) {
-                List<Contribution> dependencies = icx.getContribution().getDependencies();
-                if (dependencies != null && dependencies.contains(ic.getContribution())) {
-                    dependentContributionURIs.addAll(getDependentContributions(icx.getURI()));
-                }
-            }
-        }
-        return dependentContributionURIs;
-    }
-
-    /**
-     * Returns a default URI for a contribution based on the contribution URL
-     */
-    protected String getDefaultContributionURI(String contributionURL) {
-        String uri = null;
-        try {
-            File f = new File(contributionURL);
-            if ("classes".equals(f.getName()) && "target".equals(f.getParentFile().getName())) {
-                uri = f.getParentFile().getParentFile().getName();                   
-            } else {
-                uri = f.getName();
+    public void stop() {
+        for (DeployedComposite dc : startedComposites.values()) {
+            try {
+                dc.stop();
+            } catch (ActivationException e) {
             }
-        } catch (Exception e) {
-            // ignore
         }
-        if (uri == null) {
-            uri = contributionURL;
-        }
-        if (uri.endsWith(".zip") || uri.endsWith(".jar")) {
-            uri = uri.substring(0, uri.length()-4);
-        }
-        return uri;
+        startedComposites.clear();
+        startedComposites.clear();
+        
     }
 
-    public DomainRegistry getEndpointRegistry() {
-        return domainRegistry;
-    }
-    
 }

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/Node2TestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/Node2TestCase.java?rev=1104140&r1=1104139&r2=1104140&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/Node2TestCase.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/Node2TestCase.java Tue May 17 11:09:38 2011
@@ -27,6 +27,7 @@ import javax.xml.stream.XMLStreamExcepti
 
 import junit.framework.Assert;
 
+import org.apache.tuscany.sca.Node;
 import org.apache.tuscany.sca.TuscanyRuntime;
 import org.apache.tuscany.sca.assembly.Composite;
 import org.apache.tuscany.sca.contribution.Contribution;
@@ -42,7 +43,7 @@ public class Node2TestCase {
 
     @Test
     public void localInstall() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
-        NodeImpl2 node = TuscanyRuntime.newInstance().createNode2("ImportTestCase");
+        Node node = TuscanyRuntime.newInstance().createNode("ImportTestCase");
         node.installContribution("src/test/resources/import.jar");
 
         Assert.assertEquals(1, node.getInstalledContributionURIs().size());
@@ -53,7 +54,7 @@ public class Node2TestCase {
 
     @Test
     public void remoteInstall() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
-        NodeImpl2 node = TuscanyRuntime.newInstance().createNode2("ImportTestCase");
+        Node node = TuscanyRuntime.newInstance().createNode("ImportTestCase");
         node.installContribution("https://repository.apache.org/content/groups/snapshots/org/apache/tuscany/sca/samples/helloworld/2.0-SNAPSHOT/helloworld-2.0-SNAPSHOT.jar");
 
         Assert.assertEquals(1, node.getInstalledContributionURIs().size());
@@ -64,7 +65,7 @@ public class Node2TestCase {
 
     @Test
     public void DistributedInstall() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
-        NodeImpl2 nodeA = TuscanyRuntime.newInstance().createNode2("uri:DistributedInstall");
+        Node nodeA = TuscanyRuntime.newInstance().createNode("uri:DistributedInstall");
         nodeA.installContribution("https://repository.apache.org/content/groups/snapshots/org/apache/tuscany/sca/samples/helloworld/2.0-SNAPSHOT/helloworld-2.0-SNAPSHOT.jar");
         nodeA.installContribution("src/test/resources/export.jar");
 
@@ -74,21 +75,21 @@ public class Node2TestCase {
         Contribution cA = nodeA.getContribution("helloworld");
         Assert.assertNotNull(cA);
         
-        NodeImpl2 nodeB = TuscanyRuntime.newInstance().createNode2("uri:DistributedInstall");
+        Node nodeB = TuscanyRuntime.newInstance().createNode("uri:DistributedInstall");
         Assert.assertEquals(2, nodeB.getInstalledContributionURIs().size());
         Assert.assertTrue(nodeB.getInstalledContributionURIs().contains("export"));
         Assert.assertTrue(nodeB.getInstalledContributionURIs().contains("helloworld"));
         Contribution cB = nodeB.getContribution("helloworld");
         Assert.assertNotNull(cB);
 
-        InstalledContribution ic = nodeB.getInstalledContribution("export");
+        InstalledContribution ic = ((NodeImpl)nodeB).getInstalledContribution("export");
         Assert.assertEquals(1, ic.getJavaExports().size());
         Assert.assertEquals("sample", ic.getJavaExports().get(0));
     }
     
     @Test
     public void deployables() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
-        NodeImpl2 node = TuscanyRuntime.newInstance().createNode2("ImportTestCase");
+        Node node = TuscanyRuntime.newInstance().createNode("ImportTestCase");
         node.installContribution("src/test/resources/import.jar");
 
         Assert.assertEquals(1, node.getInstalledContributionURIs().size());
@@ -101,27 +102,27 @@ public class Node2TestCase {
 
     @Test
     public void exports() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
-        NodeImpl2 node = TuscanyRuntime.newInstance().createNode2("ImportTestCase");
+        Node node = TuscanyRuntime.newInstance().createNode("ImportTestCase");
         node.installContribution("src/test/resources/export.jar");
 
         Assert.assertEquals(1, node.getInstalledContributionURIs().size());
         Assert.assertEquals("export", node.getInstalledContributionURIs().get(0));
         
-        InstalledContribution ic = node.getInstalledContribution("export");
+        InstalledContribution ic = ((NodeImpl)node).getInstalledContribution("export");
         Assert.assertEquals(1, ic.getJavaExports().size());
         Assert.assertEquals("sample", ic.getJavaExports().get(0));
     }
 
     @Test
     public void validValidate() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
-        NodeImpl2 node = TuscanyRuntime.newInstance().createNode2("ImportTestCase");
+        Node node = TuscanyRuntime.newInstance().createNode("ImportTestCase");
         node.installContribution("src/test/resources/sample-helloworld.jar");
         node.validateContribution("sample-helloworld");
     }
 
     @Test
     public void invalidValidate() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
-        NodeImpl2 node = TuscanyRuntime.newInstance().createNode2("ImportTestCase");
+        Node node = TuscanyRuntime.newInstance().createNode("ImportTestCase");
         node.installContribution("src/test/resources/import.jar");
         try {
             node.validateContribution("import");
@@ -132,7 +133,7 @@ public class Node2TestCase {
 
     @Test
     public void importExportValidate() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
-        NodeImpl2 node = TuscanyRuntime.newInstance().createNode2("ImportTestCase");
+        Node node = TuscanyRuntime.newInstance().createNode("ImportTestCase");
         node.installContribution("src/test/resources/import.jar");
         try {
             node.validateContribution("import");
@@ -148,14 +149,14 @@ public class Node2TestCase {
 
     @Test
     public void importExportDistributedValidate() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
-        NodeImpl2 nodeA = TuscanyRuntime.newInstance().createNode2("uri:ImportTestCase");
+        Node nodeA = TuscanyRuntime.newInstance().createNode("uri:ImportTestCase");
         nodeA.installContribution("src/test/resources/import.jar");
         try {
             nodeA.validateContribution("import");
         } catch (ValidationException e) {
             // expected
         }
-        NodeImpl2 nodeB = TuscanyRuntime.newInstance().createNode2("uri:ImportTestCase");
+        Node nodeB = TuscanyRuntime.newInstance().createNode("uri:ImportTestCase");
         nodeB.installContribution("src/test/resources/export.jar");
         nodeA.validateContribution("import");
         nodeA.startComposite("import", "helloworld.composite");
@@ -165,7 +166,7 @@ public class Node2TestCase {
 
     @Test
     public void startTest() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
-        NodeImpl2 node = TuscanyRuntime.newInstance().createNode2("ImportTestCase");
+        Node node = TuscanyRuntime.newInstance().createNode("ImportTestCase");
         node.installContribution("src/test/resources/sample-helloworld.jar");
         Assert.assertEquals(0, node.getStartedComposites().size());
 
@@ -183,7 +184,7 @@ public class Node2TestCase {
 
     @Test
     public void addDeploymentCompositeTest() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, XMLStreamException {
-        NodeImpl2 node = TuscanyRuntime.newInstance().createNode2("addDeploymentCompositeTest");
+        Node node = TuscanyRuntime.newInstance().createNode("addDeploymentCompositeTest");
         String curi = node.installContribution("src/test/resources/sample-helloworld.jar");
 
         String compositeXML =

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DeployerTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DeployerTestCase.java?rev=1104140&r1=1104139&r2=1104140&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DeployerTestCase.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DeployerTestCase.java Tue May 17 11:09:38 2011
@@ -19,10 +19,14 @@
 package org.apache.tuscany.sca.runtime;
 
 import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.util.List;
+import java.util.Map;
 
+import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 
 import junit.framework.Assert;
@@ -51,7 +55,7 @@ public class DeployerTestCase {
         Contribution contribution = deployer.loadContribution(URI.create("foo"), new File("src/test/resources/sample-helloworld-nodeployable.jar").toURI().toURL(), monitor);
         monitor.analyzeProblems();
         
-        node.installContribution(contribution, null, true);
+        node.installContribution(contribution, null);
         List<String> ics = node.getInstalledContributionURIs();
         Assert.assertEquals(1, ics.size());
         Assert.assertEquals("foo", ics.get(0));
@@ -62,17 +66,31 @@ public class DeployerTestCase {
         TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance();
         Node node = tuscanyRuntime.createNode("myDomain");
         
-        node.installContribution("foo", "src/test/resources/sample-helloworld-nodeployable.jar", null, null, true);
+        node.installContribution("foo", "src/test/resources/sample-helloworld-nodeployable.jar", null, null);
 
         Deployer deployer = tuscanyRuntime.getDeployer();
         Monitor monitor = deployer.createMonitor();
         Composite composite = deployer.loadXMLDocument(new File("src/test/resources/helloworld2.composite").toURI().toURL(), monitor);
         monitor.analyzeProblems();
-        composite.setURI("helloworld2.composite");
-        node.start("foo", composite);
-        List<String> dcs = node.getStartedCompositeURIs("foo");
+        String cmpuri = node.addDeploymentComposite("foo", composite);
+        node.startComposite("foo", cmpuri);
+        Map<String, List<QName>> dcs = node.getStartedComposites();
         Assert.assertEquals(1, dcs.size());
-        Assert.assertEquals("helloworld2.composite", dcs.get(0));
+        Assert.assertEquals("helloworld2", dcs.get("foo").get(0).getLocalPart());
+    }
+
+    @Test
+    public void testAddDeploymentCompositeXML() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException, MalformedURLException, XMLStreamException, FileNotFoundException {
+        TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance();
+        Node node = tuscanyRuntime.createNode("myDomain");
+        
+        node.installContribution("foo", "src/test/resources/sample-helloworld-nodeployable.jar", null, null);
+
+        String cmpuri = node.addDeploymentComposite("foo", new FileReader(new File("src/test/resources/helloworld2.composite")));
+        node.startComposite("foo", cmpuri);
+        Map<String, List<QName>> dcs = node.getStartedComposites();
+        Assert.assertEquals(1, dcs.size());
+        Assert.assertEquals("helloworld2", dcs.get("foo").get(0).getLocalPart());
     }
 
 }

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java?rev=1104140&r1=1104139&r2=1104140&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java Tue May 17 11:09:38 2011
@@ -33,31 +33,32 @@ public class DomainCompositeTestCase {
 
     @Test
     public void localOnlyDomain() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
-        Node node = TuscanyRuntime.newInstance().createNode("DomainCompositeTestCase.localOnlyDomain");
+        Node node = TuscanyRuntime.newInstance().createNode("DomainCompositeTestCase");
         testIt(node);
     }
 
     @Test
     public void distributedDomain() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
-        Node node = TuscanyRuntime.newInstance().createNode("uri:DomainCompositeTestCase.distributedDomain");
+        Node node = TuscanyRuntime.newInstance().createNode("uri:DomainCompositeTestCase");
         testIt(node);
     }
 
     private void testIt(Node node) throws ContributionReadException, ActivationException, ValidationException {
-        node.installContribution("helloworld", "src/test/resources/sample-helloworld.jar", null, null, true);
+        node.installContribution("helloworld", "src/test/resources/sample-helloworld.jar", null, null);
+        node.startComposite("helloworld", "helloworld.composite");
         
-        Composite dc = node.getDomainLevelComposite();
-        Assert.assertEquals("domainComposite", dc.getName().getLocalPart());
+        Composite dc = node.getDomainComposite();
+        Assert.assertEquals("DomainCompositeTestCase", dc.getName().getLocalPart());
         Assert.assertEquals(1, dc.getIncludes().size());
         Composite c = dc.getIncludes().get(0);
         Assert.assertEquals("helloworld", c.getName().getLocalPart());
         
-        String s = node.getDomainLevelCompositeAsString();
-        System.out.println(s);
-        Assert.assertTrue(s.contains(":helloworld\""));
+//        String s = node.getDomainLevelCompositeAsString();
+//        System.out.println(s);
+//        Assert.assertTrue(s.contains(":helloworld\""));
 
-        node.stop("helloworld", "helloworld.composite");
-        Assert.assertEquals(0, node.getDomainLevelComposite().getIncludes().size());
+        node.stopComposite("helloworld", "helloworld.composite");
+        Assert.assertEquals(0, node.getDomainComposite().getIncludes().size());
     }
 
 }

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/NodeXMLTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/NodeXMLTestCase.java?rev=1104140&r1=1104139&r2=1104140&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/NodeXMLTestCase.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/NodeXMLTestCase.java Tue May 17 11:09:38 2011
@@ -19,6 +19,9 @@
 package org.apache.tuscany.sca.runtime;
 
 import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
 
 import junit.framework.Assert;
 
@@ -37,9 +40,9 @@ public class NodeXMLTestCase {
         List<String> cs = node.getInstalledContributionURIs();
         Assert.assertEquals(1, cs.size());
         Assert.assertEquals("sample-helloworld", cs.get(0));
-        List<String> compsoites = node.getStartedCompositeURIs("sample-helloworld");
-        Assert.assertEquals(1, compsoites.size());
-        Assert.assertEquals("helloworld.composite", compsoites.get(0));
+        Map<String, List<QName>> startedComposites = node.getStartedComposites();
+        Assert.assertEquals(1, startedComposites.size());
+        Assert.assertEquals("helloworld", startedComposites.get("sample-helloworld").get(0).getLocalPart());
     }
 
 }

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/PerfTest.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/PerfTest.java?rev=1104140&r1=1104139&r2=1104140&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/PerfTest.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/PerfTest.java Tue May 17 11:09:38 2011
@@ -39,15 +39,15 @@ public class PerfTest {
         Properties config = new Properties();
         config.setProperty(RuntimeProperties.QUIET_LOGGING, "true");
         Node node = TuscanyRuntime.newInstance(config).createNode();
-        node.installContribution(null, "src/test/resources/sample-helloworld.jar", null, null, false);
+        node.installContribution(null, "src/test/resources/sample-helloworld.jar", null, null);
         
         validate(node);
 
         int count = 3000;
         long start = System.currentTimeMillis();
         for (int i=0; i<count; i++) {
-            node.start("sample-helloworld", "helloworld.composite");
-            node.stop("sample-helloworld", "helloworld.composite");
+            node.startComposite("sample-helloworld", "helloworld.composite");
+            node.stopComposite("sample-helloworld", "helloworld.composite");
         }
         long total = System.currentTimeMillis() - start;
         System.out.println(count + " = " + total + " = " + total / (double)count);
@@ -57,12 +57,12 @@ public class PerfTest {
     }
 
     private void validate(Node node) throws ActivationException, ValidationException, NoSuchServiceException, ContributionReadException {
-        node.start("sample-helloworld", "helloworld.composite");
+        node.startComposite("sample-helloworld", "helloworld.composite");
         
         Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
         Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
         
-        node.stop("sample-helloworld", "helloworld.composite");
+        node.stopComposite("sample-helloworld", "helloworld.composite");
         try {
             node.getService(Helloworld.class, "HelloworldComponent");
             Assert.fail();

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TuscanyRuntimeTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TuscanyRuntimeTestCase.java?rev=1104140&r1=1104139&r2=1104140&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TuscanyRuntimeTestCase.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TuscanyRuntimeTestCase.java Tue May 17 11:09:38 2011
@@ -21,6 +21,9 @@ package org.apache.tuscany.sca.runtime;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
 
 import junit.framework.Assert;
 
@@ -41,7 +44,8 @@ public class TuscanyRuntimeTestCase {
     @Test
     public void testInstallDeployable() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
         Node node = TuscanyRuntime.newInstance().createNode("default");
-        node.installContribution("helloworld", "src/test/resources/sample-helloworld.jar", null, null, true);
+        node.installContribution("helloworld", "src/test/resources/sample-helloworld.jar", null, null);
+        node.startComposite("helloworld", "helloworld.composite");
 
         Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
         Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
@@ -50,13 +54,16 @@ public class TuscanyRuntimeTestCase {
     @Test
     public void testStopStart() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
         Node node = TuscanyRuntime.newInstance().createNode("default");
-        node.installContribution("helloworld", "src/test/resources/sample-helloworld.jar", null, null, true);
-        String ci = node.getStartedCompositeURIs("helloworld").get(0);
+        node.installContribution("helloworld", "src/test/resources/sample-helloworld.jar", null, null);
+        node.startComposite("helloworld", "helloworld.composite");
+
+        Map<String, List<QName>> ci = node.getStartedComposites();
+        Assert.assertEquals(1, ci.size());
 
         Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
         Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
 
-        node.stop("helloworld", ci);
+        node.stopComposite("helloworld", "helloworld.composite");
         try {
             node.getService(Helloworld.class, "HelloworldComponent");
             Assert.fail();
@@ -64,7 +71,7 @@ public class TuscanyRuntimeTestCase {
             // expected as there is no deployables
         }
         
-        node.start("helloworld", ci);
+        node.startComposite("helloworld", "helloworld.composite");
         helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
         Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
     }
@@ -73,8 +80,10 @@ public class TuscanyRuntimeTestCase {
     @Ignore("Depdends on itest/T3558 which isn't in the build?")
     public void testInstallWithDependent() throws NoSuchServiceException, ContributionReadException, ActivationException, ValidationException {
         Node node = TuscanyRuntime.newInstance().createNode("default");
-        node.installContribution("store", "../../itest/T3558/src/test/resources/sample-store.jar", null, null, true);
-        node.installContribution("store-client", "../../itest/T3558/src/test/resources/sample-store-client.jar", null, null, true);
+        node.installContribution("store", "../../testing/itest/T3558/src/test/resources/sample-store.jar", null, null);
+        node.installContribution("store-client", "../../testing/itest/T3558/src/test/resources/sample-store-client.jar", null, null);
+        node.startComposite("store", "store.composite");
+        node.startComposite("store-client", "store-client.composite");
 
         Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
         Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
@@ -83,7 +92,7 @@ public class TuscanyRuntimeTestCase {
     @Test
     public void testInstallNoDeployable() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
         Node node = TuscanyRuntime.newInstance().createNode("default");
-        node.installContribution("helloworld", "src/test/resources/sample-helloworld-nodeployable.jar", null, null, true);
+        node.installContribution("helloworld", "src/test/resources/sample-helloworld-nodeployable.jar", null, null);
 
         try {
             node.getService(Helloworld.class, "HelloworldComponent");
@@ -92,7 +101,7 @@ public class TuscanyRuntimeTestCase {
             // expected as there is no deployables
         }
 
-        node.start("helloworld", "helloworld.composite");
+        node.startComposite("helloworld", "helloworld.composite");
         Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
         Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
     }
@@ -100,7 +109,7 @@ public class TuscanyRuntimeTestCase {
     @Test
     public void testGetInstalledContributions() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
         Node node = TuscanyRuntime.newInstance().createNode("default");
-        node.installContribution("foo", "src/test/resources/sample-helloworld-nodeployable.jar", null, null, true);
+        node.installContribution("foo", "src/test/resources/sample-helloworld-nodeployable.jar", null, null);
         List<String> ics = node.getInstalledContributionURIs();
         Assert.assertEquals(1, ics.size());
         Assert.assertEquals("foo", ics.get(0));
@@ -109,8 +118,8 @@ public class TuscanyRuntimeTestCase {
     @Test
     public void testGetDeployedCompostes() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, MalformedURLException, ActivationException, ValidationException {
         Node node = TuscanyRuntime.newInstance().createNode("default");
-        node.installContribution("foo", "src/test/resources/sample-helloworld.jar", null, null, true);
-        List<String> dcs = node.getStartedCompositeURIs("foo");
+        node.installContribution("foo", "src/test/resources/sample-helloworld.jar", null, null);
+        List<String> dcs = node.startDeployables("foo");
         Assert.assertEquals(1, dcs.size());
         Assert.assertEquals("helloworld.composite", dcs.get(0));
     }
@@ -118,20 +127,25 @@ public class TuscanyRuntimeTestCase {
     @Test
     public void testRemoveComposte() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, MalformedURLException, ActivationException, ValidationException {
         Node node = TuscanyRuntime.newInstance().createNode("default");
-        node.installContribution("foo", "src/test/resources/sample-helloworld.jar", null, null, true);
-        node.stop("foo", "helloworld.composite");
-        List<String> dcs = node.getStartedCompositeURIs("foo");
-        Assert.assertEquals(0, dcs.size());
+        node.installContribution("foo", "src/test/resources/sample-helloworld.jar", null, null);
+        List<String> dcs = node.startDeployables("foo");
+        Assert.assertEquals(1, dcs.size());
+        Map<String, List<QName>> dcsx = node.getStartedComposites();
+        Assert.assertEquals(1, dcsx.size());
+        node.stopComposite("foo", "helloworld.composite");
+        dcsx = node.getStartedComposites();
+        Assert.assertEquals(0, dcsx.size());
     }
 
     @Test
     public void testInstallWithMetaData() throws ContributionReadException, ActivationException, ValidationException, NoSuchServiceException {
         Node node = TuscanyRuntime.newInstance().createNode("default");
-        ((NodeImpl)node).installContribution("helloworld", "src/test/resources/sample-helloworld-nodeployable.jar", "src/test/resources/sca-contribution-generated.xml", null, true);
+        node.installContribution("helloworld", "src/test/resources/sample-helloworld-nodeployable.jar", "src/test/resources/sca-contribution-generated.xml", null);
+        node.startComposite("helloworld", "helloworld.composite");
 
-        List<String> dcs = node.getStartedCompositeURIs("helloworld");
+        Map<String, List<QName>> dcs = node.getStartedComposites();
         Assert.assertEquals(1, dcs.size());
-        Assert.assertEquals("helloworld.composite", dcs.get(0));
+        Assert.assertEquals("helloworld", dcs.get("helloworld").get(0).getLocalPart());
 
         Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
         Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
@@ -149,9 +163,9 @@ public class TuscanyRuntimeTestCase {
         Node node = TuscanyRuntime.runComposite("helloworld.composite", "src/test/resources/sample-helloworld.jar");
         List<String> cs = node.getInstalledContributionURIs();
         Assert.assertEquals(1, cs.size());
-        List<String> dcs = node.getStartedCompositeURIs(cs.get(0));
+        Map<String, List<QName>> dcs = node.getStartedComposites();
         Assert.assertEquals(1, dcs.size());
-        Assert.assertEquals("helloworld.composite", dcs.get(0));
+        Assert.assertEquals("helloworld", dcs.get("sample-helloworld").get(0).getLocalPart());
     }
 
     @Test
@@ -159,29 +173,21 @@ public class TuscanyRuntimeTestCase {
         Node node = TuscanyRuntime.runComposite(null, "src/test/resources/sample-helloworld.jar");
         List<String> cs = node.getInstalledContributionURIs();
         Assert.assertEquals(1, cs.size());
-        List<String> dcs = node.getStartedCompositeURIs(cs.get(0));
+        Map<String, List<QName>> dcs = node.getStartedComposites();
         Assert.assertEquals(1, dcs.size());
-        Assert.assertEquals("helloworld.composite", dcs.get(0));
+        Assert.assertEquals("helloworld", dcs.get("sample-helloworld").get(0).getLocalPart());
     }
     @Test
     public void testRunComposite() throws NoSuchServiceException {
         Node node = TuscanyRuntime.runComposite("helloworld.composite", "src/test/resources/sample-helloworld.jar");
-        try {
         Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
         Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
-        } finally {
-            node.stop();
-        }
     }
 
     @Test
     public void testRunCompositeSharedRuntime() throws NoSuchServiceException {
         Node node = TuscanyRuntime.runComposite(URI.create("default"), "helloworld.composite", "src/test/resources/sample-helloworld.jar");
-        try {
         Helloworld helloworldService = node.getService(Helloworld.class, "HelloworldComponent");
         Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
-        } finally {
-            node.stop();
-        }
     }
 }

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TwoNodesTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TwoNodesTestCase.java?rev=1104140&r1=1104139&r2=1104140&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TwoNodesTestCase.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/TwoNodesTestCase.java Tue May 17 11:09:38 2011
@@ -35,7 +35,8 @@ public class TwoNodesTestCase {
     @Test
     public void testInstallDeployable() throws NoSuchServiceException, NoSuchDomainException, ContributionReadException, ActivationException, ValidationException {
         Node node1 = TuscanyRuntime.newInstance().createNode("uri:TwoNodesTestCase?multicast=off&bind=127.0.0.1:44331");
-        node1.installContribution("helloworld", "src/test/resources/sample-helloworld.jar", null, null, true);
+        node1.installContribution("helloworld", "src/test/resources/sample-helloworld.jar", null, null);
+        node1.startComposite("helloworld", "helloworld.composite");
 
         Node node2 = TuscanyRuntime.newInstance().createNode("uri:TwoNodesTestCase?multicast=off&bind=127.0.0.1:44332&wka=127.0.0.1:44331");
 



Mime
View raw message