You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2007/10/18 16:39:57 UTC

svn commit: r585979 [2/2] - in /incubator/tuscany/java/sca: itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/ modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/ modules/domain-api/src/main/j...

Added: incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/SubtractServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/SubtractServiceImpl.java?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/SubtractServiceImpl.java (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/SubtractServiceImpl.java Thu Oct 18 07:39:48 2007
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package calculator;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+    public double subtract(double n1, double n2) {
+        System.out.println("SubtractService - subtract " + n1 + " and " + n2);
+        return n1 - n2;
+    }
+
+}

Added: incubator/tuscany/java/sca/modules/domain-impl/src/test/java/org/apache/tuscany/sca/domain/impl/DomainImplTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/test/java/org/apache/tuscany/sca/domain/impl/DomainImplTestCase.java?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/test/java/org/apache/tuscany/sca/domain/impl/DomainImplTestCase.java (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/test/java/org/apache/tuscany/sca/domain/impl/DomainImplTestCase.java Thu Oct 18 07:39:48 2007
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.sca.domain.impl;
+
+import java.net.URL;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainFactory;
+import org.apache.tuscany.sca.domain.SCADomainSPI;
+import org.apache.tuscany.sca.node.SCANode;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import calculator.AddService;
+import calculator.CalculatorService;
+
+
+/**
+ * This server program that loads a composite to provide simple registry function.
+ * This server can be replaced with any registry that is appropriate but the components
+ * in each node that talk to the registry should be replaced also. 
+ */
+public class DomainImplTestCase {
+
+    private static String DEFAULT_DOMAIN_URI = "http://localhost:8877";
+    
+    private static SCADomain domain;
+    private static SCADomainSPI domainSPI;
+    private static ClassLoader cl;
+
+    @BeforeClass
+    public static void init() throws Exception {
+             
+        try {
+            cl = DomainImplTestCase.class.getClassLoader();
+            SCADomainFactory domainFactory = SCADomainFactory.newInstance();
+            domain = domainFactory.createSCADomain(DEFAULT_DOMAIN_URI); 
+            domainSPI = (SCADomainSPI)domain;
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        System.out.println("Domain started");
+    }
+    
+    @AfterClass
+    public static void destroy() throws Exception {
+        // stop the domain    
+        domain.stop();
+        System.out.println("Domain stopped");
+    }  
+    
+    @Test
+    public void testAddNode() throws Exception {    
+        domainSPI.addNode("http://mynode1", "http://localhost:81");
+        domainSPI.addNode("http://mynode2", "http://localhost:82");
+    }
+    
+    @Test
+    public void testAddContributionWithMetaData() throws Exception {    
+        domain.addContribution("contributionNodeA", cl.getResource("nodeA/"));
+    }  
+    
+    @Test
+    public void testAddContributionWithoutMetaData() throws Exception {    
+        domain.addContribution("contributionNodeB", cl.getResource("nodeB/"));
+    }     
+    
+    //@Test
+    public void testKeepServerRunning() throws Exception {
+        System.out.println("press enter to continue");
+        System.in.read();
+    }
+
+}

Added: incubator/tuscany/java/sca/modules/domain-impl/src/test/resources/nodeA/Calculator.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/test/resources/nodeA/Calculator.composite?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/test/resources/nodeA/Calculator.composite (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/test/resources/nodeA/Calculator.composite Thu Oct 18 07:39:48 2007
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           targetNamespace="http://sample"
+           xmlns:sample="http://sample"
+           name="Calculator">
+
+    <component name="CalculatorServiceComponentA">
+		<implementation.java class="calculator.CalculatorServiceImpl"/>
+        <reference name="addService" target="AddServiceComponentB" />     
+        <reference name="subtractService" target="SubtractServiceComponentC" />
+        <reference name="multiplyService" target="MultiplyServiceComponentA"/>     
+        <reference name="divideService" target="DivideServiceComponentA" />
+    </component>    
+
+    <component name="MultiplyServiceComponentA">
+        <implementation.java class="calculator.MultiplyServiceImpl" />
+    </component>   
+    
+    <component name="DivideServiceComponentA">
+        <implementation.java class="calculator.DivideServiceImpl" />
+    </component>
+
+</composite>

Added: incubator/tuscany/java/sca/modules/domain-impl/src/test/resources/nodeA/META-INF/sca-contribution.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/test/resources/nodeA/META-INF/sca-contribution.xml?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/test/resources/nodeA/META-INF/sca-contribution.xml (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/test/resources/nodeA/META-INF/sca-contribution.xml Thu Oct 18 07:39:48 2007
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    * Licensed to the Apache Software Foundation (ASF) under one
+    * or more contributor license agreements.  See the NOTICE file
+    * distributed with this work for additional information
+    * regarding copyright ownership.  The ASF licenses this file
+    * to you under the Apache License, Version 2.0 (the
+    * "License"); you may not use this file except in compliance
+    * with the License.  You may obtain a copy of the License at
+    * 
+    *   http://www.apache.org/licenses/LICENSE-2.0
+    * 
+    * Unless required by applicable law or agreed to in writing,
+    * software distributed under the License is distributed on an
+    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    * KIND, either express or implied.  See the License for the
+    * specific language governing permissions and limitations
+    * under the License.    
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+	      targetNamespace="http://sample"
+              xmlns:sample="http://sample">
+   <deployable composite="sample:Calculator"/>
+</contribution>
\ No newline at end of file

Added: incubator/tuscany/java/sca/modules/domain-impl/src/test/resources/nodeB/Calculator.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/test/resources/nodeB/Calculator.composite?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/test/resources/nodeB/Calculator.composite (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/test/resources/nodeB/Calculator.composite Thu Oct 18 07:39:48 2007
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           targetNamespace="http://sample"
+           xmlns:sample="http://sample"
+           name="Calculator">
+
+    <component name="AddServiceComponentB">
+        <implementation.java class="calculator.AddServiceImpl" />
+    </component>
+    
+</composite>

Copied: incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/DomainManagerNodeEventService.java (from r585415, incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/DomainManagerService.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/DomainManagerNodeEventService.java?p2=incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/DomainManagerNodeEventService.java&p1=incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/DomainManagerService.java&r1=585415&r2=585979&rev=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/DomainManagerService.java (original)
+++ incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/DomainManagerNodeEventService.java Thu Oct 18 07:39:48 2007
@@ -32,7 +32,7 @@
  * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
  */
 @Remotable
-public interface DomainManagerService {
+public interface DomainManagerNodeEventService {
 
     /**
      * A node registers with the distributed domain manager. The mechanism whereby this
@@ -55,14 +55,7 @@
      * @param nodeManagementUrl the endpoint for the nodes management service
      */
     public String removeNode(String nodeURI);     
-    
-    /**
-     * Retrieve a list of all of the registered nodes 
-     * 
-     * @return the list of node information 
-     */
-    public List<NodeInfo> getNodeInfo();  
-    
+     
     /**
      * Accepts information about a service endpoint and holds onto it
      * 
@@ -75,7 +68,6 @@
      */
     public String registerServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName, String URL);
     
-    
     /**
      * Removes information about a service endpoint
      * 
@@ -84,8 +76,7 @@
      * @param serviceName the name of the service that is exposed and the provided endpoint
      * @param bindingName the remote binding that is providing the endpoint
      */    
-    public String  removeServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName);
-     
+    public String removeServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName);
         
     /**
      * Locates information about a service endpoint 
@@ -96,10 +87,5 @@
      * @return url the endpoint url
      */
     public String findServiceEndpoint(String domainUri, String serviceName, String bindingName); 
-    
-    /** 
-     * Returns information for all registered services
-     * @return
-     */
-    public ServiceInfo getServiceInfo();    
+     
 }

Modified: incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainSPI.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainSPI.java?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainSPI.java (original)
+++ incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainSPI.java Thu Oct 18 07:39:48 2007
@@ -23,6 +23,7 @@
 
 import org.apache.tuscany.sca.domain.DomainException;
 import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.model.Domain;
 
 /**
  * Represents an SCA domain.
@@ -48,13 +49,7 @@
      * @return
      */
     public String removeNode(String nodeURI);
-    
-    /**
-     * Return information about all the nodes in the domain
-     * 
-     * @return
-     */
-    public List<NodeInfo> getNodeInfo();
+
     
     /**
      * Accepts information about a service endpoint and holds onto it
@@ -68,7 +63,6 @@
      */
     public String registerServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName, String URL);
     
-    
     /**
      * Removes information about a service endpoint
      * 
@@ -77,9 +71,8 @@
      * @param serviceName the name of the service that is exposed and the provided endpoint
      * @param bindingName the remote binding that is providing the endpoint
      */    
-    public String  removeServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName);
+    public String removeServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName);
      
-        
     /**
      * Locates information about a service endpoint 
      * 
@@ -90,12 +83,25 @@
      */
     public String findServiceEndpoint(String domainUri, String serviceName, String bindingName); 
     
-       
+    
+    /** 
+     * Returns the model of the domain
+     * @return
+     */
+    public Domain getDomainModel();
     
     /** 
      * Returns information for all registered services
      * @return
      */
-    public ServiceInfo getServiceInfo();    
+   // public ServiceInfo getServiceInfo(); 
+    
+    
+    /**
+     * Return information about all the nodes in the domain
+     * 
+     * @return
+     */
+  //  public List<NodeInfo> getNodeInfo();    
     
 }

Added: incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Composite.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Composite.java?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Composite.java (added)
+++ incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Composite.java Thu Oct 18 07:39:48 2007
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.domain.model;
+
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * A composite. 
+ * 
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public interface Composite {
+    
+    /**
+     * Retrieve the composite qname
+     * 
+     * @return composite qname
+     */
+    public QName getCompositeQName();
+    
+    /**
+     * Set the composite qname
+     * 
+     * @param compositeQName
+     */    
+    public void setCompositeQName(QName compositeQName);    
+}

Added: incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Contribution.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Contribution.java?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Contribution.java (added)
+++ incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Contribution.java Thu Oct 18 07:39:48 2007
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.domain.model;
+
+import java.net.URL;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+/**
+ * A contribution.
+ * 
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public interface Contribution {
+    
+    /**
+     * Retrieve the contribution uri
+     * 
+     * @return contribution uri
+     */
+    public String getContributionURI();
+    
+    /**
+     * Set the contribution uri
+     * 
+     * @param contributionURI
+     */    
+    public void setContributionURI(String contributionURI);    
+    
+    /**
+     * Retrieve the contribution url
+     * 
+     * @return contribution url
+     */    
+    public URL getContributionURL();
+   
+    /**
+     * Set the contribution url
+     * 
+     * @param contributionURL
+     */    
+    public void setContributionURL(URL contributionURL);
+    
+    public Map<QName, Composite> getComposites();       
+    public Map<QName, Composite> getDeployableComposites();   
+}

Added: incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Domain.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Domain.java?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Domain.java (added)
+++ incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Domain.java Thu Oct 18 07:39:48 2007
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.domain.model;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * A domain. Manages nodes
+ * 
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public interface Domain {
+
+    
+    /**
+     * Retrieve the domain uri
+     * 
+     * @return domain uri
+     */
+    public String getDomainURI();
+    
+    /**
+     * Set the domain uri
+     * 
+     * @param domainURI
+     */    
+    public void setDomainURI(String domainURI);    
+    
+    /**
+     * Retrieve the domain url
+     * 
+     * @return domain url
+     */    
+    public URL  getDomainURL();
+   
+    /**
+     * Set the domain url
+     * 
+     * @param domainURL
+     */    
+    public void setDomainURL(URL domainURL);
+   
+    public Map<String, Node> getNodes();
+    public Map<String, Contribution> getContributions();
+    public Map<QName, Composite> getDeployedComposites();
+}

Added: incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/DomainModelFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/DomainModelFactory.java?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/DomainModelFactory.java (added)
+++ incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/DomainModelFactory.java Thu Oct 18 07:39:48 2007
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.domain.model;
+
+/**
+ * A node. Runs SCA composites
+ * 
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public interface DomainModelFactory {
+    
+    /**
+     * Create a new domain model
+     * 
+     * @return new domain model
+     */
+    public Domain createDomain();
+   
+    /**
+     * Create a new node model
+     * 
+     * @return new node model
+     */
+    public Node createNode();  
+    
+    /**
+     * Create a new contribution model
+     * 
+     * @return new contribution model
+     */
+    public Contribution createContribution();    
+    
+    /**
+     * Create a new composite model
+     * 
+     * @return new composite model
+     */
+    public Composite createComposite();   
+    
+    /**
+     * Create a new service model
+     * 
+     * @return new service model
+     */
+    public Service createService();     
+
+}

Added: incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Node.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Node.java?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Node.java (added)
+++ incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Node.java Thu Oct 18 07:39:48 2007
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.domain.model;
+
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * A node. Runs SCA composites
+ * 
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public interface Node {
+    
+    /**
+     * Retrieve the node uri
+     * 
+     * @return node uri
+     */
+    public String getNodeURI();
+    
+    /**
+     * Set the node uri
+     * 
+     * @param nodeURI
+     */    
+    public void setNodeURI(String nodeURI);    
+    
+    /**
+     * Retrieve the node url
+     *
+     * @return node url
+     */    
+    public String getNodeURL();
+   
+    /**
+     * Set the node url
+     * 
+     * @param nodeURL
+     */    
+    public void setNodeURL(String nodeURL);
+   
+    public Map<String, Contribution> getContributions();
+    public Map<QName, Composite> getDeployedComposites();
+    public Map<String, Service> getServices();
+}

Added: incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Service.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Service.java?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Service.java (added)
+++ incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Service.java Thu Oct 18 07:39:48 2007
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.domain.model;
+
+import java.net.URL;
+import java.util.Map;
+
+/**
+ * A service
+ * 
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public interface Service {
+    
+    /**
+     * Retrieve the service uri
+     * 
+     * @return service uri
+     */
+    public String getServiceURI();
+    
+    /**
+     * Set the service uri
+     * 
+     * @param serviceURI
+     */    
+    public void setServiceURI(String serviceURI);    
+    
+    /**
+     * Retrieve the service url
+     * 
+     * @return service url
+     */    
+    public String getServiceURL();
+   
+    /**
+     * Set the service url
+     * 
+     * @param serviceURL
+     */    
+    public void setServiceURL(String serviceURL);
+    
+   
+    /**
+     * Retrieve the service binding
+     * 
+     * @return service binding
+     */    
+    public String getServiceBinding();
+   
+    /**
+     * Set the service binding
+     * 
+     * @param serviceBinding
+     */    
+    public void setServiceBinding(String serviceBinding);    
+}

Modified: incubator/tuscany/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode.java?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode.java (original)
+++ incubator/tuscany/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode.java Thu Oct 18 07:39:48 2007
@@ -53,25 +53,25 @@
     /**
      * Add an SCA contribution into the node.
      *  
-     * @param uri the URI of the contribution
-     * @param url the URL of the contribution
+     * @param contributionURI the URI of the contribution
+     * @param contributionURL the URL of the contribution
      */
-    public void addContribution(String uri, URL url) throws NodeException;
+    public void addContribution(String contributionURI, URL contributionURL) throws NodeException;
    
     /**
-     * Start the specified deployable composite on the node.
+     * Deploy the named composite if it hasn't already been deployed
      * 
-     * @param composite
+     * @param compositeQName the name of the composite to be deployed
      */
-    public void startComposite(QName composite) throws NodeException;
+    public void deployComposite(QName compositeQName) throws NodeException;
     
     /**
-     * Start the SCA node service.
+     * Start the SCA node service and all the deployed composites
      */
     public void start() throws NodeException;    
     
     /**
-     * Stop the SCA node service.
+     * Stop the SCA node service and all of the deployed composites
      */
     public void stop() throws NodeException;    
 

Modified: incubator/tuscany/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANodeFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANodeFactory.java?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANodeFactory.java (original)
+++ incubator/tuscany/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANodeFactory.java Thu Oct 18 07:39:48 2007
@@ -75,4 +75,19 @@
      */
     public abstract SCANode createSCANode(String nodeURI, String domainURI) throws NodeException;
     
+    /**
+     * Creates a new SCA node as part of a node group. Groups of nodes are used in load balancing
+     *  and failover scenarios where each node in the group runs the same contribution and 
+     *  active composites 
+     * 
+     * @param nodeURI the URI of the node, this is the endpoint URI of the
+     * node administration service
+     * @param domainURI the URI of the domain that the node belongs to
+     * @param nodeGroupURI the uri of the node group. This is the enpoint URI of the head of the
+     * group of nodes. For example, in load balancing scnearios this will be the loaded balancer itself
+     * @return a new SCA node.
+     */
+    public abstract SCANode createSCANode(String nodeURI, String domainURI, String nodeGroupURI) throws NodeException;
+    
+    
 }

Modified: incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/DomainManagerServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/DomainManagerServiceImpl.java?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/DomainManagerServiceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/DomainManagerServiceImpl.java Thu Oct 18 07:39:48 2007
@@ -24,7 +24,7 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import org.apache.tuscany.sca.domain.DomainManagerService;
+import org.apache.tuscany.sca.domain.DomainManagerNodeEventService;
 import org.apache.tuscany.sca.domain.NodeInfo;
 import org.apache.tuscany.sca.domain.ServiceInfo;
 import org.osoa.sca.annotations.Property;
@@ -38,7 +38,7 @@
  * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
  */
 @Scope("COMPOSITE")
-public class DomainManagerServiceImpl implements DomainManagerService{
+public class DomainManagerServiceImpl implements DomainManagerNodeEventService{
     
     private final static Logger logger = Logger.getLogger(DomainManagerServiceImpl.class.getName());    
     
@@ -49,7 +49,7 @@
     protected int retryInterval = 5000; //ms    
     
     @Reference
-    protected DomainManagerService domainManager;
+    protected DomainManagerNodeEventService domainManager;
 
     public String registerNode(String nodeURI, String nodeURL) {
         
@@ -79,10 +79,7 @@
     public String removeNode(String nodeURI) {
         return domainManager.removeNode(nodeURI);
     }
-    
-    public List<NodeInfo> getNodeInfo(){
-        return domainManager.getNodeInfo();
-    }
+
 
     public String registerServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName, String URL){
      
@@ -159,8 +156,5 @@
         
         return url;
     }
-    
-    public ServiceInfo getServiceInfo(){
-        return domainManager.getServiceInfo();
-    }    
+ 
 }

Modified: incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeManagerServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeManagerServiceImpl.java?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeManagerServiceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeManagerServiceImpl.java Thu Oct 18 07:39:48 2007
@@ -87,13 +87,13 @@
     }
    
     /**
-     * Start the specified deployable composite on the node.
+     * deploy deployable composite on the node.
      * 
      * @param composite
      */
-    public void startComposite(String compositeName) {
+    public void deployComposite(String compositeName) {
         try {
-            node.startComposite(QName.valueOf(compositeName));
+            node.deployComposite(QName.valueOf(compositeName));
         } catch (Exception ex){
             // TODO - sort out exceptions passing across binding.sca
             logger.log(Level.SEVERE, ex.toString());

Modified: incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainImpl.java?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainImpl.java (original)
+++ incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainImpl.java Thu Oct 18 07:39:48 2007
@@ -41,9 +41,10 @@
 import org.apache.tuscany.sca.core.assembly.ActivationException;
 import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
 import org.apache.tuscany.sca.domain.DomainException;
-import org.apache.tuscany.sca.domain.DomainManagerService;
+import org.apache.tuscany.sca.domain.DomainManagerNodeEventService;
 import org.apache.tuscany.sca.domain.NodeInfo;
 import org.apache.tuscany.sca.domain.ServiceInfo;
+import org.apache.tuscany.sca.domain.model.Domain;
 import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
@@ -77,7 +78,7 @@
     private URL domainURL; 
     
     // proxy to the domain
-    private DomainManagerService domainManager;
+    private DomainManagerNodeEventService domainManager;
     
     // proxy to the node manager
     private NodeManagerInitService nodeManagerInit;
@@ -120,7 +121,7 @@
           
             // Check if node has been given a valid domain name to connect to
             if (domainURL == null) {
-            	logger.log(Level.INFO, "Domain will be started stand-alone as node and domain URIs are not provided");
+            	logger.log(Level.INFO, "Domain will be started stand-alone as domain URL is not provided");
             } else {
                 // load the composite that allows this domain representation to 
                 // connect to the rest of the domain
@@ -160,7 +161,7 @@
                     
                         // get the management components out of the domain so that they 
                         // can be configured/used. 
-                        domainManager = domainManagementRuntime.getService(DomainManagerService.class, "DomainManagerComponent");
+                        domainManager = domainManagementRuntime.getService(DomainManagerNodeEventService.class, "DomainManagerComponent");
                         nodeManagerInit = domainManagementRuntime.getService(NodeManagerInitService.class, "NodeManagerComponent/NodeManagerInitService");
                         
                         // Now get the uri back out of the component now it has been built and started
@@ -193,17 +194,7 @@
     public String removeNode(String nodeURI){
         // Does nothing in the proxy
         return null;
-    }
-    
-    public List<NodeInfo> getNodeInfo() {
-        // Does nothing in the proxy
-        return null;
-    }
-    
-    public ServiceInfo getServiceInfo() {
-        // Does nothing in the proxy
-        return null;
-    }    
+    }  
     
     public void addNode(SCANode nodeImpl) throws DomainException {
         this.nodeImpl = (SCANodeImpl)nodeImpl;
@@ -250,32 +241,18 @@
     public String registerServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName, String URL){
         return domainManager.registerServiceEndpoint(domainUri, nodeUri, serviceName, bindingName, URL);
     }
-    
-    
-    /**
-     * Removes information about a service endpoint
-     * 
-     * @param domainUri the string uri for the distributed domain
-     * @param nodeUri the string uri for the current node
-     * @param serviceName the name of the service that is exposed and the provided endpoint
-     * @param bindingName the remote binding that is providing the endpoint
-     */    
+   
     public String  removeServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName){
         return domainManager.removeServiceEndpoint(domainUri, nodeUri, serviceName, bindingName);
     }
      
-        
-    /**
-     * Locates information about a service endpoint 
-     * 
-     * @param domainUri the string uri for the distributed domain
-     * @param serviceName the name of the service that is exposed and the provided endpoint
-     * @param bindingName the remote binding that we want to find an endpoint for
-     * @return url the endpoint url
-     */
     public String findServiceEndpoint(String domainUri, String serviceName, String bindingName){
         return domainManager.findServiceEndpoint(domainUri, serviceName, bindingName);
     }
+    
+    public Domain getDomainModel(){        
+        return null;
+    }     
        
       
     // API methods 
@@ -314,25 +291,29 @@
         }
     }
     
-    public void addComposite(QName qname) throws DomainException {
+    public void addDeploymentComposite(String contributionURI, String compositeXML) throws DomainException {
+        // TODO 
+    }
+    
+    public void addToDomainLevelComposite(QName qname) throws DomainException {
         try {
-            nodeImpl.startComposite(qname);
+            nodeImpl.deployComposite(qname);
         } catch(Exception ex) {
             new DomainException(ex);
         }
     }
       
-    public void removeComposite(QName qname) throws DomainException {
+    public void removeFromDomainLevelComposite(QName qname) throws DomainException {
         try {
             //nodeImpl.stopComposite();
         } catch(Exception ex) {
             new DomainException(ex);
         }        
-    }
+    }     
       
     public void startComposite(QName qname) throws DomainException {
         try {
-            nodeImpl.startComposite(qname);
+            nodeImpl.deployComposite(qname);
         } catch(Exception ex) {
             new DomainException(ex);
         }        

Modified: incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeFactoryImpl.java?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeFactoryImpl.java (original)
+++ incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeFactoryImpl.java Thu Oct 18 07:39:48 2007
@@ -49,7 +49,23 @@
      * @return the SCA domain
      */
     public SCANode createSCANode(String nodeURI, String domainURI) throws NodeException {
-        return new SCANodeImpl(nodeURI, domainURI);
+        return new SCANodeImpl(nodeURI, domainURI, null);
     }
     
+    /**
+     * Creates a new SCA node as part of a node group. Groups of nodes are used in load balancing
+     *  and failover scenarios where each node in the group runs the same contribution and 
+     *  active composites 
+     * 
+     * @param nodeURI the URI of the node, this is the endpoint URI of the
+     * node administration service
+     * @param domainURI the URI of the domain that the node belongs to
+     * @param nodeGroupURI the uri of the node group. This is the enpoint URI of the head of the
+     * group of nodes. For example, in load balancing scenarios this will be the loaded balancer itself
+     * @return a new SCA node.
+     */
+    public SCANode createSCANode(String nodeURI, String domainURI, String nodeGroupURI) throws NodeException {
+        return new SCANodeImpl(nodeURI, domainURI, nodeGroupURI);       
+    }
+       
 }

Modified: incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeImpl.java?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeImpl.java (original)
+++ incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeImpl.java Thu Oct 18 07:39:48 2007
@@ -40,6 +40,7 @@
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.contribution.resolver.impl.ModelResolverImpl;
 import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.core.assembly.ActivationException;
 import org.apache.tuscany.sca.domain.SCADomain;
 import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
@@ -65,6 +66,7 @@
     private URL nodeURL;
     private String domainURI; 
     private URL domainURL;
+    private String nodeGroupURI;
 
     // The tuscany runtime that does the hard work
     private ReallySmallRuntime nodeRuntime;
@@ -88,11 +90,14 @@
      * 
      * @param domainUri - identifies what host and port the domain service is running on, e.g. http://localhost:8081
      * @param nodeUri - if this is a url it is assumed that this will be used as root url for management components, e.g. http://localhost:8082
+     * @param nodeGroupURI the uri of the node group. This is the enpoint URI of the head of the
+     * group of nodes. For example, in load balancing scenarios this will be the loaded balancer itself 
      * @throws ActivationException
      */
-    public SCANodeImpl(String nodeURI, String domainURI) throws NodeException {
+    public SCANodeImpl(String nodeURI, String domainURI, String nodeGroupURI) throws NodeException {
         this.domainURI = domainURI;
         this.nodeURI = nodeURI;
+        this.nodeGroupURI = nodeGroupURI;
         this.nodeClassLoader = Thread.currentThread().getContextClassLoader();        
         init();
     }    
@@ -103,12 +108,15 @@
      * 
      * @param domainUri - identifies what host and port the domain service is running on, e.g. http://localhost:8081
      * @param nodeUri - if this is a url it is assumed that this will be used as root url for management components, e.g. http://localhost:8082
+     * @param nodeGroupURI the uri of the node group. This is the enpoint URI of the head of the
+     * group of nodes. For example, in load balancing scenarios this will be the loaded balancer itself 
      * @param cl - the ClassLoader to use for loading system resources for the node
      * @throws ActivationException
      */
-    public SCANodeImpl(String nodeURI, String domainURI, ClassLoader cl) throws NodeException {
+    public SCANodeImpl(String nodeURI, String domainURI, String nodeGroupURI, ClassLoader cl) throws NodeException {
         this.domainURI = domainURI;
         this.nodeURI = nodeURI;
+        this.nodeGroupURI = nodeGroupURI;
         this.nodeClassLoader = cl;
         init();
     }    
@@ -152,14 +160,14 @@
             // add the node to the domain
             ((SCADomainImpl)scaDomain).addNode(this);  
             
- 
-            // make the node available to the model. 
-            // TODO - No sure how this should be done properly. As a nod to this though
-            //        I have a domain factory which always returns the same domain
-            //        object. I.e. this node
-            ModelFactoryExtensionPoint factories = nodeRuntime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
-            NodeFactoryImpl domainFactory = new NodeFactoryImpl(this);
-            factories.addFactory(domainFactory);            
+            // If a non-null domain name is provided make the node available to the model
+            // this causes the runtime to start registering binding-sca service endpoints
+            // with the domain so only makes sense if we know we have a domain to talk to
+            if (domainURI != null) {
+                ModelFactoryExtensionPoint factories = nodeRuntime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
+                NodeFactoryImpl nodeFactory = new NodeFactoryImpl(this);
+                factories.addFactory(nodeFactory);    
+            }
  
         } catch(Exception ex) {
             throw new NodeException(ex);
@@ -191,6 +199,23 @@
         return components;
     }    
     
+    /**
+     * Stating to think about how a node advertises what it can do. 
+     * Maybe need to turn this round and ask the node to decide whether it
+     * can process a list of artifacts
+     * @return
+     */
+    public List<String> getFeatures() {
+        List<String> featureList = new ArrayList<String>();
+        
+        ExtensionPointRegistry registry = nodeRuntime.getExtensionPointRegistry();
+        
+        // TODO - how to get registered features?
+        ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+        
+        return null;
+    }
+    
     
     // API methods 
     
@@ -200,13 +225,8 @@
     
     public void stop() throws NodeException {
         try {
-            // stop the composite
-            stopComposites();
-            
             // remove contributions
-            removeContributions();
-
-                
+            removeAllContributions();           
         } catch (Exception ex) {
             throw new NodeException(ex);
         }
@@ -225,12 +245,7 @@
     }
     
     public void addContribution(String contributionURI, URL contributionURL, ClassLoader contributionClassLoader ) throws NodeException {
-       try {
-            // check to see if the node has been started and start it if it hasn't
-            if ( nodeComposite == null ) {
-                start();
-            }
-            
+       try {            
             if (contributionURL != null) {
                 ModelResolver modelResolver = null;
                 
@@ -247,15 +262,22 @@
                                                                            modelResolver, 
                                                                            false);
                 
+                // remember the contribution
                 contributions.put(contributionURI, contribution);
                     
+                // remember all the composites that have been found
                 for (DeployedArtifact artifact : contribution.getArtifacts()) {
                     if (artifact.getModel() instanceof Composite) {
                         Composite composite = (Composite)artifact.getModel();
                         composites.put(composite.getName(), composite);
                     }
                 }
-    
+                
+                // remember all the deployable composites ready to be started
+                for (Composite composite : contribution.getDeployables()) {
+                    compositesToStart.add(composite.getName());
+                }                
+                
             } else {
                     throw new ActivationException("Contribution " + contributionURL + " not found");
             }  
@@ -264,8 +286,11 @@
         }        
     }
 
-    private void removeContributions() throws NodeException {
-        try {           
+    private void removeAllContributions() throws NodeException {
+        try {     
+            // stop any running composites
+            stopComposites();
+            
             // Remove all contributions
             for (String contributionURI : contributions.keySet()){
                 nodeRuntime.getContributionService().remove(contributionURI);
@@ -276,38 +301,41 @@
         }   
     }
     
-    public void startComposite(QName compositeName) throws NodeException {
-        compositesToStart.add(compositeName);
+    public void deployComposite(QName compositeName) throws NodeException {
+        // if the named composite is not already in the list then 
+        // add it
+        if (compositesToStart.indexOf(compositeName) == -1 ){
+            compositesToStart.add(compositeName);  
+        }
     }
     
     private void startComposites() throws NodeException {
         try {
             if (compositesToStart.size() == 0 ){
-                throw new NodeException("Starting node " + 
-                                        nodeURI + 
-                                        " with no composite started");
-            }
-            
-            for (QName compositeName : compositesToStart) {
-                Composite composite = composites.get(compositeName);
-                
-                if (composite == null) {
-                    logger.log(Level.INFO, "Composite not found: " + compositeName);
-                } else {
-                    // Add the composite to the top level domain
-                    nodeComposite.getIncludes().add(composite);
-                    nodeRuntime.getCompositeBuilder().build(composite); 
+                logger.log(Level.INFO, nodeURI + 
+                                       " has no composites to start" );
+            } else {  
+                for (QName compositeName : compositesToStart) {
+                    Composite composite = composites.get(compositeName);
                     
-                    // activate the composite
-                    nodeRuntime.getCompositeActivator().activate(composite);              
-                    
-                    //start the composite
-                    nodeRuntime.getCompositeActivator().start(composite);
+                    if (composite == null) {
+                        logger.log(Level.INFO, "Composite not found during start: " + compositeName);
+                    } else {
+                        logger.log(Level.INFO, "Starting composite: " + compositeName);
+                        
+                        // Add the composite to the top level domain
+                        nodeComposite.getIncludes().add(composite);
+                        nodeRuntime.getCompositeBuilder().build(composite); 
+                        
+                        // activate the composite
+                        nodeRuntime.getCompositeActivator().activate(composite);              
+                        
+                        //start the composite
+                        nodeRuntime.getCompositeActivator().start(composite);
+                    }
                 }
             }
 
-        } catch (NodeException ex) {
-            throw ex;
         } catch (Exception ex) {
             throw new NodeException(ex);
         }  
@@ -322,6 +350,8 @@
                                         " with no composite started");
             }
             for (QName compositeName : compositesToStart) {
+                logger.log(Level.INFO, "Stopping composite: " + compositeName);
+                
                 Composite composite = composites.get(compositeName);   
 
                 nodeRuntime.getCompositeActivator().stop(composite);

Modified: incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeUtil.java?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeUtil.java (original)
+++ incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeUtil.java Thu Oct 18 07:39:48 2007
@@ -146,7 +146,7 @@
      * A rather ugly method to find and fix the url of the service, assuming that there
      * is one. 
      *  
-     * we can't get is out of a service reference
+     * we can't get this out of a service reference
      * the component itself doesn't know how to get it  
      * the binding can't to do it automatically as it's not the sca binding
      * 

Modified: incubator/tuscany/java/sca/modules/node-impl/src/main/resources/node.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node-impl/src/main/resources/node.composite?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/node-impl/src/main/resources/node.composite (original)
+++ incubator/tuscany/java/sca/modules/node-impl/src/main/resources/node.composite Thu Oct 18 07:39:48 2007
@@ -29,13 +29,12 @@
            xmlns:sample="http://management"
            xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
            name="Management">
-           
-    
+          
     <component name="DomainManagerComponent">
         <implementation.java class="org.apache.tuscany.sca.node.impl.DomainManagerServiceImpl"/>
         <reference name="domainManager">
-            <interface.java interface="org.apache.tuscany.sca.domain.DomainManagerService"/>
-            <binding.ws uri="http://localhost:8878/DomainManagerComponent/DomainManager"/>
+            <interface.java interface="org.apache.tuscany.sca.domain.DomainManagerNodeEventService"/>
+            <binding.ws uri="http://localhost:8878/DomainManagerComponent/DomainManagerNodeEventService"/>
         </reference>
     </component>           
            

Modified: incubator/tuscany/java/sca/modules/node-impl/src/test/java/calculator/CalculatorService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node-impl/src/test/java/calculator/CalculatorService.java?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/node-impl/src/test/java/calculator/CalculatorService.java (original)
+++ incubator/tuscany/java/sca/modules/node-impl/src/test/java/calculator/CalculatorService.java Thu Oct 18 07:39:48 2007
@@ -18,10 +18,13 @@
  */
 package calculator;
 
+import org.osoa.sca.annotations.Remotable;
+
 
 /**
  * The Calculator service interface.
  */
+@Remotable
 public interface CalculatorService {
 
     double add(double n1, double n2);

Modified: incubator/tuscany/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/DomainDrivenTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/DomainDrivenTestCase.java?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/DomainDrivenTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/DomainDrivenTestCase.java Thu Oct 18 07:39:48 2007
@@ -76,16 +76,21 @@
             domain.addContribution("nodeB", cl.getResource("nodeB/"));
             domain.addContribution("nodeC", cl.getResource("nodeC/"));
             
-            domain.addComposite(new QName("http://sample", "Calculator"));
+            domain.addToDomainLevelComposite(new QName("http://sample", "Calculator"));
             
             domain.startComposite(new QName("http://sample", "Calculator"));
             
-            // get a reference to various services in the domain
+            calculatorServiceA = domain.getService(CalculatorService.class, "CalculatorServiceComponentA");
+            calculatorServiceB = domain.getService(CalculatorService.class, "CalculatorServiceComponentB");
+            
+/*
+            // get a reference to various services in the domain            
             calculatorServiceA = nodeA.getDomain().getService(CalculatorService.class, "CalculatorServiceComponentA");
             calculatorServiceB = nodeB.getDomain().getService(CalculatorService.class, "CalculatorServiceComponentB");
             
             //addServiceB = domain.getService(AddService.class, "AddServiceComponentB");
             addServiceB = nodeA.getDomain().getService(AddService.class, "AddServiceComponentB");
+*/            
             
         } catch(Exception ex){
             System.err.println(ex.toString());
@@ -114,7 +119,6 @@
         Assert.assertEquals(calculatorServiceB.subtract(3, 2), 1.0);
         Assert.assertEquals(calculatorServiceB.multiply(3, 2), 6.0);
         Assert.assertEquals(calculatorServiceB.divide(3, 2), 1.5);
-        Assert.assertEquals(addServiceB.add(3, 2), 5.0);
-        
+       
     }
 }

Modified: incubator/tuscany/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeDrivenTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeDrivenTestCase.java?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeDrivenTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeDrivenTestCase.java Thu Oct 18 07:39:48 2007
@@ -68,21 +68,20 @@
             
             SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
             
+            // rely on meta data to start composite
             nodeA = nodeFactory.createSCANode("nodeA", DEFAULT_DOMAIN_URI);
             nodeA.addContribution("nodeA", cl.getResource("nodeA/"));
-            nodeA.startComposite(new QName("http://sample", "Calculator"));
             nodeA.start();
 
-            
+            // rely on meta data to start composite
             nodeB = nodeFactory.createSCANode("nodeB", DEFAULT_DOMAIN_URI);
             nodeB.addContribution("nodeB", cl.getResource("nodeB/"));
-            nodeB.startComposite(new QName("http://sample", "Calculator"));
             nodeB.start();
 
-            
+            // explicitly ask for composite to be started
             nodeC = nodeFactory.createSCANode("nodeC", DEFAULT_DOMAIN_URI);
             nodeC.addContribution("nodeC", cl.getResource("nodeC/"));
-            nodeC.startComposite(new QName("http://sample", "Calculator")); 
+            nodeC.deployComposite(new QName("http://sample", "Calculator")); 
             nodeC.start();
 
             SCADomainFinder domainFinder = SCADomainFinder.newInstance();

Modified: incubator/tuscany/java/sca/modules/node-impl/src/test/resources/nodeA/Calculator.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node-impl/src/test/resources/nodeA/Calculator.composite?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/node-impl/src/test/resources/nodeA/Calculator.composite (original)
+++ incubator/tuscany/java/sca/modules/node-impl/src/test/resources/nodeA/Calculator.composite Thu Oct 18 07:39:48 2007
@@ -24,6 +24,9 @@
 
     <component name="CalculatorServiceComponentA">
 		<implementation.java class="calculator.CalculatorServiceImpl"/>
+        <service name="CalculatorService">
+            <binding.sca uri="http://localhost:8087/CalculatorServiceComponentA"/>
+        </service>		
         <reference name="addService" target="AddServiceComponentB" />     
         <reference name="subtractService" target="SubtractServiceComponentC" />
         <reference name="multiplyService" target="MultiplyServiceComponentA"/>     

Modified: incubator/tuscany/java/sca/modules/node/src/main/java/org/apache/tuscany/sca/node/NodeFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node/src/main/java/org/apache/tuscany/sca/node/NodeFactoryImpl.java?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/node/src/main/java/org/apache/tuscany/sca/node/NodeFactoryImpl.java (original)
+++ incubator/tuscany/java/sca/modules/node/src/main/java/org/apache/tuscany/sca/node/NodeFactoryImpl.java Thu Oct 18 07:39:48 2007
@@ -29,11 +29,11 @@
  */
 public class NodeFactoryImpl implements NodeFactory {
 	
-	SCANode node = null;
+    SCANode node = null;
 	
-	public NodeFactoryImpl(SCANode node){
-		this.node = node;
-	}
+    public NodeFactoryImpl(SCANode node){
+        this.node = node;
+    }
     
     /**
      * Returns the domain object

Modified: incubator/tuscany/java/sca/modules/node/src/main/java/org/apache/tuscany/sca/node/NodeManagerService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node/src/main/java/org/apache/tuscany/sca/node/NodeManagerService.java?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/node/src/main/java/org/apache/tuscany/sca/node/NodeManagerService.java (original)
+++ incubator/tuscany/java/sca/modules/node/src/main/java/org/apache/tuscany/sca/node/NodeManagerService.java Thu Oct 18 07:39:48 2007
@@ -56,7 +56,7 @@
      * 
      * @param composite
      */
-    public void startComposite(String compositeName);
+    public void deployComposite(String compositeName);
     
     /**
      * Start the SCA node service.

Modified: incubator/tuscany/java/sca/samples/calculator-distributed/build.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/calculator-distributed/build.xml?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/calculator-distributed/build.xml (original)
+++ incubator/tuscany/java/sca/samples/calculator-distributed/build.xml Thu Oct 18 07:39:48 2007
@@ -215,6 +215,7 @@
     	<pathelement location="${m2.repo}\stax\stax-api\1.0.1\stax-api-1.0.1.jar"/>
     	<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-interface-java-xml\1.1-incubating-SNAPSHOT\tuscany-interface-java-xml-1.1-incubating-SNAPSHOT.jar"/>
     	<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-host-tomcat\1.1-incubating-SNAPSHOT\tuscany-host-tomcat-1.1-incubating-SNAPSHOT.jar"/>  	
+    	<pathelement location="${m2.repo}\org\apache\tuscany\sca\tuscany-policy-logging\1.1-incubating-SNAPSHOT\tuscany-policy-logging-1.1-incubating-SNAPSHOT.jar"/>    	
    </path>	
     	
     <target name="runDomainRepo">

Modified: incubator/tuscany/java/sca/samples/calculator-distributed/src/main/java/node/CalculatorNode.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/calculator-distributed/src/main/java/node/CalculatorNode.java?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/calculator-distributed/src/main/java/node/CalculatorNode.java (original)
+++ incubator/tuscany/java/sca/samples/calculator-distributed/src/main/java/node/CalculatorNode.java Thu Oct 18 07:39:48 2007
@@ -56,7 +56,7 @@
             SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
             SCANode node = nodeFactory.createSCANode(nodeName, domainName);
             node.addContribution(nodeName, cl.getResource(nodeName + "/"));
-            node.startComposite(new QName("http://sample", "Calculator"));
+            node.deployComposite(new QName("http://sample", "Calculator"));
             node.start();             
                                          
             // nodeA is the head node and runs some tests while all other nodes

Modified: incubator/tuscany/java/sca/samples/calculator-distributed/src/test/java/calculator/DomainInMemoryTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/calculator-distributed/src/test/java/calculator/DomainInMemoryTestCase.java?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/calculator-distributed/src/test/java/calculator/DomainInMemoryTestCase.java (original)
+++ incubator/tuscany/java/sca/samples/calculator-distributed/src/test/java/calculator/DomainInMemoryTestCase.java Thu Oct 18 07:39:48 2007
@@ -68,19 +68,19 @@
             
             nodeA = nodeFactory.createSCANode("nodeA", DEFAULT_DOMAIN_URI);
             nodeA.addContribution("nodeA", cl.getResource("nodeA/"));
-            nodeA.startComposite(new QName("http://sample", "Calculator"));
+            nodeA.deployComposite(new QName("http://sample", "Calculator"));
             nodeA.start();
 
             
             nodeB = nodeFactory.createSCANode("nodeB", DEFAULT_DOMAIN_URI);
             nodeB.addContribution("nodeB", cl.getResource("nodeB/"));
-            nodeB.startComposite(new QName("http://sample", "Calculator"));
+            nodeB.deployComposite(new QName("http://sample", "Calculator"));
             nodeB.start();
 
             
             nodeC = nodeFactory.createSCANode("nodeC", DEFAULT_DOMAIN_URI);
             nodeC.addContribution("nodeC", cl.getResource("nodeC/"));
-            nodeC.startComposite(new QName("http://sample", "Calculator")); 
+            nodeC.deployComposite(new QName("http://sample", "Calculator")); 
             nodeC.start();
 
             SCADomainFinder domainFinder = SCADomainFinder.newInstance();



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org