summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/tags/1.0.1/modules/domain-impl
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:26:33 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:26:33 +0000
commita40e527938d76ba71f211da7e327adb50384ba69 (patch)
treecb8f99f1727122b040a3f0fbb6649292b6a74302 /sca-java-1.x/tags/1.0.1/modules/domain-impl
parent968721109881107520d7aefa91d7fcc0519d7739 (diff)
Moving 1.x tags
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835157 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/tags/1.0.1/modules/domain-impl')
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/DISCLAIMER8
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/LICENSE205
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/NOTICE6
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/pom.xml140
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerNodeImpl.java170
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerServiceImpl.java118
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainFactoryImpl.java54
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainImpl.java662
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainUtil.java86
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/ContributionInfoImpl.java89
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/DomainInfoImpl.java99
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/NodeInfoImpl.java99
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/CompositeImpl.java54
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ContributionImpl.java87
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainImpl.java94
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainModelFactoryImpl.java80
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/NodeImpl.java93
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ServiceImpl.java89
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/resources/domain.composite49
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/resources/webroot/domain.pngbin0 -> 718 bytes
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/resources/webroot/index.html139
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/resources/webroot/node.pngbin0 -> 296 bytes
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/resources/webroot/style.css176
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/AddService.java31
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/AddServiceImpl.java31
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/CalculatorService.java35
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/CalculatorServiceImpl.java74
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/DivideService.java28
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/DivideServiceImpl.java30
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/MultiplyService.java28
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/MultiplyServiceImpl.java30
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/SubtractService.java31
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/SubtractServiceImpl.java31
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/org/apache/tuscany/sca/domain/impl/DomainImplTestCase.java93
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/resources/nodeA/Calculator.composite41
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/resources/nodeA/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/resources/nodeB/Calculator.composite29
37 files changed, 3133 insertions, 0 deletions
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/DISCLAIMER b/sca-java-1.x/tags/1.0.1/modules/domain-impl/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/DISCLAIMER
@@ -0,0 +1,8 @@
+Apache Tuscany is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
+required of all newly accepted projects until a further review indicates that
+the infrastructure, communications, and decision making process have stabilized
+in a manner consistent with other successful ASF projects. While incubation
+status is not necessarily a reflection of the completeness or stability of the
+code, it does indicate that the project has yet to be fully endorsed by the ASF.
+
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/LICENSE b/sca-java-1.x/tags/1.0.1/modules/domain-impl/LICENSE
new file mode 100644
index 0000000000..6e529a25c4
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/LICENSE
@@ -0,0 +1,205 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
+
+
+
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/NOTICE b/sca-java-1.x/tags/1.0.1/modules/domain-impl/NOTICE
new file mode 100644
index 0000000000..eb1926d971
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/NOTICE
@@ -0,0 +1,6 @@
+${pom.name}
+Copyright (c) 2005 - 2007 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/pom.xml b/sca-java-1.x/tags/1.0.1/modules/domain-impl/pom.xml
new file mode 100644
index 0000000000..1798f6b987
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/pom.xml
@@ -0,0 +1,140 @@
+<?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.
+-->
+<project>
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>1.0.1-incubating</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-domain-impl</artifactId>
+ <name>Apache Tuscany SCA Domain Implementation</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.0.1-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>1.0.1-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.0.1-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.0.1-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.0.1-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain</artifactId>
+ <version>1.0.1-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node</artifactId>
+ <version>1.0.1-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>1.0.1-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-adb</artifactId>
+ <version>1.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.0.1-incubating</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-tomcat</artifactId>
+ <version>1.0.1-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.0.1-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-axis2</artifactId>
+ <version>1.0.1-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <version>1.0.1-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-http</artifactId>
+ <version>1.0.1-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-resource</artifactId>
+ <version>1.0.1-incubating</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerNodeImpl.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerNodeImpl.java
new file mode 100644
index 0000000000..d5a7cebf81
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerNodeImpl.java
@@ -0,0 +1,170 @@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.domain.impl;
+
+import java.net.URL;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.DomainException;
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainSPI;
+import org.apache.tuscany.sca.domain.model.Domain;
+import org.apache.tuscany.sca.node.NodeException;
+import org.apache.tuscany.sca.node.SCANode;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+/**
+ * A dummy representation of and SCA Node used simply to control the
+ * endpoint of a callable reference
+ * We can remove this if we change the runtime over to referencing the
+ * domain directly rather than going via the node.
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-09 23:54:46 +0100 (Sun, 09 Sep 2007) $
+ */
+public class DomainManagerNodeImpl implements SCANode {
+
+ private final static Logger logger = Logger.getLogger(DomainManagerNodeImpl.class.getName());
+
+ private String nodeEndpoint;
+ private SCADomain scaDomain = new DomainManagerDomainImpl();
+ private SCADomainSPI realSCADomain = null;
+
+ class DomainManagerDomainImpl implements SCADomainSPI {
+ public String addNode(String nodeURI, String nodeURL){
+ return null;
+ }
+
+ public String removeNode(String nodeURI){
+ return null;
+ }
+
+ public void registerContribution(String nodeURI, String contributionURI, String contributionURL) {
+ }
+
+ public void unregisterContribution(String contributionURI){
+ }
+
+ public String registerServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName, String URL){
+ return null;
+ }
+
+ public String removeServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName){
+ return null;
+ }
+
+ public String findServiceEndpoint(String domainUri, String serviceName, String bindingName){
+ if (nodeEndpoint != null){
+ return nodeEndpoint;
+ } else {
+ return realSCADomain.findServiceEndpoint(domainUri, serviceName, bindingName);
+ }
+
+ }
+
+ public Domain getDomainModel(){
+ return null;
+ }
+
+ // SCADomain API methods
+
+ public void start() throws DomainException {
+ }
+
+ public void stop() throws DomainException {
+ }
+
+ public String getURI(){
+ return null;
+ }
+
+ public void addContribution(String contributionURI, URL contributionURL) throws DomainException {
+ }
+
+ public void removeContribution(String uri) throws DomainException {
+ }
+
+ public void addDeploymentComposite(String contributionURI, String compositeXML) throws DomainException {
+ }
+
+ public void addToDomainLevelComposite(QName compositeQName) throws DomainException {
+ }
+
+ public void removeFromDomainLevelComposite(QName compositeQName) throws DomainException {
+ }
+
+ public void startComposite(QName compositeName) throws DomainException {
+ }
+
+ public void stopComposite(QName qname) throws DomainException {
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+
+ return null;
+ }
+
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+ return null;
+ }
+
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name) {
+ return null;
+ }
+
+ }
+
+ public DomainManagerNodeImpl(SCADomainSPI scaDomain) {
+ this.realSCADomain = scaDomain;
+ }
+
+ public void setNodeEndpoint(String nodeEndpoint) {
+ this.nodeEndpoint = nodeEndpoint;
+ }
+
+ // API methods
+
+ public void start() throws NodeException {
+ }
+
+ public void stop() throws NodeException {
+
+ }
+
+ public String getURI(){
+ return null;
+ }
+
+ public SCADomain getDomain(){
+ return scaDomain;
+ }
+
+ public void addContribution(String contributionURI, URL contributionURL) throws NodeException {
+ }
+
+
+ public void deployComposite(QName compositeName) throws NodeException {
+
+ }
+
+
+}
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerServiceImpl.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerServiceImpl.java
new file mode 100644
index 0000000000..b843bde72a
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerServiceImpl.java
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.domain.impl;
+
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.domain.DomainManagerInitService;
+import org.apache.tuscany.sca.domain.DomainManagerNodeEventService;
+import org.apache.tuscany.sca.domain.SCADomainSPI;
+import org.apache.tuscany.sca.domain.management.DomainInfo;
+import org.apache.tuscany.sca.domain.management.DomainManagementService;
+import org.apache.tuscany.sca.domain.management.NodeInfo;
+import org.apache.tuscany.sca.domain.management.impl.DomainInfoImpl;
+import org.apache.tuscany.sca.domain.management.impl.NodeInfoImpl;
+import org.apache.tuscany.sca.domain.model.Domain;
+import org.apache.tuscany.sca.domain.model.Node;
+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-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+@Scope("COMPOSITE")
+@Service(interfaces = {DomainManagerNodeEventService.class, DomainManagerInitService.class, DomainManagementService.class})
+public class DomainManagerServiceImpl implements DomainManagerNodeEventService, DomainManagerInitService, DomainManagementService {
+
+ private final static Logger logger = Logger.getLogger(DomainManagerServiceImpl.class.getName());
+
+ private SCADomainSPI scaDomain;
+
+ // DomainManagerInitService methods
+
+ public void setDomain(SCADomainSPI scaDomain) {
+ this.scaDomain = scaDomain;
+ }
+
+ // DomainManagerNodeEventService methods
+
+ public String registerNode(String nodeURI, String nodeURL){
+ return scaDomain.addNode(nodeURI, nodeURL);
+ }
+
+ public String removeNode(String nodeURI){
+ return scaDomain.removeNode(nodeURI);
+ }
+
+ public void registerContribution(String nodeURI, String contributionURI, String contributionURL) {
+ scaDomain.registerContribution(nodeURI, contributionURI, contributionURL);
+ }
+
+ public void unregisterContribution(String contributionURI){
+ scaDomain.unregisterContribution(contributionURI);
+ }
+
+ public String registerServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName, String URL){
+ return scaDomain.registerServiceEndpoint(domainUri, nodeUri, serviceName, bindingName, URL);
+ }
+
+ public String removeServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName){
+ return scaDomain.removeServiceEndpoint(domainUri, nodeUri, serviceName, bindingName);
+ }
+
+
+ public String findServiceEndpoint(String domainUri, String serviceName, String bindingName){
+ return scaDomain.findServiceEndpoint(domainUri, serviceName, bindingName);
+ }
+
+ // DomainManagementService methods
+
+ public DomainInfo getDomainDescription(){
+
+ DomainInfo domainInfo = new DomainInfoImpl();
+ Domain domain = scaDomain.getDomainModel();
+
+ domainInfo.setDomainURI(domain.getDomainURI());
+ domainInfo.setDomainURL(domain.getDomainURL());
+ domainInfo.getNodes().addAll(domain.getNodes().keySet());
+ domainInfo.getContributions().addAll(domain.getContributions().keySet());
+ domainInfo.getDeployedComposites().addAll(domain.getDeployedComposites().keySet());
+
+ return domainInfo;
+ }
+
+ public NodeInfo getNodeDescription(String nodeURI){
+
+ NodeInfo nodeInfo = new NodeInfoImpl();
+ Domain domain = scaDomain.getDomainModel();
+ Node node = domain.getNodes().get(nodeURI);
+
+ nodeInfo.setNodeURI(nodeURI);
+ nodeInfo.setNodeURL(node.getNodeURL());
+ nodeInfo.getContributions().addAll(node.getContributions().keySet());
+ nodeInfo.getDeployedComposites().addAll(node.getDeployedComposites().keySet());
+ nodeInfo.getServices().addAll(node.getServices().keySet());
+
+ return nodeInfo;
+ }
+}
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainFactoryImpl.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainFactoryImpl.java
new file mode 100644
index 0000000000..8f741d7ea9
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainFactoryImpl.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.domain.impl;
+
+import org.apache.tuscany.sca.domain.DomainException;
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainFactory;
+
+/**
+ * A finder for SCA domains.
+ *
+ * @version $Rev: 580520 $ $Date: 2007-09-29 00:50:25 +0100 (Sat, 29 Sep 2007) $
+ */
+public class SCADomainFactoryImpl extends SCADomainFactory {
+
+
+ /**
+ * Returns a new SCA domain finder instance.
+ *
+ * @return a new SCA domain finder
+ */
+ public SCADomainFactoryImpl() {
+
+ }
+
+ /**
+ * Finds an existing SCA domain.
+ *
+ * @param domainURI the URI of the domain, this is the endpoint
+ * URI of the domain administration service
+ * @return the SCA domain
+ */
+ public SCADomain createSCADomain(String domainURI) throws DomainException {
+ return new SCADomainImpl(domainURI);
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainImpl.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainImpl.java
new file mode 100644
index 0000000000..cdbc8f799c
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainImpl.java
@@ -0,0 +1,662 @@
+ /*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.domain.impl;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
+import org.apache.tuscany.sca.domain.DomainException;
+import org.apache.tuscany.sca.domain.DomainManagerInitService;
+import org.apache.tuscany.sca.domain.SCADomainSPI;
+import org.apache.tuscany.sca.domain.model.Domain;
+import org.apache.tuscany.sca.domain.model.DomainModelFactory;
+import org.apache.tuscany.sca.domain.model.Node;
+import org.apache.tuscany.sca.domain.model.Service;
+import org.apache.tuscany.sca.domain.model.impl.DomainModelFactoryImpl;
+import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.node.NodeManagerService;
+import org.apache.tuscany.sca.node.NodeFactoryImpl;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * The SCA domain implementation. In Tuscany we currently have a model of the
+ * SCA Domain that relies on a central domain manager this class provides that
+ * central manager.
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-09 23:54:46 +0100 (Sun, 09 Sep 2007) $
+ */
+public class SCADomainImpl implements SCADomainSPI {
+
+ private final static Logger logger = Logger.getLogger(SCADomainImpl.class.getName());
+
+ // class loader used to get the runtime going
+ private ClassLoader domainClassLoader;
+
+ // management runtime
+ private ReallySmallRuntime domainManagementRuntime;
+ private ContributionService domainManagementContributionService;
+ private Composite domainManagementComposite;
+ private DomainManagerNodeImpl domainManagerNode;
+
+ // management services
+ private DomainManagerInitService domainManagerInitService;
+
+ // The domain model
+ private DomainModelFactory domainModelFactory = new DomainModelFactoryImpl();
+ private Domain domainModel;
+ private HashMap<String, Contribution> contributions = new HashMap<String, Contribution>();
+
+
+ /**
+ * Create a domain giving the URI for the domain.
+ *
+ * @param domainUri - identifies what host and port the domain service is running on, e.g. http://localhost:8081
+ * @throws ActivationException
+ */
+ public SCADomainImpl(String domainURI) throws DomainException {
+ this.domainModel = domainModelFactory.createDomain();
+ this.domainModel.setDomainURI(domainURI);
+ this.domainClassLoader = SCADomainImpl.class.getClassLoader();
+ init();
+ }
+
+ /**
+ * Create the domain management runtime etc
+ */
+ private void init() throws DomainException {
+ try {
+ // check whether domain uri is a url
+ URI tmpURI;
+ try {
+ tmpURI = new URI(domainModel.getDomainURI());
+ if (tmpURI.isAbsolute()){
+ domainModel.setDomainURL(tmpURI.toURL().toExternalForm());
+ }
+ } catch(Exception ex) {
+ throw new ActivationException("domain uri " +
+ domainModel.getDomainURI() +
+ "must be a valid url");
+ }
+
+ // create a runtime for the domain management services to run on
+ domainManagementRuntime = new ReallySmallRuntime(domainClassLoader);
+ domainManagementRuntime.start();
+
+ // Create an in-memory domain level management composite
+ AssemblyFactory assemblyFactory = domainManagementRuntime.getAssemblyFactory();
+ domainManagementComposite = assemblyFactory.createComposite();
+ domainManagementComposite.setName(new QName(Constants.SCA10_NS, "domainManagement"));
+ domainManagementComposite.setURI(domainModel.getDomainURI() + "/Management");
+
+ // Set up the domain so that we can push in the node endpoint before we
+ // call a node
+ domainManagerNode = new DomainManagerNodeImpl(this);
+ ModelFactoryExtensionPoint factories = domainManagementRuntime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
+ NodeFactoryImpl domainFactory = new NodeFactoryImpl(domainManagerNode);
+ factories.addFactory(domainFactory);
+
+ // Find the composite that will configure the domain
+ String domainCompositeName = "domain.composite";
+ URL contributionURL = SCADomainUtil.findContributionFromComposite(domainClassLoader, domainCompositeName);
+
+ if ( contributionURL != null ){
+ logger.log(Level.INFO, "Domain management configured from " + contributionURL);
+
+ // add node composite to the management domain
+ domainManagementContributionService = domainManagementRuntime.getContributionService();
+ Contribution contribution = null;
+
+ contribution = domainManagementContributionService.contribute(domainModel.getDomainURI(),
+ contributionURL,
+ false);
+
+ Composite composite = null;
+ for (DeployedArtifact artifact: contribution.getArtifacts()) {
+ if (domainCompositeName.equals(artifact.getURI())) {
+ composite = (Composite)artifact.getModel();
+ }
+ }
+
+ if (composite != null) {
+
+ domainManagementComposite.getIncludes().add(composite);
+ domainManagementRuntime.getCompositeBuilder().build(composite);
+
+ // TODO fix up the domain manager URI to match the provided
+ // domain uri
+
+ domainManagementRuntime.getCompositeActivator().activate(composite);
+ domainManagementRuntime.getCompositeActivator().start(composite);
+
+ // get the management components out of the domain so that they
+ // can be configured/used.
+ domainManagerInitService = getService(DomainManagerInitService.class,
+ "DomainManagerComponent/DomainManagerInitService",
+ domainManagementRuntime,
+ domainManagementComposite);
+ domainManagerInitService.setDomain((SCADomainSPI)this);
+
+
+ } else {
+ throw new ActivationException("Domain management contribution " +
+ contributionURL +
+ " found but could not be loaded");
+ }
+ } else {
+ throw new ActivationException("Domain management contribution " +
+ domainCompositeName +
+ " not found on the classpath");
+ }
+
+ } catch(Exception ex) {
+ throw new DomainException(ex);
+ }
+ }
+
+ public Component getComponent(String componentName) {
+ for (Composite composite: domainManagementComposite.getIncludes()) {
+ for (Component component: composite.getComponents()) {
+ if (component.getName().equals(componentName)) {
+ return component;
+ }
+ }
+ }
+ return null;
+ }
+
+ // SCADomain SPI methods
+
+ public Domain getDomainModel(){
+ return domainModel;
+ }
+
+ public String addNode(String nodeURI, String nodeURL){
+ // try and remove it first just in case it's already registered
+ removeNode(nodeURI);
+
+ Node node = domainModelFactory.createNode();
+ node.setNodeURI(nodeURI);
+ node.setNodeURL(nodeURL);
+ domainModel.getNodes().put(nodeURI, node);
+
+ logger.log(Level.INFO, "Registered node: " +
+ nodeURI +
+ " at endpoint " +
+ nodeURL);
+
+ return "DummyReturn";
+ }
+
+ public String removeNode(String nodeURI){
+
+ domainModel.getNodes().remove(nodeURI);
+
+ logger.log(Level.INFO, "Removed node: " + nodeURI);
+
+ return "DummyReturn";
+ }
+
+
+ public void registerContribution(String nodeURI, String contributionURI, String contributionURL){
+ try {
+ if ( domainModel.getContributions().containsKey(contributionURI) == false ){
+ // add the contribution information to the domain model
+ org.apache.tuscany.sca.domain.model.Contribution contributionModel =
+ parseContribution(contributionURI, contributionURL);
+ }
+
+
+ // assign the contribution to the referenced node
+ } catch (Exception ex) {
+ logger.log(Level.SEVERE, "Exception when registering contribution " +
+ contributionURI +
+ ex.toString() );
+ }
+
+ }
+
+
+ public void unregisterContribution(String contributionURI){
+ // TODO
+
+ }
+
+ public String registerServiceEndpoint(String domainURI, String nodeURI, String serviceName, String bindingName, String URL){
+ // if the service name ends in a "/" remove it
+ String modifiedServiceName = null;
+ if ( serviceName.endsWith("/") ) {
+ modifiedServiceName = serviceName.substring(0, serviceName.length() - 1);
+ } else {
+ modifiedServiceName = serviceName;
+ }
+
+ // collect the service info
+ Service service = domainModelFactory.createService();
+ service.setServiceURI(modifiedServiceName);
+ service.setServiceURL(URL);
+ service.setServiceBinding(bindingName);
+
+ // find the node
+ Node node = domainModel.getNodes().get(nodeURI);
+
+ if (node != null){
+ //store the service
+ node.getServices().put(serviceName+bindingName, service);
+ logger.log(Level.INFO, "Registered service: " + modifiedServiceName);
+ } else {
+ logger.log(Level.WARNING, "Trying to register service: " +
+ modifiedServiceName +
+ " for a node " +
+ nodeURI +
+ "that isn't registered");
+ }
+
+ return "";
+ }
+
+ public String removeServiceEndpoint(String domainUri, String nodeURI, String serviceName, String bindingName){
+ Node node = domainModel.getNodes().get(nodeURI);
+ node.getServices().remove(serviceName + bindingName);
+ logger.log(Level.INFO, "Removed service: " + serviceName );
+
+ return "";
+ }
+
+ public String findServiceEndpoint(String domainUri, String serviceName, String bindingName){
+ logger.log(Level.INFO, "Finding service: [" +
+ domainUri + " " +
+ serviceName + " " +
+ bindingName +
+ "]");
+
+ String url = "";
+ String serviceKey = serviceName + bindingName;
+
+ for (Node node : domainModel.getNodes().values()){
+ Service service = node.getServices().get(serviceKey);
+
+ if (service != null){
+ url = service.getServiceURL();
+ //url = replacePort(url, "8085", "8086");
+ logger.log(Level.INFO, "Found service url: " + url);
+ break;
+ }
+ }
+
+ return url;
+ }
+
+ /**
+ * Converts a port number to something else to allow for debugging using a
+ * HTTP sniffer
+ * @param url
+ * @param fromPort the port to look for
+ * @param toPort the port to replace it with
+ * @return the new url
+ */
+ private String replacePort(String url, String fromPort, String toPort) {
+ return url.replace(fromPort, toPort);
+ }
+
+
+ // SCADomain API methods
+
+ public void start() throws DomainException {
+ // TODO
+ }
+
+
+ public void stop() throws DomainException {
+ try {
+ // Stop the node
+ domainManagementRuntime.stop();
+
+ } catch(ActivationException ex) {
+ throw new DomainException(ex);
+ }
+
+ }
+
+ public String getURI(){
+ return domainModel.getDomainURI();
+ }
+
+ private org.apache.tuscany.sca.domain.model.Contribution parseContribution(String contributionURI, String contributionURL) throws DomainException {
+ // add the contribution information to the domain model
+ org.apache.tuscany.sca.domain.model.Contribution contributionModel = domainModelFactory.createContribution();
+ contributionModel.setContributionURI(contributionURI);
+ contributionModel.setContributionURL(contributionURL);
+ domainModel.getContributions().put(contributionURI, contributionModel);
+
+ // read the assembly model objects.
+ try {
+ // Create a local model from the contribution. Using the contribution
+ // processor from the domain management runtime just because we already have it
+ Contribution contribution = domainManagementContributionService.contribute(contributionURI,
+ new URL(contributionURL),
+ false);
+
+ // store the contribution
+ contributions.put(contributionURI, contribution);
+
+ // add the composite info to the domain model
+ for (DeployedArtifact artifact : contribution.getArtifacts()) {
+ if (artifact.getModel() instanceof Composite) {
+ Composite composite = (Composite)artifact.getModel();
+ org.apache.tuscany.sca.domain.model.Composite compositeModel =
+ domainModelFactory.createComposite();
+ compositeModel.setCompositeQName(composite.getName());
+ contributionModel.getComposites().put(compositeModel.getCompositeQName(), compositeModel);
+
+ }
+ }
+
+ // add all composites into the domain model
+ for (Composite composite : contribution.getDeployables()) {
+ org.apache.tuscany.sca.domain.model.Composite compositeModel =
+ domainModelFactory.createComposite();
+ compositeModel.setCompositeQName(composite.getName());
+ contributionModel.getComposites().put(compositeModel.getCompositeQName(), compositeModel);
+ }
+
+ // add the deployable composite info to the domain model
+ for (Composite composite : contribution.getDeployables()) {
+ org.apache.tuscany.sca.domain.model.Composite compositeModel =
+ contributionModel.getComposites().get(composite.getName());
+ contributionModel.getDeployableComposites().put(compositeModel.getCompositeQName(), compositeModel);
+ domainModel.getDeployedComposites().put(compositeModel.getCompositeQName(), compositeModel);
+ }
+
+ } catch(Exception ex) {
+ throw new DomainException(ex);
+ }
+
+ return contributionModel;
+ }
+
+ private void assignContributionToNode(org.apache.tuscany.sca.domain.model.Contribution contributionModel) throws DomainException {
+ // Find a node to run the contribution.
+ // TODO - add some more sophisticated algorithm here
+ // find a node without a contribution and add it to it. There is no deployment
+ // step here we just assume the contribution is available.
+
+ boolean foundFreeNode = false;
+
+ for(Node node : domainModel.getNodes().values()) {
+ if ( node.getContributions().isEmpty()){
+ foundFreeNode = true;
+ node.getContributions().put(contributionModel.getContributionURI(), contributionModel);
+ break;
+ }
+ }
+
+ if (foundFreeNode == false){
+ throw new DomainException("No free node available for contribution " +
+ contributionModel.getContributionURI());
+ }
+ }
+
+ public void addContribution(String contributionURI, URL contributionURL) throws DomainException {
+ // add the contribution information to the domain model
+ org.apache.tuscany.sca.domain.model.Contribution contributionModel =
+ parseContribution(contributionURI, contributionURL.toExternalForm());
+
+ assignContributionToNode(contributionModel);
+ }
+
+ public void removeContribution(String uri) throws DomainException {
+
+ // TODO
+ }
+
+ public void addDeploymentComposite(String contributionURI, String compositeXML) throws DomainException {
+ // TODO
+ }
+
+ public void addToDomainLevelComposite(QName compositeName) throws DomainException {
+ // find the nodes with this composite and add the composite as a deployable composite
+ for ( Node node : domainModel.getNodes().values()) {
+ for (org.apache.tuscany.sca.domain.model.Contribution contribution : node.getContributions().values()){
+ org.apache.tuscany.sca.domain.model.Composite composite =
+ contribution.getComposites().get(compositeName);
+ if (composite != null) {
+ contribution.getDeployableComposites().put(compositeName, composite);
+ domainModel.getDeployedComposites().put(compositeName, composite);
+ }
+ }
+ }
+ }
+
+ public void removeFromDomainLevelComposite(QName qname) throws DomainException {
+ // TODO
+ }
+
+ public void startComposite(QName compositeName) throws DomainException {
+ for (Node node : domainModel.getNodes().values()){
+ boolean startNode = false;
+
+ for (org.apache.tuscany.sca.domain.model.Contribution contribution : node.getContributions().values()){
+ org.apache.tuscany.sca.domain.model.Composite composite =
+ contribution.getDeployableComposites().get(compositeName);
+ if (composite != null) {
+ startNode = true;
+ break;
+ }
+ }
+
+ if (startNode == true){
+ // get the endpoint of the node in question and set it into the
+ // domain manager node in order to flip the node reference to
+ // the correct endpoint
+ String nodeURL = node.getNodeURL();
+ domainManagerNode.setNodeEndpoint(nodeURL);
+
+
+ // get a node manager service reference. This will have to have its
+ // physical endpoint set by the domain node manage we have just
+ // configured
+ NodeManagerService nodeManagerService = getService(NodeManagerService.class,
+ "NodeManagerComponent/NodeManagerService",
+ domainManagementRuntime,
+ domainManagementComposite);
+
+ // add contributions
+ for (org.apache.tuscany.sca.domain.model.Contribution contribution : node.getContributions().values()){
+ nodeManagerService.addContribution(contribution.getContributionURI(),
+ contribution.getContributionURL().toString());
+ }
+
+ // deploy composite
+ nodeManagerService.deployComposite(compositeName.toString());
+
+ // start node
+ nodeManagerService.start();
+
+ // TODO
+ // somewhere we need to add the deployed composites into the node model
+
+ // reset the endpoint setting function
+ domainManagerNode.setNodeEndpoint(null);
+ }
+ }
+ }
+
+ public void stopComposite(QName qname) throws DomainException {
+ // TODO
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ return (R)cast(target, domainManagementRuntime);
+ }
+
+ private <B, R extends CallableReference<B>> R cast(B target, ReallySmallRuntime runtime) throws IllegalArgumentException {
+ return (R)runtime.getProxyFactory().cast(target);
+ }
+
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+ return getService( businessInterface, serviceName, domainManagementRuntime, null);
+ }
+
+ private <B> B getService(Class<B> businessInterface, String serviceName, ReallySmallRuntime runtime, Composite domainComposite) {
+
+ ServiceReference<B> serviceReference = getServiceReference(businessInterface, serviceName, runtime, domainComposite);
+ if (serviceReference == null) {
+ throw new ServiceRuntimeException("Service not found: " + serviceName);
+ }
+ return serviceReference.getService();
+ }
+
+ private <B> ServiceReference<B> createServiceReference(Class<B> businessInterface, String targetURI) {
+ return createServiceReference(businessInterface, targetURI, domainManagementRuntime, null);
+ }
+
+
+ private <B> ServiceReference<B> createServiceReference(Class<B> businessInterface, String targetURI, ReallySmallRuntime runtime, Composite domainComposite) {
+ try {
+
+ AssemblyFactory assemblyFactory = runtime.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");
+ runtime.getCompositeActivator().configureComponentContext(component);
+ composite.getComponents().add(component);
+ RuntimeComponentReference reference = (RuntimeComponentReference)assemblyFactory.createComponentReference();
+ reference.setName("default");
+ ModelFactoryExtensionPoint factories =
+ runtime.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, runtime
+ .getProxyFactory(), runtime.getCompositeActivator());
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+
+
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name) {
+ return getServiceReference(businessInterface, name, domainManagementRuntime, null);
+ }
+
+
+ private <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name, ReallySmallRuntime runtime, Composite domainComposite) {
+
+ // 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
+ Component component = null;
+
+ if ( domainComposite != null ) {
+ for (Composite composite: domainComposite.getIncludes()) {
+ for (Component compositeComponent: composite.getComponents()) {
+ if (compositeComponent.getName().equals(componentName)) {
+ component = compositeComponent;
+ }
+ }
+ }
+ }
+
+ if (component == null) {
+ // The component is not local in the partition, try to create a remote service ref
+ return createServiceReference(businessInterface, name, runtime, domainComposite);
+ }
+ 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/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainUtil.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainUtil.java
new file mode 100644
index 0000000000..df618458d4
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainUtil.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.domain.impl;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.MalformedURLException;
+import java.net.ServerSocket;
+import java.net.URI;
+import java.net.URL;
+import java.net.UnknownHostException;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.util.FileHelper;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+
+
+/**
+ * Some utility methods for the Domain implementation
+ *
+ * @version $Rev: 556897 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class SCADomainUtil {
+ private final static Logger logger = Logger.getLogger(SCADomainUtil.class.getName());
+
+ /**
+ * Given the name of a composite this method finds the contribution that it belongs to
+ * this could be either a local directory of a jar file.
+ *
+ * @param classLoader
+ * @param compositeString
+ * @return the contribution URL
+ * @throws MalformedURLException
+ */
+ public static URL findContributionFromComposite(ClassLoader classLoader, String compositeString)
+ throws MalformedURLException {
+
+ URL contributionURL = classLoader.getResource(compositeString);
+
+ if ( contributionURL != null ){
+ String contributionURLString = contributionURL.toExternalForm();
+ String protocol = contributionURL.getProtocol();
+
+ if ("file".equals(protocol)) {
+ // directory contribution
+ if (contributionURLString.endsWith(compositeString)) {
+ String location = contributionURLString.substring(0, contributionURLString.lastIndexOf(compositeString));
+ // workaround from evil url/uri form maven
+ contributionURL = FileHelper.toFile(new URL(location)).toURI().toURL();
+ }
+
+ } else if ("jar".equals(protocol)) {
+ // jar contribution
+ String location = contributionURLString.substring(4, contributionURLString.lastIndexOf("!/"));
+ // workaround for evil url/uri from maven
+ contributionURL = FileHelper.toFile(new URL(location)).toURI().toURL();
+ }
+ }
+
+ return contributionURL;
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/ContributionInfoImpl.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/ContributionInfoImpl.java
new file mode 100644
index 0000000000..090bf21fc1
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/ContributionInfoImpl.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.domain.management.impl;
+
+import java.io.Serializable;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.management.ContributionInfo;
+/**
+ * Information relating to an exposed service
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class ContributionInfoImpl implements ContributionInfo, Serializable {
+
+ static final long serialVersionUID = 7669181086005969428L;
+
+ private String contributionURI;
+ private URL contributionURL;
+ private List<QName> composites = new ArrayList<QName>();
+ private List<QName> deployableComposites = new ArrayList<QName>();
+
+
+ /**
+ * Retrieve the contribution uri
+ *
+ * @return contribution uri
+ */
+ public String getContributionURI() {
+ return contributionURI;
+ }
+
+ /**
+ * Set the contribution uri
+ *
+ * @param contributionURI
+ */
+ public void setContributionURI(String contributionURI){
+ this.contributionURI = contributionURI;
+ }
+
+ /**
+ * Retrieve the contribution url
+ *
+ * @return contribution url
+ */
+ public URL getContributionURL(){
+ return contributionURL;
+ }
+
+ /**
+ * Set the contribution url
+ *
+ * @param contributionURL
+ */
+ public void setContributionURL(URL contributionURL){
+ this.contributionURL = contributionURL;
+ }
+
+ public List<QName> getComposites(){
+ return composites;
+ }
+
+ public List<QName> getDeployableComposites(){
+ return deployableComposites;
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/DomainInfoImpl.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/DomainInfoImpl.java
new file mode 100644
index 0000000000..b331d366a7
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/DomainInfoImpl.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.domain.management.impl;
+
+import java.io.Serializable;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.management.DomainInfo;
+import org.apache.tuscany.sca.domain.model.Composite;
+import org.apache.tuscany.sca.domain.model.Contribution;
+import org.apache.tuscany.sca.domain.model.Node;
+
+/**
+ * A data transport object for the management interface
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class DomainInfoImpl implements DomainInfo, Serializable {
+
+ static final long serialVersionUID = 7669181086005969428L;
+
+ private String domainURI;
+ private String domainURL;
+ private List<String> nodes = new ArrayList<String>();
+ private List<String> contributions = new ArrayList<String>();
+ private List<QName> composites = new ArrayList<QName>();
+
+ /**
+ * Retrieve the domain uri
+ *
+ * @return domain uri
+ */
+ public String getDomainURI(){
+ return domainURI;
+ }
+
+ /**
+ * Set the domain uri
+ *
+ * @param domainURI
+ */
+ public void setDomainURI(String domainURI){
+ this.domainURI = domainURI;
+ }
+
+ /**
+ * Retrieve the domain url
+ *
+ * @return domain url
+ */
+ public String getDomainURL(){
+ return domainURL;
+ }
+
+ /**
+ * Set the domain url
+ *
+ * @param domainURL
+ */
+ public void setDomainURL(String domainURL){
+ this.domainURL = domainURL;
+ }
+
+ public List<String> getNodes(){
+ return nodes;
+ }
+
+ public List<String> getContributions(){
+ return contributions;
+ }
+
+ public List<QName> getDeployedComposites(){
+ return composites;
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/NodeInfoImpl.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/NodeInfoImpl.java
new file mode 100644
index 0000000000..1d547d33d7
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/management/impl/NodeInfoImpl.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.domain.management.impl;
+
+import java.io.Serializable;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.management.NodeInfo;
+import org.apache.tuscany.sca.domain.model.Composite;
+import org.apache.tuscany.sca.domain.model.Contribution;
+import org.apache.tuscany.sca.domain.model.Service;
+
+/**
+ * Information relating to an exposed service
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class NodeInfoImpl implements NodeInfo, Serializable {
+
+ static final long serialVersionUID = 7669181086005969428L;
+
+ private String nodeURI;
+ private String nodeURL;
+ private List<String> contributions = new ArrayList<String>();
+ private List<QName> composites = new ArrayList<QName>();
+ private List<String> services = new ArrayList<String>();
+
+ /**
+ * Retrieve the node uri
+ *
+ * @return node uri
+ */
+ public String getNodeURI(){
+ return nodeURI;
+ }
+
+ /**
+ * Set the node uri
+ *
+ * @param nodeURI
+ */
+ public void setNodeURI(String nodeURI){
+ this.nodeURI = nodeURI;
+ }
+
+ /**
+ * Retrieve the node url
+ *
+ * @return node url
+ */
+ public String getNodeURL() {
+ return nodeURL;
+ }
+
+ /**
+ * Set the node url
+ *
+ * @param nodeURL
+ */
+ public void setNodeURL(String nodeURL){
+ this.nodeURL = nodeURL;
+ }
+
+ public List<String> getContributions(){
+ return contributions;
+ }
+
+ public List<QName> getDeployedComposites(){
+ return composites;
+ }
+
+ public List<String> getServices(){
+ return services;
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/CompositeImpl.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/CompositeImpl.java
new file mode 100644
index 0000000000..f2717aeeef
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/CompositeImpl.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.domain.model.impl;
+
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.model.Composite;
+
+
+/**
+ * A composite.
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class CompositeImpl implements Composite {
+
+ private QName compositeQName;
+
+ /**
+ * Retrieve the composite qname
+ *
+ * @return composite qname
+ */
+ public QName getCompositeQName(){
+ return compositeQName;
+ }
+
+ /**
+ * Set the composite qname
+ *
+ * @param compositeQName
+ */
+ public void setCompositeQName(QName compositeQName) {
+ this.compositeQName = compositeQName;
+ }
+}
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ContributionImpl.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ContributionImpl.java
new file mode 100644
index 0000000000..ed2456067e
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ContributionImpl.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.domain.model.impl;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.model.Composite;
+import org.apache.tuscany.sca.domain.model.Contribution;
+
+/**
+ * A contribution.
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class ContributionImpl implements Contribution {
+
+ private String contributionURI;
+ private String contributionURL;
+ private Map<QName, Composite> composites = new HashMap<QName, Composite>();
+ private Map<QName, Composite> deployableComposites = new HashMap<QName, Composite>();
+
+
+ /**
+ * Retrieve the contribution uri
+ *
+ * @return contribution uri
+ */
+ public String getContributionURI() {
+ return contributionURI;
+ }
+
+ /**
+ * Set the contribution uri
+ *
+ * @param contributionURI
+ */
+ public void setContributionURI(String contributionURI){
+ this.contributionURI = contributionURI;
+ }
+
+ /**
+ * Retrieve the contribution url
+ *
+ * @return contribution url
+ */
+ public String getContributionURL(){
+ return contributionURL;
+ }
+
+ /**
+ * Set the contribution url
+ *
+ * @param contributionURL
+ */
+ public void setContributionURL(String contributionURL){
+ this.contributionURL = contributionURL;
+ }
+
+ public Map<QName, Composite> getComposites(){
+ return composites;
+ }
+
+ public Map<QName, Composite> getDeployableComposites(){
+ return deployableComposites;
+ }
+}
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainImpl.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainImpl.java
new file mode 100644
index 0000000000..0f6af482f7
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainImpl.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.domain.model.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.model.Composite;
+import org.apache.tuscany.sca.domain.model.Contribution;
+import org.apache.tuscany.sca.domain.model.Node;
+import org.apache.tuscany.sca.domain.model.Domain;
+
+
+/**
+ * A domain. Manages nodes
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class DomainImpl implements Domain {
+
+ private String domainURI;
+ private String domainURL;
+ private Map<String, Node> nodes = new HashMap<String, Node>();
+ private Map<String, Contribution> contributions = new HashMap<String, Contribution>();
+ private Map<QName, Composite> composites = new HashMap<QName, Composite>();
+
+
+ /**
+ * Retrieve the domain uri
+ *
+ * @return domain uri
+ */
+ public String getDomainURI(){
+ return domainURI;
+ }
+
+ /**
+ * Set the domain uri
+ *
+ * @param domainURI
+ */
+ public void setDomainURI(String domainURI){
+ this.domainURI = domainURI;
+ }
+
+ /**
+ * Retrieve the domain url
+ *
+ * @return domain url
+ */
+ public String getDomainURL(){
+ return domainURL;
+ }
+
+ /**
+ * Set the domain url
+ *
+ * @param domainURL
+ */
+ public void setDomainURL(String domainURL){
+ this.domainURL = domainURL;
+ }
+
+ public Map<String, Node> getNodes(){
+ return nodes;
+ }
+
+ public Map<String, Contribution> getContributions(){
+ return contributions;
+ }
+
+ public Map<QName, Composite> getDeployedComposites(){
+ return composites;
+ }
+}
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainModelFactoryImpl.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainModelFactoryImpl.java
new file mode 100644
index 0000000000..768f2658a4
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/DomainModelFactoryImpl.java
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.domain.model.impl;
+
+import org.apache.tuscany.sca.domain.model.Composite;
+import org.apache.tuscany.sca.domain.model.Contribution;
+import org.apache.tuscany.sca.domain.model.Domain;
+import org.apache.tuscany.sca.domain.model.DomainModelFactory;
+import org.apache.tuscany.sca.domain.model.Node;
+import org.apache.tuscany.sca.domain.model.Service;
+
+/**
+ * A node. Runs SCA composites
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class DomainModelFactoryImpl implements DomainModelFactory {
+
+ /**
+ * Create a new domain model
+ *
+ * @return new domain model
+ */
+ public Domain createDomain(){
+ return new DomainImpl();
+ }
+ /**
+ * Create a new node model
+ *
+ * @return new node model
+ */
+ public Node createNode(){
+ return new NodeImpl();
+ }
+
+ /**
+ * Create a new contribution model
+ *
+ * @return new contribution model
+ */
+ public Contribution createContribution(){
+ return new ContributionImpl();
+ }
+
+ /**
+ * Create a new composite model
+ *
+ * @return new composite model
+ */
+ public Composite createComposite(){
+ return new CompositeImpl();
+ }
+
+ /**
+ * Create a new service model
+ *
+ * @return new service model
+ */
+ public Service createService(){
+ return new ServiceImpl();
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/NodeImpl.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/NodeImpl.java
new file mode 100644
index 0000000000..dc6454bf7e
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/NodeImpl.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.domain.model.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.domain.model.Composite;
+import org.apache.tuscany.sca.domain.model.Contribution;
+import org.apache.tuscany.sca.domain.model.Node;
+import org.apache.tuscany.sca.domain.model.Service;
+
+
+/**
+ * A node. Runs SCA composites
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class NodeImpl implements Node {
+
+ private String nodeURI;
+ private String nodeURL;
+ private Map<String, Contribution> contributions = new HashMap<String, Contribution>();
+ private Map<QName, Composite> composites = new HashMap<QName, Composite>();
+ private Map<String, Service> services = new HashMap<String, Service>();
+
+ /**
+ * Retrieve the node uri
+ *
+ * @return node uri
+ */
+ public String getNodeURI(){
+ return nodeURI;
+ }
+
+ /**
+ * Set the node uri
+ *
+ * @param nodeURI
+ */
+ public void setNodeURI(String nodeURI){
+ this.nodeURI = nodeURI;
+ }
+
+ /**
+ * Retrieve the node url
+ *
+ * @return node url
+ */
+ public String getNodeURL() {
+ return nodeURL;
+ }
+
+ /**
+ * Set the node url
+ *
+ * @param nodeURL
+ */
+ public void setNodeURL(String nodeURL){
+ this.nodeURL = nodeURL;
+ }
+
+ public Map<String, Contribution> getContributions(){
+ return contributions;
+ }
+
+ public Map<QName, Composite> getDeployedComposites(){
+ return composites;
+ }
+
+ public Map<String, Service> getServices(){
+ return services;
+ }
+}
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ServiceImpl.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ServiceImpl.java
new file mode 100644
index 0000000000..bf2ec8a6a3
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/model/impl/ServiceImpl.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.domain.model.impl;
+
+import org.apache.tuscany.sca.domain.model.Service;
+
+/**
+ * A service.
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class ServiceImpl implements Service {
+
+ private String serviceURI;
+ private String serviceURL;
+ private String serviceBinding;
+
+ /**
+ * Retrieve the service uri
+ *
+ * @return service uri
+ */
+ public String getServiceURI(){
+ return serviceURI;
+ }
+
+ /**
+ * Set the service uri
+ *
+ * @param serviceURI
+ */
+ public void setServiceURI(String serviceURI){
+ this.serviceURI = serviceURI;
+ }
+
+ /**
+ * Retrieve the service url
+ *
+ * @return service url
+ */
+ public String getServiceURL(){
+ return serviceURL;
+ }
+
+ /**
+ * Set the service url
+ *
+ * @param serviceURL
+ */
+ public void setServiceURL(String serviceURL){
+ this.serviceURL = serviceURL;
+ }
+
+
+ /**
+ * Retrieve the service binding
+ *
+ * @return service binding
+ */
+ public String getServiceBinding(){
+ return serviceBinding;
+ }
+
+ /**
+ * Set the service binding
+ *
+ * @param serviceBinding
+ */
+ public void setServiceBinding(String serviceBinding){
+ this.serviceBinding = serviceBinding;
+ }
+}
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/resources/domain.composite b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/resources/domain.composite
new file mode 100644
index 0000000000..ec41d74836
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/resources/domain.composite
@@ -0,0 +1,49 @@
+<?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"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="Domain">
+
+ <component name="domain">
+ <tuscany:implementation.resource location="webroot"/>
+ <service name="Resource">
+ <tuscany:binding.http uri="http://localhost:8877/domain"/>
+ </service>
+ </component>
+
+ <component name="DomainManagerComponent">
+ <implementation.java class="org.apache.tuscany.sca.domain.impl.DomainManagerServiceImpl"/>
+ <service name="DomainManagerInitService">
+ <interface.java interface="org.apache.tuscany.sca.domain.DomainManagerInitService"/>
+ <binding.sca/>
+ </service>
+ <service name="DomainManagerNodeEventService">
+ <interface.java interface="org.apache.tuscany.sca.domain.DomainManagerNodeEventService"/>
+ <binding.ws uri="http://localhost:8877/DomainManagerComponent/DomainManagerNodeEventService"/>
+ </service>
+ <service name="DomainManagementService">
+ <interface.java interface="org.apache.tuscany.sca.domain.management.DomainManagementService"/>
+ <tuscany:binding.jsonrpc uri="http://localhost:8877/DomainManagerComponent/DomainManagementService"/>
+ </service>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/resources/webroot/domain.png b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/resources/webroot/domain.png
new file mode 100644
index 0000000000..e88c4f882a
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/resources/webroot/domain.png
Binary files differ
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/resources/webroot/index.html b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/resources/webroot/index.html
new file mode 100644
index 0000000000..1c387ed50d
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/resources/webroot/index.html
@@ -0,0 +1,139 @@
+<html>
+<!--
+ * 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.
+ -->
+<head>
+<title>Apache Tuscany Domain</TITLE>
+
+ <script type="text/javascript" src="../SCADomain/scaDomain.js"></script>
+
+ <script language="JavaScript">
+
+ domainManager = new JSONRpcClient("../DomainManagerComponent/DomainManagementService");
+ var domainInfo;
+
+ function getDomainInfo() {
+ domainManager.DomainManagementService.getDomainDescription(handleGetDomainInfo);
+ }
+
+ function handleGetDomainInfo(result) {
+
+ domainInfo = result;
+ var text = "";
+ document.getElementById('domainName').innerHTML="Domain:&nbsp;&nbsp;" + domainInfo.domainURI;
+
+ text = text + "<H2>Nodes</H2>";
+
+ for (var i in domainInfo.nodes.list){
+ var nodeURI = domainInfo.nodes.list[i];
+
+ text = text + "<table>";
+ text = text + "<TR CLASS='source_1' >";
+ text = text + " <TD CLASS='clickable link' ONCLICK=\"getNodeInfo('" + nodeURI + "')\">" ;
+ text = text + " <IMG SRC='node.png'/>&nbsp;&nbsp;" + nodeURI;
+ text = text + " </TD>";
+ //text = text + " <TD CLASS='clickable link' ONCLICK=\"showNode('" + node.nodeURI + "')\">" + nodeManagerWebUrl + "</TD>";
+ text = text + "</TR>";
+ text = text + "<div id=\"" + nodeURI + "\">";
+ text = text + "</table>";
+ }
+
+ text = text + "<H2>Domain Contributions</H2>";
+
+ for (var i in domainInfo.contributions.list){
+ var contributionURI = domainInfo.contributions.list[i];
+ text = text + "<table>";
+ text = text + "<TR CLASS='source_1' >";
+ text = text + " <TD>";
+ text = text + " <IMG SRC='node.png'/>&nbsp;&nbsp;" + contributionURI;
+ text = text + " </TD>";
+ text = text + "</TR>";
+ text = text + "</table>";
+ }
+
+ text = text + "<H2>Deployable Composites</H2>";
+
+ for (var i in domainInfo.deployedComposites.list){
+ var compositeQName = domainInfo.deployedComposites.list[i];
+ text = text + "<table>";
+ text = text + "<TR CLASS='source_1' >";
+ text = text + " <TD>";
+ text = text + " <IMG SRC='node.png'/>&nbsp;&nbsp;" + compositeQName.namespaceURI + "#" + compositeQName.localPart;
+ text = text + " </TD>";
+ text = text + "</TR>";
+ text = text + "</table>";
+ }
+
+ document.getElementById('domainInfo').innerHTML=text;
+ }
+
+ function getNodeInfo(nodeURI) {
+ domainManager.DomainManagementService.getNodeDescription(nodeURI, handleGetNodeInfo);
+ }
+
+ function handleGetNodeInfo(result) {
+
+ var nodeInfo = result;
+ var text = "";
+
+
+ for (var i in nodeInfo.contributions.list){
+ var contributionURI = nodeInfo.contributions.list[i];
+
+ text = text + "<TR CLASS='source_2' >";
+ text = text + " <TD/>";
+ text = text + " <TD>";
+ text = text + "&nbsp;&nbsp;" + contributionURI;
+ text = text + " </TD>";
+ text = text + "</TR>";
+ }
+
+ document.getElementById(nodeInfo.nodeURI).innerHTML=text;
+ }
+
+ function showNode(url)
+ {
+ document.getElementById("nodePage").innerHTML="<IFRAME CLASS='alert_data' SRC='"+url+"'/>";
+ window.location="#data";
+ return;
+ }
+
+ </script>
+
+ <link rel="stylesheet" type="text/css" href="style.css" />
+</head>
+
+<body onload="getDomainInfo()">
+
+<h1 id="top">Apache Tuscany Domain</h1>
+<div id="errors"></div>
+
+<table>
+<TR>
+<TD>
+<div id="domainName"></div>
+</TD>
+</TR>
+</table>
+
+<div id="domainInfo"></div>
+
+<p /><input type="button" value="Refresh" onclick="getDomainInfo()" />
+
+</body>
+</html>
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/resources/webroot/node.png b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/resources/webroot/node.png
new file mode 100644
index 0000000000..fa01e64272
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/resources/webroot/node.png
Binary files differ
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/resources/webroot/style.css b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/resources/webroot/style.css
new file mode 100644
index 0000000000..28a4d4540c
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/main/resources/webroot/style.css
@@ -0,0 +1,176 @@
+/*
+ * 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.
+ */
+
+p,table,li,h1,h2,h3
+{
+font-family: verdana, arial, 'sans serif';
+}
+
+p, h1, h2, h3, table, li, hr
+{
+margin-left: 10pt;
+}
+
+table
+{
+border-color: black;
+border-collapse: separate;
+border-spacing: 0px 1px;
+
+margin-right: 10pt;
+margin-left: 10pt;
+width: 800px;
+}
+
+.sourceDetailsTable
+{
+width: 600px;
+}
+
+tr, td
+{
+margin-left: 0pt;
+margin-right: 0pt;
+padding-left: 10pt;
+font-size: 90%;
+}
+
+p,li,th
+{
+font-size: 90%;
+margin-left: 10pt;
+}
+
+pre
+{
+margin-left: 10pt;
+}
+
+body
+{
+#ffffff;
+}
+
+h1,h2,h3,hr
+{
+color: firebrick;
+}
+
+a:link {COLOR: firebrick;}
+a:visited {COLOR: firebrick;}
+a:active {COLOR: navy;}
+
+.link
+{
+COLOR: firebrick;
+text-decoration: underline;
+}
+
+.clickable
+{
+cursor: pointer
+}
+
+.unread_title
+{
+font-weight: bold;
+}
+
+.read_title
+{
+font-weight: normal;
+}
+
+.summary
+{
+color: DimGrey;
+}
+
+.hidden
+{
+display: none;
+}
+
+.source_name
+{
+width: 600px;
+}
+
+.alert_text
+{
+width: 600px;
+}
+
+.alert_data
+{
+margin-left: 10px;
+width: 800px;
+height: 800px;
+}
+
+.source_0
+{
+background-color: LightGreen;
+}
+
+.source_1
+{
+background-color: LightSkyBlue;
+}
+
+.source_2
+{
+background-color: Khaki;
+}
+
+.source_3
+{
+background-color: LightPink;
+}
+
+.source_4
+{
+background-color: Orange;
+}
+
+.source_5
+{
+background-color: LightCoral;
+}
+
+.source_6
+{
+background-color: Orchid;
+}
+
+.source_7
+{
+background-color: Peru;
+}
+
+.source_8
+{
+background-color: SpringGreen;
+}
+
+.source_9
+{
+background-color: LightGrey;
+}
+
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/AddService.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/AddService.java
new file mode 100644
index 0000000000..797ebb4024
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-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/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/AddServiceImpl.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..1a63d4ff77
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-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/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/CalculatorService.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..ad87375529
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-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/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..8ee640ed6b
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-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/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/DivideService.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/DivideService.java
new file mode 100644
index 0000000000..ef6a8b375b
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-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/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/DivideServiceImpl.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..8c33862f6d
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-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/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/MultiplyService.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..db568cc762
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-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/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..c7fbc73c00
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-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/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/SubtractService.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..615320e670
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-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/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..abf2777c7d
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-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/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/org/apache/tuscany/sca/domain/impl/DomainImplTestCase.java b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/org/apache/tuscany/sca/domain/impl/DomainImplTestCase.java
new file mode 100644
index 0000000000..21700ef056
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/java/org/apache/tuscany/sca/domain/impl/DomainImplTestCase.java
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.domain.impl;
+
+import java.net.URL;
+
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainFactory;
+import org.apache.tuscany.sca.domain.SCADomainSPI;
+import org.apache.tuscany.sca.node.SCANode;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import calculator.AddService;
+import calculator.CalculatorService;
+
+
+/**
+ * This server program that loads a composite to provide simple registry function.
+ * This server can be replaced with any registry that is appropriate but the components
+ * in each node that talk to the registry should be replaced also.
+ */
+public class DomainImplTestCase {
+
+ private static String DEFAULT_DOMAIN_URI = "http://localhost:8877";
+
+ private static SCADomain domain;
+ private static SCADomainSPI domainSPI;
+ private static ClassLoader cl;
+
+ @BeforeClass
+ public static void init() throws Exception {
+
+ try {
+ cl = DomainImplTestCase.class.getClassLoader();
+ SCADomainFactory domainFactory = SCADomainFactory.newInstance();
+ domain = domainFactory.createSCADomain(DEFAULT_DOMAIN_URI);
+ domainSPI = (SCADomainSPI)domain;
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ System.out.println("Domain started");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ // stop the domain
+ domain.stop();
+ System.out.println("Domain stopped");
+ }
+
+ @Test
+ public void testAddNode() throws Exception {
+ domainSPI.addNode("http://mynode1", "http://localhost:81");
+ domainSPI.addNode("http://mynode2", "http://localhost:82");
+ }
+
+ @Test
+ public void testAddContributionWithMetaData() throws Exception {
+ domain.addContribution("contributionNodeA", cl.getResource("nodeA/"));
+ }
+
+ @Test
+ public void testAddContributionWithoutMetaData() throws Exception {
+ domain.addContribution("contributionNodeB", cl.getResource("nodeB/"));
+ }
+
+ //@Test
+ public void testKeepServerRunning() throws Exception {
+ System.out.println("press enter to continue");
+ System.in.read();
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/resources/nodeA/Calculator.composite b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/resources/nodeA/Calculator.composite
new file mode 100644
index 0000000000..7731cc7b55
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/resources/nodeA/Calculator.composite
@@ -0,0 +1,41 @@
+<?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="CalculatorServiceComponentA">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponentB" />
+ <reference name="subtractService" target="SubtractServiceComponentC" />
+ <reference name="multiplyService" target="MultiplyServiceComponentA"/>
+ <reference name="divideService" target="DivideServiceComponentA" />
+ </component>
+
+ <component name="MultiplyServiceComponentA">
+ <implementation.java class="calculator.MultiplyServiceImpl" />
+ </component>
+
+ <component name="DivideServiceComponentA">
+ <implementation.java class="calculator.DivideServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/resources/nodeA/META-INF/sca-contribution.xml b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/resources/nodeA/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..3f9ed8024b
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-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/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/resources/nodeB/Calculator.composite b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/resources/nodeB/Calculator.composite
new file mode 100644
index 0000000000..9d2a97b172
--- /dev/null
+++ b/sca-java-1.x/tags/1.0.1/modules/domain-impl/src/test/resources/nodeB/Calculator.composite
@@ -0,0 +1,29 @@
+<?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="AddServiceComponentB">
+ <implementation.java class="calculator.AddServiceImpl" />
+ </component>
+
+</composite>