tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r573552 [1/3] - in /incubator/tuscany/java/sca: modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/ modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/ modules/binding-sca/src...
Date Fri, 07 Sep 2007 11:41:56 GMT
Author: slaws
Date: Fri Sep  7 04:41:52 2007
New Revision: 573552

URL: http://svn.apache.org/viewvc?rev=573552&view=rev
Log:
TUSCANY-1637
A wide ranging set of changes to rebuild the domain/node support taking the good bits from our exiting domain representations

Added:
    incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/DomainFactoryImpl.java   (with props)
    incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestDomain.java   (with props)
    incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/DomainManagerServiceImpl.java   (with props)
    incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/NodeInfoImpl.java   (with props)
    incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/ServiceDiscoveryServiceImpl.java   (with props)
    incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/ServiceInfoImpl.java   (with props)
    incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/ComponentInfoImpl.java   (with props)
    incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/ComponentManagerServiceImpl.java   (with props)
    incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/ContributionManagerImpl.java   (with props)
    incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/DomainFactoryImpl.java   (with props)
    incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/DomainManagerProxyImpl.java   (with props)
    incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/NodeImpl.java   (with props)
    incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/NodeManagerServiceImpl.java   (with props)
    incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/ServiceDiscoveryProxyImpl.java   (with props)
    incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/_node/
    incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/_node/META-INF/
    incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/_node/META-INF/sca-contribution.xml   (with props)
    incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/_node/management.composite   (with props)
    incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/domain/
    incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/domain/META-INF/
    incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/domain/META-INF/sca-contribution.xml   (with props)
    incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/domain/domain.composite   (with props)
    incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/domain/Domain.java   (with props)
    incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/domain/DomainFactory.java   (with props)
    incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/domain/DomainManagerService.java   (with props)
    incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/domain/NodeInfo.java   (with props)
    incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/domain/ServiceDiscoveryService.java   (with props)
    incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/domain/ServiceInfo.java   (with props)
    incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/node/
    incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/node/ComponentInfo.java   (with props)
    incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/node/ComponentListener.java   (with props)
    incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/node/ComponentManager.java   (with props)
    incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/node/ComponentManagerService.java   (with props)
    incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/node/CompositeManager.java   (with props)
    incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/node/ContributionManager.java   (with props)
    incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/node/Node.java   (with props)
    incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/node/NodeManagerInitService.java   (with props)
    incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/node/NodeManagerService.java   (with props)
    incubator/tuscany/java/sca/samples/calculator-distributed/src/main/resources/_node/
    incubator/tuscany/java/sca/samples/calculator-distributed/src/main/resources/_node/META-INF/
    incubator/tuscany/java/sca/samples/calculator-distributed/src/main/resources/_node/META-INF/sca-contribution.xml   (with props)
    incubator/tuscany/java/sca/samples/calculator-distributed/src/main/resources/_node/management.composite   (with props)
    incubator/tuscany/java/sca/samples/calculator-distributed/src/main/resources/_node/webroot/
    incubator/tuscany/java/sca/samples/calculator-distributed/src/main/resources/_node/webroot/index.html   (with props)
    incubator/tuscany/java/sca/samples/calculator-distributed/src/main/resources/_node/webroot/node.png   (with props)
    incubator/tuscany/java/sca/samples/calculator-distributed/src/main/resources/_node/webroot/style.css   (with props)
Removed:
    incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestDistributedSCADomainImpl.java
    incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/DistributedSCADomainImpl.java
    incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/DistributedSCADomainMemoryImpl.java
    incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/DistributedSCADomainNetworkImpl.java
    incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/management/
    incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/EmbeddedNode.java
    incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/management/
    incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/domain/DistributedSCADomain.java
    incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/management/
    incubator/tuscany/java/sca/samples/calculator-distributed/src/main/resources/management/
Modified:
    incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java
    incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java
    incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java
    incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java
    incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BaseTest.java
    incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java
    incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java
    incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java
    incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestServiceDiscoveryImpl.java
    incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProviderFactory.java
    incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java
    incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAServiceBindingProvider.java
    incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java
    incubator/tuscany/java/sca/modules/distributed-impl/src/test/java/org/apache/tuscany/sca/distributed/impl/InMemoryTestCase.java
    incubator/tuscany/java/sca/modules/distributed/pom.xml
    incubator/tuscany/java/sca/samples/calculator-distributed/build.xml
    incubator/tuscany/java/sca/samples/calculator-distributed/pom.xml
    incubator/tuscany/java/sca/samples/calculator-distributed/src/main/java/node/CalculatorNode.java
    incubator/tuscany/java/sca/samples/calculator-distributed/src/main/resources/domain/META-INF/sca-contribution.xml
    incubator/tuscany/java/sca/samples/calculator-distributed/src/main/resources/domain/domain.composite
    incubator/tuscany/java/sca/samples/calculator-distributed/src/test/java/calculator/DomainInMemoryTestCase.java
    incubator/tuscany/java/sca/samples/pom.xml

Modified: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java?rev=573552&r1=573551&r2=573552&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java Fri Sep  7 04:41:52 2007
@@ -22,6 +22,8 @@
 import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.distributed.domain.Domain;
+import org.apache.tuscany.sca.distributed.domain.DomainFactory;
 import org.apache.tuscany.sca.host.http.ServletHost;
 import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
 import org.apache.tuscany.sca.invocation.MessageFactory;
@@ -41,28 +43,34 @@
     
     private MessageFactory messageFactory;
     private ServletHost servletHost;
+    private Domain domain = null;
 
     public Axis2SCABindingProviderFactory(ExtensionPointRegistry extensionPoints) {
         ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
         this.servletHost = servletHosts.getServletHosts().get(0);
         ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
         this.messageFactory = modelFactories.getFactory(MessageFactory.class);
+        DomainFactory domainFactory = modelFactories.getFactory(DomainFactory.class);
+        
+        if (domainFactory != null) {
+            this.domain = domainFactory.getDomain();
+        }
     }    
 
     public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
                                                                    RuntimeComponentReference reference,
                                                                    DistributedSCABinding binding) {
-        return new Axis2SCAReferenceBindingProvider(component, reference, binding, servletHost, messageFactory);
+        return new Axis2SCAReferenceBindingProvider(domain, component, reference, binding, servletHost, messageFactory);
     }
 
     public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
                                                                RuntimeComponentService service,
                                                                DistributedSCABinding binding) {
-        return new Axis2SCAServiceBindingProvider(component, service, binding, servletHost, messageFactory);
+        return new Axis2SCAServiceBindingProvider(domain, component, service, binding, servletHost, messageFactory);
     }
 
     public Class<DistributedSCABinding> getModelType() {
         return DistributedSCABinding.class;
-    }
+    }  
 
 }

Modified: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java?rev=573552&r1=573551&r2=573552&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java Fri Sep  7 04:41:52 2007
@@ -23,14 +23,13 @@
 import org.apache.tuscany.sca.assembly.Binding;
 import org.apache.tuscany.sca.assembly.SCABinding;
 import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
-import org.apache.tuscany.sca.binding.sca.impl.SCABindingImpl;
 import org.apache.tuscany.sca.binding.ws.DefaultWebServiceBindingFactory;
 import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
 import org.apache.tuscany.sca.binding.ws.axis2.Axis2ReferenceBindingProvider;
 import org.apache.tuscany.sca.binding.ws.axis2.Java2WSDLHelper;
 import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
-import org.apache.tuscany.sca.distributed.domain.DistributedSCADomain;
-import org.apache.tuscany.sca.distributed.management.ServiceDiscovery;
+import org.apache.tuscany.sca.distributed.domain.Domain;
+import org.apache.tuscany.sca.distributed.domain.ServiceDiscoveryService;
 import org.apache.tuscany.sca.host.http.ServletHost;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.Operation;
@@ -51,6 +50,7 @@
  */
 public class Axis2SCAReferenceBindingProvider implements ReferenceBindingProvider2 {
 
+	private Domain domain;
     private RuntimeComponent component;
     private RuntimeComponentReference reference;
     private SCABinding binding;
@@ -60,11 +60,13 @@
     private EndpointReference serviceEPR = null;
     private EndpointReference callbackEPR = null;
 
-    public Axis2SCAReferenceBindingProvider(RuntimeComponent component,
+    public Axis2SCAReferenceBindingProvider(Domain domain,
+    		                                RuntimeComponent component,
                                             RuntimeComponentReference reference,
                                             DistributedSCABinding binding,
                                             ServletHost servletHost,
                                             MessageFactory messageFactory) {
+    	this.domain = domain;
         this.component = component;
         this.reference = reference;
         this.binding = binding.getSCABinding();
@@ -118,22 +120,29 @@
      */
     public EndpointReference getServiceEndpoint(){
         
-        if ( serviceEPR == null ){
+        if ( serviceEPR == null && domain != null ){
             // try to resolve the service endpoint with the registry 
-            DistributedSCADomain distributedDomain = ((SCABindingImpl)binding).getDistributedDomain();
-            ServiceDiscovery serviceDiscovery = distributedDomain.getServiceDiscovery();
+            ServiceDiscoveryService serviceDiscovery = domain.getServiceDiscovery();
             
-            // The binding URI might be null in the case where this reference is completely
-            // dynamic, for example, in the case of callbacks
-            if (binding.getURI() != null) {
-                String serviceUrl = serviceDiscovery.findServiceEndpoint(distributedDomain.getDomainName(), 
-                                                                         binding.getURI(), 
-                                                                         SCABinding.class.getName());
-                
-                if ( (serviceUrl != null ) &&
-                     (!serviceUrl.equals(""))){
-                    serviceEPR = new EndpointReferenceImpl(serviceUrl);
-                }
+            if (serviceDiscovery != null){
+            
+	            // The binding URI might be null in the case where this reference is completely
+	            // dynamic, for example, in the case of callbacks
+	            if (binding.getURI() != null) {
+	                String serviceUrl = serviceDiscovery.findServiceEndpoint(domain.getDomainUri(), 
+	                                                                         binding.getURI(), 
+	                                                                         SCABinding.class.getName());
+	                
+	                if ( (serviceUrl != null ) &&
+	                     (!serviceUrl.equals(""))){
+	                    serviceEPR = new EndpointReferenceImpl(serviceUrl);
+	                }
+	            }
+            } else {
+	            throw new IllegalStateException("No service manager available for component: "+
+						                        component.getName() +
+						                        " and service: " + 
+						                        reference.getName());	 
             }
         }
         

Modified: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java?rev=573552&r1=573551&r2=573552&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java Fri Sep  7 04:41:52 2007
@@ -20,17 +20,18 @@
 package org.apache.tuscany.sca.binding.sca.axis2.impl;
 
 import java.net.URI;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.apache.axiom.om.OMElement;
 import org.apache.tuscany.sca.assembly.SCABinding;
 import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
-import org.apache.tuscany.sca.binding.sca.impl.SCABindingImpl;
 import org.apache.tuscany.sca.binding.ws.DefaultWebServiceBindingFactory;
 import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
 import org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvider;
 import org.apache.tuscany.sca.binding.ws.axis2.Java2WSDLHelper;
-import org.apache.tuscany.sca.distributed.domain.DistributedSCADomain;
-import org.apache.tuscany.sca.distributed.management.ServiceDiscovery;
+import org.apache.tuscany.sca.distributed.domain.Domain;
+import org.apache.tuscany.sca.distributed.domain.ServiceDiscoveryService;
 import org.apache.tuscany.sca.host.http.ServletHost;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.Operation;
@@ -48,7 +49,10 @@
  * @version $Rev: 563772 $ $Date: 2007-08-08 07:50:49 +0100 (Wed, 08 Aug 2007) $
  */
 public class Axis2SCAServiceBindingProvider implements ServiceBindingProvider2 {
+    
+    private final static Logger logger = Logger.getLogger(Axis2SCAServiceBindingProvider.class.getName());
 
+    private Domain domain;
     private SCABinding binding;
     private Axis2ServiceProvider axisProvider;
     private WebServiceBinding wsBinding;
@@ -56,11 +60,13 @@
     private boolean started = false;
 
 
-    public Axis2SCAServiceBindingProvider(RuntimeComponent component,
+    public Axis2SCAServiceBindingProvider(Domain domain,
+    		                              RuntimeComponent component,
                                           RuntimeComponentService service,
                                           DistributedSCABinding binding,
                                           ServletHost servletHost,
                                           MessageFactory messageFactory) {
+    	this.domain = domain;
         this.binding = binding.getSCABinding();
         wsBinding = (new DefaultWebServiceBindingFactory()).createWebServiceBinding();
         
@@ -84,48 +90,59 @@
                                                    servletHost,
                                                    messageFactory);
         
-        //this.binding.setURI(wsBinding.getURI());
-        
-        // get the url out of the binding and send it to the registry if
-        // a distributed domain is configured
-        DistributedSCADomain distributedDomain = ((SCABindingImpl)this.binding).getDistributedDomain();
-        
-        ServiceDiscovery serviceDiscovery = distributedDomain.getServiceDiscovery();
-        
-        // register endpoint against the path element of the binding uri
-        String componentName = this.binding.getURI();
-        
-        try {
-            URI servicePath = new URI(this.binding.getURI());
-            componentName = servicePath.getPath();
-            
-            // strinp any leading slash
-            if (componentName.charAt(0) == '/'){
-                componentName = componentName.substring(1, componentName.length());
-            }
-        } catch(Exception ex) {
-            // do nothing, the binding uri string will be used
-        }
 
+        if (domain != null){
+	        // get the url out of the binding and send it to the registry if
+	        // a distributed domain is configured
+	        ServiceDiscoveryService serviceDiscovery = domain.getServiceDiscovery();
+	        
+	        if (serviceDiscovery != null) {
+		        // register endpoint against the path element of the binding uri
+		        String componentName = this.binding.getURI();
+		        
+		        try {
+		            URI servicePath = new URI(this.binding.getURI());
+		            componentName = servicePath.getPath();
+		            
+		            // strip any leading slash
+		            if (componentName.charAt(0) == '/'){
+		                componentName = componentName.substring(1, componentName.length());
+		            }
+		        } catch(Exception ex) {
+		            // do nothing, the binding uri string will be used
+		        }
+		
+		        try {
+    		            serviceDiscovery.registerServiceEndpoint(domain.getDomainUri(), 
+    		                                                     domain.getNodeUri(), 
+    		                                                     componentName, 
+    		                                                     SCABinding.class.getName(), 
+    		                                                     wsBinding.getURI());
+	                } catch(Exception ex) {
+	                    logger.log(Level.WARNING, 
+	                               "Unable to  register service: "  +
+	                               domain.getDomainUri() + " " +
+	                               domain.getNodeUri() + " " +
+	                               componentName + " " +
+	                               SCABinding.class.getName() + " " +
+	                               wsBinding.getURI());
+	                }
+	        } else {
+	          /* don't think we should thrown an exception here as it
+	           * may be a stand alone node
+	            throw new IllegalStateException("No service manager available for component: "+
+                                                component.getName() +
+                                                " and service: " + 
+                                                service.getName());
+                  */	        	
+	        }
+        } else {
+            throw new IllegalStateException("No distributed domain available for component: "+
+                                            component.getName() +
+                                            " and service: " + 
+                                            service.getName());        	
+        }
 
-        serviceDiscovery.registerServiceEndpoint(distributedDomain.getDomainName(), 
-                                                 distributedDomain.getNodeName(), 
-                                                 componentName, 
-                                                 SCABinding.class.getName(), 
-                                                 wsBinding.getURI());
-
-/*       
-        serviceDiscovery.registerServiceEndpoint(distributedDomain.getDomainName(), 
-                                                 distributedDomain.getNodeName(), 
-                                                 component.getName(), 
-                                                 SCABinding.class.getName(), 
-                                                 wsBinding.getURI());
-        serviceDiscovery.registerServiceEndpoint(distributedDomain.getDomainName(), 
-                                                 distributedDomain.getNodeName(), 
-                                                 component.getName() + "/" + this.binding.getName(), 
-                                                 SCABinding.class.getName(), 
-                                                 wsBinding.getURI());
-*/
     }
 
     public InterfaceContract getBindingInterfaceContract() {

Modified: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.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/AsynchTestCase.java?rev=573552&r1=573551&r2=573552&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java Fri Sep  7 04:41:52 2007
@@ -23,6 +23,7 @@
 
 import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient;
 import org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientCallbackOnewayRemoteImpl;
+import org.apache.tuscany.sca.distributed.domain.Domain;
 import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -30,19 +31,17 @@
 
 public class AsynchTestCase extends BaseTest {
     
-    public static EmbeddedSCADomain domainA;
-    public static EmbeddedSCADomain domainB;
+    public static TestDomain domainA;
+    public static TestDomain domainB;
 
     @BeforeClass
     public static void init() throws Exception {
         System.out.println("Setting up distributed nodes");
 
         try {
-            // create and start domainA
+            // create and start domains
             domainA = createDomain("nodeG");
             domainB = createDomain("nodeH");
-            startDomain(domainA);
-            startDomain(domainB);
 
         } catch (Exception ex) {
             System.err.println("Exception when creating domain " + ex.getMessage());
@@ -53,9 +52,8 @@
 
     @AfterClass
     public static void destroy() throws Exception {
-        // stop the nodes and hence the domains they contain        
-        stopDomain(domainA);
-        stopDomain(domainB);
+        domainA.stop();
+        domainB.stop();
     }   
     
     @Test

Modified: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BaseTest.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/BaseTest.java?rev=573552&r1=573551&r2=573552&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BaseTest.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BaseTest.java Fri Sep  7 04:41:52 2007
@@ -18,79 +18,15 @@
  */
 package org.apache.tuscany.sca.binding.sca.axis2;
 
-import java.net.URL;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceLocal;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.service.ContributionService;
-import org.apache.tuscany.sca.distributed.domain.DistributedSCADomain;
-import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.apache.tuscany.sca.distributed.domain.Domain;
 
 public class BaseTest {
 
     public static String DEFULT_DOMAIN_NAME = "mydomain";
+    public static TestServiceDiscoveryImpl serviceDiscovery = new TestServiceDiscoveryImpl();
 
-    public static EmbeddedSCADomain createDomain(String nodeName) throws Exception {
-        ClassLoader cl = BaseTest.class.getClassLoader();
-        EmbeddedSCADomain domain = null;
-
-        try {
-            // Create the distributed domain representation
-            TestDistributedSCADomainImpl distributedDomain = new TestDistributedSCADomainImpl(DEFULT_DOMAIN_NAME);
-            distributedDomain.setNodeName(nodeName);
-
-            // create and start domainA
-            domain = new EmbeddedSCADomain(cl, DEFULT_DOMAIN_NAME);
-            domain.start();
-
-            // add a contribution to the domain
-            ContributionService contributionService = domain.getContributionService();
-
-            // find the current directory as a URL. This is where our contribution 
-            // will come from
-            URL contributionURL = Thread.currentThread().getContextClassLoader().getResource(nodeName + "/");
-
-            // Contribute the SCA application
-            Contribution contribution = contributionService.contribute("http://calculator", contributionURL, null, //resolver, 
-                                                                       false);
-            Composite composite = contribution.getDeployables().get(0);
-
-            // Add the deployable composite to the domain
-            domain.getDomainComposite().getIncludes().add(composite);
-            domain.getCompositeBuilder().build(composite);
-
-            distributedDomain.addDistributedDomainToBindings(composite);
-
-            domain.getCompositeActivator().activate(composite);
-        } catch (Exception ex) {
-            System.err.println("Exception when creating domain " + ex.getMessage());
-            ex.printStackTrace(System.err);
-            throw ex;
-        }   
-        return domain;
-    }
-
-    public static void startDomain(EmbeddedSCADomain domain) 
-      throws Exception {
-        try {
-            // Start domain
-            for (Composite composite : domain.getDomainComposite().getIncludes()) {
-                domain.getCompositeActivator().start(composite);
-            }
-
-        } catch (Exception ex) {
-            System.err.println("Exception when creating domain " + ex.getMessage());
-            ex.printStackTrace(System.err);
-            throw ex;
-        }     
+    public static TestDomain createDomain(String nodeName) throws Exception {
+       
+        return new TestDomain(DEFULT_DOMAIN_NAME, nodeName,serviceDiscovery);
     }
-
-    public static void stopDomain(EmbeddedSCADomain domain) throws Exception {
-        // stop the domain     
-        domain.stop();
-    }
-
 }

Modified: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.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/CallbackTestCase.java?rev=573552&r1=573551&r2=573552&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java Fri Sep  7 04:41:52 2007
@@ -22,33 +22,24 @@
 
 import junit.framework.Assert;
 
-import org.apache.tuscany.sca.assembly.Composite;
 import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient;
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceLocal;
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.service.ContributionService;
-import org.apache.tuscany.sca.distributed.domain.DistributedSCADomain;
-import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
 public class CallbackTestCase extends BaseTest {
     
-    public static EmbeddedSCADomain domainA;
-    public static EmbeddedSCADomain domainB;
+    public static TestDomain domainA;
+    public static TestDomain domainB;
 
     @BeforeClass
     public static void init() throws Exception {
         System.out.println("Setting up distributed nodes");
 
         try {
-            // create and start domainA
+            // create and start domains
             domainA = createDomain("nodeE");
             domainB = createDomain("nodeF");
-            startDomain(domainA);
-            startDomain(domainB);
 
         } catch (Exception ex) {
             System.err.println("Exception when creating domain " + ex.getMessage());
@@ -59,9 +50,8 @@
 
     @AfterClass
     public static void destroy() throws Exception {
-        // stop the nodes and hence the domains they contain        
-        stopDomain(domainA);
-        stopDomain(domainB);
+        domainA.stop();
+        domainB.stop();
     }   
     
     //@Test

Added: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/DomainFactoryImpl.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/DomainFactoryImpl.java?rev=573552&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/DomainFactoryImpl.java (added)
+++ incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/DomainFactoryImpl.java Fri Sep  7 04:41:52 2007
@@ -0,0 +1,51 @@
+/*
+ * 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.binding.sca.axis2;
+
+import org.apache.tuscany.sca.distributed.domain.Domain;
+import org.apache.tuscany.sca.distributed.domain.DomainFactory;
+import org.apache.tuscany.sca.distributed.domain.ServiceDiscoveryService;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+
+/**
+ * A factory that always returns the same domain object
+ * 
+ * @version $Rev: 556897 $ $Date$
+ */
+public class DomainFactoryImpl implements DomainFactory {
+	
+	Domain domain = null;
+	
+	public DomainFactoryImpl(Domain domain){
+		this.domain = domain;
+	}
+    
+    /**
+     * Returns the domain object
+     * 
+     * @return the domain 
+     */
+    public Domain getDomain(){
+    	return domain;
+    }
+    
+}

Propchange: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/DomainFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/DomainFactoryImpl.java
------------------------------------------------------------------------------
    svn:keywords = Red Date

Modified: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.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/PromotionTestCase.java?rev=573552&r1=573551&r2=573552&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java Fri Sep  7 04:41:52 2007
@@ -22,33 +22,24 @@
 
 import junit.framework.Assert;
 
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient;
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceLocal;
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.service.ContributionService;
-import org.apache.tuscany.sca.distributed.domain.DistributedSCADomain;
-import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
 public class PromotionTestCase extends BaseTest {
     
-    public static EmbeddedSCADomain domainA;
-    public static EmbeddedSCADomain domainB;
+    public static TestDomain domainA;
+    public static TestDomain domainB;
 
     @BeforeClass
     public static void init() throws Exception {
         System.out.println("Setting up distributed nodes");
 
         try {
-            // create and start domainA
+            // create and start domains
             domainA = createDomain("nodeC");
             domainB = createDomain("nodeD");
-            startDomain(domainA);
-            startDomain(domainB);
+
 
         } catch (Exception ex) {
             System.err.println("Exception when creating domain " + ex.getMessage());
@@ -59,9 +50,8 @@
 
     @AfterClass
     public static void destroy() throws Exception {
-        // stop the nodes and hence the domains they contain        
-        stopDomain(domainA);
-        stopDomain(domainB);
+        domainA.stop(); 
+        domainB.stop();
     }    
     
     @Test

Modified: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.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/SimpleTestCase.java?rev=573552&r1=573551&r2=573552&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java Fri Sep  7 04:41:52 2007
@@ -22,33 +22,24 @@
 
 import junit.framework.Assert;
 
-import org.apache.tuscany.sca.assembly.Composite;
 import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient;
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceLocal;
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.service.ContributionService;
-import org.apache.tuscany.sca.distributed.domain.DistributedSCADomain;
-import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
 public class SimpleTestCase extends BaseTest {
     
-    public static EmbeddedSCADomain domainA;
-    public static EmbeddedSCADomain domainB;
+    public static TestDomain domainA;
+    public static TestDomain domainB;
 
     @BeforeClass
     public static void init() throws Exception {
         System.out.println("Setting up distributed nodes");
 
         try {
-            // create and start domainA
+            // create and start domains
             domainA = createDomain("nodeA");
-            domainB = createDomain("nodeB");
-            startDomain(domainA);
-            startDomain(domainB);
+            domainB = createDomain("nodeB");;
 
         } catch (Exception ex) {
             System.err.println("Exception when creating domain " + ex.getMessage());
@@ -59,9 +50,8 @@
 
     @AfterClass
     public static void destroy() throws Exception {
-        // stop the nodes and hence the domains they contain        
-        stopDomain(domainA);
-        stopDomain(domainB);
+        domainA.stop();
+        domainB.stop();
     }    
     
     @Test

Added: 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=573552&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestDomain.java (added)
+++ incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestDomain.java Fri Sep  7 04:41:52 2007
@@ -0,0 +1,249 @@
+/*
+ * 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.binding.sca.axis2;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.SCABinding;
+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.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
+import org.apache.tuscany.sca.distributed.domain.Domain;
+import org.apache.tuscany.sca.distributed.domain.ServiceDiscoveryService;
+import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * The very minimum domain implementation to get these tests going without creating a dependency on 
+ * domain-impl
+ * 
+ * @version $Rev: 552343 $ $Date$
+ */
+public class TestDomain implements Domain {
+    
+    private String nodeName;
+    private String domainURI;
+    private static ServiceDiscoveryService serviceDiscovery;   
+    private ReallySmallRuntime nodeRuntime;
+    
+    private ClassLoader cl = BaseTest.class.getClassLoader();
+    private Composite nodeComposite = null;
+        
+    
+    public TestDomain(String domainURI, String nodeName, TestServiceDiscoveryImpl serviceDiscovery)
+      throws Exception {
+        this.domainURI = domainURI; 
+        this.nodeName = nodeName;
+        this.serviceDiscovery = serviceDiscovery;
+        
+        try {
+
+            // create and start domainA
+            nodeRuntime = new ReallySmallRuntime(cl);
+            nodeRuntime.start();
+            
+            // Create an in-memory domain level composite
+            AssemblyFactory assemblyFactory = nodeRuntime.getAssemblyFactory();
+            nodeComposite = assemblyFactory.createComposite();
+            nodeComposite.setName(new QName(Constants.SCA10_NS, "domain"));
+            nodeComposite.setURI(domainURI);
+            
+            // add the top level composite into the composite activator
+            nodeRuntime.getCompositeActivator().setDomainComposite(nodeComposite);  
+            
+            // make the domain available to the model. 
+            ModelFactoryExtensionPoint factories = nodeRuntime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
+            DomainFactoryImpl domainFactory = new DomainFactoryImpl(this);
+            factories.addFactory(domainFactory);                       
+
+            // add a contribution to the domain
+            ContributionService contributionService = nodeRuntime.getContributionService();
+
+            // find the current directory as a URL. This is where our contribution 
+            // will come from
+            URL contributionURL = Thread.currentThread().getContextClassLoader().getResource(nodeName + "/");
+
+            // Contribute the SCA application
+            Contribution contribution = contributionService.contribute("http://calculator", contributionURL, null, //resolver, 
+                                                                       false);
+            Composite composite = contribution.getDeployables().get(0);
+
+            // Add the deployable composite to the domain
+            nodeComposite.getIncludes().add(composite);
+            nodeRuntime.getCompositeBuilder().build(composite);
+            nodeRuntime.getCompositeActivator().activate(composite);
+            nodeRuntime.getCompositeActivator().start(composite);
+            
+        } catch (Exception ex) {
+            System.err.println("Exception when creating domain " + ex.getMessage());
+            ex.printStackTrace(System.err);
+            throw ex;
+        }         
+    }
+    
+    public void start()
+        throws ActivationException {
+        
+    }
+    
+    public void stop() 
+      throws ActivationException {
+        nodeRuntime.stop();
+    }
+    
+        
+    public String getNodeUri(){
+        return nodeName;
+    }  
+    
+    public String getDomainUri(){
+        return domainURI;
+    } 
+    
+    public ServiceDiscoveryService getServiceDiscovery(){
+        return serviceDiscovery;
+    }     
+    
+    public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+        return null; 
+    }
+
+    public <B> B getService(Class<B> businessInterface, String serviceName) {
+        ServiceReference<B> serviceReference = getServiceReference(businessInterface, serviceName);
+        if (serviceReference == null) {
+            throw new ServiceRuntimeException("Service not found: " + serviceName);
+        }
+        return serviceReference.getService();
+    }
+
+    private <B> ServiceReference<B> createServiceReference(Class<B> businessInterface, String targetURI) {
+        try {
+            AssemblyFactory assemblyFactory = nodeRuntime.getAssemblyFactory();
+            Composite composite = assemblyFactory.createComposite();
+            composite.setName(new QName(Constants.SCA10_TUSCANY_NS, "default"));
+            RuntimeComponent component = (RuntimeComponent)assemblyFactory.createComponent();
+            component.setName("default");
+            component.setURI("default");
+            nodeRuntime.getCompositeActivator().configureComponentContext(component);
+            composite.getComponents().add(component);
+            RuntimeComponentReference reference = (RuntimeComponentReference)assemblyFactory.createComponentReference();
+            reference.setName("default");
+            ModelFactoryExtensionPoint factories =
+                nodeRuntime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
+            JavaInterfaceFactory javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class);
+            InterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
+            interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(businessInterface));
+            reference.setInterfaceContract(interfaceContract);
+            component.getReferences().add(reference);
+            reference.setComponent(component);
+            SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class);
+            SCABinding binding = scaBindingFactory.createSCABinding();
+            binding.setURI(targetURI);
+            reference.getBindings().add(binding);       
+            return new ServiceReferenceImpl<B>(businessInterface, component, reference, binding, nodeRuntime
+                .getProxyFactory(), nodeRuntime.getCompositeActivator());
+        } catch (Exception e) {
+            throw new ServiceRuntimeException(e);
+        }
+    }
+
+    public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name) {
+
+        // Extract the component name
+        String componentName;
+        String serviceName;
+        int i = name.indexOf('/');
+        if (i != -1) {
+            componentName = name.substring(0, i);
+            serviceName = name.substring(i + 1);
+
+        } else {
+            componentName = name;
+            serviceName = null;
+        }
+
+        // Lookup the component in the domain
+        
+        Component component = null;
+        
+        for (Composite composite: nodeComposite.getIncludes()) {
+            for (Component componentLoop: composite.getComponents()) {
+                if (componentLoop.getName().equals(componentName)) {
+                    component = componentLoop;
+                    break;
+                }
+            }
+        }        
+        if (component == null) {
+            // The component is not local in the partition, try to create a remote service ref
+            return createServiceReference(businessInterface, name);
+        }
+        RuntimeComponentContext componentContext = null;
+
+        // If the component is a composite, then we need to find the
+        // non-composite component that provides the requested service
+        if (component.getImplementation() instanceof Composite) {
+            for (ComponentService componentService : component.getServices()) {
+                if (serviceName == null || serviceName.equals(componentService.getName())) {
+                    CompositeService compositeService = (CompositeService)componentService.getService();
+                    if (compositeService != null) {
+                        if (serviceName != null) {
+                            serviceName = "$promoted$." + serviceName;
+                        }
+                        componentContext =
+                            ((RuntimeComponent)compositeService.getPromotedComponent()).getComponentContext();
+                        return componentContext.createSelfReference(businessInterface, compositeService
+                            .getPromotedService());
+                    }
+                    break;
+                }
+            }
+            // No matching service is found
+            throw new ServiceRuntimeException("Composite service not found: " + name);
+        } else {
+            componentContext = ((RuntimeComponent)component).getComponentContext();
+            if (serviceName != null) {
+                return componentContext.createSelfReference(businessInterface, serviceName);
+            } else {
+                return componentContext.createSelfReference(businessInterface);
+            }
+        }
+    } 
+    
+    
+}

Propchange: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestDomain.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestDomain.java
------------------------------------------------------------------------------
    svn:keywords = Red Date

Modified: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestServiceDiscoveryImpl.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/TestServiceDiscoveryImpl.java?rev=573552&r1=573551&r2=573552&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestServiceDiscoveryImpl.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestServiceDiscoveryImpl.java Fri Sep  7 04:41:52 2007
@@ -22,7 +22,8 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.tuscany.sca.distributed.management.ServiceDiscovery;
+import org.apache.tuscany.sca.distributed.domain.ServiceDiscoveryService;
+import org.apache.tuscany.sca.distributed.domain.ServiceInfo;
 
 
 /**
@@ -30,7 +31,7 @@
  * 
  * @version $Rev: 552343 $ $Date: 2007-07-01 18:43:40 +0100 (Sun, 01 Jul 2007) $
  */
-public class TestServiceDiscoveryImpl implements ServiceDiscovery{
+public class TestServiceDiscoveryImpl implements ServiceDiscoveryService{
     
     List<ServiceEndpoint> serviceEndpoints = new ArrayList<ServiceEndpoint>();
     
@@ -135,6 +136,11 @@
             }
         }
         return url;
+    }
+    
+    public ServiceInfo getServiceInfo() {
+        // TODO Auto-generated method stub
+        return null;
     }
     
 }

Modified: incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProviderFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProviderFactory.java?rev=573552&r1=573551&r2=573552&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProviderFactory.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProviderFactory.java Fri Sep  7 04:41:52 2007
@@ -20,7 +20,10 @@
 package org.apache.tuscany.sca.binding.sca.impl;
 
 import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.distributed.domain.Domain;
+import org.apache.tuscany.sca.distributed.domain.DomainFactory;
 import org.apache.tuscany.sca.provider.BindingProviderFactory;
 import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
 import org.apache.tuscany.sca.provider.ServiceBindingProvider;
@@ -36,9 +39,16 @@
 public class RuntimeSCABindingProviderFactory implements BindingProviderFactory<SCABinding> {
     
     private ExtensionPointRegistry extensionPoints;
+    private Domain domain = null;
     
     public RuntimeSCABindingProviderFactory(ExtensionPointRegistry extensionPoints) {
         this.extensionPoints = extensionPoints;
+        ModelFactoryExtensionPoint factories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+        DomainFactory domainFactory = factories.getFactory(DomainFactory.class);
+        
+        if (domainFactory != null) {
+        	domain = domainFactory.getDomain();
+        }
         
     } 
     
@@ -46,17 +56,16 @@
                                                                    RuntimeComponentReference reference,
                                                                    SCABinding binding) {
               
-        return  new RuntimeSCAReferenceBindingProvider(extensionPoints, component, reference, binding);
+        return  new RuntimeSCAReferenceBindingProvider(extensionPoints, domain, component, reference, binding);
     }
 
     public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
                                                                RuntimeComponentService service,
                                                                SCABinding binding) {
-        return new RuntimeSCAServiceBindingProvider(extensionPoints, component, service, binding);
+        return new RuntimeSCAServiceBindingProvider(extensionPoints, domain, component, service, binding);
     }
 
     public Class<SCABinding> getModelType() {
         return SCABinding.class;
     }
-
 }

Modified: incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java?rev=573552&r1=573551&r2=573552&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java Fri Sep  7 04:41:52 2007
@@ -23,8 +23,8 @@
 import org.apache.tuscany.sca.assembly.WireableBinding;
 import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.distributed.domain.DistributedSCADomain;
-import org.apache.tuscany.sca.distributed.management.ServiceDiscovery;
+import org.apache.tuscany.sca.distributed.domain.Domain;
+import org.apache.tuscany.sca.distributed.domain.ServiceDiscoveryService;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.invocation.Invoker;
@@ -50,6 +50,7 @@
 public class RuntimeSCAReferenceBindingProvider implements ReferenceBindingProvider2 {
 
     private ExtensionPointRegistry extensionPoints;
+    private Domain domain;
     private RuntimeComponent component;
     private RuntimeComponentReference reference;
     private SCABinding binding;
@@ -57,13 +58,14 @@
 
     private BindingProviderFactory<DistributedSCABinding> distributedProviderFactory = null;
     private ReferenceBindingProvider2 distributedProvider = null;
-    private DistributedSCADomain distributedDomain = null;
 
     public RuntimeSCAReferenceBindingProvider(ExtensionPointRegistry extensionPoints,
+    		                                  Domain domain,
                                               RuntimeComponent component,
                                               RuntimeComponentReference reference,
                                               SCABinding binding) {
         this.extensionPoints = extensionPoints;
+        this.domain = domain;
         this.component = component;
         this.reference = reference;
         this.binding = binding;
@@ -77,8 +79,6 @@
             (BindingProviderFactory<DistributedSCABinding>)factoryExtensionPoint
                 .getProviderFactory(DistributedSCABinding.class);
 
-        // Get the distributed domain
-        distributedDomain = ((SCABindingImpl)binding).getDistributedDomain();
 
         // determine if the target is remote. If we can tell now then this will
         // do some initialization before we get to run time
@@ -100,11 +100,11 @@
             // reference, e.g. a callback, so check the domain to see if the service is available
             // at this node. The binding uri might be null here if the dynamic reference has been
             // fully configured yet. It won't have all of the information until invocation time
-            if ((distributedDomain != null) && (binding.getURI() != null)) {
-                ServiceDiscovery serviceDiscovery = distributedDomain.getServiceDiscovery();
+            if ((domain != null) && (binding.getURI() != null)) {
+                ServiceDiscoveryService serviceDiscovery = domain.getServiceDiscovery();
 
                 String serviceUrl =
-                    serviceDiscovery.findServiceEndpoint(distributedDomain.getDomainName(),
+                    serviceDiscovery.findServiceEndpoint(domain.getDomainUri(),
                                                          binding.getURI(),
                                                          SCABinding.class.getName());
                 if (serviceUrl == null) {
@@ -134,7 +134,7 @@
                         + reference.getName());
                 }
 
-                if (distributedDomain == null) {
+                if (domain == null) {
                     throw new IllegalStateException("No distributed domain available for component: " + component
                         .getName()
                         + " and reference: "

Modified: incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAServiceBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAServiceBindingProvider.java?rev=573552&r1=573551&r2=573552&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAServiceBindingProvider.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAServiceBindingProvider.java Fri Sep  7 04:41:52 2007
@@ -23,8 +23,8 @@
 import org.apache.tuscany.sca.assembly.WireableBinding;
 import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.distributed.domain.DistributedSCADomain;
-import org.apache.tuscany.sca.distributed.management.ServiceDiscovery;
+import org.apache.tuscany.sca.distributed.domain.Domain;
+import org.apache.tuscany.sca.distributed.domain.ServiceDiscoveryService;
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.invocation.Invoker;
@@ -43,16 +43,19 @@
  * @version $Rev$ $Date$
  */
 public class RuntimeSCAServiceBindingProvider implements ServiceBindingProvider2 {
-
+  
+	private Domain domain;
     private RuntimeComponentService service;
     private BindingProviderFactory<DistributedSCABinding> distributedProviderFactory;
     private ServiceBindingProvider2 distributedProvider;
     private DistributedSCABinding distributedBinding;
     
     public RuntimeSCAServiceBindingProvider(ExtensionPointRegistry extensionPoints,
+    		                                Domain domain,
                                             RuntimeComponent component,
                                             RuntimeComponentService service,
                                             SCABinding binding) {
+    	this.domain = domain;
         this.service = service;
         // if there is potentially a wire to this service that crosses the node boundary 
         if (service.getInterfaceContract().getInterface().isRemotable()) {  
@@ -72,7 +75,7 @@
             // - distributed domain in which to look for remote endpoints 
             // - remotable interface on the service
             if (distributedProviderFactory != null) {
-                if (((SCABindingImpl)binding).getDistributedDomain() != null) {
+                if (this.domain != null) {
                     if (!service.getInterfaceContract().getInterface().isRemotable()) {
                         throw new IllegalStateException("Reference interface not remoteable for component: "+
                                                         component.getName() +

Modified: incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java?rev=573552&r1=573551&r2=573552&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java Fri Sep  7 04:41:52 2007
@@ -27,7 +27,6 @@
 import org.apache.tuscany.sca.assembly.Extensible;
 import org.apache.tuscany.sca.assembly.SCABinding;
 import org.apache.tuscany.sca.assembly.WireableBinding;
-import org.apache.tuscany.sca.distributed.domain.DistributedSCADomain;
 import org.apache.tuscany.sca.policy.Intent;
 import org.apache.tuscany.sca.policy.IntentAttachPointType;
 import org.apache.tuscany.sca.policy.PolicySet;
@@ -50,8 +49,6 @@
     private ComponentService targetComponentService;
     private Binding targetBinding;
     
-    private DistributedSCADomain distributedDomain;
-
     /**
      * Constructs a new SCA binding.
      */
@@ -194,16 +191,4 @@
     public void setTargetBinding(Binding targetBinding) {
         this.targetBinding = targetBinding;
     }
-    
-    // Operations needed by the distributed SCA binding
-    // TODO - these are really runtime reference so need a better place for them 
-    
-    public void setDistributedDomain(DistributedSCADomain distributedDomain){
-        this.distributedDomain = distributedDomain;
-    }
-    
-    public DistributedSCADomain getDistributedDomain(){
-        return distributedDomain;
-    }
-
 }

Added: incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/DomainManagerServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/DomainManagerServiceImpl.java?rev=573552&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/DomainManagerServiceImpl.java (added)
+++ incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/DomainManagerServiceImpl.java Fri Sep  7 04:41:52 2007
@@ -0,0 +1,88 @@
+/*
+ * 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.distributed.domain.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.distributed.domain.DomainManagerService;
+import org.apache.tuscany.sca.distributed.domain.NodeInfo;
+import org.apache.tuscany.sca.distributed.domain.ServiceDiscoveryService;
+import org.apache.tuscany.sca.distributed.domain.impl.ServiceDiscoveryServiceImpl.ServiceEndpoint;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+
+/**
+ * Stores details of services exposed and retrieves details of remote services
+ * 
+ * @version $Rev: 552343 $ $Date$
+ */
+@Scope("COMPOSITE")
+public class DomainManagerServiceImpl implements DomainManagerService{
+    
+    @Reference 
+    public ServiceDiscoveryService serviceDiscovery;
+
+    List<NodeInfo> nodes = new ArrayList<NodeInfo>();
+    
+    public String registerNode(String domainUri, String nodeUri){ 
+        NodeInfo nodeInfo = new NodeInfoImpl(domainUri, nodeUri);
+        nodes.add(nodeInfo);
+        System.err.println("Registering node: " + nodeUri);
+        return nodeUri;
+    }
+    
+    public String removeNode(String domainUri, String nodeUri){ 
+        
+        NodeInfo nodeToRemove = null;
+        
+        for(NodeInfo node : nodes){
+            if ( node.match(domainUri, nodeUri)){
+                nodeToRemove = node;
+                break;
+            }
+        }
+
+        nodes.remove(nodeToRemove);
+        System.err.println("Removed node: " + nodeUri);
+        
+        return nodeUri;
+    }    
+    
+    public List<NodeInfo> getNodeInfo(){
+        
+        // get the nodeManagerUrl for each node
+        for(NodeInfo node : nodes){
+            String url = serviceDiscovery.findServiceEndpoint(node.getDomainUri(), 
+                                                              node.getNodeUri() + "NodeManagerService",
+                                                              "");
+                                                 
+
+            if (url != null) {
+                node.setNodeManagerUrl(url);
+            }
+        }
+        
+        return nodes;
+    }
+    
+}

Propchange: incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/DomainManagerServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/DomainManagerServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Red Date

Added: incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/NodeInfoImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/NodeInfoImpl.java?rev=573552&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/NodeInfoImpl.java (added)
+++ incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/NodeInfoImpl.java Fri Sep  7 04:41:52 2007
@@ -0,0 +1,71 @@
+/*
+ * 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.distributed.domain.impl;
+
+import java.io.Serializable;
+
+import org.apache.tuscany.sca.distributed.domain.NodeInfo;
+
+/**
+ * Information relating to an exposed service
+ * 
+ * @version $Rev: 552343 $ $Date$
+ */
+public class NodeInfoImpl implements NodeInfo, Serializable {
+    
+    private String domainUri;
+    private String nodeUri;
+    private String nodeManagerUrl;
+    
+    public NodeInfoImpl(String domainUri, String nodeUri){
+        this.domainUri = domainUri;
+        this.nodeUri = nodeUri;
+    }  
+    
+    public boolean match (String domainUri, String nodeUri){
+        return ((this.domainUri.equals(domainUri)) &&
+                (this.nodeUri.equals(nodeUri)));
+    }
+    
+    public String getDomainUri(){
+        return domainUri;
+    } 
+    
+    public String getNodeUri(){
+        return nodeUri;
+    }     
+    
+    public void setNodeManagerUrl(String nodeManagerUrl){
+        this.nodeManagerUrl = nodeManagerUrl;
+    }
+    
+    public String getNodeManagerUrl(){
+        return nodeManagerUrl;
+    }
+    
+    @Override
+    public String toString (){
+        return "[" +
+               domainUri + " " +
+               nodeUri + 
+               "]";
+    }
+    
+}

Propchange: incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/NodeInfoImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/NodeInfoImpl.java
------------------------------------------------------------------------------
    svn:keywords = Red Date

Added: incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/ServiceDiscoveryServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/ServiceDiscoveryServiceImpl.java?rev=573552&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/ServiceDiscoveryServiceImpl.java (added)
+++ incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/ServiceDiscoveryServiceImpl.java Fri Sep  7 04:41:52 2007
@@ -0,0 +1,170 @@
+/*
+ * 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.distributed.domain.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.distributed.domain.ServiceDiscoveryService;
+import org.apache.tuscany.sca.distributed.domain.ServiceInfo;
+import org.osoa.sca.annotations.Scope;
+
+
+/**
+ * Stores details of services exposed and retrieves details of remote services
+ * 
+ * @version $Rev: 552343 $ $Date$
+ */
+@Scope("COMPOSITE")
+public class ServiceDiscoveryServiceImpl implements ServiceDiscoveryService {
+    
+    List<ServiceEndpoint> serviceEndpoints = new ArrayList<ServiceEndpoint>();
+    
+    public class ServiceEndpoint {
+        public String domainUri;
+        public String nodeUri;
+        public String serviceName;
+        public String bindingName;
+        public String url;
+        
+        public ServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName, String URL){
+            this.domainUri = domainUri;
+            this.nodeUri = nodeUri;
+            this.serviceName = serviceName;
+            this.bindingName = bindingName;
+            this.url = URL;
+        }
+        
+        public boolean match(String domainUri, String serviceName, String bindingName) {
+            // trap the case where the we are trying to map
+            //   ComponentName/Service name with a registered ComponentName             - this is OK
+            //   ComponentName              with a registered ComponentName/ServiceName - this should fail
+            
+            boolean serviceNameMatch = false;
+            
+            if (this.serviceName.equals(serviceName)) {
+                serviceNameMatch = true;
+            } else {
+                int s = serviceName.indexOf('/');
+                if ((s != -1) &&
+                    (this.serviceName.equals(serviceName.substring(0, s)))){
+                    serviceNameMatch = true;
+                }
+            }
+            
+            return ((this.domainUri.equals(domainUri)) &&
+                    (serviceNameMatch) &&
+                    (this.bindingName.equals(bindingName)));
+        }
+        
+        public String getUrl() {
+            return url;
+        }     
+        
+        @Override
+        public String toString (){
+            return "[" +
+                   domainUri + " " +
+                   nodeUri + " " +
+                   serviceName + " " +
+                   bindingName + " " + 
+                   url +
+                   "]";
+        }
+    }
+     
+    /**
+     * Accepts information about a service endpoint and holds onto it
+     * 
+     * @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
+     * @param url the enpoint 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("/") ) {
+            modifiedServiceName = serviceName.substring(0, serviceName.length() - 1);
+        } else {
+            modifiedServiceName = serviceName;
+        }
+        
+        ServiceEndpoint serviceEndpoint = new ServiceEndpoint (domainUri, nodeUri, modifiedServiceName, bindingName, URL);
+        serviceEndpoints.add(serviceEndpoint);
+        System.err.println("Registering service: " + serviceEndpoint.toString());
+        return "";
+    }
+    
+   
+    /**
+     * 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){
+        System.err.println("Finding service: [" + 
+                           domainUri + " " +
+                           serviceName + " " +
+                           bindingName +
+                           "]");
+        
+        String url = "";
+        
+        for(ServiceEndpoint serviceEndpoint : serviceEndpoints){
+            if ( serviceEndpoint.match(domainUri, serviceName, bindingName)){
+                url = serviceEndpoint.getUrl();
+                // if you want to temporarily modify the registered port 
+                // numbers for debugging uncomment this line
+                //url = replacePort(url, "8085", "8086");
+                System.err.println("Matching service url: " + url); 
+            }
+        }
+        return url;
+    }
+    
+    /**
+     * Converts a port number to something else to allow for debugging using a
+     * HTTP sniffer
+     * @param url
+     * @param fromPort the port to look for
+     * @param toPort the port to replace it with
+     * @return the new url
+     */
+    private String replacePort(String url, String fromPort, String toPort) {
+    	return url.replace(fromPort, toPort);
+    }
+    
+    public ServiceInfo getServiceInfo(){
+        
+        ServiceEndpoint serviceEndpoint = serviceEndpoints.get(0);
+        
+        return new ServiceInfoImpl(serviceEndpoint.domainUri, 
+                                   serviceEndpoint.nodeUri, 
+                                   serviceEndpoint.serviceName, 
+                                   serviceEndpoint.bindingName, 
+                                   serviceEndpoint.url);
+    }
+    
+}

Propchange: incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/ServiceDiscoveryServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/ServiceDiscoveryServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Red Date

Added: incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/ServiceInfoImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/ServiceInfoImpl.java?rev=573552&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/ServiceInfoImpl.java (added)
+++ incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/domain/impl/ServiceInfoImpl.java Fri Sep  7 04:41:52 2007
@@ -0,0 +1,84 @@
+/*
+ * 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.distributed.domain.impl;
+
+import java.io.Serializable;
+
+import org.apache.tuscany.sca.distributed.domain.ServiceInfo;
+
+/**
+ * Information relating to an exposed service
+ * 
+ * @version $Rev: 552343 $ $Date$
+ */
+public class ServiceInfoImpl implements ServiceInfo, Serializable {
+    
+    private String domainUri;
+    private String nodeUri;
+    private String serviceName;
+    private String bindingName;
+    private String url;
+    
+    public ServiceInfoImpl(String domainUri, String nodeUri, String serviceName, String bindingName, String URL){
+        this.domainUri = domainUri;
+        this.nodeUri = nodeUri;
+        this.serviceName = serviceName;
+        this.bindingName = bindingName;
+        this.url = URL;
+    }
+    
+    public boolean match(String domainUri, String serviceName, String bindingName) {
+        // trap the case where the we are trying to map
+        //   ComponentName/Service name with a registered ComponentName             - this is OK
+        //   ComponentName              with a registered ComponentName/ServiceName - this should fail
+        
+        boolean serviceNameMatch = false;
+        
+        if (this.serviceName.equals(serviceName)) {
+            serviceNameMatch = true;
+        } else {
+            int s = serviceName.indexOf('/');
+            if ((s != -1) &&
+                (this.serviceName.equals(serviceName.substring(0, s)))){
+                serviceNameMatch = true;
+            }
+        }
+        
+        return ((this.domainUri.equals(domainUri)) &&
+                (serviceNameMatch) &&
+                (this.bindingName.equals(bindingName)));
+    }
+    
+    public String getUrl() {
+        return url;
+    }     
+    
+    @Override
+    public String toString (){
+        return "[" +
+               domainUri + " " +
+               nodeUri + " " +
+               serviceName + " " +
+               bindingName + " " + 
+               url +
+               "]";
+    }
+    
+}



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


Mime
View raw message