Author: slaws
Date: Sat Sep 15 13:19:10 2007
New Revision: 575969

URL: http://svn.apache.org/viewvc?rev=575969&view=rev
Log:
Allow domain and node urls to be passed in as parameters on node creation

Added:
    
incubator/tuscany/branches/sca-java-1.0/modules/domain-impl/src/main/resources/webroot/domain.png
   (with props)
Modified:
    
incubator/tuscany/branches/sca-java-1.0/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java
    
incubator/tuscany/branches/sca-java-1.0/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java
    
incubator/tuscany/branches/sca-java-1.0/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java
    
incubator/tuscany/branches/sca-java-1.0/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeImpl.java
    
incubator/tuscany/branches/sca-java-1.0/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeUtil.java
    
incubator/tuscany/branches/sca-java-1.0/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/InMemoryTestCase.java
    
incubator/tuscany/branches/sca-java-1.0/modules/node-impl/src/test/resources/nodeA/Calculator.composite
    
incubator/tuscany/branches/sca-java-1.0/modules/node/src/main/resources/node.composite
    
incubator/tuscany/branches/sca-java-1.0/samples/calculator-distributed/src/test/java/calculator/DomainInMemoryTestCase.java

Modified: 
incubator/tuscany/branches/sca-java-1.0/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java?rev=575969&r1=575968&r2=575969&view=diff
==============================================================================
--- 
incubator/tuscany/branches/sca-java-1.0/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java
 (original)
+++ 
incubator/tuscany/branches/sca-java-1.0/itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/CallableReferenceRemoteTestCase.java
 Sat Sep 15 13:19:10 2007
@@ -38,7 +38,7 @@
  */
 public class CallableReferenceRemoteTestCase {
     
-    private static String DEFAULT_DOMAIN_NAME = "mydomain";
+    private static String DEFAULT_DOMAIN_NAME = "http://localhost:8080";;
 
     private static SCANodeImpl domain;
     private static SCANodeImpl nodeA;

Modified: 
incubator/tuscany/branches/sca-java-1.0/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/branches/sca-java-1.0/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java?rev=575969&r1=575968&r2=575969&view=diff
==============================================================================
--- 
incubator/tuscany/branches/sca-java-1.0/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java
 (original)
+++ 
incubator/tuscany/branches/sca-java-1.0/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java
 Sat Sep 15 13:19:10 2007
@@ -139,7 +139,7 @@
                        }
                    }
             } else {
-                   throw new IllegalStateException("No service manager 
available for component: "+
+                   throw new IllegalStateException("No domain service 
available while trying to find component: "+
                                                                        
component.getName() +
                                                                        " and 
service: " + 
                                                                        
reference.getName());    

Modified: 
incubator/tuscany/branches/sca-java-1.0/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java?rev=575969&r1=575968&r2=575969&view=diff
==============================================================================
--- 
incubator/tuscany/branches/sca-java-1.0/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java
 (original)
+++ 
incubator/tuscany/branches/sca-java-1.0/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java
 Sat Sep 15 13:19:10 2007
@@ -107,7 +107,7 @@
                     serviceDiscovery.findServiceEndpoint(domain.getDomainUri(),
                                                          binding.getURI(),
                                                          
SCABinding.class.getName());
-                if (serviceUrl == null) {
+                if ((serviceUrl == null) || serviceUrl.equals("")) {
                     targetIsRemote = false;
                 } else {
                     targetIsRemote = true;

Added: 
incubator/tuscany/branches/sca-java-1.0/modules/domain-impl/src/main/resources/webroot/domain.png
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/domain-impl/src/main/resources/webroot/domain.png?rev=575969&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
incubator/tuscany/branches/sca-java-1.0/modules/domain-impl/src/main/resources/webroot/domain.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: 
incubator/tuscany/branches/sca-java-1.0/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeImpl.java?rev=575969&r1=575968&r2=575969&view=diff
==============================================================================
--- 
incubator/tuscany/branches/sca-java-1.0/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeImpl.java
 (original)
+++ 
incubator/tuscany/branches/sca-java-1.0/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeImpl.java
 Sat Sep 15 13:19:10 2007
@@ -23,6 +23,7 @@
 import java.io.InputStream;
 import java.net.InetAddress;
 import java.net.ServerSocket;
+import java.net.URI;
 import java.net.URL;
 import java.util.List;
 import java.util.logging.Level;
@@ -33,6 +34,7 @@
 import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.Binding;
 import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
 import org.apache.tuscany.sca.assembly.ComponentService;
 import org.apache.tuscany.sca.assembly.Composite;
 import org.apache.tuscany.sca.assembly.CompositeService;
@@ -72,8 +74,8 @@
        
     private final static Logger logger = 
Logger.getLogger(SCANodeImpl.class.getName());
        
-    public final static String LOCAL_DOMAIN_URI = "localdomain";
-    public final static String LOCAL_NODE_URI = "localnode";
+    public final static String LOCAL_DOMAIN_URI = "standalonedomain";
+    public final static String LOCAL_NODE_URI = "standalonenode";
     
     private boolean isStandalone = false;
     
@@ -84,8 +86,10 @@
     private ClassLoader domainClassLoader;
     
     // representation of the private state of the node that the domain is 
running on
-    private String domainUri;          
+    private String domainUri; 
+    private String domainUrl;
     private String nodeUri;
+    private String nodeUrl;
     private ReallySmallRuntime nodeRuntime;
     private Composite nodeComposite; 
     
@@ -117,15 +121,15 @@
      * Creates a node connected to a wider domain.  To find its place in the 
domain 
      * node and domain identifiers must be provided. 
      * 
-     * @param domainUri the domain identifier
-     * @param nodeUri the node identifier
+     * @param domainUri - identifies what host and port the domain service is 
running on, e.g. http://localhost:8081
+     * @param nodeUri - if this is a url it is assumed that this will be used 
as root url for management components, e.g. http://localhost:8082
      * @throws ActivationException
      */
     public SCANodeImpl(String domainUri, String nodeUri)
     throws ActivationException {
         this.domainUri = domainUri;
         this.nodeUri = nodeUri;
-        this.isStandalone = false;
+        this.isStandalone = LOCAL_DOMAIN_URI.equals(domainUri);
         init();
     }    
     
@@ -133,8 +137,8 @@
      * Creates a node connected to a wider domain and allows a classpath to be 
specified.  
      * To find its place in the domain node and domain identifiers must be 
provided. 
      * 
-     * @param domainUri the domain identifier
-     * @param nodeUri the node identifier
+     * @param domainUri - identifies what host and port the domain service is 
running on, e.g. http://localhost:8081
+     * @param nodeUri - if this is a url it is assumed that this will be used 
as root url for management components, e.g. http://localhost:8082
      * @param classpath the classpath to use for loading system resources for 
the node
      * @throws ActivationException
      */
@@ -168,6 +172,27 @@
                managementRuntime = null;
                scaDomain = null;
             } else {
+                // check where domain and node uris are urls, they will be 
used to configure various
+                // endpoints if they are
+                URI tmpURI;
+                try {
+                    tmpURI = new URI(domainUri); 
+                    if (tmpURI.isAbsolute()){
+                        domainUrl = domainUri;
+                    }
+                } catch(Exception ex) {
+                    domainUrl = null;
+                }
+                
+                try {
+                    tmpURI = new URI(nodeUri); 
+                    if (tmpURI.isAbsolute()){
+                        nodeUrl = nodeUri;
+                    }
+                } catch(Exception ex) {
+                    nodeUrl = null;
+                }
+
                 createManagementNode();
             }
         } catch(ActivationException ex) {
@@ -210,22 +235,21 @@
                     // in service discovery. It's not on an SCA binding. 
                     // TODO - really want to be able to hand out service 
references but they
                     //        don't serialize out over web services yet. 
-                    fixUpNodeServiceUrls();                    
+                    
SCANodeUtil.fixUpNodeServiceUrls(managementRuntime.getDomainComposite().getIncludes().get(0).getComponents(),
 nodeUrl); 
+                    
SCANodeUtil.fixUpNodeReferenceUrls(managementRuntime.getDomainComposite().getIncludes().get(0).getComponents(),
 domainUrl);  
                   
                     
managementRuntime.getCompositeActivator().activate(composite); 
                     managementRuntime.getCompositeActivator().start(composite);
                 
                     // get the management components out of the domain so that 
they 
-                    // can be configured/used. None are yet but this would be 
the place to 
-                    // get components out of the management domain and give 
them access to 
-                    // useful parts of the node
+                    // can be configured/used. 
                     scaDomain =  
managementRuntime.getService(SCADomainService.class, "SCADomainComponent");
                     domainManager = 
managementRuntime.getService(DomainManagerService.class, 
"DomainManagerComponent");
                     nodeManagerInit = 
managementRuntime.getService(NodeManagerInitService.class, 
"NodeManagerComponent/NodeManagerInitService");
                     
-                    // Now get the uri back out of the component no it has 
been build and started
+                    // Now get the uri back out of the component now it has 
been built and started
                     // TODO - this doesn't pick up the url from external 
hosting environments
-                    String nodeManagerUrl = getNodeManagerServiceUrl();
+                    String nodeManagerUrl = 
SCANodeUtil.getNodeManagerServiceUrl(managementRuntime.getDomainComposite().getIncludes().get(0).getComponents());
                     
                     if (nodeManagerUrl != null) {
                         if (isStandalone == false){
@@ -238,8 +262,10 @@
                                                                   
nodeManagerUrl);
                                 
                             } catch(Exception ex) {
-                                // not sure what to do here
-                                logger.log(Level.WARNING,  "Can't connect to 
domain manager");
+                                logger.log(Level.SEVERE,  
+                                           "Can't connect to domain manager 
at: " + 
+                                           domainUrl);
+                                throw new ActivationException(ex);
                             }
                         }                        
                     }
@@ -259,109 +285,7 @@
         } catch(Exception ex) {
             throw new ActivationException(ex);
         }
-    }
-    
-    /** 
-     * A rather ugly method to find out to fix the url of the service, 
assuming that there
-     * is one. 
-     *  
-     * we can't get is out of a service reference
-     * the component itself doesn't know how to get it  
-     * the binding can't to do it automatically as it's not he sca binding
-     * 
-     * TODO - This would be better done by passing out a serializable 
reference to service discovery 
-     *         but this doesn't work yet     
-     * 
-     * @return node manager url
-     */    
-    private void fixUpNodeServiceUrls(){
-        String nodeManagerUrl = null;
-        
-        // First get the NodeManager binding from the model 
-        List<Component> components = 
managementRuntime.getDomainComposite().getIncludes().get(0).getComponents();
-       
-        for(Component component : components){
-            for (ComponentService service : component.getServices() ){
-                for (Binding binding : service.getBindings() ) {
-                    fixUpBindingUrl(binding);  
-                }
-            }            
-        }
-    }
-    
-    private String getNodeManagerServiceUrl(){
-        String nodeManagerUrl = null;
-        
-        // First get the NodeManager binding from the model 
-        List<Component> components = 
managementRuntime.getDomainComposite().getIncludes().get(0).getComponents();
-        
-        for(Component component : components){
-            for (ComponentService service : component.getServices() ){
-                
-                if ( service.getName().equals("NodeManagerService")) {
-                    nodeManagerUrl = service.getBindings().get(0).getURI();
-                }
-            }            
-        }
-        
-        return nodeManagerUrl;
-    }    
-    
-    /**
-     * For http protocol find a port that isn't in use and make sure the 
domain name is the real domain name
-     * 
-     * @param binding
-     */
-    private void fixUpBindingUrl(Binding binding){
-
-        String urlString = binding.getURI(); 
-        
-        try {
-            
-            if( (urlString.startsWith("http") != true ) ||
-                (binding instanceof SCABinding)) {
-                return;
-            }
-            
-            URL url =  new URL(urlString);
-            String protocol = url.getProtocol();
-            
-            // first find a socket that is available starting with what
-            // is in the composite file
-            int port = url.getPort();
-            int startPort = port;
-            boolean portIsBusy = true;
-            
-            do {
-                try {
-                    ServerSocket socket = new ServerSocket(port);
-                    portIsBusy = false;
-                    socket.close();
-                    break;
-                }
-                catch (IOException ex) {
-                    // the port is busy
-                    port = port + 1;
-                }
-            } while (portIsBusy || port > 9999); 
-            
-            urlString = urlString.replace(String.valueOf(startPort), 
String.valueOf(port));
-            
-            // now replace localhost, if its there,  with the real host name
-            InetAddress address = InetAddress.getLocalHost();
-            urlString = urlString.replace("localhost", address.getHostName());
-            
-            // set the address back into the NodeManager binding.
-            binding.setURI(urlString);
-        
-        } catch (Exception ex) {
-            // don't do anything and leave the address as is
-            logger.log(Level.WARNING, 
-                       "Exception while fixing up binding url in management 
composite " + 
-                       urlString, 
-                       ex);
-        }
-    }    
+    }   
     
         
     // methods that implement interfaces 
@@ -399,8 +323,10 @@
                 // go out and add this node to the wider domain
                 domainManager.registerNode(domainUri, nodeUri);
             } catch(Exception ex) {
-                // not sure what to do here
-                logger.log(Level.WARNING,  "Can't connect to domain manager");
+                logger.log(Level.SEVERE,  
+                           "Can't connect to domain manager at: " + 
+                           domainUrl);
+                throw new ActivationException(ex);
             }
         }
     }
@@ -419,8 +345,10 @@
             try {
                 domainManager.removeNode(domainUri, nodeUri);
             } catch(Exception ex) {
-                // not sure what to do here
-                logger.log(Level.WARNING,  "Can't connect to domain manager");
+                logger.log(Level.SEVERE,  
+                        "Can't connect to domain manager at: " + 
+                        domainUrl);
+                throw new ActivationException(ex);
             }
         }
     }    

Modified: 
incubator/tuscany/branches/sca-java-1.0/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeUtil.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeUtil.java?rev=575969&r1=575968&r2=575969&view=diff
==============================================================================
--- 
incubator/tuscany/branches/sca-java-1.0/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeUtil.java
 (original)
+++ 
incubator/tuscany/branches/sca-java-1.0/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCANodeUtil.java
 Sat Sep 15 13:19:10 2007
@@ -19,11 +19,21 @@
 
 package org.apache.tuscany.sca.node.impl;
 
+import java.io.IOException;
+import java.net.InetAddress;
 import java.net.MalformedURLException;
+import java.net.ServerSocket;
 import java.net.URL;
+import java.net.UnknownHostException;
+import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.SCABinding;
 import org.apache.tuscany.sca.domain.SCADomainService;
 import org.apache.tuscany.sca.node.SCADomainFactory;
 import org.apache.tuscany.sca.node.SCADomain;
@@ -40,7 +50,7 @@
        private final static Logger logger = 
Logger.getLogger(SCANodeUtil.class.getName());
        
        /**
-        * Given the name of a composite this methid finds the contribution 
that it belongs to
+        * Given the name of a composite this method finds the contribution 
that it belongs to
         * this could be either a local directory of a jar file.
         * 
         * @param classLoader
@@ -82,4 +92,137 @@
         
        return contributionURL;
     } 
+    
+    
+    /** 
+     * A rather ugly method to find out to fix the url of the service, 
assuming that there
+     * is one. 
+     *  
+     * we can't get is out of a service reference
+     * the component itself doesn't know how to get it  
+     * the binding can't to do it automatically as it's not the sca binding
+     * 
+     * TODO - This would be better done by passing out a serializable 
reference to service discovery 
+     *         but this doesn't work yet     
+     * 
+     * @return node manager url
+     */    
+    public static void fixUpNodeServiceUrls(List<Component> nodeComponents, 
String nodeUrlString)
+      throws MalformedURLException, UnknownHostException {
+        String nodeManagerUrl = null;
+      
+        for(Component component : nodeComponents){
+            for (ComponentService service : component.getServices() ){
+                for (Binding binding : service.getBindings() ) {
+                    fixUpBindingUrl(binding, nodeUrlString);  
+                }
+            }            
+        }
+    }
+    
+    public static void fixUpNodeReferenceUrls(List<Component> nodeComponents, 
String domainUrlString)
+      throws MalformedURLException, UnknownHostException{
+        String nodeManagerUrl = null;
+              
+        for(Component component : nodeComponents){
+            for (ComponentReference reference : component.getReferences() ){
+                if ( reference.getName().equals("domainManager") ||
+                     reference.getName().equals("scaDomainService")) {
+                    for (Binding binding : reference.getBindings() ) {
+                        fixUpBindingUrl(binding, domainUrlString);  
+                    }
+                }
+            }            
+        }
+    }    
+    
+    public static String getNodeManagerServiceUrl(List<Component> 
nodeComponents){
+        String nodeManagerUrl = null;
+              
+        for(Component component : nodeComponents){
+            for (ComponentService service : component.getServices() ){
+                
+                if ( service.getName().equals("NodeManagerService")) {
+                    nodeManagerUrl = service.getBindings().get(0).getURI();
+                }
+            }            
+        }
+        
+        return nodeManagerUrl;
+    }    
+    
+    /**
+     * For http(s) protocol find a port that isn't in use and make sure the 
domain name 
+     * is the real domain name
+     * 
+     * @param binding
+     * @param nodeURL the URL provided as the identifier of the node
+     */
+    public static void fixUpBindingUrl(Binding binding, String manualUrlString)
+      throws MalformedURLException, UnknownHostException{
+
+        String urlString = binding.getURI(); 
+        
+        // only going to fiddle with bindings that use HTTP protocol
+        if( ((urlString.startsWith("http") != true ) &&
+            (urlString.startsWith("https") != true )) ||
+            (binding instanceof SCABinding)) {
+            return;
+        }
+        
+        URL bindingUrl =  new URL(urlString);
+        String originalHost = bindingUrl.getHost();
+        String newHost = null;
+        int originalPort = bindingUrl.getPort();
+        int newPort = 0;
+        
+        if (manualUrlString != null) {
+            // the required url has been specified manually
+            URL manualUrl = new URL(manualUrlString);
+            newHost = manualUrl.getHost();
+            newPort = manualUrl.getPort();
+            
+            if ( newHost.equals("localhost")){
+                newHost = InetAddress.getLocalHost().getHostName();
+            }
+        } else {
+            // discover the host and port information
+            newHost = InetAddress.getLocalHost().getHostName();
+            newPort = findFreePort(originalPort);
+        }
+        
+        // replace the old with the new
+        urlString = urlString.replace(String.valueOf(originalPort), 
String.valueOf(newPort));          
+        urlString = urlString.replace(originalHost, newHost);
+        
+        // set the address back into the NodeManager binding.
+        binding.setURI(urlString);   
+    }  
+    
+    /**
+     * Find a port on this machine that isn't in use. 
+     * 
+     * @param startPort
+     * @return
+     */
+    public static int findFreePort(int startPort)
+    {
+        boolean portIsBusy = true;
+        int freePort = startPort;
+        
+        do {
+            try {
+                ServerSocket socket = new ServerSocket(freePort);
+                portIsBusy = false;
+                socket.close();
+                break;
+            }
+            catch (IOException ex) {
+                // the port is busy
+                freePort = freePort + 1;
+            }
+        } while (portIsBusy || freePort > 9999); 
+        
+        return freePort;
+    }       
 }

Modified: 
incubator/tuscany/branches/sca-java-1.0/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/InMemoryTestCase.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/InMemoryTestCase.java?rev=575969&r1=575968&r2=575969&view=diff
==============================================================================
--- 
incubator/tuscany/branches/sca-java-1.0/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/InMemoryTestCase.java
 (original)
+++ 
incubator/tuscany/branches/sca-java-1.0/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/InMemoryTestCase.java
 Sat Sep 15 13:19:10 2007
@@ -69,21 +69,18 @@
             
             // create the node that runs the 
             // subtract component 
-            domainNodeC = new SCANodeImpl(DEFULT_DOMAIN_URI, "nodeC");
+            domainNodeC = new SCANodeImpl(DEFULT_DOMAIN_URI, 
"http://localhost:8088";);
             domainNodeC.start();
             
domainNodeC.getContributionManager().startContribution(InMemoryTestCase.class.getClassLoader().getResource("nodeC/"));
         
     
             // get a reference to the calculator service from domainA
             // which will be running this component
             calculatorServiceA = 
domainNodeA.getService(CalculatorService.class, "CalculatorServiceComponent");
-    } catch(Exception ex){
+            calculatorServiceB = 
domainNodeB.getService(CalculatorService.class, "CalculatorServiceComponent");
+            
+        } catch(Exception ex){
             System.err.println(ex.toString());
-    }
-        
-        // get a reference to the calculator service from domainA
-        // which will be running this component
-        calculatorServiceA = domainNodeA.getService(CalculatorService.class, 
"CalculatorServiceComponent1");
-        calculatorServiceB = domainNodeB.getService(CalculatorService.class, 
"CalculatorServiceComponent");       
+        }  
         
    }
 

Modified: 
incubator/tuscany/branches/sca-java-1.0/modules/node-impl/src/test/resources/nodeA/Calculator.composite
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/node-impl/src/test/resources/nodeA/Calculator.composite?rev=575969&r1=575968&r2=575969&view=diff
==============================================================================
--- 
incubator/tuscany/branches/sca-java-1.0/modules/node-impl/src/test/resources/nodeA/Calculator.composite
 (original)
+++ 
incubator/tuscany/branches/sca-java-1.0/modules/node-impl/src/test/resources/nodeA/Calculator.composite
 Sat Sep 15 13:19:10 2007
@@ -22,68 +22,17 @@
            xmlns:sample="http://sample";
            name="Calculator">
 
-    <component name="CalculatorServiceComponent1">
+    <component name="CalculatorServiceComponent">
                <implementation.java class="calculator.CalculatorServiceImpl"/>
         <reference name="addService" target="AddServiceComponent" />     
         <reference name="subtractService" target="SubtractServiceComponent" />
         <reference name="multiplyService" target="MultiplyServiceComponent"/>  
   
         <reference name="divideService" target="DivideServiceComponent" />
-    </component>
-    
-    <!--component name="CalculatorServiceComponent2">
-        <implementation.java class="calculator.CalculatorServiceImpl"/>        
        
-        <reference name="addService"> 
-            <interface.java interface="calculator.AddService"/>
-            <binding.ws 
wsdlElement="http://calculator/add#wsdl.port(AddService/AddSoapPort)"/>
-        </reference>      
-        <reference name="subtractService" target="SubtractServiceComponent" />
-        <reference name="multiplyService" target="MultiplyServiceComponent1"/> 
    
-        <reference name="divideService" target="DivideServiceComponent" />
-    </component--> 
-    
-    <!--component name="CalculatorServiceComponent3">
-        <implementation.java class="calculator.CalculatorServiceImpl"/>
-        <reference name="addService" target="AddServiceComponent" />
-        <reference name="subtractService" target="SubtractServiceComponent" />
-        <reference name="multiplyService" target="MultiplyServiceComponent">
-            <interface.java interface="calculator.MultiplyService" />
-            <binding.ws 
wsdlElement="http://calculator/multiply#wsdl.binding(MultiplySoapBinding)"/>
-        </reference>
-        <reference name="divideService" target="DivideServiceComponent" />
-    </component-->
-    
-    <!--component name="AddServiceComponent">
-        <implementation.java class="calculator.AddServiceImpl"/>
-        <service name="AddService">
-            <interface.java interface="calculator.AddService" />
-            <binding.ws 
wsdlElement="http://calculator/add#wsdl.port(AddService/AddSoapPort)"/>
-        </service>        
-    </component-->   
-    
-    <!--component name="SubtractServiceComponent1">
-        <implementation.java class="calculator.SubtractServiceImpl"/>      
-    </component-->  
-    
-    <!--component name="SubtractServiceComponent">
-        <implementation.java class="calculator.SubtractServiceImpl"/>
-        <service name="SubtractService">
-            <interface.java interface="calculator.SubtractService" />
-            <binding.sca uri="http://localhost:8087/SomeService"/>
-            <binding.ws 
wsdlElement="http://calculator/subtract#wsdl.port(SubtractService/SubtractSoapPort)"/>
-        </service>        
-    </component-->      
+    </component>  
 
     <component name="MultiplyServiceComponent">
         <implementation.java class="calculator.MultiplyServiceImpl" />
-    </component>
-    
-    <!--component name="MultiplyServiceComponent">
-        <implementation.java class="calculator.MultiplyServiceImpl" />
-        <service>
-            <interface.java interface="calculator.MultiplyService" />
-            <binding.ws 
wsdlElement="http://calculator/multiply#wsdl.binding(MultiplySoapBinding)"/>
-        </service>
-    </component-->     
+    </component>    
     
     <component name="DivideServiceComponent">
         <implementation.java class="calculator.DivideServiceImpl" />

Modified: 
incubator/tuscany/branches/sca-java-1.0/modules/node/src/main/resources/node.composite
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/modules/node/src/main/resources/node.composite?rev=575969&r1=575968&r2=575969&view=diff
==============================================================================
--- 
incubator/tuscany/branches/sca-java-1.0/modules/node/src/main/resources/node.composite
 (original)
+++ 
incubator/tuscany/branches/sca-java-1.0/modules/node/src/main/resources/node.composite
 Sat Sep 15 13:19:10 2007
@@ -17,6 +17,13 @@
  * specific language governing permissions and limitations
  * under the License.    
 -->
+
+
+<!--
+  The components used to interact with a Node. The components her are expect 
to be here
+  to edit with caution. In particular the service and reference urls are 
edited at runtime
+  in the in memory model. So don;t rely on the values here.  
+-->
 <composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
            targetNamespace="http://management";
            xmlns:sample="http://management";
@@ -31,11 +38,11 @@
         </service>
         <service name="NodeManagerService">
             <interface.java 
interface="org.apache.tuscany.sca.node.NodeManagerService"/>
-            <tuscany:binding.jsonrpc 
uri="http://localhost:8082/NodeManagerComponent/NodeManagerJson"/>
+            <tuscany:binding.jsonrpc 
uri="http://localhost:8080/NodeManagerComponent/NodeManagerJson"/>
         </service>
         <service name="ComponentManagerService">
             <interface.java 
interface="org.apache.tuscany.sca.node.ComponentManagerService"/>
-            <tuscany:binding.jsonrpc 
uri="http://localhost:8082/NodeManagerComponent/ComponentManagerJson"/>
+            <tuscany:binding.jsonrpc 
uri="http://localhost:8080/NodeManagerComponent/ComponentManagerJson"/>
         </service>
     </component>           
     
@@ -56,7 +63,7 @@
 
     <component name="node">
         <service name="Resource">
-            <tuscany:binding.http uri="http://localhost:8082/node"/>
+            <tuscany:binding.http uri="http://localhost:8080/node"/>
         </service>
        <tuscany:implementation.resource location="webroot"/>
     </component>    

Modified: 
incubator/tuscany/branches/sca-java-1.0/samples/calculator-distributed/src/test/java/calculator/DomainInMemoryTestCase.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-1.0/samples/calculator-distributed/src/test/java/calculator/DomainInMemoryTestCase.java?rev=575969&r1=575968&r2=575969&view=diff
==============================================================================
--- 
incubator/tuscany/branches/sca-java-1.0/samples/calculator-distributed/src/test/java/calculator/DomainInMemoryTestCase.java
 (original)
+++ 
incubator/tuscany/branches/sca-java-1.0/samples/calculator-distributed/src/test/java/calculator/DomainInMemoryTestCase.java
 Sat Sep 15 13:19:10 2007
@@ -35,7 +35,7 @@
  */
 public class DomainInMemoryTestCase {
     
-    private static String DEFAULT_DOMAIN_URL = "http:/localhost:8080";
+    private static String DEFAULT_DOMAIN_URL = "http://localhost:8080";;
 
     private static SCANodeImpl domain;
     private static SCANodeImpl domainNodeA;



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to