tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r981512 - in /tuscany/sca-java-2.x/trunk/modules/domain-node/src: main/java/org/apache/tuscany/sca/node2/ main/java/org/apache/tuscany/sca/node2/impl/ test/java/org/apache/tuscany/sca/node2/
Date Mon, 02 Aug 2010 13:58:02 GMT
Author: antelder
Date: Mon Aug  2 13:58:01 2010
New Revision: 981512

URL: http://svn.apache.org/viewvc?rev=981512&view=rev
Log:
Change add/removeToDoamin method to have the contribution and composite uri as separate parameters

Modified:
    tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/Node.java
    tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/NodeFactory.java
    tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/impl/NodeImpl.java
    tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/node2/NodeTestCase.java

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/Node.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/Node.java?rev=981512&r1=981511&r2=981512&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/Node.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/Node.java
Mon Aug  2 13:58:01 2010
@@ -181,21 +181,23 @@ public interface Node {
      * 4685 services and references in the supplied composite is not defined; since there
is no composite scope
      * 4686 outside the domain composite, the usual idea of promotion has no utility.
      *  
+     * @param cotributionURI
      * @param compositeURI
      * @throws ActivationException 
      * @throws ValidationException 
      */
-    void addToDomainLevelComposite(String compositeURI) throws ActivationException, ValidationException;
+    void addToDomainLevelComposite(String contributionURI, String compositeURI) throws ActivationException,
ValidationException;
     
     /**
      * 4687 10.7.2 remove From Domain-Level Composite
      * 4688 Removes from the Domain Level composite the elements corresponding to the composite
identified by a
      * 4689 supplied composite URI. This means that the removal of the components, wires,
services and references
      * 4690 originally added to the domain level composite by the identified composite. 
   * 
+     * @param contributionURI
      * @param compositeURI
      * @throws ActivationException 
      */
-    void removeFromDomainLevelComposite(String compositeURI) throws ActivationException;
+    void removeFromDomainLevelComposite(String contributionURI, String compositeURI) throws
ActivationException;
 
     /**
      * 10.7.3 get Domain-Level Composite

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/NodeFactory.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/NodeFactory.java?rev=981512&r1=981511&r2=981512&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/NodeFactory.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/NodeFactory.java
Mon Aug  2 13:58:01 2010
@@ -72,13 +72,7 @@ public class NodeFactory {
 
             String curi = node.installContribution(null, contributionURL, null, null, compositeURI
== null);
             if (compositeURI != null) {
-                if (curi.endsWith("/")) {
-                    curi = curi + compositeURI;
-                } else {
-                    curi = curi + "/" + compositeURI;
-                }
-                // TODO: change addToDomainLevelComposite to take curi, compositeURI
-                node.addToDomainLevelComposite(curi);
+                node.addToDomainLevelComposite(curi, compositeURI);
             }
             return node;
             

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/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/node2/impl/NodeImpl.java?rev=981512&r1=981511&r2=981512&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/impl/NodeImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/node2/impl/NodeImpl.java
Mon Aug  2 13:58:01 2010
@@ -161,15 +161,14 @@ public class NodeImpl implements Node {
         return compositeArtifcatURI;
     }
 
-    public void addToDomainLevelComposite(String compositeURI) throws ActivationException,
ValidationException {
-        String contributionURI = getContributionUriForArtifact(compositeURI);
+    @Override
+    public void addToDomainLevelComposite(String contributionURI, String compositeURI) throws
ActivationException, ValidationException {
         InstalledContribution ic = installedContributions.get(contributionURI);
         if (ic == null) {
             throw new IllegalArgumentException("Contribution not installed: " + contributionURI);
         }
-        String relativeURI = compositeURI.substring(contributionURI.endsWith("/") ? contributionURI.length()
: contributionURI.length()+1);
         for (Artifact a : ic.getContribution().getArtifacts()) {
-            if (a.getURI().equals(relativeURI)) {
+            if (a.getURI().equals(compositeURI)) {
                 runComposite((Composite) a.getModel(), ic);
                 return;
             }
@@ -177,12 +176,14 @@ public class NodeImpl implements Node {
         throw new IllegalArgumentException("composite not found: " + compositeURI);
     }
 
-    public void removeFromDomainLevelComposite(String compositeURI) throws ActivationException
{
-        String contributionURI = getContributionUriForArtifact(compositeURI);
+    @Override
+    public void removeFromDomainLevelComposite(String contributionURI, String compositeURI)
throws ActivationException {
         InstalledContribution ic = installedContributions.get(contributionURI);
-        String relativeURI = compositeURI.substring(contributionURI.length()+1);
+        if (ic == null) {
+            throw new IllegalArgumentException("Contribution not installed: " + contributionURI);
+        }
         for (DeployedComposite dc : ic.getDeployedComposites()) {
-            if (relativeURI.equals(dc.getURI())) {
+            if (compositeURI.equals(dc.getURI())) {
                 ic.getDeployedComposites().remove(dc);
                 dc.unDeploy();
                 return;
@@ -353,5 +354,5 @@ public class NodeImpl implements Node {
         }
         return uri;
     }
-    
+
 }

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/node2/NodeTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/node2/NodeTestCase.java?rev=981512&r1=981511&r2=981512&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/node2/NodeTestCase.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/node2/NodeTestCase.java
Mon Aug  2 13:58:01 2010
@@ -65,7 +65,7 @@ public class NodeTestCase {
 //            // expected as there is no deployables
 //        }
 
-        node.addToDomainLevelComposite("helloworld" + "/helloworld.composite");
+        node.addToDomainLevelComposite("helloworld", "helloworld.composite");
 //        Helloworld helloworldService = scaClientFactory.getService(Helloworld.class, "HelloworldComponent");
 //        Assert.assertEquals("Hello petra", helloworldService.sayHello("petra"));
     }
@@ -92,7 +92,7 @@ public class NodeTestCase {
     public void testRemoveComposte() throws NoSuchServiceException, NoSuchDomainException,
ContributionReadException, MalformedURLException, ActivationException, ValidationException
{
         Node node = NodeFactory.newInstance().createNode("default");
         node.installContribution("foo", "src/test/resources/sample-helloworld.jar", null,
null, true);
-        node.removeFromDomainLevelComposite("foo/helloworld.composite");
+        node.removeFromDomainLevelComposite("foo", "helloworld.composite");
         List<String> dcs = node.getDeployedCompostes("foo");
         Assert.assertEquals(0, dcs.size());
     }



Mime
View raw message