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 [1/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...

Author: slaws
Date: Thu Oct 18 07:39:48 2007
New Revision: 585979

URL: http://svn.apache.org/viewvc?rev=585979&view=rev
Log:
Some connected tidying on the way to adding domain/nodes into distribution/webapp
- API tidying (more to come)
- Add domain impl test
- Simplify domain model
- Enable getService at the domain level
- sca-contribution/deployables processing in node

Added:
    incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/
    incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/
    incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/CompositeImpl.java
    incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ContributionImpl.java
    incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainImpl.java
    incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainModelFactoryImpl.java
    incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/NodeImpl.java
    incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ServiceImpl.java
    incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/
    incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/AddService.java
    incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/AddServiceImpl.java
    incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/CalculatorService.java
    incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/CalculatorServiceImpl.java
    incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/DivideService.java
    incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/DivideServiceImpl.java
    incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/MultiplyService.java
    incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/MultiplyServiceImpl.java
    incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/SubtractService.java
    incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/SubtractServiceImpl.java
    incubator/tuscany/java/sca/modules/domain-impl/src/test/java/org/
    incubator/tuscany/java/sca/modules/domain-impl/src/test/java/org/apache/
    incubator/tuscany/java/sca/modules/domain-impl/src/test/java/org/apache/tuscany/
    incubator/tuscany/java/sca/modules/domain-impl/src/test/java/org/apache/tuscany/sca/
    incubator/tuscany/java/sca/modules/domain-impl/src/test/java/org/apache/tuscany/sca/domain/
    incubator/tuscany/java/sca/modules/domain-impl/src/test/java/org/apache/tuscany/sca/domain/impl/
    incubator/tuscany/java/sca/modules/domain-impl/src/test/java/org/apache/tuscany/sca/domain/impl/DomainImplTestCase.java
    incubator/tuscany/java/sca/modules/domain-impl/src/test/resources/nodeA/
    incubator/tuscany/java/sca/modules/domain-impl/src/test/resources/nodeA/Calculator.composite
    incubator/tuscany/java/sca/modules/domain-impl/src/test/resources/nodeA/META-INF/
    incubator/tuscany/java/sca/modules/domain-impl/src/test/resources/nodeA/META-INF/sca-contribution.xml
    incubator/tuscany/java/sca/modules/domain-impl/src/test/resources/nodeB/
    incubator/tuscany/java/sca/modules/domain-impl/src/test/resources/nodeB/Calculator.composite
    incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/DomainManagerNodeEventService.java
      - copied, changed from r585415, incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/DomainManagerService.java
    incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/
    incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Composite.java
    incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Contribution.java
    incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Domain.java
    incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/DomainModelFactory.java
    incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Node.java
    incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/model/Service.java
    incubator/tuscany/java/sca/modules/node-impl/src/test/resources/nodeB/META-INF/sca-deployables/
    incubator/tuscany/java/sca/modules/node-impl/src/test/resources/nodeB/META-INF/sca-deployables/Calculator.composite
      - copied unchanged from r585415, incubator/tuscany/java/sca/modules/node-impl/src/test/resources/nodeB/Calculator.composite
Removed:
    incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/DomainManagerService.java
    incubator/tuscany/java/sca/modules/node-impl/src/test/resources/nodeB/Calculator.composite
    incubator/tuscany/java/sca/modules/node-impl/src/test/resources/nodeB/META-INF/sca-contribution.xml
    incubator/tuscany/java/sca/modules/node-impl/src/test/resources/nodeC/META-INF/
Modified:
    incubator/tuscany/java/sca/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java
    incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestDomain.java
    incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java
    incubator/tuscany/java/sca/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/SCADomain.java
    incubator/tuscany/java/sca/modules/domain-impl/   (props changed)
    incubator/tuscany/java/sca/modules/domain-impl/pom.xml
    incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerNodeImpl.java
    incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerServiceImpl.java
    incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainImpl.java
    incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/domain.composite
    incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/webroot/index.html
    incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainSPI.java
    incubator/tuscany/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode.java
    incubator/tuscany/java/sca/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANodeFactory.java
    incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/DomainManagerServiceImpl.java
    incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeManagerServiceImpl.java
    incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainImpl.java
    incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeFactoryImpl.java
    incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeImpl.java
    incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeUtil.java
    incubator/tuscany/java/sca/modules/node-impl/src/main/resources/node.composite
    incubator/tuscany/java/sca/modules/node-impl/src/test/java/calculator/CalculatorService.java
    incubator/tuscany/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/DomainDrivenTestCase.java
    incubator/tuscany/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeDrivenTestCase.java
    incubator/tuscany/java/sca/modules/node-impl/src/test/resources/nodeA/Calculator.composite
    incubator/tuscany/java/sca/modules/node/src/main/java/org/apache/tuscany/sca/node/NodeFactoryImpl.java
    incubator/tuscany/java/sca/modules/node/src/main/java/org/apache/tuscany/sca/node/NodeManagerService.java
    incubator/tuscany/java/sca/samples/calculator-distributed/build.xml
    incubator/tuscany/java/sca/samples/calculator-distributed/src/main/java/node/CalculatorNode.java
    incubator/tuscany/java/sca/samples/calculator-distributed/src/test/java/calculator/DomainInMemoryTestCase.java

Modified: incubator/tuscany/java/sca/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java (original)
+++ incubator/tuscany/java/sca/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java Thu Oct 18 07:39:48 2007
@@ -66,12 +66,10 @@
             
             nodeA = nodeFactory.createSCANode("nodeA", DEFAULT_DOMAIN_URI);
             nodeA.addContribution("nodeA", cl.getResource("nodeA/"));
-            nodeA.startComposite(new QName("http://foo", "CompositeA"));
             nodeA.start();
             
             nodeB = nodeFactory.createSCANode("nodeB", DEFAULT_DOMAIN_URI);
             nodeB.addContribution("nodeB", cl.getResource("nodeB/"));
-            nodeB.startComposite(new QName("http://foo", "CompositeB"));
             nodeB.start();                  
             
             // get a reference to the calculator service from domainA

Modified: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestDomain.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestDomain.java?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestDomain.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestDomain.java Thu Oct 18 07:39:48 2007
@@ -42,6 +42,7 @@
 import org.apache.tuscany.sca.domain.SCADomain;
 import org.apache.tuscany.sca.domain.SCADomainSPI;
 import org.apache.tuscany.sca.domain.ServiceInfo;
+import org.apache.tuscany.sca.domain.model.Domain;
 import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
@@ -137,7 +138,7 @@
         }
     }
     
-    public List<NodeInfo> getNodeInfo() {
+    public Domain getDomainModel() {
         return null;
     }
      
@@ -193,11 +194,6 @@
         return url;
     }
     
-    public ServiceInfo getServiceInfo() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-    
     public SCADomain getDomain(){
         return null;
     }
@@ -218,10 +214,13 @@
     public void removeContribution(String contributionURI) throws DomainException {
     }
     
-    public void addComposite(QName qname) throws DomainException {  
+    public void addDeploymentComposite(String contributionURI, String compositeXML) throws DomainException {
+    }
+
+    public void addToDomainLevelComposite(QName compositeQName) throws DomainException {
     }
   
-    public void removeComposite(QName qname) throws DomainException {          
+    public void removeFromDomainLevelComposite(QName compositeQName) throws DomainException {
     }
     
     public void startComposite(QName compositeName) throws DomainException {

Modified: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java Thu Oct 18 07:39:48 2007
@@ -151,11 +151,7 @@
  
     }
     
-    public void startComposite(QName compositeName) throws NodeException {
-
-    }
-
-    public void stopComposite() throws NodeException {             
+    public void deployComposite(QName compositeName) throws NodeException {
 
     }
     

Modified: incubator/tuscany/java/sca/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/SCADomain.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/SCADomain.java?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/SCADomain.java (original)
+++ incubator/tuscany/java/sca/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/SCADomain.java Thu Oct 18 07:39:48 2007
@@ -57,35 +57,49 @@
     /**
      * Add an SCA contribution to the domain.
      *  
-     * @param uri the URI of the contribution
-     * @param url the URL of the contribution
-     */
-    public void addContribution(String uri, URL url)
+     * @param contributionURI the URI of the contribution
+     * @param contributionURL the URL of the contribution
+     * @throws DomainException
+     */  
+    public void addContribution(String contributionURI, URL contributionURL)
       throws DomainException;
     
     /**
      * Remove a contribution from the domain.
      * 
-     * @param url the URL of the contribution
+     * @param contributionURI the URI of the contribution
+     * @throws DomainException
      */
-    public void removeContribution(String uri)
+    public void removeContribution(String contributionURI)
       throws DomainException; 
+    
+    /**
+     * Add the supplied composite XML to the identified contribution
+     * 
+     * @param contributionURI the URI of the contribution
+     * @param compositeXML the XML string of the composite 
+     * @throws DomainException
+     */
+    public void addDeploymentComposite(String contributionURI, String compositeXML)
+      throws DomainException;
 
     /**
      * Add a deployable composite to the domain.
      * 
-     * @param qname the QName of the composite
+     * @param compositeQName the QName of the composite
+     * @throws DomainException     
      */
-    public void addComposite(QName qname)
+    public void addToDomainLevelComposite(QName compositeQName)
       throws DomainException;
     
     /**
      * Remove a deployable composite from the domain.
      * 
-     * @param qname the QName of the composite.
+     * @param compositeQName the QName of the composite
+     * @throws DomainException     
      */
-    public void removeComposite(QName qname)
-      throws DomainException;
+    public void removeFromDomainLevelComposite(QName compositeQName)
+      throws DomainException;   
     
     /**
      * Start a composite. The domain is responsible for starting all the
@@ -93,18 +107,20 @@
      * one ore more smaller composites and load these composites into
      * different SCA nodes.
      * 
-     * @param qname The QName of the composite.
+     * @param compositeQName The QName of the composite
+     * @throws DomainException
      */
-    public void startComposite(QName qname)
+    public void startComposite(QName compositeQName)
       throws DomainException;
     
     /**
      * Stop a composite. The domain will stop all the components from the
      * specified composite.
      * 
-     * @param qname The QName of the composite.
+     * @param compositeQName The QName of the composite
+     * @throws DomainException
      */
-    public void stopComposite(QName qname)
+    public void stopComposite(QName compositeQName)
       throws DomainException;
     
     /**

Propchange: incubator/tuscany/java/sca/modules/domain-impl/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Oct 18 07:39:48 2007
@@ -9,3 +9,4 @@
 .settings
 .deployables
 .wtpmodules
+work

Modified: incubator/tuscany/java/sca/modules/domain-impl/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/pom.xml?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/domain-impl/pom.xml Thu Oct 18 07:39:48 2007
@@ -95,7 +95,7 @@
         
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-host-jetty</artifactId>
+            <artifactId>tuscany-host-tomcat</artifactId>
             <version>1.1-incubating-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>         
@@ -113,6 +113,27 @@
             <version>1.1-incubating-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-binding-jsonrpc</artifactId>
+            <version>1.1-incubating-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>   
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-binding-http</artifactId>
+            <version>1.1-incubating-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>   
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-resource</artifactId>
+            <version>1.1-incubating-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>   
        
     </dependencies>
 

Modified: incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerNodeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerNodeImpl.java?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerNodeImpl.java (original)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerNodeImpl.java Thu Oct 18 07:39:48 2007
@@ -51,6 +51,7 @@
 import org.apache.tuscany.sca.domain.SCADomain;
 import org.apache.tuscany.sca.domain.SCADomainSPI;
 import org.apache.tuscany.sca.domain.ServiceInfo;
+import org.apache.tuscany.sca.domain.model.Domain;
 import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
@@ -65,7 +66,10 @@
 import org.osoa.sca.ServiceRuntimeException;
 
 /**
- * A local representation of the sca domain running on a single node
+ * A dummy representation of and SCA Node used simply to control the 
+ * endpoint of a callable reference
+ * We can remove this if we change the runtime over to referencing the 
+ * domain directly rather than going via the node. 
  * 
  * @version $Rev: 552343 $ $Date: 2007-09-09 23:54:46 +0100 (Sun, 09 Sep 2007) $
  */
@@ -75,6 +79,7 @@
     
     private String nodeEndpoint;
     private SCADomain scaDomain = new DomainManagerDomainImpl();
+    private SCADomainSPI realSCADomain = null;
 	
     class DomainManagerDomainImpl implements SCADomainSPI {
         public String addNode(String nodeURI, String nodeURL){ 
@@ -85,10 +90,6 @@
             return null;
         }
         
-        public List<NodeInfo> getNodeInfo(){
-            return null;
-        }
-        
         public String  registerServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName, String URL){
             return null;
         }
@@ -98,14 +99,18 @@
         }
        
         public String findServiceEndpoint(String domainUri, String serviceName, String bindingName){
-            return nodeEndpoint;
+            if (nodeEndpoint != null){
+                return nodeEndpoint;
+            } else {
+                return realSCADomain.findServiceEndpoint(domainUri, serviceName, bindingName);
+            }
+            
         }
-              
-        public ServiceInfo getServiceInfo(){     
+
+        public Domain getDomainModel(){
             return null;
         }
             
-            
         // SCADomain API methods 
         
         public void start() throws DomainException {
@@ -124,10 +129,13 @@
         public void removeContribution(String uri) throws DomainException {
         }
         
-        public void addComposite(QName compositeName) throws DomainException {
+        public void addDeploymentComposite(String contributionURI, String compositeXML) throws DomainException {
         }
-          
-        public void removeComposite(QName qname) throws DomainException {
+
+        public void addToDomainLevelComposite(QName compositeQName) throws DomainException {
+        }
+     
+        public void removeFromDomainLevelComposite(QName compositeQName) throws DomainException {
         }
           
         public void startComposite(QName compositeName) throws DomainException {            
@@ -151,7 +159,8 @@
         
     }
 
-    public DomainManagerNodeImpl() {
+    public DomainManagerNodeImpl(SCADomainSPI scaDomain) {
+        this.realSCADomain = scaDomain;
     }    
     
     public void setNodeEndpoint(String nodeEndpoint) {
@@ -179,7 +188,7 @@
     }
     
     
-    public void startComposite(QName compositeName) throws NodeException {
+    public void deployComposite(QName compositeName) throws NodeException {
 
     }  
 

Modified: incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerServiceImpl.java?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerServiceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerServiceImpl.java Thu Oct 18 07:39:48 2007
@@ -23,7 +23,7 @@
 import java.util.logging.Logger;
 
 import org.apache.tuscany.sca.domain.DomainManagerInitService;
-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.SCADomainSPI;
 import org.apache.tuscany.sca.domain.ServiceInfo;
@@ -37,8 +37,8 @@
  * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
  */
 @Scope("COMPOSITE")
-@Service(interfaces = {DomainManagerService.class, DomainManagerInitService.class})
-public class DomainManagerServiceImpl implements DomainManagerService, DomainManagerInitService {
+@Service(interfaces = {DomainManagerNodeEventService.class, DomainManagerInitService.class})
+public class DomainManagerServiceImpl implements DomainManagerNodeEventService, DomainManagerInitService {
     
     private final static Logger logger = Logger.getLogger(DomainManagerServiceImpl.class.getName());
     
@@ -57,12 +57,7 @@
     
     public String removeNode(String nodeURI){ 
         return scaDomain.removeNode(nodeURI);
-    }    
-    
-    public List<NodeInfo> getNodeInfo(){
-        return scaDomain.getNodeInfo();
-    }
-    
+    }      
     
     public String  registerServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName, String URL){
         return scaDomain.registerServiceEndpoint(domainUri, nodeUri, serviceName, bindingName, URL);
@@ -75,11 +70,6 @@
 
     public String findServiceEndpoint(String domainUri, String serviceName, String bindingName){
         return scaDomain.findServiceEndpoint(domainUri, serviceName, bindingName);
-    }
-    
-    
-    public ServiceInfo getServiceInfo(){
-        return scaDomain.getServiceInfo();
     }    
     
 }

Modified: incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainImpl.java?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainImpl.java (original)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainImpl.java Thu Oct 18 07:39:48 2007
@@ -22,6 +22,7 @@
 import java.net.URI;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -37,6 +38,7 @@
 import org.apache.tuscany.sca.assembly.SCABindingFactory;
 import org.apache.tuscany.sca.assembly.xml.Constants;
 import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.service.ContributionService;
 import org.apache.tuscany.sca.core.assembly.ActivationException;
@@ -46,6 +48,11 @@
 import org.apache.tuscany.sca.domain.NodeInfo;
 import org.apache.tuscany.sca.domain.SCADomainSPI;
 import org.apache.tuscany.sca.domain.ServiceInfo;
+import org.apache.tuscany.sca.domain.model.Domain;
+import org.apache.tuscany.sca.domain.model.DomainModelFactory;
+import org.apache.tuscany.sca.domain.model.Node;
+import org.apache.tuscany.sca.domain.model.Service;
+import org.apache.tuscany.sca.domain.model.impl.DomainModelFactoryImpl;
 import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
@@ -74,21 +81,18 @@
     
     // management runtime
     private ReallySmallRuntime domainManagementRuntime;
+    private ContributionService domainManagementContributionService;
     private Composite domainManagementComposite;
-    private DomainManagerNodeImpl domainManagerNode = new DomainManagerNodeImpl();
+    private DomainManagerNodeImpl domainManagerNode;
     
     // management services
     private DomainManagerInitService domainManagerInitService;
-       
-    // dummy runtime to give access to sca references that are part of the domain.
-    private ReallySmallRuntime domainRuntime;
-    
-    // the state of the domain
-    private String domainURI; 
-    private URL domainURL;
-    
-    private List<NodeInfo> nodes = new ArrayList<NodeInfo>();
-    private List<ServiceInfo> services = new ArrayList<ServiceInfo>();
+          
+    // The domain model
+    private DomainModelFactory domainModelFactory = new DomainModelFactoryImpl();
+    private Domain domainModel;
+    private HashMap<String, Contribution> contributions = new HashMap<String, Contribution>();
+     
      
     /** 
      * Create a domain giving the URI for the domain. 
@@ -98,7 +102,8 @@
      * @throws ActivationException
      */
     public SCADomainImpl(String domainURI) throws DomainException {
-        this.domainURI = domainURI;
+        this.domainModel = domainModelFactory.createDomain();
+        this.domainModel.setDomainURI(domainURI);
         this.domainClassLoader = SCADomainImpl.class.getClassLoader(); 
         init();
     }    
@@ -111,13 +116,13 @@
             // check whether domain uri is a url
             URI tmpURI;
             try {
-                tmpURI = new URI(domainURI); 
+                tmpURI = new URI(domainModel.getDomainURI()); 
                 if (tmpURI.isAbsolute()){
-                    domainURL = tmpURI.toURL();
+                    domainModel.setDomainURL(tmpURI.toURL());
                 }
             } catch(Exception ex) {
                 throw new ActivationException("domain uri " + 
-                                              domainURI + 
+                                              domainModel.getDomainURI() + 
                                               "must be a valid url");
             }
                 
@@ -125,14 +130,15 @@
             domainManagementRuntime = new ReallySmallRuntime(domainClassLoader);
             domainManagementRuntime.start();
             
-            // Create an in-memory domain level composite
+            // Create an in-memory domain level management composite
             AssemblyFactory assemblyFactory = domainManagementRuntime.getAssemblyFactory();
             domainManagementComposite = assemblyFactory.createComposite();
             domainManagementComposite.setName(new QName(Constants.SCA10_NS, "domainManagement"));
-            domainManagementComposite.setURI(domainURI); 
+            domainManagementComposite.setURI(domainModel.getDomainURI() + "/Management");            
             
             // Set up the domain so that we can push in the node endpoint before we
             // call a node
+            domainManagerNode = new DomainManagerNodeImpl(this);
             ModelFactoryExtensionPoint factories = domainManagementRuntime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
             NodeFactoryImpl domainFactory = new NodeFactoryImpl(domainManagerNode);
             factories.addFactory(domainFactory);            
@@ -145,12 +151,12 @@
                 logger.log(Level.INFO, "Domain management configured from " + contributionURL);
                            
                 // add node composite to the management domain
-                ContributionService contributionService = domainManagementRuntime.getContributionService();
+                domainManagementContributionService = domainManagementRuntime.getContributionService();
                 Contribution contribution = null;
 
-                contribution = contributionService.contribute(domainURI, 
-                                                              contributionURL, 
-                                                              false);
+                contribution = domainManagementContributionService.contribute(domainModel.getDomainURI(), 
+                                                                              contributionURL, 
+                                                                              false);
                 
                 if (contribution.getDeployables().size() != 0) {
                     Composite composite = contribution.getDeployables().get(0);
@@ -201,14 +207,19 @@
     }       
     
     // SCADomain SPI methods 
+    public Domain getDomainModel(){        
+        return domainModel;
+    }    
     
     public String addNode(String nodeURI, String nodeURL){ 
         // try and remove it first just in case it's already registered
         removeNode(nodeURI);
         
-        NodeInfo nodeInfo = new NodeInfoImpl(nodeURI);
-        nodeInfo.setNodeURL(nodeURL);
-        nodes.add(nodeInfo);
+        Node node = domainModelFactory.createNode();
+        node.setNodeURI(nodeURI);
+        node.setNodeURL(nodeURL);
+        domainModel.getNodes().put(nodeURI, node);     
+        
         logger.log(Level.INFO, "Registered node: " + 
                                nodeURI + 
                                " at endpoint " + 
@@ -219,27 +230,14 @@
     
     public String removeNode(String nodeURI){ 
         
-        List<NodeInfo> nodesToRemove = new ArrayList<NodeInfo>();
-        
-        for(NodeInfo node : nodes){
-            if ( node.match(nodeURI)){
-                nodesToRemove.add(node);
-            }
-        }
-
-        for(NodeInfo nodeToRemove : nodesToRemove){
-            nodes.remove(nodeToRemove);
-            logger.log(Level.INFO, "Removed node: " + nodeURI);
-        }
+        domainModel.getNodes().remove(nodeURI);
+               
+        logger.log(Level.INFO, "Removed node: " + nodeURI);
         
         return "DummyReturn";
     }
     
-    public List<NodeInfo> getNodeInfo(){        
-        return nodes;
-    }
-    
-    public String  registerServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName, String URL){
+    public String  registerServiceEndpoint(String domainURI, String nodeURI, String serviceName, String bindingName, String URL){
         // if the service name ends in a "/" remove it
         String modifiedServiceName = null;
         if ( serviceName.endsWith("/") ) {
@@ -248,27 +246,34 @@
             modifiedServiceName = serviceName;
         }
         
+        // collect the service info
+        Service service = domainModelFactory.createService();
+        service.setServiceURI(modifiedServiceName);
+        service.setServiceURL(URL);
+        service.setServiceBinding(bindingName);
+        
+        // find the node
+        Node node = domainModel.getNodes().get(nodeURI);
+        
+        if (node != null){
+            //store the service
+            node.getServices().put(serviceName+bindingName, service);
+            logger.log(Level.INFO, "Registered service: " + modifiedServiceName);
+        } else {
+            logger.log(Level.WARNING, "Trying to register service: " + 
+                                      modifiedServiceName + 
+                                      " for a node " + 
+                                      nodeURI + 
+                                      "that isn't registered");
+        }
         
-        ServiceInfoImpl serviceEndpoint = new ServiceInfoImpl (domainUri, nodeUri, modifiedServiceName, bindingName, URL);
-        services.add(serviceEndpoint);
-        logger.log(Level.INFO, "Registered service: " + serviceEndpoint.toString());
         return "";
     }
      
-    public String  removeServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName){
-        
-        List<ServiceInfo> serviceEndpointsToRemove = new ArrayList<ServiceInfo>();
-        
-        for(ServiceInfo serviceEndpoint : services){
-            if ( serviceEndpoint.match(domainUri, serviceName, bindingName)){
-                serviceEndpointsToRemove.add(serviceEndpoint);
-            }
-        }
-        
-        for(ServiceInfo serviceEndpointToRemove : serviceEndpointsToRemove){
-            services.remove(serviceEndpointToRemove);
-            logger.log(Level.INFO, "Removed service: " +  serviceName );
-        }
+    public String  removeServiceEndpoint(String domainUri, String nodeURI, String serviceName, String bindingName){
+        Node node = domainModel.getNodes().get(nodeURI);
+        node.getServices().remove(serviceName + bindingName);
+        logger.log(Level.INFO, "Removed service: " +  serviceName );     
         
         return "";
     }
@@ -281,16 +286,19 @@
                                "]");
         
         String url = "";
+        String serviceKey = serviceName + bindingName;
         
-        for(ServiceInfo serviceEndpoint : services){
-            if ( serviceEndpoint.match(domainUri, serviceName, bindingName)){
-                url = serviceEndpoint.getUrl();
-                // if you want to temporarily modify the registered port 
-                // numbers for debugging uncomment this line
+        for (Node node : domainModel.getNodes().values()){
+            Service service = node.getServices().get(serviceKey);
+            
+            if (service != null){
+                url = service.getServiceURL();
                 //url = replacePort(url, "8085", "8086");
                 logger.log(Level.INFO, "Found service url: " + url); 
+                break;
             }
         }
+               
         return url;
     }
     
@@ -305,10 +313,6 @@
     private String replacePort(String url, String fromPort, String toPort) {
         return url.replace(fromPort, toPort);
     }
-    
-    public ServiceInfo getServiceInfo(){     
-        return services.get(0);
-    }
         
         
     // SCADomain API methods 
@@ -330,22 +334,72 @@
     }    
  
     public String getURI(){
-        return domainURI;
+        return domainModel.getDomainURI();
     }
     
     public void addContribution(String contributionURI, URL contributionURL) throws DomainException {
-        // find a node without a contribution and add it to it
+        // add the contribution information to the domain model
+        org.apache.tuscany.sca.domain.model.Contribution contributionModel = domainModelFactory.createContribution();
+        contributionModel.setContributionURI(contributionURI);
+        contributionModel.setContributionURL(contributionURL);
+        domainModel.getContributions().put(contributionURI, contributionModel);
+        
+        // read the assembly model objects.      
+        try {
+            // Create a local model from the contribution. Using the contribution
+            // processor from the domain management runtime just because we already have it
+            Contribution contribution =  domainManagementContributionService.contribute(contributionURI, 
+                                                                                        contributionURL, 
+                                                                                        false);
+            
+            // store the contribution
+            contributions.put(contributionURI, contribution);
+            
+            // add the composite info to the domain model 
+            for (DeployedArtifact artifact : contribution.getArtifacts()) {
+                if (artifact.getModel() instanceof Composite) {
+                    Composite composite = (Composite)artifact.getModel();
+                    org.apache.tuscany.sca.domain.model.Composite compositeModel = 
+                        domainModelFactory.createComposite();
+                    compositeModel.setCompositeQName(composite.getName());
+                    contributionModel.getComposites().put(compositeModel.getCompositeQName(), compositeModel);
+                    
+                }
+            }            
+            
+            // add all deployable composites into the domain model
+            for (Composite composite : contribution.getDeployables()) {
+                org.apache.tuscany.sca.domain.model.Composite compositeModel = 
+                    domainModelFactory.createComposite();
+                compositeModel.setCompositeQName(composite.getName());
+                contributionModel.getComposites().put(compositeModel.getCompositeQName(), compositeModel);
+            }            
+            
+            // add the deployable composite info to the domain model 
+            for (Composite composite : contribution.getDeployables()) {
+                org.apache.tuscany.sca.domain.model.Composite compositeModel = 
+                    contributionModel.getComposites().get(composite.getName());
+                contributionModel.getDeployableComposites().put(compositeModel.getCompositeQName(), compositeModel);
+            }
+            
+        } catch(Exception ex) {
+            throw new DomainException(ex);
+        }       
+        
+        // Find a node to run the contribution. 
+        // TODO - add some more sophisticated algorithm here
+        // find a node without a contribution and add it to it. There is no deployment
+        // step here we just assume the contribution is available. 
         
         boolean foundFreeNode = false;
         
-        for (NodeInfo nodeInfo : nodes) {
-            if (nodeInfo.getContributionURI() == null) {
+        for(Node node : domainModel.getNodes().values()) {
+            if ( node.getContributions().isEmpty()){
                 foundFreeNode = true;
-                nodeInfo.setContributionURI(contributionURI);
-                nodeInfo.setContributionURL(contributionURL);
+                node.getContributions().put(contributionURI, contributionModel);
                 break;
             }
-        }
+        }      
         
         if (foundFreeNode == false){
             throw new DomainException("No free node available for contribution " + 
@@ -354,62 +408,79 @@
     }
 
     public void removeContribution(String uri) throws DomainException {
-          // TODO
+        
+        // TODO
+    }
+    
+    public void addDeploymentComposite(String contributionURI, String compositeXML) throws DomainException {
+        // TODO
     }
     
-    public void addComposite(QName compositeName) throws DomainException {
-        // find the nodes with this composite and add it. Currently we add it to 
-        // all nodes and let the node worry about whether it has the composite
-        for (NodeInfo nodeInfo : nodes) {
-             nodeInfo.addCompositeName(compositeName);
+    public void addToDomainLevelComposite(QName compositeName) throws DomainException {
+        // find the nodes with this composite and add the composite as a deployable composite
+        for ( Node node : domainModel.getNodes().values()) {
+            for (org.apache.tuscany.sca.domain.model.Contribution contribution : node.getContributions().values()){
+                org.apache.tuscany.sca.domain.model.Composite composite = 
+                    contribution.getComposites().get(compositeName);
+                if (composite != null) {
+                    contribution.getDeployableComposites().put(compositeName, composite);
+                }
+            }
         }
     }
       
-    public void removeComposite(QName qname) throws DomainException {
+    public void removeFromDomainLevelComposite(QName qname) throws DomainException {
         // TODO
     }
       
     public void startComposite(QName compositeName) throws DomainException {
-        // Start all nodes with this composite
-        for (NodeInfo nodeInfo : getNodeInfo()) {
-            
+        for (Node node : domainModel.getNodes().values()){
             boolean startNode = false;
             
-            for (QName nodeCompositeName : nodeInfo.getCompositeNames()){
-                if (compositeName.equals(nodeCompositeName) ) {
+            for (org.apache.tuscany.sca.domain.model.Contribution contribution : node.getContributions().values()){
+                org.apache.tuscany.sca.domain.model.Composite composite = 
+                    contribution.getDeployableComposites().get(compositeName);
+                if (composite != null) {
                     startNode = true;
+                    break;
                 }
             }
             
-            if (startNode = true){
+            if (startNode == true){
                 // get the endpoint of the node in question and set it into the
                 // domain manager node in order to flip the node reference to 
                 // the correct endpoint
-                String nodeURL = nodeInfo.getNodeURL();
+                String nodeURL = node.getNodeURL();
                 domainManagerNode.setNodeEndpoint(nodeURL);
                 
                 
-                // get a ode manager service reference. This will have to have its
-                // physical enpoint set by the domain node manage we have just 
+                // get a node manager service reference. This will have to have its
+                // physical endpoint set by the domain node manage we have just 
                 // configured
                 NodeManagerService nodeManagerService = getService(NodeManagerService.class, 
                                                         "NodeManagerComponent/NodeManagerService",
                                                         domainManagementRuntime, 
                                                         domainManagementComposite);                
                 
-                // add contribution
-                nodeManagerService.addContribution(nodeInfo.getContributionURI(),
-                                                   nodeInfo.getContributionURL().toString());
-                
-                // start composite
-                nodeManagerService.startComposite(compositeName.toString());
+                // add contributions
+                for (org.apache.tuscany.sca.domain.model.Contribution contribution : node.getContributions().values()){
+                    nodeManagerService.addContribution(contribution.getContributionURI(),
+                                                       contribution.getContributionURL().toString());
+                }
+
+                // deploy composite
+                nodeManagerService.deployComposite(compositeName.toString());
                 
                 // start node
                 nodeManagerService.start();
-            }
-            nodeInfo.addCompositeName(compositeName);
-       }
-         
+                
+                // TODO
+                // somewhere we need to add the deployed composites into the node model 
+                
+                // reset the endpoint setting function
+                domainManagerNode.setNodeEndpoint(null);
+            }        
+        }    
     }
       
     public void stopComposite(QName qname) throws DomainException {
@@ -417,14 +488,15 @@
     }
              
     public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
-        /*
-        return (R)nodeRuntime.getProxyFactory().cast(target);
-        */
-        return null;
+        return (R)cast(target, domainManagementRuntime);
+    }
+    
+    private <B, R extends CallableReference<B>> R cast(B target, ReallySmallRuntime runtime) throws IllegalArgumentException {
+        return (R)runtime.getProxyFactory().cast(target);
     }
 
     public <B> B getService(Class<B> businessInterface, String serviceName) {
-        return null;
+        return getService( businessInterface, serviceName, domainManagementRuntime, null);
     }
     
     private <B> B getService(Class<B> businessInterface, String serviceName, ReallySmallRuntime runtime, Composite domainComposite) {
@@ -437,7 +509,7 @@
     }
 
     private <B> ServiceReference<B> createServiceReference(Class<B> businessInterface, String targetURI) {
-        return null;
+        return createServiceReference(businessInterface, targetURI, domainManagementRuntime, null);
     }
 
     
@@ -476,7 +548,7 @@
 
 
     public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name) {
-        return null;
+        return getServiceReference(businessInterface, name, domainManagementRuntime, null);
     }
 
         
@@ -497,14 +569,16 @@
 
         // Lookup the component 
         Component component = null;
-            
-        for (Composite composite: domainComposite.getIncludes()) {
-            for (Component compositeComponent: composite.getComponents()) {
-                if (compositeComponent.getName().equals(componentName)) {
-                    component = compositeComponent;
+         
+        if ( domainComposite != null ) {
+            for (Composite composite: domainComposite.getIncludes()) {
+                for (Component compositeComponent: composite.getComponents()) {
+                    if (compositeComponent.getName().equals(componentName)) {
+                        component = compositeComponent;
+                    }
                 }
-            }
-        }        
+            }    
+        }
        
         if (component == null) {
             // The component is not local in the partition, try to create a remote service ref

Added: incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/CompositeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/CompositeImpl.java?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/CompositeImpl.java (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/CompositeImpl.java Thu Oct 18 07:39:48 2007
@@ -0,0 +1,56 @@
+/*
+ * 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.impl;
+
+
+import java.io.Serializable;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.model.Composite;
+
+
+/**
+ * A composite. 
+ * 
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class CompositeImpl implements Composite, Serializable {
+    
+    private QName compositeQName;
+    
+    /**
+     * Retrieve the composite qname
+     * 
+     * @return composite qname
+     */
+    public QName getCompositeQName(){
+        return compositeQName;
+    }
+    
+    /**
+     * Set the composite qname
+     * 
+     * @param compositeQName
+     */    
+    public void setCompositeQName(QName compositeQName) {
+        this.compositeQName = compositeQName;
+    }
+}

Added: incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ContributionImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ContributionImpl.java?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ContributionImpl.java (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ContributionImpl.java Thu Oct 18 07:39:48 2007
@@ -0,0 +1,89 @@
+/*
+ * 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.impl;
+
+import java.io.Serializable;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.model.Composite;
+import org.apache.tuscany.sca.domain.model.Contribution;
+
+/**
+ * A contribution.
+ * 
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class ContributionImpl implements Contribution, Serializable {
+    
+    private String contributionURI;
+    private URL contributionURL;
+    private org.apache.tuscany.sca.contribution.Contribution contribution;
+    private Map<QName, Composite> composites = new HashMap<QName, Composite>();   
+    private Map<QName, Composite> deployableComposites = new HashMap<QName, Composite>();  
+    
+    
+    /**
+     * Retrieve the contribution uri
+     * 
+     * @return contribution uri
+     */
+    public String getContributionURI() {
+        return contributionURI;
+    }
+    
+    /**
+     * Set the contribution uri
+     * 
+     * @param contributionURI
+     */    
+    public void setContributionURI(String contributionURI){
+        this.contributionURI = contributionURI;
+    }
+    
+    /**
+     * Retrieve the contribution url
+     * 
+     * @return contribution url
+     */    
+    public URL getContributionURL(){
+        return contributionURL;
+    }
+   
+    /**
+     * Set the contribution url
+     * 
+     * @param contributionURL
+     */    
+    public void setContributionURL(URL contributionURL){
+        this.contributionURL = contributionURL;
+    }
+    
+    public Map<QName, Composite> getComposites(){
+        return composites;
+    }   
+    
+    public Map<QName, Composite> getDeployableComposites(){
+        return deployableComposites;
+    }    
+}

Added: incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainImpl.java?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainImpl.java (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainImpl.java Thu Oct 18 07:39:48 2007
@@ -0,0 +1,97 @@
+/*
+ * 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.impl;
+
+import java.io.Serializable;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.model.Composite;
+import org.apache.tuscany.sca.domain.model.Contribution;
+import org.apache.tuscany.sca.domain.model.Node;
+import org.apache.tuscany.sca.domain.model.Domain;
+
+
+/**
+ * A domain. Manages nodes
+ * 
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class DomainImpl implements Domain, Serializable {
+    
+    private String domainURI;
+    private URL domainURL;
+    private Map<String, Node> nodes = new HashMap<String, Node>();
+    private Map<String, Contribution> contributions = new HashMap<String, Contribution>();    
+    private Map<QName, Composite> composites = new HashMap<QName, Composite>();
+       
+    
+    /**
+     * Retrieve the domain uri
+     * 
+     * @return domain uri
+     */
+    public String getDomainURI(){
+        return domainURI;
+    }
+    
+    /**
+     * Set the domain uri
+     * 
+     * @param domainURI
+     */    
+    public void setDomainURI(String domainURI){
+        this.domainURI = domainURI;
+    }
+    
+    /**
+     * Retrieve the domain url
+     * 
+     * @return domain url
+     */    
+    public URL getDomainURL(){
+        return domainURL;
+    }
+   
+    /**
+     * Set the domain url
+     * 
+     * @param domainURL
+     */    
+    public void setDomainURL(URL domainURL){
+        this.domainURL = domainURL;
+    }
+   
+    public Map<String, Node> getNodes(){
+        return nodes;
+    }
+    
+    public Map<String, Contribution> getContributions(){
+        return contributions;
+    }
+    
+    public Map<QName, Composite> getDeployedComposites(){
+        return composites;
+    }    
+}

Added: incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainModelFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainModelFactoryImpl.java?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainModelFactoryImpl.java (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainModelFactoryImpl.java Thu Oct 18 07:39:48 2007
@@ -0,0 +1,80 @@
+/*
+ * 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.impl;
+
+import org.apache.tuscany.sca.domain.model.Composite;
+import org.apache.tuscany.sca.domain.model.Contribution;
+import org.apache.tuscany.sca.domain.model.Domain;
+import org.apache.tuscany.sca.domain.model.DomainModelFactory;
+import org.apache.tuscany.sca.domain.model.Node;
+import org.apache.tuscany.sca.domain.model.Service;
+
+/**
+ * A node. Runs SCA composites
+ * 
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class DomainModelFactoryImpl implements DomainModelFactory {
+    
+    /**
+     * Create a new domain model
+     * 
+     * @return new domain model
+     */
+    public Domain createDomain(){
+        return new DomainImpl();
+    }
+    /**
+     * Create a new node model
+     * 
+     * @return new node model
+     */
+    public Node createNode(){
+        return new NodeImpl();
+    }
+    
+    /**
+     * Create a new contribution model
+     * 
+     * @return new contribution model
+     */
+    public Contribution createContribution(){
+        return new ContributionImpl();
+    }
+    
+    /**
+     * Create a new composite model
+     * 
+     * @return new composite model
+     */
+    public Composite createComposite(){
+        return new CompositeImpl();
+    }
+    
+    /**
+     * Create a new service model
+     * 
+     * @return new service model
+     */
+    public Service createService(){
+        return new ServiceImpl();
+    }
+
+}

Added: incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/NodeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/NodeImpl.java?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/NodeImpl.java (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/NodeImpl.java Thu Oct 18 07:39:48 2007
@@ -0,0 +1,97 @@
+/*
+ * 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.impl;
+
+import java.io.Serializable;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.model.Composite;
+import org.apache.tuscany.sca.domain.model.Contribution;
+import org.apache.tuscany.sca.domain.model.Node;
+import org.apache.tuscany.sca.domain.model.Service;
+
+
+/**
+ * A node. Runs SCA composites
+ * 
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class NodeImpl implements Node, Serializable {
+    
+    private String nodeURI;
+    private String nodeURL;
+    private Map<String, Contribution> contributions = new HashMap<String, Contribution>();
+    private Map<QName, Composite> composites = new HashMap<QName, Composite>();
+    private Map<String, Service> services = new HashMap<String, Service>();
+    
+    /**
+     * Retrieve the node uri
+     * 
+     * @return node uri
+     */
+    public String getNodeURI(){
+        return nodeURI;
+    }
+    
+    /**
+     * Set the node uri
+     * 
+     * @param nodeURI
+     */    
+    public void setNodeURI(String nodeURI){
+        this.nodeURI = nodeURI;
+    }
+    
+    /**
+     * Retrieve the node url
+     *
+     * @return node url
+     */    
+    public String getNodeURL() {
+        return nodeURL;
+    }
+   
+    /**
+     * Set the node url
+     * 
+     * @param nodeURL
+     */    
+    public void setNodeURL(String nodeURL){
+        this.nodeURL = nodeURL;
+    }
+   
+    public Map<String, Contribution> getContributions(){
+        return contributions;
+    }
+    
+    public Map<QName, Composite> getDeployedComposites(){
+        return composites;
+    }
+    
+    public Map<String, Service> getServices(){
+        return services;
+    }
+}

Added: incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ServiceImpl.java?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ServiceImpl.java (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ServiceImpl.java Thu Oct 18 07:39:48 2007
@@ -0,0 +1,92 @@
+/*
+ * 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.impl;
+
+import java.net.URL;
+import java.util.Map;
+
+import org.apache.tuscany.sca.domain.model.Service;
+
+/**
+ * A service.
+ * 
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class ServiceImpl implements Service {
+    
+    private String serviceURI;
+    private String serviceURL;
+    private String serviceBinding;
+    
+    /**
+     * Retrieve the service uri
+     * 
+     * @return service uri
+     */
+    public String getServiceURI(){
+        return serviceURI;
+    }
+    
+    /**
+     * Set the service uri
+     * 
+     * @param serviceURI
+     */    
+    public void setServiceURI(String serviceURI){
+        this.serviceURI = serviceURI;
+    }
+    
+    /**
+     * Retrieve the service url
+     * 
+     * @return service url
+     */    
+    public String getServiceURL(){
+        return serviceURL;
+    }
+   
+    /**
+     * Set the service url
+     * 
+     * @param serviceURL
+     */    
+    public void setServiceURL(String serviceURL){
+        this.serviceURL = serviceURL;
+    }
+    
+   
+    /**
+     * Retrieve the service binding
+     * 
+     * @return service binding
+     */    
+    public String getServiceBinding(){
+        return serviceBinding;
+    }
+   
+    /**
+     * Set the service binding
+     * 
+     * @param serviceBinding
+     */    
+    public void setServiceBinding(String serviceBinding){
+        this.serviceBinding = serviceBinding;
+    }
+}

Modified: incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/domain.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/domain.composite?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/domain.composite (original)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/domain.composite Thu Oct 18 07:39:48 2007
@@ -36,11 +36,9 @@
             <interface.java interface="org.apache.tuscany.sca.domain.DomainManagerInitService"/>
             <binding.sca/>
         </service>
-        <service name="DomainManagerService">
-            <interface.java interface="org.apache.tuscany.sca.domain.DomainManagerService"/>
-            <binding.sca uri="http://localhost:8877/SCADomainComponent/DomainManagerSCA"/>
-            <binding.ws uri="http://localhost:8877/DomainManagerComponent/DomainManager"/>
-            <tuscany:binding.jsonrpc uri="http://localhost:8877/DomainManagerComponent/DomainManagerJson"/>
+        <service name="DomainManagerNodeEventService">
+            <interface.java interface="org.apache.tuscany.sca.domain.DomainManagerNodeEventService"/>
+            <binding.ws uri="http://localhost:8877/DomainManagerComponent/DomainManagerNodeEventService"/>
         </service>
     </component>  
     

Modified: incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/webroot/index.html
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/webroot/index.html?rev=585979&r1=585978&r2=585979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/webroot/index.html (original)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/webroot/index.html Thu Oct 18 07:39:48 2007
@@ -40,15 +40,12 @@
               text = text + "<table>";
               text = text + "<TR CLASS='source_1' >";
               text = text + "  <TD>";
-              text = text + "    <IMG SRC='node.png'/>&nbsp;&nbsp;" + node.domainUri;
+              text = text + "    <IMG SRC='node.png'/>&nbsp;&nbsp;" + node.nodeURI;
               text = text + "  </TD>";
               
-              var noProtocol = node.nodeManagerUrl.substring(7);
-              var colonPos = noProtocol.indexOf(':')
-              var nodeManagerWebUrl = noProtocol.substring(0, colonPos + 6);
-              nodeManagerWebUrl = "http://" + nodeManagerWebUrl + "node/index.html";
+              nodeManagerWebUrl = node.nodeURL + "/node/index.html";
               
-              text = text + "  <TD CLASS='clickable link' ONCLICK=\"showNode('" + nodeManagerWebUrl + "')\">" + node.nodeUri + "</TD>";
+              text = text + "  <TD CLASS='clickable link' ONCLICK=\"showNode('" + node.nodeURI + "')\">" + nodeManagerWebUrl + "</TD>";
               text = text + "</TR>";       
               text = text + "</table>";        
           }

Added: incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/AddService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/AddService.java?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/AddService.java (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/AddService.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;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The Add service interface
+ */
+@Remotable
+public interface AddService {
+
+    double add(double n1, double n2);
+
+}

Added: incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/AddServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/AddServiceImpl.java?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/AddServiceImpl.java (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/AddServiceImpl.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 Add service
+ */
+public class AddServiceImpl implements AddService {
+
+    public double add(double n1, double n2) {
+        System.out.println("AddService - add " + n1 + " and " + n2);
+        return n1 + n2;
+    }
+
+}

Added: incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/CalculatorService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/CalculatorService.java?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/CalculatorService.java (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/CalculatorService.java Thu Oct 18 07:39:48 2007
@@ -0,0 +1,35 @@
+/*
+ * 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;
+
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService {
+
+    double add(double n1, double n2);
+
+    double subtract(double n1, double n2);
+
+    double multiply(double n1, double n2);
+
+    double divide(double n1, double n2);
+
+}

Added: incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/CalculatorServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/CalculatorServiceImpl.java?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/CalculatorServiceImpl.java (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/CalculatorServiceImpl.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 calculator;
+
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorServiceImpl implements CalculatorService {
+
+    private AddService addService;
+    private SubtractService subtractService;
+    private MultiplyService multiplyService; 
+    private DivideService divideService;
+
+    @Reference
+    public void setAddService(AddService addService) {
+        this.addService = addService;
+    }
+
+    @Reference
+    public void setSubtractService(SubtractService subtractService) {
+       this.subtractService = subtractService;
+    }
+
+    @Reference
+    public void setMultiplyService(MultiplyService multiplyService) {
+        this.multiplyService = multiplyService;
+    }
+    
+    @Reference
+    public void setDivideService(DivideService divideService) {
+        this.divideService = divideService;
+    }
+    
+    public double add(double n1, double n2) {
+        System.out.println("CalculatorService - add " + n1 + " and " + n2);
+        return addService.add(n1, n2);
+    }
+
+    public double subtract(double n1, double n2) {
+        System.out.println("CalculatorService - subtract " + n1 + " and " + n2);
+        return subtractService.subtract(n1, n2);
+    }
+
+    public double multiply(double n1, double n2) {
+        System.out.println("CalculatorService - multiply " + n1 + " and " + n2);
+        return multiplyService.multiply(n1, n2);
+    }
+
+    public double divide(double n1, double n2) {
+        System.out.println("CalculatorService - divide " + n1 + " and " + n2);
+        return divideService.divide(n1, n2);
+    }
+
+}

Added: incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/DivideService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/DivideService.java?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/DivideService.java (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/DivideService.java Thu Oct 18 07:39:48 2007
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+/**
+ * The divide service interface
+ */
+public interface DivideService {
+
+    double divide(double n1, double n2);
+
+}

Added: incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/DivideServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/DivideServiceImpl.java?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/DivideServiceImpl.java (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/DivideServiceImpl.java Thu Oct 18 07:39:48 2007
@@ -0,0 +1,30 @@
+/*
+ * 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 Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+    public double divide(double n1, double n2) {
+        return n1 / n2;
+    }
+
+}

Added: incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/MultiplyService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/MultiplyService.java?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/MultiplyService.java (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/MultiplyService.java Thu Oct 18 07:39:48 2007
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+    double multiply(double n1, double n2);
+
+}

Added: incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/MultiplyServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/MultiplyServiceImpl.java?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/MultiplyServiceImpl.java (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/MultiplyServiceImpl.java Thu Oct 18 07:39:48 2007
@@ -0,0 +1,30 @@
+/*
+ * 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 Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+    public double multiply(double n1, double n2) {
+        return n1 * n2;
+    }
+
+}

Added: incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/SubtractService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/SubtractService.java?rev=585979&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/SubtractService.java (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/test/java/calculator/SubtractService.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;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the multiply service
+ */
+@Remotable
+public interface SubtractService {
+
+    double subtract(double n1, double n2);
+
+}



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