You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2007/09/07 13:41:56 UTC

svn commit: r573552 [2/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...

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

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

Added: incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/ComponentInfoImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/ComponentInfoImpl.java?rev=573552&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/ComponentInfoImpl.java (added)
+++ incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/ComponentInfoImpl.java Fri Sep  7 04:41:52 2007
@@ -0,0 +1,47 @@
+/*
+ * 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.node.impl;
+
+import java.io.Serializable;
+
+import org.apache.tuscany.sca.distributed.node.ComponentInfo;
+
+public class ComponentInfoImpl implements ComponentInfo, Serializable {
+    
+    private String name;
+    private boolean started;
+    
+    public String getName() {
+        return name;
+    }
+    
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public boolean isStarted() {
+        return started;
+    }
+    
+    public void setStarted(boolean started) {
+        this.started = started;
+    }
+
+}

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

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

Added: incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/ComponentManagerServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/ComponentManagerServiceImpl.java?rev=573552&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/ComponentManagerServiceImpl.java (added)
+++ incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/ComponentManagerServiceImpl.java Fri Sep  7 04:41:52 2007
@@ -0,0 +1,113 @@
+/*
+ * 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.node.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.assembly.RuntimeComponentImpl;
+import org.apache.tuscany.sca.distributed.domain.Domain;
+import org.apache.tuscany.sca.distributed.node.ComponentListener;
+import org.apache.tuscany.sca.distributed.node.ComponentManager;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
+
+public class ComponentManagerServiceImpl implements ComponentManager {
+
+    protected List<ComponentListener> listeners = new CopyOnWriteArrayList<ComponentListener>();
+    protected String domainURI;
+    protected String nodeName;
+    protected Composite nodeComposite;
+    protected ReallySmallRuntime nodeRuntime;
+    
+    public ComponentManagerServiceImpl(String domainURI, String nodeName, Composite nodeComposite, ReallySmallRuntime nodeRuntime) {
+        this.domainURI = domainURI;
+        this.nodeName = nodeName;
+        this.nodeComposite = nodeComposite;
+        this.nodeRuntime = nodeRuntime;
+    }
+
+    public void addComponentListener(ComponentListener listener) {
+        this.listeners.add(listener);
+    }
+
+    public void removeComponentListener(ComponentListener listener) {
+        this.listeners.remove(listener);
+    }
+
+    public Component getComponent(String componentName) {
+        for (Composite composite: nodeComposite.getIncludes()) {
+            for (Component component: composite.getComponents()) {
+                if (component.getName().equals(componentName)) {
+                    return component;
+                }
+            }
+        }
+        return null;
+    }
+    
+    public List<Component> getComponents() {
+        List<Component> components = new ArrayList<Component>();
+        for (Composite composite: nodeComposite.getIncludes()) {
+            components.addAll(composite.getComponents());
+        }
+        return components;
+    }
+
+    public void startComponent(Component component) throws ActivationException {
+        nodeRuntime.getCompositeActivator().start(component);
+        notifyComponentStarted(component);
+    }
+
+    public void stopComponent(Component component) throws ActivationException {
+        nodeRuntime.getCompositeActivator().stop(component);
+        notifyComponentStopped(component);
+    }
+
+    public void notifyComponentStarted(Component component) {
+        for (ComponentListener listener : listeners) {
+            try {
+                listener.componentStarted(component);
+            } catch (Exception e) {
+                e.printStackTrace(); // TODO: log
+            }
+        }
+    }
+
+    public void notifyComponentStopped(Component component) {
+        for (ComponentListener listener : listeners) {
+            try {
+                listener.componentStopped(component);
+            } catch (Exception e) {
+                e.printStackTrace(); // TODO: log
+            }
+        }
+    }
+
+    public boolean isComponentStarted(Component component) {
+        RuntimeComponentImpl runtimeComponent = (RuntimeComponentImpl)component;
+        return runtimeComponent.isStarted();
+    }
+
+}

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

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

Added: incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/ContributionManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/ContributionManagerImpl.java?rev=573552&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/ContributionManagerImpl.java (added)
+++ incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/ContributionManagerImpl.java Fri Sep  7 04:41:52 2007
@@ -0,0 +1,159 @@
+/*
+ * 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.node.impl;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.impl.ModelResolverImpl;
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.assembly.RuntimeComponentImpl;
+import org.apache.tuscany.sca.distributed.domain.Domain;
+import org.apache.tuscany.sca.distributed.node.ContributionManager;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
+import org.apache.tuscany.sca.host.embedded.management.variation.ComponentListener;
+import org.apache.tuscany.sca.host.embedded.management.variation.ComponentManager;
+
+public class ContributionManagerImpl implements ContributionManager {
+
+    protected String domainURI;
+    protected String nodeName;
+    protected Composite nodeComposite;
+    protected ReallySmallRuntime nodeRuntime;
+    private ClassLoader classLoader;
+
+    private String contributionLocation;
+    private ModelResolver modelResolver;
+    private Contribution contribution; 
+    
+    public ContributionManagerImpl(String domainURI, String nodeName, Composite nodeComposite, ReallySmallRuntime nodeRuntime, ClassLoader classLoader, ModelResolver modelResolver) {
+        this.domainURI = domainURI;
+        this.nodeName = nodeName;
+        this.nodeComposite = nodeComposite;
+        this.nodeRuntime = nodeRuntime;
+        this.classLoader = classLoader;
+        this.modelResolver = modelResolver;
+        
+    	// work out what the contribution string if its not supplied 
+        if (contributionLocation == null){
+        	if (nodeName != null){
+        		// guess that it's in a directory with the node name
+        		contributionLocation = nodeName + "/";
+        	} else {
+        		// guess that it's in the current directory
+        		contributionLocation = "/";
+        	}
+        }
+
+        this.contributionLocation = contributionLocation;
+    }
+    
+    public String getContributionLocation(){
+    	return contributionLocation;
+    }
+   
+    public void addContribution(String contributionLocation)
+      throws ActivationException, ContributionException, IOException, CompositeBuilderException {        
+
+        URL contributionURL = classLoader.getResource(contributionLocation);
+    
+        if (contributionURL != null) {
+	        // Get ready to add contributions to the domain
+	        ContributionService contributionService = nodeRuntime.getContributionService();
+	        
+	        // Contribute the SCA application
+	        contribution = contributionService.contribute(contributionLocation, 
+	                                                      contributionURL, 
+	                                                      modelResolver, 
+	                                                      false);
+	        
+	        // Add the composites to the top level domain
+	        for(Composite composite: contribution.getDeployables()) {
+	        	nodeComposite.getIncludes().add(composite);
+	            nodeRuntime.getCompositeBuilder().build(composite); 
+	        }
+	        
+	        // activate all of the composites just loaded
+	        for(Composite composite: contribution.getDeployables()) {
+	            nodeRuntime.getCompositeActivator().activate(composite);     
+	        }
+        } else {
+        	throw new ActivationException("Contribution " + contributionLocation + " not found");
+        }              
+    }
+
+    public void removeContribution(String contributionLocation)
+      throws ActivationException, ContributionException {
+    	
+    	stopContribution(contributionLocation);
+    	
+        // Deactivate the composites
+    	 for(Composite composite: contribution.getDeployables()) {
+            nodeRuntime.getCompositeActivator().deactivate(composite);
+        }
+
+        // Remove the composites
+    	 for(Composite composite: contribution.getDeployables()) {
+            nodeComposite.getIncludes().remove(composite);
+        }
+
+        // Remove contribution
+        nodeRuntime.getContributionService().remove(contributionLocation);
+    }
+    
+    public void startContribution(String contributionLocation)
+      throws ActivationException, ContributionException, IOException, CompositeBuilderException  {
+    	
+    	if (contribution == null){
+    		addContribution(contributionLocation);
+    	}
+    	
+    	if (contribution != null) {
+	        for(Composite composite: contribution.getDeployables()) {
+	        	 nodeRuntime.getCompositeActivator().start(composite);
+	        }
+    	} else {
+    		throw new ActivationException("Contribution " + contributionLocation + " not added");
+    	}
+    }
+    
+    public void stopContribution(String contributionLocation)
+      throws ActivationException {
+    	if (contribution != null) {
+	        for(Composite composite: contribution.getDeployables()) {
+	       	 nodeRuntime.getCompositeActivator().stop(composite);
+	       }
+    	} else {
+    		throw new ActivationException("Contribution " + contributionLocation + " not added");
+    	}
+    }
+
+}

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

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

Added: incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/DomainFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/DomainFactoryImpl.java?rev=573552&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/DomainFactoryImpl.java (added)
+++ incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/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.distributed.node.impl;
+
+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/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/DomainFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/DomainManagerProxyImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/DomainManagerProxyImpl.java?rev=573552&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/DomainManagerProxyImpl.java (added)
+++ incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/DomainManagerProxyImpl.java Fri Sep  7 04:41:52 2007
@@ -0,0 +1,55 @@
+/*
+ * 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.node.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.distributed.domain.DomainManagerService;
+import org.apache.tuscany.sca.distributed.domain.NodeInfo;
+import org.apache.tuscany.sca.distributed.domain.impl.ServiceDiscoveryServiceImpl.ServiceEndpoint;
+import org.apache.tuscany.sca.distributed.node.NodeManagerService;
+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 DomainManagerProxyImpl implements DomainManagerService{
+    
+    @Reference
+    protected DomainManagerService domainManager;
+
+    public String registerNode(String domainUri, String nodeUri) {
+        return domainManager.registerNode(domainUri, nodeUri);
+    }
+
+    public String removeNode(String domainUri, String nodeUri) {
+        return domainManager.removeNode(domainUri, nodeUri);
+    }
+    
+    public List<NodeInfo> getNodeInfo(){
+        return domainManager.getNodeInfo();
+    }
+}

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

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

Added: incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/NodeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/NodeImpl.java?rev=573552&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/NodeImpl.java (added)
+++ incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/NodeImpl.java Fri Sep  7 04:41:52 2007
@@ -0,0 +1,526 @@
+/*
+ * 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.node.impl;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.URL;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+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.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.resolver.impl.ModelResolverImpl;
+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.DomainManagerService;
+import org.apache.tuscany.sca.distributed.domain.ServiceDiscoveryService;
+import org.apache.tuscany.sca.distributed.node.ComponentManager;
+import org.apache.tuscany.sca.distributed.node.ContributionManager;
+import org.apache.tuscany.sca.distributed.node.Node;
+import org.apache.tuscany.sca.distributed.node.NodeManagerInitService;
+import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
+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;
+
+/**
+ * A local representation of the sca domain running on a single node
+ * 
+ * @version $Rev: 552343 $ $Date$
+ */
+public class NodeImpl implements Domain, Node {
+	
+    private final static Logger logger = Logger.getLogger(NodeImpl.class.getName());
+	
+    final static String LOCAL_DOMAIN_URI = "localdomain";
+    final static String LOCAL_NODE_NAME = "localnode";
+    
+    private boolean isStandalone = false;
+    
+    // the domain used by the node to talk to the rest of the domain
+    private EmbeddedSCADomain managementRuntime;
+    
+    // class loader used to get the runtime going
+    private ClassLoader domainClassLoader;
+    
+    // representation of the private state of the node that the domain is running on
+    private String domainUri;    	
+    private String nodeUri;
+    private ReallySmallRuntime nodeRuntime;
+    private Composite nodeComposite; 
+    
+    // the managers used to control the domain node
+    private ComponentManagerServiceImpl componentManager;
+ //   private CompositeManagerImpl compositeManager;
+    private ContributionManagerImpl contributionManager;
+    
+    // the proxies to the domain
+    private ServiceDiscoveryService serviceDiscovery;
+    private DomainManagerService domainManager;
+    private NodeManagerInitService nodeManagerInit;
+       
+    // methods defined on the implementation only
+    
+    public NodeImpl()
+      throws ActivationException {
+        this.domainUri = LOCAL_DOMAIN_URI ; 
+        this.nodeUri = LOCAL_NODE_NAME;
+        this.isStandalone = true;
+        init();
+    }
+    
+    public NodeImpl(String domainUri)
+      throws ActivationException {
+        this.domainUri = domainUri; 
+        this.nodeUri = LOCAL_NODE_NAME;
+        this.isStandalone = true;
+        init();
+    }
+    
+    public NodeImpl(String domainUri, String nodeUri)
+    throws ActivationException {
+        this.domainUri = domainUri;
+        this.nodeUri = nodeUri;
+        this.isStandalone = false;
+        init();
+    }    
+    
+    /**
+     * Work out if we are representing a domain in memory or can go out to the network to 
+     * get domain information. This all depends on whether there is a management
+     * composite on the classpath
+     */
+    private void init()
+      throws ActivationException {
+        try {
+            if (domainClassLoader == null) {
+            	domainClassLoader = NodeImpl.class.getClassLoader(); 
+            }
+            
+            // create a node runtime for the domain contributions to run on
+            nodeRuntime = new ReallySmallRuntime(domainClassLoader);
+            
+          
+            // Check if node has been given a domain name to connect to
+            if (isStandalone) {
+            	logger.log(Level.INFO, "Domain node will be started stand-alone as no node name is provided");
+            	managementRuntime = null;
+            	serviceDiscovery = null;
+            } else {
+                createManagementNode();
+            }
+        } catch(ActivationException ex) {
+            throw ex;                        
+        } catch(Exception ex) {
+            throw new ActivationException(ex);
+        }
+    }
+    
+    private void createManagementNode()
+      throws ActivationException {
+        try {
+            // create a runtime for components to run on that will be used for talking to the 
+            // rest of the domain
+            String contributionString = "_node/";
+            URL contributionURL = domainClassLoader.getResource(contributionString);
+            
+            if ( contributionURL != null ){ 
+                logger.log(Level.INFO, 
+                           "Domain node will use node management contribution from " + 
+                           contributionURL);
+
+                
+                // start a local domain in order to talk to the logical domain
+                managementRuntime = new EmbeddedSCADomain(domainClassLoader, "node");   
+                managementRuntime.start();
+            
+                // add node composite to the management domain
+                ContributionService contributionService = managementRuntime.getContributionService();
+            
+                Contribution contribution = contributionService.contribute(nodeUri, 
+                                                                           contributionURL, 
+                                                                           false);
+                if (contribution.getDeployables().size() != 0) {
+                    Composite composite = contribution.getDeployables().get(0);
+                
+                    managementRuntime.getDomainComposite().getIncludes().add(composite);
+                    managementRuntime.getCompositeBuilder().build(composite);
+                    
+                    // deal with the special case of registering the node manager service 
+                    // 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. 
+                    String nodeManagerUrl = fixUpManagementServiceUrls();                    
+                  
+                    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
+                    serviceDiscovery =  managementRuntime.getService(ServiceDiscoveryService.class, "ServiceDiscoveryComponent");
+                    domainManager = managementRuntime.getService(DomainManagerService.class, "DomainManagerComponent");
+                    nodeManagerInit = managementRuntime.getService(NodeManagerInitService.class, "NodeManagerComponent/NodeManagerInitService");
+                    
+                    if (nodeManagerUrl != null) {
+                        if (isStandalone == false){
+                            try {
+                                
+                                serviceDiscovery.registerServiceEndpoint(domainUri, 
+                                                                         nodeUri, 
+                                                                         nodeUri + "NodeManagerService",
+                                                                         "",
+                                                                         nodeManagerUrl);
+                                
+                            } catch(Exception ex) {
+                                // not sure what to do here
+                                logger.log(Level.WARNING,  "Can't connect to domain manager");
+                            }
+                        }                        
+                    }
+                        
+                } else {
+                    throw new ActivationException("Node management contribution " + 
+                                                  contributionURL + 
+                                                  " found but could not be loaded");
+                }
+            } else {
+                throw new ActivationException("Node contribution " + 
+                                              contributionString + 
+                                              " not found on the classpath");
+            }
+        } catch(ActivationException ex) {
+            throw ex;                        
+        } 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 String fixUpManagementServiceUrls(){
+        String nodeManagerUrl = null;
+        
+        // First get the NodeManager binding from the model 
+        List<Component> components = managementRuntime.getDomainComposite().getIncludes().get(0).getComponents();
+        Component nodeManagerComponent = null;
+        
+        for(Component component : components){
+            for (ComponentService service : component.getServices() ){
+                for (Binding binding : service.getBindings() ) {
+                    fixUpBindingUrl(binding);  
+                }
+                
+                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 domains 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 
+    
+    public void start() throws ActivationException {
+        // Start the runtime
+        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. 
+        // TODO - No sure how this should be done properly. As a nod to this though
+        //        I have a domain factory which always returns the same domain
+        //        object
+        ModelFactoryExtensionPoint factories = nodeRuntime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
+        DomainFactoryImpl domainFactory = new DomainFactoryImpl(this);
+        factories.addFactory(domainFactory);
+        
+        // create the domain node managers
+        componentManager = new ComponentManagerServiceImpl(domainUri, nodeUri, nodeComposite, nodeRuntime);
+        contributionManager = new ContributionManagerImpl(domainUri, nodeUri, nodeComposite, nodeRuntime, domainClassLoader, null);
+        
+        
+        if (isStandalone == false){
+            // pass this object into the node manager
+            nodeManagerInit.setNode((Node)this);
+            
+            try {
+                // go out an 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");
+            }
+        }
+    }
+
+    public void stop() throws ActivationException {
+        // Stop the node
+    	nodeRuntime.stop();
+        
+        // Cleanup the top level composite
+        nodeComposite = null;
+        
+        // remove the manager objects
+        
+        // go out and remove this node from the wider domain
+        if (isStandalone == false){
+            try {
+                domainManager.removeNode(domainUri, nodeUri);
+            } catch(Exception ex) {
+                // not sure what to do here
+                logger.log(Level.WARNING,  "Can't connect to domain manager");
+            }
+        }
+    }    
+ 
+    public String getDomainUri(){
+        return domainUri;
+    }
+    
+    public String getNodeUri(){
+        return nodeUri;
+    }    
+    
+    public ComponentManager getComponentManager() {
+        return componentManager;
+    } 
+
+/*
+    public CompositeManager getCompositeManager() {
+        return compositeManager;
+    }
+*/
+    
+    public ContributionManager getContributionManager() {    	
+        return contributionManager;
+    }     
+    
+    public ContributionManager getContributionManager(ClassLoader classLoader) {
+        
+    	return new ContributionManagerImpl(domainUri, nodeUri, nodeComposite, nodeRuntime, classLoader, new ModelResolverImpl(classLoader));
+    }      
+
+    
+    /**
+     * Return an interface for registering local services and for
+     * finding remote services
+     * 
+     * @return The service discovery interface
+     */    
+    public ServiceDiscoveryService getServiceDiscovery(){
+        return serviceDiscovery;
+    }
+       
+    public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+        return (R)nodeRuntime.getProxyFactory().cast(target);
+    }
+
+    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 = componentManager.getComponent(componentName);
+        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/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/NodeImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/NodeManagerServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/NodeManagerServiceImpl.java?rev=573552&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/NodeManagerServiceImpl.java (added)
+++ incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/NodeManagerServiceImpl.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.node.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.distributed.node.ComponentInfo;
+import org.apache.tuscany.sca.distributed.node.ComponentManager;
+import org.apache.tuscany.sca.distributed.node.ComponentManagerService;
+import org.apache.tuscany.sca.distributed.node.Node;
+import org.apache.tuscany.sca.distributed.node.NodeManagerService;
+import org.apache.tuscany.sca.distributed.node.NodeManagerInitService;
+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 NodeManagerServiceImpl implements NodeManagerService, NodeManagerInitService, ComponentManagerService {
+    
+    private Node node; 
+    
+    public String getNodeUri(){
+        return node.getNodeUri();
+    }
+    
+    // NodeManagerInitService
+    public void setNode(Node node){
+        this.node = node;
+    }
+    
+    // ComponentManagerService
+    public List<ComponentInfo> getComponentInfos() {
+        List<ComponentInfo> componentInfos = new ArrayList<ComponentInfo>();
+        for (Component component: node.getComponentManager().getComponents()) {
+            ComponentInfo componentInfo = new ComponentInfoImpl();
+            componentInfo.setName(component.getName());
+            componentInfo.setStarted(node.getComponentManager().isComponentStarted(component));
+            componentInfos.add(componentInfo);
+        }
+        return componentInfos;
+    }
+    
+    public ComponentInfo getComponentInfo(String componentName) {
+        Component component = node.getComponentManager().getComponent(componentName);
+        ComponentInfo componentInfo = new ComponentInfoImpl();
+        componentInfo.setName(component.getName());
+        componentInfo.setStarted(node.getComponentManager().isComponentStarted(component));
+        return componentInfo;
+    }
+    
+    public void startComponent(String componentName) throws ActivationException {
+        node.getComponentManager().startComponent(node.getComponentManager().getComponent(componentName));
+    }
+
+    public void stopComponent(String componentName) throws ActivationException {
+        node.getComponentManager().stopComponent(node.getComponentManager().getComponent(componentName));
+    }
+    
+    // TODO - ContributionManagerService
+}

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

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

Added: incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/ServiceDiscoveryProxyImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/ServiceDiscoveryProxyImpl.java?rev=573552&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/ServiceDiscoveryProxyImpl.java (added)
+++ incubator/tuscany/java/sca/modules/distributed-impl/src/main/java/org/apache/tuscany/sca/distributed/node/impl/ServiceDiscoveryProxyImpl.java Fri Sep  7 04:41:52 2007
@@ -0,0 +1,109 @@
+/*
+ * 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.node.impl;
+
+import org.apache.tuscany.sca.distributed.domain.ServiceDiscoveryService;
+import org.apache.tuscany.sca.distributed.domain.ServiceInfo;
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * Stores details of services exposed and retrieves details of remote services
+ * 
+ * @version $Rev: 552343 $ $Date$
+ */
+public class ServiceDiscoveryProxyImpl implements ServiceDiscoveryService{
+    
+    @Reference
+    protected ServiceDiscoveryService serviceDiscovery;
+     
+    /**
+     * 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
+     * @return dummy valus just so that we don;t have a void return which doesn't work 
+     */
+    public String registerServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName, String URL){
+        System.err.println("Registering service: [" + 
+                domainUri + " " +
+                nodeUri + " " +
+                serviceName + " " +
+                bindingName + " " +
+                URL +
+                "]");
+        
+        String dummy = null; 
+        
+     //   try {
+            dummy =  serviceDiscovery.registerServiceEndpoint(domainUri, nodeUri, serviceName, bindingName, URL);
+     //   } catch(Exception ex) {
+            // When we get round to caching we could keep a list of registered endpoints
+            // and try again later either when this object is called or when the 
+            // domain comes back up again
+            /* not sure this should be an exception 
+            throw new IllegalStateException("Unable to  registering service: "  +
+                                            domainUri + " " +
+                                            nodeUri + " " +
+                                            serviceName + " " +
+                                            bindingName + " " +
+                                            URL, ex );
+            */
+     //   }
+        
+        return dummy;
+    }
+    
+   
+    /**
+     * 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 = null;
+        
+        try {
+            url =  serviceDiscovery.findServiceEndpoint(domainUri, serviceName, bindingName);
+        } catch(Exception ex) {
+            // do nothing here. 
+            // If we can't find a service fo what ever reason then just return null
+        }
+        
+        return url;
+    }
+    
+    public ServiceInfo getServiceInfo(){
+        return serviceDiscovery.getServiceInfo();
+    }
+    
+}

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

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

Modified: incubator/tuscany/java/sca/modules/distributed-impl/src/test/java/org/apache/tuscany/sca/distributed/impl/InMemoryTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/distributed-impl/src/test/java/org/apache/tuscany/sca/distributed/impl/InMemoryTestCase.java?rev=573552&r1=573551&r2=573552&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/distributed-impl/src/test/java/org/apache/tuscany/sca/distributed/impl/InMemoryTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/distributed-impl/src/test/java/org/apache/tuscany/sca/distributed/impl/InMemoryTestCase.java Fri Sep  7 04:41:52 2007
@@ -22,10 +22,7 @@
 
 import junit.framework.Assert;
 
-import org.apache.tuscany.sca.distributed.domain.DistributedSCADomain;
-import org.apache.tuscany.sca.distributed.domain.impl.DistributedSCADomainMemoryImpl;
-import org.apache.tuscany.sca.distributed.node.impl.EmbeddedNode;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.distributed.node.impl.NodeImpl;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -40,59 +37,61 @@
     
     private static String DEFULT_DOMAIN_NAME = "mydomain";
 
-    private static DistributedSCADomain distributedDomain;
-    private static EmbeddedNode nodeA;
-    private static SCADomain domainA;
-    private static EmbeddedNode nodeB;
-    private static SCADomain domainB;
-    private static EmbeddedNode nodeC;
+    private static NodeImpl registry;
+    private static NodeImpl domainNodeA;
+    private static NodeImpl domainNodeB;
+    private static NodeImpl domainNodeC;
     private static CalculatorService calculatorServiceA;
     private static CalculatorService calculatorServiceB;
 
     @BeforeClass
     public static void init() throws Exception {
-        System.out.println("Setting up distributed nodes");
              
-        // Create the distributed domain representation
-        distributedDomain = new DistributedSCADomainMemoryImpl(DEFULT_DOMAIN_NAME);
-        
-        // create the node that runs the 
-        // calculator component
-        nodeA = new EmbeddedNode("nodeA");
-        domainA = nodeA.attachDomain(distributedDomain);
-        nodeA.addContribution(DEFULT_DOMAIN_NAME, null);
-
-        // create the node that runs the 
-        // add component
-        nodeB = new EmbeddedNode("nodeB");
-        domainB = nodeB.attachDomain(distributedDomain);
-        nodeB.addContribution(DEFULT_DOMAIN_NAME, null);         
- 
-        // create the node that runs the 
-        // subtract component      
-        nodeC = new EmbeddedNode("nodeC");
-        nodeC.attachDomain(distributedDomain);
-        nodeC.addContribution(DEFULT_DOMAIN_NAME, null);  
-     
-        
-        // start all of the nodes
-        nodeA.start();
-        nodeB.start();
-        nodeC.start();
+        try {
+            System.out.println("Setting up domain registry");
+            
+            registry = new NodeImpl(DEFULT_DOMAIN_NAME);
+            registry.start();
+            registry.getContributionManager().startContribution("domain/");
+            
+            System.out.println("Setting up domain nodes");
+                   
+            // Create the domain representation
+            domainNodeA = new NodeImpl(DEFULT_DOMAIN_NAME, "nodeA");
+            domainNodeA.start();
+            domainNodeA.getContributionManager().startContribution("nodeA/");
+            
+            // Create the domain representation
+            domainNodeB = new NodeImpl(DEFULT_DOMAIN_NAME, "nodeB");
+            domainNodeB.start();
+            domainNodeB.getContributionManager().startContribution("nodeB/");        
+            
+            // create the node that runs the 
+            // subtract component 
+            domainNodeC = new NodeImpl(DEFULT_DOMAIN_NAME, "nodeC");
+            domainNodeC.start();
+            domainNodeC.getContributionManager().startContribution("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){
+            System.err.println(ex.toString());
+    }
         
         // get a reference to the calculator service from domainA
         // which will be running this component
-        calculatorServiceA = domainA.getService(CalculatorService.class, "CalculatorServiceComponent1");
-        calculatorServiceB = domainB.getService(CalculatorService.class, "CalculatorServiceComponent");       
+        calculatorServiceA = domainNodeA.getService(CalculatorService.class, "CalculatorServiceComponent1");
+        calculatorServiceB = domainNodeB.getService(CalculatorService.class, "CalculatorServiceComponent");       
         
    }
 
     @AfterClass
     public static void destroy() throws Exception {
         // stop the nodes and hence the domains they contain        
-        nodeA.stop();
-        nodeB.stop();    
-        nodeC.stop();
+        domainNodeA.stop();
+        domainNodeB.stop();    
+        domainNodeC.stop();
     }
 
     @Test

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

Propchange: incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/_node/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/_node/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:keywords = Red Date

Added: incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/_node/management.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/_node/management.composite?rev=573552&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/_node/management.composite (added)
+++ incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/_node/management.composite Fri Sep  7 04:41:52 2007
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           targetNamespace="http://management"
+           xmlns:sample="http://management"
+           xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+           name="Management">
+    
+    <component name="NodeManagerComponent">
+        <implementation.java class="org.apache.tuscany.sca.distributed.node.impl.NodeManagerServiceImpl"/>
+        <service name="NodeManagerInitService">
+            <interface.java interface="org.apache.tuscany.sca.distributed.node.NodeManagerInitService"/>
+        </service>
+        <service name="NodeManagerService">
+            <interface.java interface="org.apache.tuscany.sca.distributed.node.NodeManagerService"/>
+            <tuscany:binding.jsonrpc uri="http://localhost:8081/NodeManagerComponent/NodeManagerJson"/>
+        </service>
+        <service name="ComponentManagerService">
+            <interface.java interface="org.apache.tuscany.sca.distributed.node.ComponentManagerService"/>
+            <tuscany:binding.jsonrpc uri="http://localhost:8081/NodeManagerComponent/ComponentManagerJson"/>
+        </service>
+    </component>           
+    
+    <component name="DomainManagerComponent">
+        <implementation.java class="org.apache.tuscany.sca.distributed.node.impl.DomainManagerProxyImpl"/>
+        <reference name="domainManager">
+            <interface.java interface="org.apache.tuscany.sca.distributed.domain.DomainManagerService"/>
+            <binding.ws uri="http://localhost:8080/DomainManagerComponent/DomainManager"/>
+        </reference>
+    </component>
+    
+    <component name="ServiceDiscoveryComponent">
+        <implementation.java class="org.apache.tuscany.sca.distributed.node.impl.ServiceDiscoveryProxyImpl" />
+        <reference name="serviceDiscovery">
+            <binding.ws uri="http://localhost:8080/ServiceDiscoveryComponent/ServiceDiscovery"/>
+        </reference>
+    </component>
+    
+
+</composite>

Propchange: incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/_node/management.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/_node/management.composite
------------------------------------------------------------------------------
    svn:keywords = Red Date

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

Propchange: incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/domain/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/domain/META-INF/sca-contribution.xml
------------------------------------------------------------------------------
    svn:keywords = Red Date

Added: incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/domain/domain.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/domain/domain.composite?rev=573552&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/domain/domain.composite (added)
+++ incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/domain/domain.composite Fri Sep  7 04:41:52 2007
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+           targetNamespace="http://sample"
+           xmlns:sample="http://sample"
+           name="Domain">
+                 
+    <component name="DomainManagerComponent">
+        <implementation.java class="org.apache.tuscany.sca.distributed.domain.impl.DomainManagerServiceImpl"/>
+        <service name="DomainManagerService">
+            <interface.java interface="org.apache.tuscany.sca.distributed.domain.DomainManagerService"/>
+            <binding.ws uri="http://localhost:8080/DomainManagerComponent/DomainManager"/>
+        </service>
+        <reference name="serviceDiscovery" target="ServiceDiscoveryComponent"/>
+    </component>
+    
+    <component name="ServiceDiscoveryComponent">
+        <implementation.java class="org.apache.tuscany.sca.distributed.domain.impl.ServiceDiscoveryServiceImpl" />
+        <service name="ServiceDiscoveryService">
+            <interface.java interface="org.apache.tuscany.sca.distributed.domain.ServiceDiscoveryService"/>
+            <binding.sca uri="http://localhost:8080/ServiceDiscoveryComponent/ServiceDiscovery"/>
+            <binding.ws uri="http://localhost:8080/ServiceDiscoveryComponent/ServiceDiscovery"/>           
+        </service>
+    </component>    
+    
+</composite>

Propchange: incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/domain/domain.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/distributed-impl/src/test/resources/domain/domain.composite
------------------------------------------------------------------------------
    svn:keywords = Red Date

Modified: incubator/tuscany/java/sca/modules/distributed/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/distributed/pom.xml?rev=573552&r1=573551&r2=573552&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/distributed/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/distributed/pom.xml Fri Sep  7 04:41:52 2007
@@ -41,7 +41,19 @@
             <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>tuscany-assembly</artifactId>
             <version>1.0-incubating-SNAPSHOT</version>
-        </dependency>      
+        </dependency>   
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-contribution</artifactId>
+            <version>1.0-incubating-SNAPSHOT</version>
+        </dependency> 
+        
+         <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-core</artifactId>
+            <version>1.0-incubating-SNAPSHOT</version>
+        </dependency>  
                     
         <dependency>
             <groupId>org.easymock</groupId>

Added: incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/domain/Domain.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/domain/Domain.java?rev=573552&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/domain/Domain.java (added)
+++ incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/domain/Domain.java Fri Sep  7 04:41:52 2007
@@ -0,0 +1,94 @@
+/*
+ * 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;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+
+/**
+ * A handle to an SCA domain.
+ * 
+ * @version $Rev: 556897 $ $Date$
+ */
+public interface Domain {
+    
+    /**
+     * Returns the name of the distributed domain that this node
+     * is part of.
+     * 
+     * @return the domain Uri
+     */
+    public String getDomainUri();
+    
+    /**
+     * Returns the name of the name of this node
+     * 
+     * @return the node uri
+     */
+    public String getNodeUri();  
+         
+    
+    /**
+     * Return an interface for registering and looking up remote services
+     * 
+     * @return The service discovery interface
+     */    
+    public ServiceDiscoveryService getServiceDiscovery();
+
+    /**
+     * Cast a type-safe reference to a CallableReference. Converts a type-safe
+     * reference to an equivalent CallableReference; if the target refers to a
+     * service then a ServiceReference will be returned, if the target refers to
+     * a callback then a CallableReference will be returned.
+     * 
+     * @param target a reference proxy provided by the SCA runtime
+     * @param <B> the Java type of the business interface for the reference
+     * @param <R> the type of reference to be returned
+     * @return a CallableReference equivalent for the proxy
+     * @throws IllegalArgumentException if the supplied instance is not a
+     *             reference supplied by the SCA runtime
+     */
+    public abstract <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException;
+
+    /**
+     * Returns a proxy for a service provided by a component in the SCA domain.
+     * 
+     * @param businessInterface the interface that will be used to invoke the
+     *            service
+     * @param serviceName the name of the service
+     * @param <B> the Java type of the business interface for the service
+     * @return an object that implements the business interface
+     */
+    public abstract <B> B getService(Class<B> businessInterface, String serviceName);
+
+    /**
+     * Returns a ServiceReference for a service provided by a component in the
+     * SCA domain.
+     * 
+     * @param businessInterface the interface that will be used to invoke the
+     *            service
+     * @param serviceName the name of the service
+     * @param <B> the Java type of the business interface for the service
+     * @return a ServiceReference for the designated service
+     */
+    public abstract <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName);
+    
+}

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

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

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

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

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

Added: incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/domain/DomainManagerService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/domain/DomainManagerService.java?rev=573552&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/domain/DomainManagerService.java (added)
+++ incubator/tuscany/java/sca/modules/distributed/src/main/java/org/apache/tuscany/sca/distributed/domain/DomainManagerService.java Fri Sep  7 04:41:52 2007
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.distributed.domain;
+
+import java.util.List;
+
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * The management interface for distributed domain. This is resposible for 
+ * creating appropriate configuration on all the nodes that are running 
+ * domain nodes for the distributed domain. 
+ * 
+ * @version $Rev: 552343 $ $Date$
+ */
+@Remotable
+public interface DomainManagerService {
+
+    /**
+     * A node registers with the distributed domain manager. The mechanism whereby this
+     * registration interface is discovered is not defined. For example, JMS, JINI
+     * or a hard coded configuration could all be candidates in the java world. 
+     * 
+     * @param domainUri the string uri for the distributed domain
+     * @param nodeUri the string uri for the current node
+     * @param nodeManagementUrl the endpoint for the nodes management service
+     */
+    public String registerNode(String domainUri, String nodeUri);
+    
+    /**
+     * A node registers with the distributed domain manager. The mechanism whereby this
+     * registration interface is discovered is not defined. For example, JMS, JINI
+     * or a hard coded configuration could all be candidates in the java world. 
+     * 
+     * @param domainUri the string uri for the distributed domain
+     * @param nodeUri the string uri for the current node
+     * @param nodeManagementUrl the endpoint for the nodes management service
+     */
+    public String removeNode(String domainUri, String nodeUri);    
+    
+    /**
+     * Retrieve the configuration for the specified node. The return type is interesting
+     * here. There are many ways in which all of the information that comprises a 
+     * configuration can be provisioned onto a node, for example, shared file system,
+     * ftp, http. The return value is the url of where to look for the configuration 
+     * information. From a management point of view it is convenient to maintain all 
+     * current and previous node configurations. This can easily be achieved by providing
+     * a different URL each time the configuration is changed. 
+     *  
+     * @param domainUri the string uri for the distributed domain
+     * @param nodeUri the string uri for the current node
+     * @return the URL from where the configuration can be retrieved
+     */
+   //public String getDomainNodeConfiguration(String domainUri, String nodeUri);  
+    
+    /**
+     * Retrieve a list of all of the registered nodes 
+     * 
+     * @return the list of node information 
+     */
+    public List<NodeInfo> getNodeInfo();    
+}

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

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



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