summaryrefslogtreecommitdiffstats
path: root/tags/java/sca/1.0-RC1/modules/node-impl/src
diff options
context:
space:
mode:
Diffstat (limited to 'tags/java/sca/1.0-RC1/modules/node-impl/src')
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ComponentInfoImpl.java47
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ComponentManagerServiceImpl.java113
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ContributionManagerImpl.java189
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/DomainFactoryImpl.java51
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/DomainManagerProxyImpl.java52
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java562
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeManagerServiceImpl.java84
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ServiceDiscoveryProxyImpl.java113
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/AddService.java31
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/AddServiceImpl.java31
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/CalculatorService.java35
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/CalculatorServiceImpl.java74
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/DivideService.java28
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/DivideServiceImpl.java30
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/MultiplyService.java28
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/MultiplyServiceImpl.java30
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/SubtractService.java31
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/SubtractServiceImpl.java31
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/org/apache/tuscany/sca/distributed/impl/InMemoryTestCase.java111
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/_node/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/_node/management.composite65
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/domain/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/domain/domain.composite43
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeA/Calculator.composite92
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeA/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeA/wsdl/add.wsdl88
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeA/wsdl/multiply.wsdl81
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeA/wsdl/subtract.wsdl87
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeB/Calculator.composite45
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeB/META-INF/sca-contribution.xml24
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeC/Calculator.composite32
-rw-r--r--tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeC/META-INF/sca-contribution.xml24
32 files changed, 2324 insertions, 0 deletions
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ComponentInfoImpl.java b/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ComponentInfoImpl.java
new file mode 100644
index 0000000000..5e38c6bb81
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ComponentInfoImpl.java
@@ -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.node.impl;
+
+import java.io.Serializable;
+
+import org.apache.tuscany.sca.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;
+ }
+
+}
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ComponentManagerServiceImpl.java b/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ComponentManagerServiceImpl.java
new file mode 100644
index 0000000000..5256285abf
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ComponentManagerServiceImpl.java
@@ -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.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.node.ComponentListener;
+import org.apache.tuscany.sca.node.ComponentManager;
+import org.apache.tuscany.sca.domain.Domain;
+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();
+ }
+
+}
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ContributionManagerImpl.java b/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ContributionManagerImpl.java
new file mode 100644
index 0000000000..df99220e00
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ContributionManagerImpl.java
@@ -0,0 +1,189 @@
+/*
+ * 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.node.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+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.service.ContributionException;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.node.ContributionManager;
+import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
+
+public class ContributionManagerImpl implements ContributionManager {
+
+ protected String domainURI;
+ protected String nodeName;
+ protected Composite nodeComposite;
+ protected ReallySmallRuntime nodeRuntime;
+ private ClassLoader classLoader;
+
+ private ModelResolver modelResolver;
+
+ private Map<URL, Contribution> contributions = new HashMap<URL, 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;
+ }
+
+ public void addContribution(URL contributionLocation)
+ throws ActivationException, ContributionException, IOException, CompositeBuilderException {
+
+ if (contributionLocation != null) {
+ // Get ready to add contributions to the domain
+ ContributionService contributionService = nodeRuntime.getContributionService();
+
+ // Contribute the SCA application
+ Contribution contribution = contributionService.contribute(contributionLocation.toExternalForm(),
+ contributionLocation,
+ modelResolver,
+ false);
+
+ contributions.put(contributionLocation, contribution);
+
+ // 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(URL contributionLocation)
+ throws ActivationException, ContributionException {
+
+ Contribution contribution = contributions.get(contributionLocation);
+
+ 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.toExternalForm());
+ }
+
+ public void startContribution(URL contributionLocation)
+ throws ActivationException, ContributionException, IOException, CompositeBuilderException {
+
+ Contribution contribution = contributions.get(contributionLocation);
+
+ if (contribution == null){
+ addContribution(contributionLocation);
+ }
+
+ contribution = contributions.get(contributionLocation);
+
+ if (contribution != null) {
+ for(Composite composite: contribution.getDeployables()) {
+ nodeRuntime.getCompositeActivator().start(composite);
+ }
+ } else {
+ throw new ActivationException("Contribution " + contributionLocation + " not added");
+ }
+ }
+
+ public void stopContribution(URL contributionLocation)
+ throws ActivationException {
+
+ Contribution contribution = contributions.get(contributionLocation);
+
+ if (contribution != null) {
+ for(Composite composite: contribution.getDeployables()) {
+ nodeRuntime.getCompositeActivator().stop(composite);
+ }
+ } else {
+ throw new ActivationException("Contribution " + contributionLocation + " not added");
+ }
+ }
+
+ public void addContributionJAR(URL contributionJar) throws CompositeBuilderException, ActivationException {
+
+ ContributionService contributionService = nodeRuntime.getContributionService();
+
+ Contribution contribution = contributeJAR(contributionJar, contributionService);
+
+ // 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);
+ }
+
+ // start all the composites just loaded
+ for (Composite composite : contribution.getDeployables()) {
+ nodeRuntime.getCompositeActivator().start(composite);
+ }
+ }
+
+ protected Contribution contributeJAR(URL contributionJar, ContributionService contributionService) throws ActivationException {
+ InputStream is;
+ try {
+ is = contributionJar.openStream();
+ } catch (IOException e) {
+ throw new ActivationException(e);
+ }
+ Contribution contribution;
+ try {
+ contribution = contributionService.contribute(contributionJar.toString(), contributionJar, is, modelResolver);
+ } catch (Exception e) {
+ throw new ActivationException(e);
+ }
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ throw new ActivationException(e);
+ }
+ }
+ return contribution;
+ }
+}
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/DomainFactoryImpl.java b/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/DomainFactoryImpl.java
new file mode 100644
index 0000000000..02b61a72f5
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/DomainFactoryImpl.java
@@ -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.node.impl;
+
+import org.apache.tuscany.sca.domain.Domain;
+import org.apache.tuscany.sca.domain.DomainFactory;
+import org.apache.tuscany.sca.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: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+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;
+ }
+
+}
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/DomainManagerProxyImpl.java b/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/DomainManagerProxyImpl.java
new file mode 100644
index 0000000000..e68ecce2b4
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/DomainManagerProxyImpl.java
@@ -0,0 +1,52 @@
+/*
+ * 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.node.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.domain.DomainManagerService;
+import org.apache.tuscany.sca.domain.NodeInfo;
+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: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+@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();
+ }
+}
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
new file mode 100644
index 0000000000..8beebdfc44
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
@@ -0,0 +1,562 @@
+/*
+ * 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.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.node.ComponentManager;
+import org.apache.tuscany.sca.node.ContributionManager;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeManagerInitService;
+import org.apache.tuscany.sca.domain.Domain;
+import org.apache.tuscany.sca.domain.DomainManagerService;
+import org.apache.tuscany.sca.domain.ServiceDiscoveryService;
+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: 2007-09-09 23:54:46 +0100 (Sun, 09 Sep 2007) $
+ */
+public class NodeImpl implements Domain, Node {
+
+ private final static Logger logger = Logger.getLogger(NodeImpl.class.getName());
+
+ public final static String LOCAL_DOMAIN_URI = "localdomain";
+ public final static String LOCAL_NODE_URI = "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
+
+ /**
+ * Default constructor creates a standalone node with no connectivity to a wider
+ * domain and no local web page.
+ */
+ public NodeImpl()
+ throws ActivationException {
+ this.domainUri = LOCAL_DOMAIN_URI ;
+ this.nodeUri = LOCAL_NODE_URI;
+ this.isStandalone = true;
+ init();
+ }
+
+ /**
+ * 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
+ * @throws ActivationException
+ */
+ public NodeImpl(String domainUri, String nodeUri)
+ throws ActivationException {
+ this.domainUri = domainUri;
+ this.nodeUri = nodeUri;
+ this.isStandalone = false;
+ init();
+ }
+
+ /**
+ * 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 classpath the classpath to use for loading system resources for the node
+ * @throws ActivationException
+ */
+ public NodeImpl(String domainUri, String nodeUri, ClassLoader cl)
+ throws ActivationException {
+ this.domainUri = domainUri;
+ this.nodeUri = nodeUri;
+ this.domainClassLoader = cl;
+ this.isStandalone = LOCAL_DOMAIN_URI.equals(domainUri);
+ 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 node and domain name are not 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.
+ 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");
+
+ // Now get the uri back out of the component no it has been build and started
+ // TODO - this doesn't pick up the url from external hosting environments
+ String nodeManagerUrl = getNodeManagerServiceUrl();
+
+ 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 void fixUpManagementServiceUrls(){
+ 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
+
+ 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. I.e. this node
+ 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 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");
+ }
+ }
+ }
+
+ 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);
+ }
+ }
+ }
+
+}
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeManagerServiceImpl.java b/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeManagerServiceImpl.java
new file mode 100644
index 0000000000..2cb8a0232f
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeManagerServiceImpl.java
@@ -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.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.node.ComponentInfo;
+import org.apache.tuscany.sca.node.ComponentManagerService;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeManagerInitService;
+import org.apache.tuscany.sca.node.NodeManagerService;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Stores details of services exposed and retrieves details of remote services
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-11 18:45:36 +0100 (Tue, 11 Sep 2007) $
+ */
+@Scope("COMPOSITE")
+@Service(interfaces = {NodeManagerService.class, NodeManagerInitService.class, ComponentManagerService.class})
+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
+}
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ServiceDiscoveryProxyImpl.java b/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ServiceDiscoveryProxyImpl.java
new file mode 100644
index 0000000000..ac615ec97b
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ServiceDiscoveryProxyImpl.java
@@ -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.node.impl;
+
+import org.apache.tuscany.sca.domain.ServiceDiscoveryService;
+import org.apache.tuscany.sca.domain.ServiceInfo;
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * Stores details of services exposed and retrieves details of remote services
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-09 23:54:46 +0100 (Sun, 09 Sep 2007) $
+ */
+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();
+ }
+
+}
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/AddService.java b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/AddService.java
new file mode 100644
index 0000000000..797ebb4024
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/AddService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The Add service interface
+ */
+@Remotable
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/AddServiceImpl.java b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..1a63d4ff77
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/AddServiceImpl.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Add service
+ */
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ System.out.println("AddService - add " + n1 + " and " + n2);
+ return n1 + n2;
+ }
+
+}
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/CalculatorService.java b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..ad87375529
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/CalculatorService.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/CalculatorServiceImpl.java b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..8ee640ed6b
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/CalculatorServiceImpl.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ @Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ @Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ public double add(double n1, double n2) {
+ System.out.println("CalculatorService - add " + n1 + " and " + n2);
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ System.out.println("CalculatorService - subtract " + n1 + " and " + n2);
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ System.out.println("CalculatorService - multiply " + n1 + " and " + n2);
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ System.out.println("CalculatorService - divide " + n1 + " and " + n2);
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/DivideService.java b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/DivideService.java
new file mode 100644
index 0000000000..ef6a8b375b
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/DivideService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The divide service interface
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/DivideServiceImpl.java b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..8c33862f6d
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/DivideServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Divide service.
+ */
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ return n1 / n2;
+ }
+
+}
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/MultiplyService.java b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..db568cc762
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/MultiplyService.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/MultiplyServiceImpl.java b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..c7fbc73c00
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/MultiplyServiceImpl.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the Multiply service.
+ */
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ return n1 * n2;
+ }
+
+}
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/SubtractService.java b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..615320e670
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/SubtractService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The interface for the multiply service
+ */
+@Remotable
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/SubtractServiceImpl.java b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..abf2777c7d
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/calculator/SubtractServiceImpl.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package calculator;
+
+/**
+ * An implementation of the subtract service.
+ */
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ System.out.println("SubtractService - subtract " + n1 + " and " + n2);
+ return n1 - n2;
+ }
+
+}
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/org/apache/tuscany/sca/distributed/impl/InMemoryTestCase.java b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/org/apache/tuscany/sca/distributed/impl/InMemoryTestCase.java
new file mode 100644
index 0000000000..aa5fada921
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/java/org/apache/tuscany/sca/distributed/impl/InMemoryTestCase.java
@@ -0,0 +1,111 @@
+/*
+ * 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.impl;
+
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import calculator.CalculatorService;
+
+/**
+ * Runs a distributed domain in a single VM by using and in memory
+ * implementation of the distributed domain
+ */
+public class InMemoryTestCase {
+
+ private static String DEFULT_DOMAIN_NAME = "mydomain";
+
+ 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 {
+
+ try {
+ System.out.println("Setting up domain registry");
+
+ registry = new NodeImpl();
+ registry.start();
+ registry.getContributionManager().startContribution(InMemoryTestCase.class.getClassLoader().getResource("domain/"));
+
+ System.out.println("Setting up calculator ");
+
+ // Create the domain representation
+ domainNodeA = new NodeImpl(DEFULT_DOMAIN_NAME, "nodeA");
+ domainNodeA.start();
+ domainNodeA.getContributionManager().startContribution(InMemoryTestCase.class.getClassLoader().getResource("nodeA/"));
+
+ // Create the domain representation
+ domainNodeB = new NodeImpl(DEFULT_DOMAIN_NAME, "nodeB");
+ domainNodeB.start();
+ domainNodeB.getContributionManager().startContribution(InMemoryTestCase.class.getClassLoader().getResource("nodeB/"));
+
+ // create the node that runs the
+ // subtract component
+ domainNodeC = new NodeImpl(DEFULT_DOMAIN_NAME, "nodeC");
+ 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){
+ 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");
+
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ // stop the nodes and hence the domains they contain
+ domainNodeA.stop();
+ domainNodeB.stop();
+ domainNodeC.stop();
+ }
+
+ @Test
+ public void testCalculator() throws Exception {
+
+ // Calculate
+ Assert.assertEquals(calculatorServiceA.add(3, 2), 5.0);
+ Assert.assertEquals(calculatorServiceA.subtract(3, 2), 1.0);
+ Assert.assertEquals(calculatorServiceA.multiply(3, 2), 6.0);
+ Assert.assertEquals(calculatorServiceA.divide(3, 2), 1.5);
+ Assert.assertEquals(calculatorServiceB.add(3, 2), 5.0);
+ Assert.assertEquals(calculatorServiceB.subtract(3, 2), 1.0);
+ Assert.assertEquals(calculatorServiceB.multiply(3, 2), 6.0);
+ Assert.assertEquals(calculatorServiceB.divide(3, 2), 1.5);
+
+ }
+}
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/_node/META-INF/sca-contribution.xml b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/_node/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..b73217ebb8
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/_node/META-INF/sca-contribution.xml
@@ -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
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/_node/management.composite b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/_node/management.composite
new file mode 100644
index 0000000000..706337d0a2
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/_node/management.composite
@@ -0,0 +1,65 @@
+<?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.node.impl.NodeManagerServiceImpl"/>
+ <service name="NodeManagerInitService">
+ <interface.java interface="org.apache.tuscany.sca.node.NodeManagerInitService"/>
+ <binding.sca/>
+ </service>
+ <service name="NodeManagerService">
+ <interface.java interface="org.apache.tuscany.sca.node.NodeManagerService"/>
+ <tuscany:binding.jsonrpc uri="http://localhost:8082/NodeManagerComponent/NodeManagerJson"/>
+ </service>
+ <service name="ComponentManagerService">
+ <interface.java interface="org.apache.tuscany.sca.node.ComponentManagerService"/>
+ <tuscany:binding.jsonrpc uri="http://localhost:8082/NodeManagerComponent/ComponentManagerJson"/>
+ </service>
+ </component>
+
+ <component name="DomainManagerComponent">
+ <implementation.java class="org.apache.tuscany.sca.node.impl.DomainManagerProxyImpl"/>
+ <reference name="domainManager">
+ <interface.java interface="org.apache.tuscany.sca.domain.DomainManagerService"/>
+ <binding.ws uri="http://localhost:8080/DomainManagerComponent/DomainManager"/>
+ </reference>
+ </component>
+
+ <component name="ServiceDiscoveryComponent">
+ <implementation.java class="org.apache.tuscany.sca.node.impl.ServiceDiscoveryProxyImpl" />
+ <reference name="serviceDiscovery">
+ <binding.ws uri="http://localhost:8080/ServiceDiscoveryComponent/ServiceDiscovery"/>
+ </reference>
+ </component>
+
+ <component name="node">
+ <service name="Resource">
+ <tuscany:binding.http uri="http://localhost:8082/node"/>
+ </service>
+ <tuscany:implementation.resource location="webroot"/>
+ </component>
+
+
+</composite>
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/domain/META-INF/sca-contribution.xml b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/domain/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..5725d12fd5
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/domain/META-INF/sca-contribution.xml
@@ -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
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/domain/domain.composite b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/domain/domain.composite
new file mode 100644
index 0000000000..d2fdb88ddc
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/domain/domain.composite
@@ -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.domain.impl.DomainManagerServiceImpl"/>
+ <service name="DomainManagerService">
+ <interface.java interface="org.apache.tuscany.sca.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.domain.impl.ServiceDiscoveryServiceImpl" />
+ <service name="ServiceDiscoveryService">
+ <interface.java interface="org.apache.tuscany.sca.domain.ServiceDiscoveryService"/>
+ <binding.sca uri="http://localhost:8080/ServiceDiscoveryComponent/ServiceDiscovery"/>
+ <binding.ws uri="http://localhost:8080/ServiceDiscoveryComponent/ServiceDiscovery"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeA/Calculator.composite b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeA/Calculator.composite
new file mode 100644
index 0000000000..a43491f509
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeA/Calculator.composite
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent1">
+ <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 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 name="DivideServiceComponent">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeA/META-INF/sca-contribution.xml b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeA/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..3f9ed8024b
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeA/META-INF/sca-contribution.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:Calculator"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeA/wsdl/add.wsdl b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeA/wsdl/add.wsdl
new file mode 100644
index 0000000000..5dda2c214e
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeA/wsdl/add.wsdl
@@ -0,0 +1,88 @@
+<?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.
+-->
+<wsdl:definitions targetNamespace="http://calculator/add"
+ xmlns:tns="http://calculator/add"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="add">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified"
+ targetNamespace="http://calculator/add"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="add">
+ <complexType>
+ <sequence>
+ <element name="n1" type="xsd:double"/>
+ <element name="n2" type="xsd:double"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="addResponse">
+ <complexType>
+ <sequence>
+ <element name="response" type="xsd:double"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="addRequest">
+ <wsdl:part element="tns:add" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="addResponse">
+ <wsdl:part element="tns:addResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="Add">
+ <wsdl:operation name="add">
+ <wsdl:input message="tns:addRequest" name="addRequest"/>
+ <wsdl:output message="tns:addResponse" name="addResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="AddSoapBinding" type="tns:Add">
+ <wsdlsoap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="add">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="addRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="addResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="AddService">
+ <wsdl:port binding="tns:AddSoapBinding" name="AddSoapPort">
+ <!--wsdlsoap:address location="http://localhost:8085/sample-calculator-webapp-ws/services/AddService"/-->
+ <wsdlsoap:address location="http://localhost:8085/AddServiceComponent"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeA/wsdl/multiply.wsdl b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeA/wsdl/multiply.wsdl
new file mode 100644
index 0000000000..81033cc9ec
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeA/wsdl/multiply.wsdl
@@ -0,0 +1,81 @@
+<?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.
+-->
+<wsdl:definitions targetNamespace="http://calculator/multiply"
+ xmlns:tns="http://calculator/multiply"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="multiply">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified"
+ targetNamespace="http://calculator/multiply"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="multiply">
+ <complexType>
+ <sequence>
+ <element name="n1" type="xsd:double"/>
+ <element name="n2" type="xsd:double"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="multiplyResponse">
+ <complexType>
+ <sequence>
+ <element name="response" type="xsd:double"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="multiplyRequest">
+ <wsdl:part element="tns:multiply" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="multiplyResponse">
+ <wsdl:part element="tns:multiplyResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="Multiply">
+ <wsdl:operation name="multiply">
+ <wsdl:input message="tns:multiplyRequest" name="multiplyRequest"/>
+ <wsdl:output message="tns:multiplyResponse" name="multiplyResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="MultiplySoapBinding" type="tns:Multiply">
+ <wsdlsoap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="multiply">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="multiplyRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="multiplyResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeA/wsdl/subtract.wsdl b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeA/wsdl/subtract.wsdl
new file mode 100644
index 0000000000..ed015d31c2
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeA/wsdl/subtract.wsdl
@@ -0,0 +1,87 @@
+<?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.
+-->
+<wsdl:definitions targetNamespace="http://calculator/subtract"
+ xmlns:tns="http://calculator/subtract"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="subtract">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified"
+ targetNamespace="http://calculator/subtract"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="subtract">
+ <complexType>
+ <sequence>
+ <element name="n1" type="xsd:double"/>
+ <element name="n2" type="xsd:double"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="subtractResponse">
+ <complexType>
+ <sequence>
+ <element name="response" type="xsd:double"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="subtractRequest">
+ <wsdl:part element="tns:subtract" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="subtractResponse">
+ <wsdl:part element="tns:subtractResponse" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:portType name="Subtract">
+ <wsdl:operation name="subtract">
+ <wsdl:input message="tns:subtractRequest" name="subtractRequest"/>
+ <wsdl:output message="tns:subtractResponse" name="subtractResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="SubtractSoapBinding" type="tns:Subtract">
+ <wsdlsoap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="subtract">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="subtractRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="subtractResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="SubtractService">
+ <wsdl:port binding="tns:SubtractSoapBinding" name="SubtractSoapPort">
+ <wsdlsoap:address location="http://localhost:8088/SubtractServiceComponent"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeB/Calculator.composite b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeB/Calculator.composite
new file mode 100644
index 0000000000..08abaf40ce
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeB/Calculator.composite
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="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="MultiplyServiceComponent">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.AddServiceImpl" />
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeB/META-INF/sca-contribution.xml b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeB/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..3f9ed8024b
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeB/META-INF/sca-contribution.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:Calculator"/>
+</contribution> \ No newline at end of file
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeC/Calculator.composite b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeC/Calculator.composite
new file mode 100644
index 0000000000..4ef4c5ddb6
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeC/Calculator.composite
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Calculator">
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.SubtractServiceImpl" />
+ <service name="SubtractService">
+ <binding.sca uri="http://localhost:8086/SubtractServiceComponent"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeC/META-INF/sca-contribution.xml b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeC/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..3f9ed8024b
--- /dev/null
+++ b/tags/java/sca/1.0-RC1/modules/node-impl/src/test/resources/nodeC/META-INF/sca-contribution.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:Calculator"/>
+</contribution> \ No newline at end of file