summaryrefslogtreecommitdiffstats
path: root/branches
diff options
context:
space:
mode:
authornash <nash@13f79535-47bb-0310-9956-ffa450edef68>2008-07-21 17:37:59 +0000
committernash <nash@13f79535-47bb-0310-9956-ffa450edef68>2008-07-21 17:37:59 +0000
commitcad71ff83bb8c7a98315094151b3bff64830d4a7 (patch)
tree64f9098fe95c58f4d59aa8fdd8bceaeeb598afcf /branches
parentbaf3fd3cf072b0acf1267858703e4f499ece8bf4 (diff)
Fix TUSCANY-2486 and TUSCANY-2324
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@678491 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--branches/sca-java-1.3/itest/builder/pom.xml99
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDImpl.java43
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3.java33
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3a.java33
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario1/META-INF/sca-contribution.xml24
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario1/scenario1.composite45
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario1/scenario1a.composite47
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario2/META-INF/sca-contribution.xml24
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario2/scenario2.composite45
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario2/scenario2a.composite47
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario3/META-INF/sca-contribution.xml24
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario3/scenario3.composite44
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario3/scenario3a.composite48
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario4/META-INF/sca-contribution.xml24
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario4/scenario4.composite44
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario4/scenario4a.composite48
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario5/META-INF/sca-contribution.xml24
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario5/scenario5.composite46
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario5/scenario5a.composite47
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario5/scenarios.wsdl63
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario6/META-INF/sca-contribution.xml24
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario6/scenario6.composite47
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario6/scenario6a.composite47
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario6/scenarios.wsdl63
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario7/META-INF/sca-contribution.xml24
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario7/scenario7.composite45
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario7/scenario7a.composite49
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario7/scenarios.wsdl63
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario8/META-INF/sca-contribution.xml24
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario8/scenario8.composite44
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario8/scenario8a.composite50
-rw-r--r--branches/sca-java-1.3/itest/builder/src/main/resources/scenario8/scenarios.wsdl63
-rw-r--r--branches/sca-java-1.3/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java693
-rw-r--r--branches/sca-java-1.3/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CompositeBuilderNonWiringImpl.java176
-rw-r--r--branches/sca-java-1.3/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java210
-rw-r--r--branches/sca-java-1.3/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/TestUtils.java203
-rw-r--r--branches/sca-java-1.3/itest/policy/src/main/resources/definitions.xml1
-rw-r--r--branches/sca-java-1.3/itest/pom.xml1
-rw-r--r--branches/sca-java-1.3/itest/validation/src/main/resources/policy/xml/UnableToMapPolicies/definitions.xml5
-rw-r--r--branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java18
-rw-r--r--branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java355
-rw-r--r--branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java212
-rw-r--r--branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java18
-rw-r--r--branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java162
-rw-r--r--branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java99
-rw-r--r--branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java50
-rw-r--r--branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java46
-rw-r--r--branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java224
-rw-r--r--branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceWireBuilderImpl.java61
-rw-r--r--branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java2
-rw-r--r--branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java170
-rw-r--r--branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServicePromotionBuilderImpl.java77
-rw-r--r--branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceConfigurationUtil.java121
-rw-r--r--branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ServiceConfigurationUtil.java29
-rw-r--r--branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java9
-rw-r--r--branches/sca-java-1.3/modules/assembly/src/main/resources/assembly-validation-messages.properties1
-rw-r--r--branches/sca-java-1.3/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java2
-rw-r--r--branches/sca-java-1.3/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java6
-rw-r--r--branches/sca-java-1.3/modules/binding-ws-wsdlgen/src/main/resources/wsdlgen-validation-messages.properties1
-rw-r--r--branches/sca-java-1.3/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java2
-rw-r--r--branches/sca-java-1.3/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java2
-rw-r--r--branches/sca-java-1.3/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java2
-rw-r--r--branches/sca-java-1.3/samples/databinding-echo/src/main/resources/EchoDataBinding.composite8
-rw-r--r--branches/sca-java-1.3/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite2
64 files changed, 3854 insertions, 509 deletions
diff --git a/branches/sca-java-1.3/itest/builder/pom.xml b/branches/sca-java-1.3/itest/builder/pom.xml
new file mode 100644
index 0000000000..24c4a88285
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/pom.xml
@@ -0,0 +1,99 @@
+<?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-itest</artifactId>
+ <version>1.3-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-builder</artifactId>
+ <name>Apache Tuscany SCA Builder Integration Test</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.3-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.3-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-monitor-logging</artifactId>
+ <version>1.3-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-workspace-impl</artifactId>
+ <version>1.3-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-xml</artifactId>
+ <version>1.3-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-sca-xml</artifactId>
+ <version>1.3-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>1.3-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>1.3-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDImpl.java b/branches/sca-java-1.3/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDImpl.java
new file mode 100644
index 0000000000..41f66c3f2c
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDImpl.java
@@ -0,0 +1,43 @@
+/*
+ * 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.itest.builder;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implementation class for ComponentD.
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(interfaces={Service3.class, Service3a.class})
+public class ComponentDImpl implements Service3, Service3a {
+
+ @Reference
+ protected Service3a reference3;
+
+ public String getGreetings(String name) {
+ return "Hello, " + name + "!";
+ }
+
+ public String getGreetings2(String name) {
+ return "Goodbye, " + name + "!";
+ }
+
+}
diff --git a/branches/sca-java-1.3/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3.java b/branches/sca-java-1.3/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3.java
new file mode 100644
index 0000000000..9a775feec9
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3.java
@@ -0,0 +1,33 @@
+/*
+ * 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.itest.builder;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Interface for Service3 in ComponentD.
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface Service3 {
+
+ String getGreetings(String name);
+
+}
diff --git a/branches/sca-java-1.3/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3a.java b/branches/sca-java-1.3/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3a.java
new file mode 100644
index 0000000000..98a1741fb6
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3a.java
@@ -0,0 +1,33 @@
+/*
+ * 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.itest.builder;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Interface for Service3a in ComponentD.
+ *
+ * @version $Rev$ $Date$
+ */
+@Remotable
+public interface Service3a {
+
+ String getGreetings2(String name);
+
+}
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario1/META-INF/sca-contribution.xml b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario1/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..256d01be58
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario1/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://scenario1"
+ xmlns:ns1="http://scenario1">
+ <deployable composite="ns1:CompositeA" />
+</contribution>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario1/scenario1.composite b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario1/scenario1.composite
new file mode 100644
index 0000000000..5c2a98ab40
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario1/scenario1.composite
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario1"
+ xmlns:tns="http://scenario1"
+ name="CompositeA">
+
+ <service name="Service1" promote="ComponentB/Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws />
+ </service>
+ <reference name="reference1" promote="ComponentB/reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentB">
+ <implementation.composite name="tns:CompositeC" />
+ <service name="Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario1/scenario1a.composite b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario1/scenario1a.composite
new file mode 100644
index 0000000000..21b5897aa1
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario1/scenario1a.composite
@@ -0,0 +1,47 @@
+<?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://scenario1"
+ xmlns:tns="http://scenario1"
+ name="CompositeC">
+
+ <service name="Service2" promote="ComponentD/Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a" promote="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2" promote="ComponentD/reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentD">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDImpl"/>
+ <service name="Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario2/META-INF/sca-contribution.xml b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario2/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..6fa901c4df
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario2/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://scenario2"
+ xmlns:ns2="http://scenario2">
+ <deployable composite="ns2:CompositeA" />
+</contribution>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario2/scenario2.composite b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario2/scenario2.composite
new file mode 100644
index 0000000000..66f88294ff
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario2/scenario2.composite
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario2"
+ xmlns:tns="http://scenario2"
+ name="CompositeA">
+
+ <service name="Service1" promote="ComponentB/Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference1" promote="ComponentB/reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentB">
+ <implementation.composite name="tns:CompositeC" />
+ <service name="Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws />
+ </service>
+ <service name="Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario2/scenario2a.composite b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario2/scenario2a.composite
new file mode 100644
index 0000000000..db1af4743f
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario2/scenario2a.composite
@@ -0,0 +1,47 @@
+<?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://scenario2"
+ xmlns:tns="http://scenario2"
+ name="CompositeC">
+
+ <service name="Service2" promote="ComponentD/Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a" promote="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2" promote="ComponentD/reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentD">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDImpl"/>
+ <service name="Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario3/META-INF/sca-contribution.xml b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario3/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..f5899ab1f0
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario3/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://scenario3"
+ xmlns:ns3="http://scenario3">
+ <deployable composite="ns3:CompositeA" />
+</contribution>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario3/scenario3.composite b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario3/scenario3.composite
new file mode 100644
index 0000000000..4b37c19e4e
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario3/scenario3.composite
@@ -0,0 +1,44 @@
+<?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://scenario3"
+ xmlns:tns="http://scenario3"
+ name="CompositeA">
+
+ <service name="Service1" promote="ComponentB/Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference1" promote="ComponentB/reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentB">
+ <implementation.composite name="tns:CompositeC" />
+ <service name="Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario3/scenario3a.composite b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario3/scenario3a.composite
new file mode 100644
index 0000000000..fedd79ff3d
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario3/scenario3a.composite
@@ -0,0 +1,48 @@
+<?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://scenario3"
+ xmlns:tns="http://scenario3"
+ name="CompositeC">
+
+ <service name="Service2" promote="ComponentD/Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws />
+ </service>
+ <service name="Service2a" promote="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2" promote="ComponentD/reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentD">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDImpl"/>
+ <service name="Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario4/META-INF/sca-contribution.xml b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario4/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..642245ea7e
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario4/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://scenario4"
+ xmlns:ns4="http://scenario4">
+ <deployable composite="ns4:CompositeA" />
+</contribution>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario4/scenario4.composite b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario4/scenario4.composite
new file mode 100644
index 0000000000..1bb876b33d
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario4/scenario4.composite
@@ -0,0 +1,44 @@
+<?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://scenario4"
+ xmlns:tns="http://scenario4"
+ name="CompositeA">
+
+ <service name="Service1" promote="ComponentB/Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference1" promote="ComponentB/reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentB">
+ <implementation.composite name="tns:CompositeC" />
+ <service name="Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario4/scenario4a.composite b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario4/scenario4a.composite
new file mode 100644
index 0000000000..55e13700a6
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario4/scenario4a.composite
@@ -0,0 +1,48 @@
+<?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://scenario4"
+ xmlns:tns="http://scenario4"
+ name="CompositeC">
+
+ <service name="Service2" promote="ComponentD/Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a" promote="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2" promote="ComponentD/reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentD">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDImpl"/>
+ <service name="Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws />
+ </service>
+ <service name="Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario5/META-INF/sca-contribution.xml b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario5/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..92da17179f
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario5/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://scenario5"
+ xmlns:ns5="http://scenario5">
+ <deployable composite="ns5:CompositeA" />
+</contribution>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario5/scenario5.composite b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario5/scenario5.composite
new file mode 100644
index 0000000000..403e19b087
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario5/scenario5.composite
@@ -0,0 +1,46 @@
+<?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://scenario5"
+ xmlns:tns="http://scenario5"
+ name="CompositeA">
+
+ <service name="Service1" promote="ComponentB/Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference1" promote="ComponentB/reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <interface.wsdl interface="http://scenarios#wsdl.interface(Service3a)" />
+ <binding.ws uri="http://foo.com/bar" />
+ </reference>
+
+ <component name="ComponentB">
+ <implementation.composite name="tns:CompositeC" />
+ <service name="Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario5/scenario5a.composite b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario5/scenario5a.composite
new file mode 100644
index 0000000000..0e37ded0e4
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario5/scenario5a.composite
@@ -0,0 +1,47 @@
+<?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://scenario5"
+ xmlns:tns="http://scenario5"
+ name="CompositeC">
+
+ <service name="Service2" promote="ComponentD/Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a" promote="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2" promote="ComponentD/reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentD">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDImpl"/>
+ <service name="Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario5/scenarios.wsdl b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario5/scenarios.wsdl
new file mode 100644
index 0000000000..7480419231
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario5/scenarios.wsdl
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions name="Service3Service"
+ targetNamespace="http://scenarios"
+ xmlns:tns="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified"
+ elementFormDefault="unqualified"
+ targetNamespace="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="getGreetings2">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetings2Response">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetings2">
+ <wsdl:part name="getGreetings2" element="tns:getGreetings2" />
+ </wsdl:message>
+
+ <wsdl:message name="getGreetings2Response">
+ <wsdl:part name="getGreetings2Response" element="tns:getGreetings2Response" />
+ </wsdl:message>
+
+ <wsdl:portType name="Service3a">
+ <wsdl:operation name="getGreetings2">
+ <wsdl:input message="tns:getGreetings2" />
+ <wsdl:output message="tns:getGreetings2Response" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+</wsdl:definitions>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario6/META-INF/sca-contribution.xml b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario6/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..42d45b0b98
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario6/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://scenario6"
+ xmlns:ns6="http://scenario6">
+ <deployable composite="ns6:CompositeA" />
+</contribution>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario6/scenario6.composite b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario6/scenario6.composite
new file mode 100644
index 0000000000..1c89139905
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario6/scenario6.composite
@@ -0,0 +1,47 @@
+<?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://scenario6"
+ xmlns:tns="http://scenario6"
+ name="CompositeA">
+
+ <service name="Service1" promote="ComponentB/Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference1" promote="ComponentB/reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentB">
+ <implementation.composite name="tns:CompositeC" />
+ <service name="Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws uri="http://foo.com/bar" />
+ </service>
+ <reference name="reference2" target="ComponentB/Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <interface.wsdl interface="http://scenarios#wsdl.interface(Service3a)" />
+ <binding.ws />
+ </reference>
+ </component>
+</composite>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario6/scenario6a.composite b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario6/scenario6a.composite
new file mode 100644
index 0000000000..853703a353
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario6/scenario6a.composite
@@ -0,0 +1,47 @@
+<?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://scenario6"
+ xmlns:tns="http://scenario6"
+ name="CompositeC">
+
+ <service name="Service2" promote="ComponentD/Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a" promote="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2" promote="ComponentD/reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentD">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDImpl"/>
+ <service name="Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario6/scenarios.wsdl b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario6/scenarios.wsdl
new file mode 100644
index 0000000000..7480419231
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario6/scenarios.wsdl
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions name="Service3Service"
+ targetNamespace="http://scenarios"
+ xmlns:tns="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified"
+ elementFormDefault="unqualified"
+ targetNamespace="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="getGreetings2">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetings2Response">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetings2">
+ <wsdl:part name="getGreetings2" element="tns:getGreetings2" />
+ </wsdl:message>
+
+ <wsdl:message name="getGreetings2Response">
+ <wsdl:part name="getGreetings2Response" element="tns:getGreetings2Response" />
+ </wsdl:message>
+
+ <wsdl:portType name="Service3a">
+ <wsdl:operation name="getGreetings2">
+ <wsdl:input message="tns:getGreetings2" />
+ <wsdl:output message="tns:getGreetings2Response" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+</wsdl:definitions>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario7/META-INF/sca-contribution.xml b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario7/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..44c471cc65
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario7/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://scenario7"
+ xmlns:ns7="http://scenario7">
+ <deployable composite="ns7:CompositeA" />
+</contribution>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario7/scenario7.composite b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario7/scenario7.composite
new file mode 100644
index 0000000000..6b1ac24cec
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario7/scenario7.composite
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario7"
+ xmlns:tns="http://scenario7"
+ name="CompositeA">
+
+ <service name="Service1" promote="ComponentB/Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference1" promote="ComponentB/reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentB">
+ <implementation.composite name="tns:CompositeC" />
+ <service name="Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws uri="http://foo.com/bar" />
+ </service>
+ <reference name="reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario7/scenario7a.composite b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario7/scenario7a.composite
new file mode 100644
index 0000000000..8e0cebbdd5
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario7/scenario7a.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://scenario7"
+ xmlns:tns="http://scenario7"
+ name="CompositeC">
+
+ <service name="Service2" promote="ComponentD/Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a" promote="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2" promote="ComponentD/reference3" target="ComponentB/Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <interface.wsdl interface="http://scenarios#wsdl.interface(Service3a)" />
+ <binding.ws />
+ </reference>
+
+ <component name="ComponentD">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDImpl"/>
+ <service name="Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario7/scenarios.wsdl b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario7/scenarios.wsdl
new file mode 100644
index 0000000000..7480419231
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario7/scenarios.wsdl
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions name="Service3Service"
+ targetNamespace="http://scenarios"
+ xmlns:tns="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified"
+ elementFormDefault="unqualified"
+ targetNamespace="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="getGreetings2">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetings2Response">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetings2">
+ <wsdl:part name="getGreetings2" element="tns:getGreetings2" />
+ </wsdl:message>
+
+ <wsdl:message name="getGreetings2Response">
+ <wsdl:part name="getGreetings2Response" element="tns:getGreetings2Response" />
+ </wsdl:message>
+
+ <wsdl:portType name="Service3a">
+ <wsdl:operation name="getGreetings2">
+ <wsdl:input message="tns:getGreetings2" />
+ <wsdl:output message="tns:getGreetings2Response" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+</wsdl:definitions>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario8/META-INF/sca-contribution.xml b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario8/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..7cb09d0a74
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario8/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://scenario8"
+ xmlns:ns8="http://scenario8">
+ <deployable composite="ns8:CompositeA" />
+</contribution>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario8/scenario8.composite b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario8/scenario8.composite
new file mode 100644
index 0000000000..26e5ee33fa
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario8/scenario8.composite
@@ -0,0 +1,44 @@
+<?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://scenario8"
+ xmlns:tns="http://scenario8"
+ name="CompositeA">
+
+ <service name="Service1" promote="ComponentB/Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference1" promote="ComponentB/reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentB">
+ <implementation.composite name="tns:CompositeC" />
+ <service name="Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+</composite>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario8/scenario8a.composite b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario8/scenario8a.composite
new file mode 100644
index 0000000000..4fa0712199
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario8/scenario8a.composite
@@ -0,0 +1,50 @@
+<?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://scenario8"
+ xmlns:tns="http://scenario8"
+ name="CompositeC">
+
+ <service name="Service2" promote="ComponentD/Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a" promote="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2" promote="ComponentD/reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentD">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDImpl"/>
+ <service name="Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws uri="http://foo.com/bar" />
+ </service>
+ <reference name="reference3" target="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <interface.wsdl interface="http://scenarios#wsdl.interface(Service3a)" />
+ <binding.ws />
+ </reference>
+ </component>
+</composite>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario8/scenarios.wsdl b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario8/scenarios.wsdl
new file mode 100644
index 0000000000..7480419231
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario8/scenarios.wsdl
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<wsdl:definitions name="Service3Service"
+ targetNamespace="http://scenarios"
+ xmlns:tns="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified"
+ elementFormDefault="unqualified"
+ targetNamespace="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="getGreetings2">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetings2Response">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetings2">
+ <wsdl:part name="getGreetings2" element="tns:getGreetings2" />
+ </wsdl:message>
+
+ <wsdl:message name="getGreetings2Response">
+ <wsdl:part name="getGreetings2Response" element="tns:getGreetings2Response" />
+ </wsdl:message>
+
+ <wsdl:portType name="Service3a">
+ <wsdl:operation name="getGreetings2">
+ <wsdl:input message="tns:getGreetings2" />
+ <wsdl:output message="tns:getGreetings2Response" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+</wsdl:definitions>
diff --git a/branches/sca-java-1.3/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java b/branches/sca-java-1.3/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java
new file mode 100644
index 0000000000..b7663fc7c4
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java
@@ -0,0 +1,693 @@
+/*
+ * 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.itest.builder;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.xml.namespace.QName;
+import junit.framework.TestCase;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
+
+/**
+ * Load and build some composites and inspect the results.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BuilderTestCase extends TestCase {
+ private CustomCompositeBuilder customBuilder;
+
+ @Override
+ protected void setUp() throws Exception {
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ }
+
+ // Scenario 1: <binding.ws> on outer composite service CompositeA/Service1
+ public void testScenario1() throws Exception {
+ System.out.println("====>Running testScenario1");
+ customBuilder = new CustomCompositeBuilder(false);
+ customBuilder.loadContribution("scenario1.composite", "TestContribution", "src/main/resources/scenario1/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario1Results(false);
+ }
+
+ public void testScenario1NonWiring() throws Exception {
+ System.out.println("====>Running testScenario1NonWiring");
+ customBuilder = new CustomCompositeBuilder(true);
+ customBuilder.loadContribution("scenario1.composite", "TestContribution", "src/main/resources/scenario1/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario1Results(true);
+ }
+
+ private void checkScenario1Results(boolean nonWiring) {
+ Composite domainComposite = customBuilder.getDomainComposite();
+
+ Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
+ if (!nonWiring) {
+ // Should create component service $promoted$.Service1 on innermost component
+ // ComponentD, with <binding.ws> and uri="/Service1"
+ // No other services on ComponentD should have <binding.ws>
+ WebServiceBinding wsBinding = null;
+ for (ComponentService service : componentD.getServices()) {
+ WebServiceBinding wsb = service.getBinding(WebServiceBinding.class);
+ if ("$promoted$.Service1".equals(service.getName())) {
+ wsBinding = wsb;
+ } else {
+ assert wsb == null;
+ }
+ }
+ assert "/Service1".equals(wsBinding.getURI());
+
+ // Should create WSDL document for ComponentD/$promoted$.Service1 with endpoint uri="/Service1"
+ Definition def = wsBinding.getWSDLDocument();
+ javax.wsdl.Service svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
+ Port port = svc.getPort("Service3Port");
+ assert "/Service1".equals(TestUtils.getPortAddress(port));
+ } else {
+ // Should not create component service $promoted$.Service1 on innermost component ComponentD
+ // No component services on ComponentD should have <binding.ws>
+ for (ComponentService service : componentD.getServices()) {
+ assert !"$promoted$.Service1".equals(service.getName());
+ assert service.getBinding(WebServiceBinding.class) == null;
+ }
+ }
+
+ // No services on ComponentB should have <binding.ws>
+ Component componentB = TestUtils.getComponent(domainComposite, "ComponentB");
+ for (ComponentService service : componentB.getServices()) {
+ assert service.getBinding(WebServiceBinding.class) == null;
+ }
+
+ // No services on CompositeC should have <binding.ws>
+ Composite compositeC = TestUtils.getComposite(domainComposite, new QName("http://scenario1", "CompositeC"));
+ for (Service service : compositeC.getServices()) {
+ assert service.getBinding(WebServiceBinding.class) == null;
+ }
+
+ if (nonWiring) {
+ // Should not add a WSDL document to domain composite service Service1
+ WebServiceBinding wsBinding = null;
+ for (Service service : domainComposite.getServices()) {
+ if ("Service1".equals(service.getName())) {
+ wsBinding = service.getBinding(WebServiceBinding.class);
+ }
+ }
+ assert wsBinding.getWSDLDocument() == null;
+ }
+ }
+
+ // Scenario 2: <binding.ws> on outer component service ComponentB/Service2
+ public void testScenario2() throws Exception {
+ System.out.println("====>Running testScenario2");
+ customBuilder = new CustomCompositeBuilder(false);
+ customBuilder.loadContribution("scenario2.composite", "TestContribution", "src/main/resources/scenario2/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario2and3Results("http://scenario2", false);
+ }
+
+ public void testScenario2NonWiring() throws Exception {
+ System.out.println("====>Running testScenario2NonWiring");
+ customBuilder = new CustomCompositeBuilder(true);
+ customBuilder.loadContribution("scenario2.composite", "TestContribution", "src/main/resources/scenario2/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario2and3Results("http://scenario2", true);
+ }
+
+ private void checkScenario2and3Results(String namespace, boolean nonWiring) {
+ Composite domainComposite = customBuilder.getDomainComposite();
+
+ // Should create WSDL document for ComponentB/Service2 with endpoint uri="/ComponentB/Service2"
+ // No other services on ComponentB should have <binding.ws>
+ Component componentB = TestUtils.getComponent(domainComposite, "ComponentB");
+ WebServiceBinding wsBinding = null;
+ for (ComponentService service : componentB.getServices()) {
+ WebServiceBinding wsb = service.getBinding(WebServiceBinding.class);
+ if ("Service2".equals(service.getName())) {
+ wsBinding = wsb;
+ } else {
+ assert wsb == null;
+ }
+ }
+ Definition def = wsBinding.getWSDLDocument();
+ javax.wsdl.Service svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
+ Port port = svc.getPort("Service3Port");
+ assert "/ComponentB/Service2".equals(TestUtils.getPortAddress(port));
+
+ Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
+ /*
+ if (!nonWiring) {
+ */
+ // Should create component service $promoted$.ComponentB.Service2 on innermost component
+ // ComponentD, with <binding.ws> and uri="/ComponentB/Service2"
+ wsBinding = null;
+ for (ComponentService service : componentD.getServices()) {
+ if ("$promoted$.ComponentB.Service2".equals(service.getName())) {
+ wsBinding = service.getBinding(WebServiceBinding.class);
+ }
+ }
+ assert "/ComponentB/Service2".equals(wsBinding.getURI());
+
+ // Should create WSDL document for ComponentD/$promoted$.ComponentB.Service2 with endpoint uri="/ComponentB/Service2"
+ def = wsBinding.getWSDLDocument();
+ svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
+ port = svc.getPort("Service3Port");
+ assert "/ComponentB/Service2".equals(TestUtils.getPortAddress(port));
+ /*
+ } else {
+ // Should not create component service $promoted$.ComponentB.Service2 on innermost component ComponentD
+ for (ComponentService service : componentD.getServices()) {
+ assert !"$promoted$.ComponentB.Service2".equals(service.getName());
+ }
+ }
+ */
+
+ // Should add <binding.ws> to outer composite service CompositeA/Service1
+ wsBinding = null;
+ for (Service service : domainComposite.getServices()) {
+ if ("Service1".equals(service.getName())) {
+ wsBinding = service.getBinding(WebServiceBinding.class);
+ }
+ }
+ assert wsBinding != null;
+ if (nonWiring) {
+ // Should not add a WSDL document to domain composite service Service1
+ assert wsBinding.getWSDLDocument() == null;
+ }
+
+ if (!nonWiring) {
+ // Should create component service $promoted$.Service1 on innermost component
+ // ComponentD, with <binding.ws> and uri="/Service1"
+ wsBinding = null;
+ for (ComponentService service : componentD.getServices()) {
+ if ("$promoted$.Service1".equals(service.getName())) {
+ wsBinding = service.getBinding(WebServiceBinding.class);
+ }
+ }
+ assert "/Service1".equals(wsBinding.getURI());
+
+ // Should create WSDL document for ComponentD/$promoted$.Service1 with endpoint uri="/Service1"
+ def = wsBinding.getWSDLDocument();
+ svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
+ port = svc.getPort("Service3Port");
+ assert "/Service1".equals(TestUtils.getPortAddress(port));
+ } else {
+ // Should not create component service $promoted$.Service1 on innermost component ComponentD
+ for (ComponentService service : componentD.getServices()) {
+ assert !"$promoted$.Service1".equals(service.getName());
+ }
+ }
+
+ // No services on ComponentD should have <binding.ws>, except for $promoted$.Service1
+ // and $promoted$.ComponentB.Service2
+ for (ComponentService service : componentD.getServices()) {
+ if (!"$promoted$.Service1".equals(service.getName()) &&
+ !"$promoted$.ComponentB.Service2".equals(service.getName())) {
+ assert service.getBinding(WebServiceBinding.class) == null;
+ }
+ }
+
+ // No services on CompositeC should have <binding.ws>, except for Service2 in Scenario 3
+ Composite compositeC = TestUtils.getComposite(domainComposite, new QName(namespace, "CompositeC"));
+ for (Service service : compositeC.getServices()) {
+ if ("http://scenario3".equals(namespace) && "Service2".equals(service.getName())) {
+ assert service.getBinding(WebServiceBinding.class) != null;
+ } else {
+ assert service.getBinding(WebServiceBinding.class) == null;
+ }
+ }
+ }
+
+ // Scenario 3: <binding.ws> on inner composite service CompositeC/Service2
+ public void testScenario3() throws Exception {
+ System.out.println("====>Running testScenario3");
+ customBuilder = new CustomCompositeBuilder(false);
+ customBuilder.loadContribution("scenario3.composite", "TestContribution", "src/main/resources/scenario3/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario2and3Results("http://scenario3", false);
+ }
+
+ public void testScenario3NonWiring() throws Exception {
+ System.out.println("====>Running testScenario3NonWiring");
+ customBuilder = new CustomCompositeBuilder(true);
+ customBuilder.loadContribution("scenario3.composite", "TestContribution", "src/main/resources/scenario3/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario2and3Results("http://scenario3", true);
+ }
+
+ // Scenario 4: <binding.ws> on inner component service ComponentD/Service3
+ public void testScenario4() throws Exception {
+ System.out.println("====>Running testScenario4");
+ customBuilder = new CustomCompositeBuilder(false);
+ customBuilder.loadContribution("scenario4.composite", "TestContribution", "src/main/resources/scenario4/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario4Results(false);
+ }
+
+ public void testScenario4NonWiring() throws Exception {
+ System.out.println("====>Running testScenario4NonWiring");
+ customBuilder = new CustomCompositeBuilder(true);
+ customBuilder.loadContribution("scenario4.composite", "TestContribution", "src/main/resources/scenario4/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario4Results(true);
+ }
+
+ private void checkScenario4Results(boolean nonWiring) {
+ Composite domainComposite = customBuilder.getDomainComposite();
+
+ // Should create WSDL document for ComponentD/Service3 with endpoint uri="/ComponentD/Service3"
+ Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
+ WebServiceBinding wsBinding = null;
+ for (ComponentService service : componentD.getServices()) {
+ if ("Service3".equals(service.getName())) {
+ wsBinding = service.getBinding(WebServiceBinding.class);
+ }
+ }
+ Definition def = wsBinding.getWSDLDocument();
+ javax.wsdl.Service svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
+ Port port = svc.getPort("Service3Port");
+ assert "/ComponentB/ComponentD/Service3".equals(TestUtils.getPortAddress(port));
+
+ // Should add <binding.ws> to inner composite service CompositeC/Service2
+ // No other services on CompositeC should have <binding.ws>
+ Composite compositeC = TestUtils.getComposite(domainComposite, new QName("http://scenario4", "CompositeC"));
+ wsBinding = null;
+ for (Service service : compositeC.getServices()) {
+ WebServiceBinding wsb = service.getBinding(WebServiceBinding.class);
+ if ("Service2".equals(service.getName())) {
+ wsBinding = wsb;
+ } else {
+ assert wsb == null;
+ }
+ }
+ assert "/ComponentB/Service2".equals(wsBinding.getURI());
+
+ // Should add <binding.ws> to outer component service ComponentB/Service2
+ // Should create WSDL document for ComponentB/Service2 with endpoint uri="/ComponentB/Service2"
+ // No other services on ComponentB should have <binding.ws>
+ Component componentB = TestUtils.getComponent(domainComposite, "ComponentB");
+ wsBinding = null;
+ for (ComponentService service : componentB.getServices()) {
+ WebServiceBinding wsb = service.getBinding(WebServiceBinding.class);
+ if ("Service2".equals(service.getName())) {
+ wsBinding = wsb;
+ } else {
+ assert wsb == null;
+ }
+ }
+ assert "/ComponentB/Service2".equals(wsBinding.getURI());
+ def = wsBinding.getWSDLDocument();
+ svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
+ port = svc.getPort("Service3Port");
+ assert "/ComponentB/Service2".equals(TestUtils.getPortAddress(port));
+
+ /*
+ if (!nonWiring) {
+ */
+ // Should create component service $promoted$.ComponentB.Service2 on innermost component
+ // ComponentD, with <binding.ws> and uri="/ComponentB/Service2"
+ wsBinding = null;
+ for (ComponentService service : componentD.getServices()) {
+ if ("$promoted$.ComponentB.Service2".equals(service.getName())) {
+ wsBinding = service.getBinding(WebServiceBinding.class);
+ }
+ }
+ assert "/ComponentB/Service2".equals(wsBinding.getURI());
+
+ // Should create WSDL document for ComponentD/$promoted$.ComponentB.Service2 with endpoint uri="/ComponentB/Service2"
+ def = wsBinding.getWSDLDocument();
+ svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
+ port = svc.getPort("Service3Port");
+ assert "/ComponentB/Service2".equals(TestUtils.getPortAddress(port));
+ /*
+ } else {
+ // Should not create component service $promoted$.ComponentB.Service2 on innermost component ComponentD
+ for (ComponentService service : componentD.getServices()) {
+ assert !"$promoted$.ComponentB.Service2".equals(service.getName());
+ }
+ }
+ */
+
+ // Should add <binding.ws> to outer composite service CompositeA/Service1
+ wsBinding = null;
+ for (Service service : domainComposite.getServices()) {
+ if ("Service1".equals(service.getName())) {
+ wsBinding = service.getBinding(WebServiceBinding.class);
+ }
+ }
+ assert wsBinding != null;
+ if (nonWiring) {
+ // Should not add a WSDL document to domain composite service Service1
+ assert wsBinding.getWSDLDocument() == null;
+ }
+
+ if (!nonWiring) {
+ // Should create component service $promoted$.Service1 on innermost component
+ // ComponentD, with <binding.ws> and uri="/Service1"
+ wsBinding = null;
+ for (ComponentService service : componentD.getServices()) {
+ if ("$promoted$.Service1".equals(service.getName())) {
+ wsBinding = service.getBinding(WebServiceBinding.class);
+ }
+ }
+ assert "/Service1".equals(wsBinding.getURI());
+
+ // Should create WSDL document for ComponentD/$promoted$.Service1 with endpoint uri="/Service1"
+ def = wsBinding.getWSDLDocument();
+ svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
+ port = svc.getPort("Service3Port");
+ assert "/Service1".equals(TestUtils.getPortAddress(port));
+ } else {
+ // Should not create component service $promoted$.Service1 on innermost component ComponentD
+ for (ComponentService service : componentD.getServices()) {
+ assert !"$promoted$.Service1".equals(service.getName());
+ }
+ }
+
+ // No services on ComponentD should have <binding.ws>, except for Service3,
+ // $promoted$.Service1 and $promoted$.ComponentB.Service2
+ for (ComponentService service : componentD.getServices()) {
+ if (!"Service3".equals(service.getName()) &&
+ !"$promoted$.Service1".equals(service.getName()) &&
+ !"$promoted$.ComponentB.Service2".equals(service.getName())) {
+ assert service.getBinding(WebServiceBinding.class) == null;
+ }
+ }
+ }
+
+ // Scenario 5: <binding.ws> and <interface.wsdl> on outer composite reference CompositeA/reference1
+ public void testScenario5() throws Exception {
+ System.out.println("====>Running testScenario5");
+ customBuilder = new CustomCompositeBuilder(false);
+ customBuilder.loadContribution("scenario5.composite", "TestContribution", "src/main/resources/scenario5/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario5Results(false);
+ }
+
+ public void testScenario5NonWiring() throws Exception {
+ System.out.println("====>Running testScenario5NonWiring");
+ customBuilder = new CustomCompositeBuilder(true);
+ customBuilder.loadContribution("scenario5.composite", "TestContribution", "src/main/resources/scenario5/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario5Results(true);
+ }
+
+ private void checkScenario5Results(boolean nonWiring) {
+ Composite domainComposite = customBuilder.getDomainComposite();
+
+ // Should not add <binding.ws> to any outer component references
+ Component componentB = TestUtils.getComponent(domainComposite, "ComponentB");
+ for (ComponentReference reference : componentB.getReferences()) {
+ assert reference.getBinding(WebServiceBinding.class) == null;
+ }
+
+ Definition def;
+ javax.wsdl.Service svc;
+ Port port;
+ WebServiceBinding wsBinding;
+ Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
+ if (!nonWiring) {
+ // Should add <binding.ws> to inner component reference ComponentD/reference3 with uri="http://foo.com/bar"
+ // Should set <interface.wsdl> on inner component reference ComponentD/reference3
+ wsBinding = null;
+ for (ComponentReference reference : componentD.getReferences()) {
+ if ("reference3".equals(reference.getName())) {
+ wsBinding = reference.getBinding(WebServiceBinding.class);
+ assert reference.getInterfaceContract() instanceof WSDLInterfaceContract;
+ }
+ }
+ assert "http://foo.com/bar".equals(wsBinding.getURI());
+
+ // Should create WSDL document for ComponentD/reference3 with endpoint uri="http://foo.com/bar"
+ def = wsBinding.getWSDLDocument();
+ svc = def.getService(new QName("http://scenarios/ComponentD/reference3", "Service3aService"));
+ port = svc.getPort("Service3aPort");
+ assert "http://foo.com/bar".equals(TestUtils.getPortAddress(port));
+ } else {
+ // Should not add <binding.ws> to any inner component references
+ for (ComponentReference reference : componentD.getReferences()) {
+ assert reference.getBinding(WebServiceBinding.class) == null;
+ }
+ }
+
+ // Should not add <binding.ws> or <interface.wsdl> to inner composite reference CompositeC/reference2
+ Composite compositeC = TestUtils.getComposite(domainComposite, new QName("http://scenario5", "CompositeC"));
+ for (Reference reference : compositeC.getReferences()) {
+ assert reference.getBinding(WebServiceBinding.class) == null;
+ assert reference.getInterfaceContract() instanceof JavaInterfaceContract;
+ }
+ }
+
+ // Scenario 6: <binding.ws> and <interface.wsdl> on outer component reference ComponentB/reference2
+ public void testScenario6() throws Exception {
+ System.out.println("====>Running testScenario6");
+ customBuilder = new CustomCompositeBuilder(false);
+ customBuilder.loadContribution("scenario6.composite", "TestContribution", "src/main/resources/scenario6/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario6and7Results("http://scenario6", false);
+ }
+
+ public void testScenario6NonWiring() throws Exception {
+ System.out.println("====>Running testScenario6NonWiring");
+ customBuilder = new CustomCompositeBuilder(true);
+ customBuilder.loadContribution("scenario6.composite", "TestContribution", "src/main/resources/scenario6/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario6and7Results("http://scenario6", true);
+ }
+
+ private void checkScenario6and7Results(String namespace, boolean nonWiring) {
+ Composite domainComposite = customBuilder.getDomainComposite();
+
+ // Should remove target= on ComponentB/reference2 (for Scenario 6) or
+ // CompositeC/reference2 (for Scenario 7), and add uri="http://foo.com/bar"
+ // to the <binding.ws> element on ComponentB/reference2
+ // For nonWiring, ComponentB/reference2 should have target=
+ // and no uri= should be added
+ Component componentB = TestUtils.getComponent(domainComposite, "ComponentB");
+ WebServiceBinding wsBinding = null;
+ for (ComponentReference reference : componentB.getReferences()) {
+ if ("reference2".equals(reference.getName())) {
+ if (!nonWiring) {
+ assert reference.getTargets().size() == 0;
+ } else {
+ assert reference.getTargets().size() == 1;
+ }
+ wsBinding = reference.getBinding(WebServiceBinding.class);
+ }
+ }
+ if (!nonWiring) {
+ assert "http://foo.com/bar".equals(wsBinding.getURI());
+ } else {
+ assert wsBinding.getURI() == null;
+ }
+
+ Definition def;
+ javax.wsdl.Service svc;
+ Port port;
+ if (!nonWiring) {
+ // Should create WSDL document for ComponentB/reference2 with endpoint uri="http://foo.com/bar"
+ def = wsBinding.getWSDLDocument();
+ svc = def.getService(new QName("http://scenarios/ComponentB/reference2", "Service3aService"));
+ port = svc.getPort("Service3aPort");
+ assert "http://foo.com/bar".equals(TestUtils.getPortAddress(port));
+ }
+
+ Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
+ if (!nonWiring) {
+ // Should add <binding.ws> to inner component reference ComponentD/reference3 with uri="http://foo.com/bar"
+ // Should set <interface.wsdl> on inner component reference ComponentD/reference3
+ wsBinding = null;
+ for (ComponentReference reference : componentD.getReferences()) {
+ if ("reference3".equals(reference.getName())) {
+ wsBinding = reference.getBinding(WebServiceBinding.class);
+ assert reference.getInterfaceContract() instanceof WSDLInterfaceContract;
+ }
+ }
+ assert "http://foo.com/bar".equals(wsBinding.getURI());
+
+ // Should create WSDL document for ComponentD/reference3 with endpoint uri="http://foo.com/bar"
+ def = wsBinding.getWSDLDocument();
+ svc = def.getService(new QName("http://scenarios/ComponentB/reference2", "Service3aService"));
+ port = svc.getPort("Service3aPort");
+ assert "http://foo.com/bar".equals(TestUtils.getPortAddress(port));
+ } else {
+ // Should not add <binding.ws> to any inner component references
+ for (ComponentReference reference : componentD.getReferences()) {
+ assert reference.getBinding(WebServiceBinding.class) == null;
+ }
+ }
+
+ // No references on CompositeC should have <binding.ws> or <interface.wsdl>, except for
+ // reference2 in Scenario 7
+ Composite compositeC = TestUtils.getComposite(domainComposite, new QName(namespace, "CompositeC"));
+ for (Reference reference : compositeC.getReferences()) {
+ if ("http://scenario7".equals(namespace) && "reference2".equals(reference.getName())) {
+ assert reference.getBinding(WebServiceBinding.class)!= null;
+ assert reference.getInterfaceContract() instanceof WSDLInterfaceContract;
+ } else {
+ assert reference.getBinding(WebServiceBinding.class) == null;
+ assert reference.getInterfaceContract() instanceof JavaInterfaceContract;
+ }
+ }
+
+ // Should add <binding.ws> and <interface.wsdl> to outer composite reference CompositeA/reference1
+ wsBinding = null;
+ for (Reference reference : domainComposite.getReferences()) {
+ if ("reference1".equals(reference.getName())) {
+ wsBinding = reference.getBinding(WebServiceBinding.class);
+ assert reference.getInterfaceContract() instanceof WSDLInterfaceContract;
+ }
+ }
+ assert wsBinding.getURI() == null;
+
+ // Should not add a WSDL document to domain composite reference reference1
+ assert wsBinding.getWSDLDocument() == null;
+ }
+
+ // Scenario 7: <binding.ws> and <interface.wsdl> on inner composite reference CompositeC/reference2
+ public void testScenario7() throws Exception {
+ System.out.println("====>Running testScenario7");
+ customBuilder = new CustomCompositeBuilder(false);
+ customBuilder.loadContribution("scenario7.composite", "TestContribution", "src/main/resources/scenario7/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario6and7Results("http://scenario7", false);
+ }
+
+ public void testScenario7NonWiring() throws Exception {
+ System.out.println("====>Running testScenario7NonWiring");
+ customBuilder = new CustomCompositeBuilder(true);
+ customBuilder.loadContribution("scenario7.composite", "TestContribution", "src/main/resources/scenario7/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario6and7Results("http://scenario7", true);
+ }
+
+ // Scenario 8: <binding.ws> and <interface.wsdl> on inner component reference ComponentD/reference3
+ public void testScenario8() throws Exception {
+ System.out.println("====>Running testScenario8");
+ customBuilder = new CustomCompositeBuilder(false);
+ customBuilder.loadContribution("scenario8.composite", "TestContribution", "src/main/resources/scenario8/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario8Results(false);
+ }
+
+ public void testScenario8NonWiring() throws Exception {
+ System.out.println("====>Running testScenario8NonWiring");
+ customBuilder = new CustomCompositeBuilder(true);
+ customBuilder.loadContribution("scenario8.composite", "TestContribution", "src/main/resources/scenario8/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario8Results(true);
+ }
+
+ private void checkScenario8Results(boolean nonWiring) {
+ Composite domainComposite = customBuilder.getDomainComposite();
+
+ // Should replace target= on ComponentD/reference3 by uri="http://foo.com/bar" on <binding.ws>
+ // For nonWiring, the original target= is preserved and there is no uri=
+ Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
+ WebServiceBinding wsBinding = null;
+ for (ComponentReference reference : componentD.getReferences()) {
+ if ("reference3".equals(reference.getName())) {
+ if (!nonWiring) {
+ assert reference.getTargets().size() == 0;
+ } else {
+ assert reference.getTargets().size() == 1;
+ }
+ wsBinding = reference.getBinding(WebServiceBinding.class);
+ }
+ }
+ if (!nonWiring) {
+ assert "http://foo.com/bar".equals(wsBinding.getURI());
+ } else {
+ assert wsBinding.getURI() == null;
+ }
+
+ Definition def;
+ javax.wsdl.Service svc;
+ Port port;
+ if (!nonWiring) {
+ // Should create WSDL document for ComponentD/reference3 with endpoint uri="http://foo.com/bar"
+ def = wsBinding.getWSDLDocument();
+ svc = def.getService(new QName("http://scenarios/ComponentD/reference3", "Service3aService"));
+ port = svc.getPort("Service3aPort");
+ assert "http://foo.com/bar".equals(TestUtils.getPortAddress(port));
+ }
+
+ // Should add <binding.ws> and <interface.wsdl> to inner composite reference CompositeC/reference2
+ Composite compositeC = TestUtils.getComposite(domainComposite, new QName("http://scenario8", "CompositeC"));
+ wsBinding = null;
+ for (Reference reference : compositeC.getReferences()) {
+ if ("reference2".equals(reference.getName())) {
+ wsBinding = reference.getBinding(WebServiceBinding.class);
+ assert reference.getInterfaceContract() instanceof WSDLInterfaceContract;
+ }
+ }
+ assert wsBinding.getURI() == null;
+
+ // Should add <binding.ws> and <interface.wsdl> to outer component reference ComponentB/reference2
+ Component componentB = TestUtils.getComponent(domainComposite, "ComponentB");
+ wsBinding = null;
+ for (ComponentReference reference : componentB.getReferences()) {
+ if ("reference2".equals(reference.getName())) {
+ wsBinding = reference.getBinding(WebServiceBinding.class);
+ assert reference.getInterfaceContract() instanceof WSDLInterfaceContract;
+ }
+ }
+ assert wsBinding.getURI() == null;
+
+ // Should add <binding.ws> and <interface.wsdl> to outer composite reference CompositeA/reference1
+ wsBinding = null;
+ for (Reference reference : domainComposite.getReferences()) {
+ if ("reference1".equals(reference.getName())) {
+ wsBinding = reference.getBinding(WebServiceBinding.class);
+ assert reference.getInterfaceContract() instanceof WSDLInterfaceContract;
+ }
+ }
+ assert wsBinding.getURI() == null;
+
+ // Should not add a WSDL document to domain composite reference reference1
+ assert wsBinding.getWSDLDocument() == null;
+ }
+
+}
diff --git a/branches/sca-java-1.3/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CompositeBuilderNonWiringImpl.java b/branches/sca-java-1.3/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CompositeBuilderNonWiringImpl.java
new file mode 100644
index 0000000000..05b5596076
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CompositeBuilderNonWiringImpl.java
@@ -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.
+ */
+package org.apache.tuscany.sca.itest.builder;
+
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultEndpointFactory;
+import org.apache.tuscany.sca.assembly.EndpointFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+
+/**
+ * Test version of org.apache.tuscany.sca.assembly.builder.impl.builder.CompositeBuilderImpl
+ *
+ * This class should be identical to CompositeBuilderImpl except for omitting the
+ * following builders:
+ * componentWireBuilder
+ * compositeReferenceWireBuilder
+ * compositePromotedServiceBuilder
+ * It omits the component wiring step and the special processing that's performed
+ * for composite service and reference promotion.
+ *
+ * @version $Rev: 674139 $ $Date: 2008-07-05 00:20:36 +0100 (Sat, 05 Jul 2008) $
+ */
+public class CompositeBuilderNonWiringImpl implements CompositeBuilder {
+ private static final Logger logger = Logger.getLogger(CompositeBuilderNonWiringImpl.class.getName());
+ private CompositeBuilder compositeIncludeBuilder;
+ //private CompositeBuilder componentReferenceWireBuilder;
+ //private CompositeBuilder componentReferencePromotionWireBuilder;
+ //private CompositeBuilder compositeReferenceWireBuilder;
+ private CompositeBuilder compositeCloneBuilder;
+ private CompositeBuilder componentConfigurationBuilder;
+ private CompositeBuilder compositeServiceConfigurationBuilder;
+ private CompositeBuilder compositeReferenceConfigurationBuilder;
+ private CompositeBuilder compositeBindingURIBuilder;
+ private CompositeBuilder componentServicePromotionBuilder;
+ //private CompositeBuilder compositeServicePromotionBuilder;
+ private CompositeBuilder compositePromotionBuilder;
+ private CompositeBuilder compositePolicyBuilder;
+ private CompositeBuilder componentServiceBindingBuilder;
+ private CompositeBuilder componentReferenceBindingBuilder;
+
+ /**
+ * Constructs a new composite builder.
+ *
+ * @param assemblyFactory
+ * @param scaBindingFactory
+ * @param intentAttachPointTypeFactory
+ * @param interfaceContractMapper
+ * @param monitor
+ */
+ public CompositeBuilderNonWiringImpl(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ Monitor monitor) {
+ this(assemblyFactory, null, scaBindingFactory, intentAttachPointTypeFactory, interfaceContractMapper, null, monitor);
+ }
+
+ /**
+ * Constructs a new composite builder.
+ *
+ * @param assemblyFactory
+ * @param scaBindingFactory
+ * @param endpointFactory
+ * @param intentAttachPointTypeFactory
+ * @param interfaceContractMapper
+ * @param policyDefinitions
+ * @param monitor
+ */
+ public CompositeBuilderNonWiringImpl(AssemblyFactory assemblyFactory,
+ EndpointFactory endpointFactory,
+ SCABindingFactory scaBindingFactory,
+ IntentAttachPointTypeFactory intentAttachPointTypeFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ SCADefinitions policyDefinitions,
+ Monitor monitor) {
+
+ if (endpointFactory == null){
+ endpointFactory = new DefaultEndpointFactory();
+ }
+
+ compositeIncludeBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositeIncludeBuilderImpl(monitor);
+ //componentReferenceWireBuilder = new org.apache.tuscany.sca.assembly.builder.impl.ComponentReferenceWireBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ //componentReferencePromotionWireBuilder = new org.apache.tuscany.sca.assembly.builder.impl.ComponentReferencePromotionWireBuilderImpl(assemblyFactory, monitor);
+ //compositeReferenceWireBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositeReferenceWireBuilderImpl(assemblyFactory, monitor);
+ compositeCloneBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositeCloneBuilderImpl(monitor);
+ componentConfigurationBuilder = new org.apache.tuscany.sca.assembly.builder.impl.ComponentConfigurationBuilderImpl(assemblyFactory, scaBindingFactory, interfaceContractMapper, policyDefinitions, monitor);
+ compositeServiceConfigurationBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositeServiceConfigurationBuilderImpl(assemblyFactory);
+ compositeReferenceConfigurationBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositeReferenceConfigurationBuilderImpl(assemblyFactory);
+ compositeBindingURIBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositeBindingURIBuilderImpl(assemblyFactory, scaBindingFactory, interfaceContractMapper, policyDefinitions, monitor);
+ componentServicePromotionBuilder = new org.apache.tuscany.sca.assembly.builder.impl.ComponentServicePromotionBuilderImpl(assemblyFactory);
+ //compositeServicePromotionBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositeServicePromotionBuilderImpl(assemblyFactory);
+ compositePromotionBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositePromotionBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ compositePolicyBuilder = new org.apache.tuscany.sca.assembly.builder.impl.CompositePolicyBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ componentServiceBindingBuilder = new org.apache.tuscany.sca.assembly.builder.impl.ComponentServiceBindingBuilderImpl(monitor);
+ componentReferenceBindingBuilder = new org.apache.tuscany.sca.assembly.builder.impl.ComponentReferenceBindingBuilderImpl(monitor);
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+
+ // Collect and fuse includes
+ compositeIncludeBuilder.build(composite);
+
+ // Expand nested composites
+ compositeCloneBuilder.build(composite);
+
+ // Configure all components
+ componentConfigurationBuilder.build(composite);
+
+ // Connect composite services/references to promoted services/references
+ compositePromotionBuilder.build(composite);
+
+ // Compute the policies across the model hierarchy
+ compositePolicyBuilder.build(composite);
+
+ // Configure composite services
+ compositeServiceConfigurationBuilder.build(composite);
+
+ // Configure composite references
+ compositeReferenceConfigurationBuilder.build(composite);
+
+ // Configure binding URIs
+ compositeBindingURIBuilder.build(composite);
+
+ // Create promoted component services
+ componentServicePromotionBuilder.build(composite);
+
+ // Create promoted composite services
+// compositeServicePromotionBuilder.build(composite);
+
+ // Build component service binding-related information
+ componentServiceBindingBuilder.build(composite);
+
+ // Wire the components
+// componentReferenceWireBuilder.build(composite);
+
+ // Wire the promoted component references
+// componentReferencePromotionWireBuilder.build(composite);
+
+ // Wire the composite references
+// compositeReferenceWireBuilder.build(composite);
+
+ // Build component reference binding-related information
+ componentReferenceBindingBuilder.build(composite);
+
+ // Fuse nested composites
+ //FIXME do this later
+ //cloneBuilder.fuseCompositeImplementations(composite);
+ }
+
+}
diff --git a/branches/sca-java-1.3/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java b/branches/sca-java-1.3/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java
new file mode 100644
index 0000000000..82a8ca6689
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java
@@ -0,0 +1,210 @@
+/*
+ * 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.itest.builder;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint;
+import org.apache.tuscany.sca.core.UtilityExtensionPoint;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.MonitorFactory;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.workspace.Workspace;
+import org.apache.tuscany.sca.workspace.WorkspaceFactory;
+import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder;
+import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl;
+
+public class CustomCompositeBuilder {
+ private URLArtifactProcessor<Contribution> contributionProcessor;
+ private ModelResolverExtensionPoint modelResolvers;
+ private ModelFactoryExtensionPoint modelFactories;
+ private WorkspaceFactory workspaceFactory;
+ private AssemblyFactory assemblyFactory;
+ private XMLOutputFactory outputFactory;
+ private StAXArtifactProcessor<Object> xmlProcessor;
+ private ContributionDependencyBuilder contributionDependencyBuilder;
+ private CompositeBuilder domainCompositeBuilder;
+ private static Workspace workspace;
+ private List<SCADefinitions> policyDefinitions;
+ private Monitor monitor;
+ private Composite domainComposite;
+ private boolean nonWiring;
+
+ protected CustomCompositeBuilder(boolean nonWiring) {
+ this.nonWiring = nonWiring;
+ }
+
+ private void init() {
+
+ // Create extension point registry
+ ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
+
+ // Create a monitor
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
+ monitor = monitorFactory.createMonitor();
+
+ // Initialize the Tuscany module activators
+ ModuleActivatorExtensionPoint moduleActivators = extensionPoints.getExtensionPoint(ModuleActivatorExtensionPoint.class);
+ for (ModuleActivator activator : moduleActivators.getModuleActivators()) {
+ activator.start(extensionPoints);
+ }
+
+ // Get XML input/output factories
+ modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
+ outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
+
+ // Get contribution workspace and assembly model factories
+ workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class);
+ assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+
+ // Create XML artifact processors
+ StAXArtifactProcessorExtensionPoint xmlProcessorExtensions = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ xmlProcessor = new ExtensibleStAXArtifactProcessor(xmlProcessorExtensions, inputFactory, outputFactory, monitor);
+
+ // Create contribution content processor
+ URLArtifactProcessorExtensionPoint docProcessorExtensions = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ contributionProcessor = docProcessorExtensions.getProcessor(Contribution.class);
+
+ // Get the model resolvers
+ modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class);
+
+ // Create a contribution dependency builder
+ contributionDependencyBuilder = new ContributionDependencyBuilderImpl(monitor);
+
+ // Create a composite builder
+ SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
+ IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
+ InterfaceContractMapper contractMapper = utilities.getUtility(InterfaceContractMapper.class);
+ if (nonWiring) {
+ domainCompositeBuilder = new CompositeBuilderNonWiringImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, contractMapper, monitor);
+ } else {
+ domainCompositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, contractMapper, monitor);
+ }
+ }
+
+ public void loadContribution(String compositeURL, String sourceURI, String sourceURL) throws Exception {
+ init();
+
+ // Create workspace model
+ workspace = workspaceFactory.createWorkspace();
+ workspace.setModelResolver(new ExtensibleModelResolver(workspace, modelResolvers, modelFactories));
+
+ // Read the test contribution
+ URI artifactURI = URI.create(sourceURI);
+ URL artifactURL = new File(sourceURL).toURI().toURL();
+ URL contributionURL = new File(compositeURL).toURI().toURL();
+ Contribution testContribution = contributionProcessor.read(contributionURL, artifactURI, artifactURL);
+ workspace.getContributions().add(testContribution);
+
+ // Build the contribution dependencies
+ Map<Contribution, List<Contribution>> contributionDependencies = new HashMap<Contribution, List<Contribution>>();
+ Set<Contribution> resolved = new HashSet<Contribution>();
+ for (Contribution contribution: workspace.getContributions()) {
+ List<Contribution> dependencies = contributionDependencyBuilder.buildContributionDependencies(contribution, workspace);
+
+ // Resolve contributions
+ for (Contribution dependency: dependencies) {
+ if (!resolved.contains(dependency)) {
+ resolved.add(dependency);
+ contributionProcessor.resolve(dependency, workspace.getModelResolver());
+ }
+ }
+
+ contributionDependencies.put(contribution, dependencies);
+ }
+
+ // Create a composite model for the domain
+ domainComposite = assemblyFactory.createComposite();
+ domainComposite.setName(new QName(Constants.SCA10_NS, "domain"));
+
+ // Add all deployables to it, normally the domain administrator would select
+ // the deployables to include
+ domainComposite.getIncludes().addAll(workspace.getDeployables());
+
+ // Build the domain composite and wire the components included in it
+ domainCompositeBuilder.build(domainComposite);
+ }
+
+ /**
+ * Returns the delegating model processor.
+ * @return the delegating model processor
+ */
+ public StAXArtifactProcessor<Object> getModelProcessor() {
+ return xmlProcessor;
+ }
+
+ /**
+ * Returns the XML output factory.
+ * @return the XML output factory
+ */
+ public XMLOutputFactory getOutputFactory() {
+ return outputFactory;
+ }
+
+ /**
+ * Returns the domain composite.
+ * @return the domain composite model object
+ */
+ public Composite getDomainComposite() {
+ return domainComposite;
+ }
+
+ /**
+ * Returns the monitor.
+ * @return the monitor instance
+ */
+ public Monitor getMonitor() {
+ return monitor;
+ }
+
+}
diff --git a/branches/sca-java-1.3/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/TestUtils.java b/branches/sca-java-1.3/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/TestUtils.java
new file mode 100644
index 0000000000..9bff4d394e
--- /dev/null
+++ b/branches/sca-java-1.3/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/TestUtils.java
@@ -0,0 +1,203 @@
+/*
+ * 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.itest.builder;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap12.SOAP12Address;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLWriter;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.stream.XMLStreamWriter;
+import junit.framework.TestCase;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.xml.serialize.OutputFormat;
+import org.apache.xml.serialize.XMLSerializer;
+import org.w3c.dom.Document;
+
+/**
+ * Static utility methods for use by test cases.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestUtils {
+
+ protected static void checkProblems(CustomCompositeBuilder customBuilder) throws Exception {
+ boolean problems = false;
+ for (Problem problem : customBuilder.getMonitor().getProblems()) {
+ if (problem.getCause() != null) {
+ problem.getCause().printStackTrace();
+ }
+ problems = true;
+ }
+ assert !problems;
+ }
+
+ protected static String getPortAddress(Port port) {
+ Object ext = port.getExtensibilityElements().get(0);
+ if (ext instanceof SOAPAddress) {
+ return ((SOAPAddress)ext).getLocationURI();
+ }
+ if (ext instanceof SOAP12Address) {
+ return ((SOAP12Address)ext).getLocationURI();
+ }
+ return null;
+ }
+
+ protected static Component getComponent(Composite composite, String name) {
+ for (Component component : composite.getComponents()) {
+ if (name.equals(component.getName())) {
+ return component;
+ }
+ // process implementation composites recursively
+ Implementation impl = component.getImplementation();
+ if (impl instanceof Composite) {
+ Component comp = getComponent((Composite)impl, name);
+ if (comp != null) {
+ return comp;
+ }
+ }
+ }
+ return null;
+ }
+
+ protected static Composite getComposite(Composite composite, QName name) {
+ if (name.equals(composite.getName())) {
+ return composite;
+ }
+ for (Component component : composite.getComponents()) {
+ // process implementation composites recursively
+ Implementation impl = component.getImplementation();
+ if (impl instanceof Composite) {
+ Composite comp = getComposite((Composite)impl, name);
+ if (comp != null) {
+ return comp;
+ }
+ }
+ }
+ return null;
+ }
+
+ protected static void printResults(CustomCompositeBuilder customBuilder) throws Exception {
+ for (Problem problem : customBuilder.getMonitor().getProblems()) {
+ if (problem.getCause() != null) {
+ problem.getCause().printStackTrace();
+ }
+ }
+ Composite domainComposite = customBuilder.getDomainComposite();
+ printComposite(domainComposite, customBuilder);
+ }
+
+ private static void printComposite(Composite composite, CustomCompositeBuilder customBuilder) throws Exception {
+ // process implementation composites recursively
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ printComposite((Composite)implementation, customBuilder);
+ }
+ }
+
+ // write out the SCDL
+ writeSCDL(composite, customBuilder);
+
+ // find all the component service and reference bindings
+ for (Component component : composite.getComponents()) {
+ for (ComponentService componentService : component.getServices()) {
+ for (Binding binding : componentService.getBindings()) {
+ if (binding instanceof WebServiceBinding) {
+ writeWSDL(component, componentService, ((WebServiceBinding)binding).getWSDLDocument());
+ }
+ }
+ }
+ for (ComponentReference componentReference : component.getReferences()) {
+ for (Binding binding : componentReference.getBindings()) {
+ if (binding instanceof WebServiceBinding) {
+ writeWSDL(component, componentReference, ((WebServiceBinding)binding).getWSDLDocument());
+ }
+ }
+ }
+ }
+
+ // find all the composite service and reference bindings
+ for (Service service : composite.getServices()) {
+ for (Binding binding : service.getBindings()) {
+ if (binding instanceof WebServiceBinding) {
+ writeWSDL(null, service, ((WebServiceBinding)binding).getWSDLDocument());
+ }
+ }
+ }
+ for (Reference reference : composite.getReferences()) {
+ for (Binding binding : reference.getBindings()) {
+ if (binding instanceof WebServiceBinding) {
+ writeWSDL(null, reference, ((WebServiceBinding)binding).getWSDLDocument());
+ }
+ }
+ }
+ }
+
+ private static void writeSCDL(Composite composite, CustomCompositeBuilder customBuilder) throws Exception {
+ // Print out a composite
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ XMLStreamWriter writer = customBuilder.getOutputFactory().createXMLStreamWriter(bos);
+ customBuilder.getModelProcessor().write(composite, writer);
+
+ // Parse and write again to pretty format it
+ DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ Document document = documentBuilder.parse(new ByteArrayInputStream(bos.toByteArray()));
+ OutputFormat format = new OutputFormat();
+ format.setIndenting(true);
+ format.setIndent(2);
+ XMLSerializer serializer = new XMLSerializer(System.out, format);
+ System.out.println("-->Runtime SCDL model for composite " + composite.getName());
+ serializer.serialize(document);
+ }
+
+ private static void writeWSDL(Component component, Contract contract, Definition definition) {
+ if (definition == null) {
+ System.out.println("-->No generated WSDL for " + (component != null ? component.getName() : "") + "/" + contract.getName());
+ } else {
+ try {
+ System.out.println("-->Generated WSDL for " + (component != null ? component.getName() : "") + "/" + contract.getName());
+ WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter();
+ writer.writeWSDL(definition, System.out);
+ } catch (WSDLException e) {
+ // ignore
+ }
+ }
+ }
+
+}
diff --git a/branches/sca-java-1.3/itest/policy/src/main/resources/definitions.xml b/branches/sca-java-1.3/itest/policy/src/main/resources/definitions.xml
index 54aa8ec480..7ae6b2c547 100644
--- a/branches/sca-java-1.3/itest/policy/src/main/resources/definitions.xml
+++ b/branches/sca-java-1.3/itest/policy/src/main/resources/definitions.xml
@@ -45,6 +45,7 @@
<sca:intent name="TestIntent_1.Qualifier_1" />
+ <sca:intent name="TestIntent_4.Qualifier_1" />
<!-- PolicySets -->
diff --git a/branches/sca-java-1.3/itest/pom.xml b/branches/sca-java-1.3/itest/pom.xml
index da62e428ee..87adceeb72 100644
--- a/branches/sca-java-1.3/itest/pom.xml
+++ b/branches/sca-java-1.3/itest/pom.xml
@@ -59,6 +59,7 @@
</activation>
<modules>
<module>bpel</module>
+ <module>builder</module>
<module>callablereferences</module>
<module>callablereferences-ws</module>
<module>callback-api</module>
diff --git a/branches/sca-java-1.3/itest/validation/src/main/resources/policy/xml/UnableToMapPolicies/definitions.xml b/branches/sca-java-1.3/itest/validation/src/main/resources/policy/xml/UnableToMapPolicies/definitions.xml
index 14eefadaba..6faca15da0 100644
--- a/branches/sca-java-1.3/itest/validation/src/main/resources/policy/xml/UnableToMapPolicies/definitions.xml
+++ b/branches/sca-java-1.3/itest/validation/src/main/resources/policy/xml/UnableToMapPolicies/definitions.xml
@@ -19,6 +19,7 @@
-->
<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ xmlns:test="http://tuscany.apache.org/xmlns/sca/1.0"
xmlns:calc="http://calculator">
<!-- Extension Types Metadata -->
@@ -46,7 +47,7 @@
<intent name="TestIntentTwo"
constrains="sca:binding"
- requires="TestIntentOne">
+ requires="test:TestIntentOne">
<description>
Protect messages from unauthorized reading or modification
</description>
@@ -137,7 +138,7 @@
<policySet name="ConfidentialityPolicies"
provides="test:confidentiality"
- bindings="binding.ws"
+ appliesTo="binding.ws"
xmlns="http://www.osoa.org/xmlns/sca/1.0"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
<intentMap provides="test:confidentiality" default="transport">
diff --git a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java
index f38346663a..2eb1bf21b0 100644
--- a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java
+++ b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java
@@ -47,6 +47,24 @@ public interface Reference extends AbstractReference, Contract {
void setWiredByImpl(boolean wiredByImpl);
/**
+ * Returns a boolean value, "false" by default, which indicates whether
+ * the configuration of this reference is a promotion override for
+ * another more deeply nested reference.
+ *
+ * @return true if the reference is a promotion override
+ */
+ boolean isPromotionOverride();
+
+ /**
+ * Sets a boolean value, "false" by default, which indicates whether
+ * the configuration of this reference is a promotion override for
+ * another more deeply nested reference.
+ *
+ * @param promotionOverride whether the reference is a promotion override
+ */
+ void setPromotionOverride(boolean promotionOverride);
+
+ /**
* Returns the targets of this reference.
*
* @return the targets of this reference.
diff --git a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
index 853c11c2ee..648977792a 100644
--- a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
+++ b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
@@ -38,6 +38,7 @@ import org.apache.tuscany.sca.assembly.ComponentReference;
import org.apache.tuscany.sca.assembly.ComponentService;
import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.Contract;
import org.apache.tuscany.sca.assembly.Implementation;
import org.apache.tuscany.sca.assembly.Multiplicity;
import org.apache.tuscany.sca.assembly.OptimizableBinding;
@@ -95,7 +96,7 @@ public abstract class BaseConfigurationBuilderImpl {
protected void configureComponents(Composite composite) throws CompositeBuilderException {
configureComponents(composite, null);
configureSourcedProperties(composite, null);
- configureBindingURIs(composite, null, null);
+ //configureBindingURIs(composite, null, null);
}
/**
@@ -138,7 +139,7 @@ public abstract class BaseConfigurationBuilderImpl {
SCABinding scaBinding = createSCABinding();
service.getBindings().add(scaBinding);
}
-
+/*
// Initialize binding names and URIs
for (Binding binding : service.getBindings()) {
@@ -155,6 +156,7 @@ public abstract class BaseConfigurationBuilderImpl {
}
}
}
+*/
}
// Initialize reference bindings
@@ -164,7 +166,7 @@ public abstract class BaseConfigurationBuilderImpl {
SCABinding scaBinding = createSCABinding();
reference.getBindings().add(scaBinding);
}
-
+/*
// Set binding names
for (Binding binding : reference.getBindings()) {
if (binding.getName() == null) {
@@ -179,6 +181,7 @@ public abstract class BaseConfigurationBuilderImpl {
}
}
}
+*/
}
// Initialize all component services and references
@@ -252,7 +255,7 @@ public abstract class BaseConfigurationBuilderImpl {
SCABinding scaBinding = createSCABinding();
componentService.getBindings().add(scaBinding);
}
-
+/*
// Set binding names
for (Binding binding : componentService.getBindings()) {
@@ -268,6 +271,7 @@ public abstract class BaseConfigurationBuilderImpl {
}
}
}
+*/
}
// Initialize reference bindings
@@ -278,7 +282,7 @@ public abstract class BaseConfigurationBuilderImpl {
SCABinding scaBinding = createSCABinding();
componentReference.getBindings().add(scaBinding);
}
-
+/*
// Set binding names
for (Binding binding : componentReference.getBindings()) {
if (binding.getName() == null) {
@@ -292,6 +296,7 @@ public abstract class BaseConfigurationBuilderImpl {
}
}
}
+*/
}
}
}
@@ -801,208 +806,6 @@ public abstract class BaseConfigurationBuilderImpl {
}
/**
- * Activate composite services in nested composites.
- *
- * @param composite
- * @param problems
- */
- protected void configureCompositeServices(Composite composite) {
-
- // Process nested composites recursively
- configureNestedCompositeServices(composite);
-
- // Process top level composite services
- for (Service service : composite.getServices()) {
- CompositeService compositeService = (CompositeService)service;
-
- // Get the inner most promoted service
- ComponentService promotedService = ServiceConfigurationUtil.getPromotedComponentService(compositeService);
- if (promotedService != null) {
- Component promotedComponent = getPromotedComponent(compositeService);
-
- // Default to use the interface from the promoted service
- if (compositeService.getInterfaceContract() == null && promotedService.getInterfaceContract() != null) {
- compositeService.setInterfaceContract(promotedService.getInterfaceContract());
- }
-
- // Create a new component service to represent this composite
- // service on the promoted component
- ComponentService newComponentService = assemblyFactory.createComponentService();
- newComponentService.setName("$promoted$." + compositeService.getName());
- promotedComponent.getServices().add(newComponentService);
- newComponentService.setService(promotedService.getService());
- // set the bindings using the top level bindings to override the
- // lower level bindings
- if (bindingsSpecifiedManually(compositeService.getBindings())){
- newComponentService.getBindings()
- .addAll(compositeService.getBindings());
- } else {
- for (Binding binding : promotedService.getBindings()){
- try {
- newComponentService.getBindings().add((Binding)binding.clone());
- } catch(CloneNotSupportedException ex){
- // this binding can't be used in the promoted service
- }
- }
- }
- newComponentService.setInterfaceContract(compositeService.getInterfaceContract());
- if (compositeService.getInterfaceContract() != null && compositeService
- .getInterfaceContract().getCallbackInterface() != null) {
- newComponentService.setCallback(assemblyFactory.createCallback());
- if ((compositeService.getCallback() != null) &&
- (bindingsSpecifiedManually(compositeService.getCallback().getBindings()))){
- newComponentService.getCallback().getBindings()
- .addAll(compositeService.getCallback().getBindings());
- } else if ((promotedService.getCallback() != null) &&
- (bindingsSpecifiedManually(promotedService.getCallback().getBindings()))){
- for (Binding binding : promotedService.getCallback().getBindings()){
- try {
- newComponentService.getCallback().getBindings().add((Binding)binding.clone());
- } catch(CloneNotSupportedException ex){
- // this binding can't be used in the promoted service
- }
- }
- }
- }
-
- // Change the composite service to now promote the newly
- // created component service directly
- compositeService.setPromotedComponent(promotedComponent);
- compositeService.setPromotedService(newComponentService);
- }
- }
- }
-
- /**
- * Activate composite services in nested composites.
- *
- * @param composite
- * @param problems
- */
- private void configureNestedCompositeServices(Composite composite) {
-
- // Process nested composites recursively
- for (Component component : composite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
-
- // First process nested composites
- configureNestedCompositeServices((Composite)implementation);
-
- // Process the component services declared on components
- // in this composite
- for (ComponentService componentService : component.getServices()) {
- Service implService = componentService.getService();
- if (implService != null && implService instanceof CompositeService) {
- CompositeService compositeService = (CompositeService)implService;
-
- // Get the inner most promoted service
- ComponentService promotedService =
- ServiceConfigurationUtil.getPromotedComponentService(compositeService);
- if (promotedService != null) {
- Component promotedComponent = getPromotedComponent(compositeService);
-
- // Default to use the interface from the promoted
- // service
- if (compositeService.getInterfaceContract() == null) {
- compositeService.setInterfaceContract(promotedService
- .getInterfaceContract());
- }
- if (componentService.getInterfaceContract() == null) {
- componentService.setInterfaceContract(promotedService
- .getInterfaceContract());
- }
-
- // Create a new component service to represent this
- // composite service on the promoted component
- ComponentService newComponentService =
- assemblyFactory.createComponentService();
- newComponentService.setName("$promoted$." + componentService.getName());
- promotedComponent.getServices().add(newComponentService);
- newComponentService.setService(promotedService.getService());
-
- // set the bindings using the top level bindings to override the
- // lower level bindings
- if (bindingsSpecifiedManually(componentService.getBindings())){
- newComponentService.getBindings()
- .addAll(componentService.getBindings());
- } else if (bindingsSpecifiedManually(compositeService.getBindings())){
- newComponentService.getBindings()
- .addAll(compositeService.getBindings());
- } else {
- for (Binding binding : promotedService.getBindings()){
- try {
- newComponentService.getBindings().add((Binding)binding.clone());
- } catch(CloneNotSupportedException ex){
- // this binding can't be used in the promoted service
- }
- }
- }
-
- newComponentService.setInterfaceContract(componentService
- .getInterfaceContract());
-
- if (componentService.getInterfaceContract() != null &&
- componentService.getInterfaceContract().getCallbackInterface() != null) {
-
- newComponentService.setCallback(assemblyFactory.createCallback());
-
- // set the bindings using the top level bindings to override the
- // lower level bindings
- if ((componentService.getCallback() != null) &&
- (bindingsSpecifiedManually(componentService.getCallback().getBindings()))){
- newComponentService.getCallback().getBindings()
- .addAll(componentService.getCallback().getBindings());
- } else if ((compositeService.getCallback() != null) &&
- (bindingsSpecifiedManually(compositeService.getCallback().getBindings()))){
- newComponentService.getCallback().getBindings()
- .addAll(compositeService.getCallback().getBindings());
- } else if ((promotedService.getCallback() != null) &&
- (bindingsSpecifiedManually(promotedService.getCallback().getBindings()))){
- for (Binding binding : promotedService.getCallback().getBindings()){
- try {
- newComponentService.getCallback().getBindings().add((Binding)binding.clone());
- } catch(CloneNotSupportedException ex){
- // this binding can't be used in the promoted service
- }
- }
- }
- }
-
- // Change the composite service to now promote the
- // newly created component service directly
- compositeService.setPromotedComponent(promotedComponent);
- compositeService.setPromotedService(newComponentService);
- }
- }
- }
- }
- }
- }
-
- /**
- * If the bindings are specified in the composite file return true as they should
- * otherwise return false
- *
- * @param bindings
- * @return true if the bindings were specified manually
- */
- private boolean bindingsSpecifiedManually(List<Binding> bindings){
-
- if (bindings.size() > 1){
- return true;
- } else if ((bindings.size() == 1) &&
- (bindings.get(0) instanceof AutomaticBinding) &&
- (((AutomaticBinding)bindings.get(0)).getIsAutomatic() == true )){
- return false;
- } else if (bindings.size() == 1) {
- return true;
- } else {
- return false;
- }
- }
-
- /**
* @param composite
*/
private void configureSourcedProperties(Composite composite, List<ComponentProperty> propertySettings) {
@@ -1032,34 +835,6 @@ public abstract class BaseConfigurationBuilderImpl {
}
}
- /**
- * Follow a service promotion chain down to the inner most (non composite)
- * component.
- *
- * @param compositeService
- * @return
- */
- protected static Component getPromotedComponent(CompositeService compositeService) {
- ComponentService componentService = compositeService.getPromotedService();
- if (componentService != null) {
- Service service = componentService.getService();
- if (componentService.getName() != null && service instanceof CompositeService) {
-
- // Continue to follow the service promotion chain
- return getPromotedComponent((CompositeService)service);
-
- } else {
-
- // Found a non-composite service
- return compositeService.getPromotedComponent();
- }
- } else {
-
- // No promoted service
- return null;
- }
- }
-
private ComponentProperty getComponentPropertyByName(String propertyName, List<ComponentProperty> properties) {
if (properties != null) {
for (ComponentProperty aProperty : properties) {
@@ -1074,8 +849,8 @@ public abstract class BaseConfigurationBuilderImpl {
private SCABinding createSCABinding() {
SCABinding scaBinding = scaBindingFactory.createSCABinding();
- // mark the bindings that are added automatically so that theu can
- // can be disregarded for overriding purposes
+ // mark the bindings that are added automatically so that they can
+ // be disregarded for overriding purposes
if (scaBinding instanceof AutomaticBinding){
((AutomaticBinding)scaBinding).setIsAutomatic(true);
}
@@ -1092,6 +867,16 @@ public abstract class BaseConfigurationBuilderImpl {
}
/**
+ * Called by CompositeBindingURIBuilderImpl
+ *
+ * @param composite the composite to be configured
+ */
+ protected void configureBindingURIsAndNames(Composite composite) throws CompositeBuilderException {
+ configureBindingURIs(composite, null, null);
+ configureBindingNames(composite);
+ }
+
+ /**
* Fully resolve the binding URIs based on available information. This includes information
* from the ".composite" files, from resources associated with the binding, e.g. WSDL files,
* from any associated policies and from the default information for each binding type.
@@ -1108,7 +893,13 @@ public abstract class BaseConfigurationBuilderImpl {
* from the ".composite" files, from resources associated with the binding, e.g. WSDL files,
* from any associated policies and from the default information for each binding type.
*
- * TODO: Share the URL calculation algorithm with the configureComponents() method above
+ * NOTE: This method repeats some of the processing performed by the configureComponents()
+ * method above. The duplication is needed because NodeConfigurationServiceImpl
+ * calls this method without previously calling configureComponents(). In the
+ * normal builder sequence used by CompositeBuilderImpl, both of these methods
+ * are called.
+ *
+ * TODO: Share the URL calculation algorithm with the configureComponents() method above
* although keeping the configureComponents() methods signature as is because when
* a composite is actually build in a node the node default information is currently
* available
@@ -1209,23 +1000,96 @@ public abstract class BaseConfigurationBuilderImpl {
}
}
}
+
+ /**
+ * Add default names for callback bindings and reference bindings. Needs to be
+ * separate from configureBindingURIs() because configureBindingURIs() is called
+ * by NodeConfigurationServiceImpl as well as by CompositeBuilderImpl.
+ */
+ private void configureBindingNames(Composite composite) {
+
+ // Process nested composites recursively
+ for (Component component : composite.getComponents()) {
+
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+
+ // Process nested composite
+ configureBindingNames((Composite)implementation);
+ }
+ }
+
+ // Initialize composite service callback binding names
+ for (Service service : composite.getServices()) {
+
+ if (service.getCallback() != null) {
+ for (Binding binding : service.getCallback().getBindings()) {
+ constructBindingName(service, binding);
+ }
+ }
+ }
+
+ // Initialize composite reference binding names
+ for (Reference reference : composite.getReferences()) {
+
+ for (Binding binding : reference.getBindings()) {
+ constructBindingName(reference, binding);
+ }
+
+ if (reference.getCallback() != null) {
+ for (Binding binding : reference.getCallback().getBindings()) {
+ constructBindingName(reference, binding);
+ }
+ }
+ }
+
+ // Initialize component service and reference binding names
+ for (Component component : composite.getComponents()) {
+
+ // Initialize component service callback binding names
+ for (ComponentService service : component.getServices()) {
+
+ if (service.getCallback() != null) {
+ for (Binding binding : service.getCallback().getBindings()) {
+ constructBindingName(service, binding);
+ }
+ }
+ }
+
+ // Initialize component reference binding names
+ for (ComponentReference reference : component.getReferences()) {
+
+ // Initialize binding names
+ for (Binding binding : reference.getBindings()) {
+ constructBindingName(reference, binding);
+ }
+
+ if (reference.getCallback() != null) {
+ for (Binding binding : reference.getCallback().getBindings()) {
+ constructBindingName(reference, binding);
+ }
+ }
+ }
+ }
+ }
/**
- * If a binding name is not provided by the user construct it based on the service name
+ * If a binding name is not provided by the user, construct it based on the service
+ * or reference name
*
- * @param service
+ * @param contract the service or reference
* @param binding
*/
- private void constructBindingName(Service service, Binding binding) throws CompositeBuilderException{
+ private void constructBindingName(Contract contract, Binding binding) {
// set the default binding name if one is required
- // if there is no name on the binding then set it to the service name
+ // if there is no name on the binding then set it to the service or reference name
if (binding.getName() == null){
- binding.setName(service.getName());
+ binding.setName(contract.getName());
}
// Check that multiple bindings do not have the same name
- for (Binding otherBinding : service.getBindings()) {
+ for (Binding otherBinding : contract.getBindings()) {
if (otherBinding == binding) {
// Skip the current binding
continue;
@@ -1235,7 +1099,8 @@ public abstract class BaseConfigurationBuilderImpl {
continue;
}
if (binding.getName().equals(otherBinding.getName())) {
- warning("MultipleBindingsForService", binding, service.getName(), binding.getName());
+ warning(contract instanceof Service ? "MultipleBindingsForService" : "MultipleBindingsForReference",
+ binding, contract.getName(), binding.getName());
}
}
}
diff --git a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
index 544240d07e..c5faa46f85 100644
--- a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
+++ b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
@@ -939,218 +939,6 @@ class BaseWireBuilderImpl {
// Clear the list of wires
composite.getWires().clear();
}
-
- /**
- * Wire composite references in nested composites.
- *
- * @param composite
- * @param problems
- */
- protected void wireCompositeReferences(Composite composite) {
-
- // Process nested composites recursively
- for (Component component : composite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- wireCompositeReferences((Composite)implementation);
- }
- }
-
- // Process composite references declared in this composite
- for (Reference reference : composite.getReferences()) {
- CompositeReference compositeReference = (CompositeReference)reference;
- List<ComponentReference> promotedReferences = getPromotedComponentReferences(compositeReference);
- for (ComponentReference promotedReference : promotedReferences) {
-
- reconcileReferenceBindings(compositeReference, promotedReference);
- if (compositeReference.getInterfaceContract() != null && // can be null in unit tests
- compositeReference.getInterfaceContract().getCallbackInterface() != null) {
- SCABinding scaCallbackBinding = promotedReference.getCallbackBinding(SCABinding.class);
- if (promotedReference.getCallback() != null) {
- promotedReference.getCallback().getBindings().clear();
- } else {
- promotedReference.setCallback(assemblyFactory.createCallback());
- }
- if (scaCallbackBinding != null) {
- promotedReference.getCallback().getBindings().add(scaCallbackBinding);
- }
- if (compositeReference.getCallback() != null) {
- promotedReference.getCallback().getBindings().addAll(compositeReference.getCallback()
- .getBindings());
- }
- }
- }
- }
-
- // Process the component references declared on components
- // in this composite
- for (Component component : composite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- for (ComponentReference componentReference : component.getReferences()) {
- Reference implReference = componentReference.getReference();
- if (implReference != null && implReference instanceof CompositeReference) {
- CompositeReference compositeReference = (CompositeReference)implReference;
- List<ComponentReference> promotedReferences =
- getPromotedComponentReferences(compositeReference);
- for (ComponentReference promotedReference : promotedReferences) {
-
- // Override the configuration of the promoted reference
- reconcileReferenceBindings(componentReference, promotedReference);
- if (componentReference.getInterfaceContract() != null && // can be null in unit tests
- componentReference.getInterfaceContract().getCallbackInterface() != null) {
- SCABinding scaCallbackBinding = promotedReference.getCallbackBinding(SCABinding.class);
- if (promotedReference.getCallback() != null) {
- promotedReference.getCallback().getBindings().clear();
- } else {
- promotedReference.setCallback(assemblyFactory.createCallback());
- }
- if (scaCallbackBinding != null) {
- promotedReference.getCallback().getBindings().add(scaCallbackBinding);
- }
- if (componentReference.getCallback() != null) {
- promotedReference.getCallback().getBindings().addAll(componentReference
- .getCallback().getBindings());
- }
- }
-
- // Wire the promoted reference to the actual
- // non-composite component services
- if (promotedReference.getMultiplicity() == Multiplicity.ONE_ONE || promotedReference
- .getMultiplicity() == Multiplicity.ONE_ONE) {
- // promotedReference.getTargets().clear();
- }
- for (ComponentService target : componentReference.getTargets()) {
- if (target.getService() instanceof CompositeService) {
-
- // Wire to the actual component service
- // promoted by a composite service
- CompositeService compositeService = (CompositeService)target.getService();
- // Find the promoted component service
- ComponentService componentService = ServiceConfigurationUtil.getPromotedComponentService(compositeService);
- if (componentService != null) {
- promotedReference.getTargets().add(componentService);
- }
- } else {
-
- // Wire to a non-composite target service
- promotedReference.getTargets().add(target);
- }
- }
- }
- }
- }
- } else {
- for (ComponentReference componentReference : component.getReferences()) {
-
- // Wire the component reference to the actual
- // non-composite component services
- List<ComponentService> targets = componentReference.getTargets();
- for (int i = 0, n = targets.size(); i < n; i++) {
- ComponentService target = targets.get(i);
- if (target.getService() instanceof CompositeService) {
-
- // Wire to the actual component service
- // promoted by a composite service
- CompositeService compositeService = (CompositeService)target.getService();
- ComponentService componentService = compositeService.getPromotedService();
- if (componentService != null) {
- targets.set(i, componentService);
- }
- }
- }
- }
- }
- }
- }
-
- /**
- * Follow a reference promotion chain down to the inner most (non composite)
- * component references.
- *
- * @param compositeReference
- * @return
- */
- private List<ComponentReference> getPromotedComponentReferences(CompositeReference compositeReference) {
- List<ComponentReference> componentReferences = new ArrayList<ComponentReference>();
- collectPromotedComponentReferences(compositeReference, componentReferences);
- return componentReferences;
- }
-
- /**
- * Follow a reference promotion chain down to the inner most (non composite)
- * component references.
- *
- * @param compositeReference
- * @param componentReferences
- * @return
- */
- private void collectPromotedComponentReferences(CompositeReference compositeReference,
- List<ComponentReference> componentReferences) {
- for (ComponentReference componentReference : compositeReference.getPromotedReferences()) {
- Reference reference = componentReference.getReference();
- if (reference instanceof CompositeReference) {
-
- // Continue to follow the reference promotion chain
- collectPromotedComponentReferences((CompositeReference)reference, componentReferences);
-
- } else if (reference != null) {
-
- // Found a non-composite reference
- componentReferences.add(componentReference);
- }
- }
- }
-
- /**
- * Override the bindings for a promoted reference from an outer component
- * reference
- *
- * @param reference
- * @param promotedReference
- */
- private void reconcileReferenceBindings(Reference reference, ComponentReference promotedReference) {
- List<Binding> bindings = new ArrayList<Binding>();
-
- // collect the top level bindings first
- for (Binding binding : reference.getBindings()) {
- if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) {
- bindings.add(binding);
- }
- }
-
- // if there are not top level bindings to override the promoted bindings
- // then collect the promoted bindings
- if (bindings.size() == 0){
- for (Binding binding : promotedReference.getBindings()) {
- if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) {
- bindings.add(binding);
- }
- }
- }
-
- promotedReference.getBindings().clear();
- promotedReference.getBindings().addAll(bindings);
-
- if (promotedReference.getMultiplicity() == Multiplicity.ONE_ONE || promotedReference.getMultiplicity() == Multiplicity.ZERO_ONE) {
- if (promotedReference.getBindings().size() > 1) {
- warning("ComponentReferenceMoreWire", promotedReference, promotedReference.getName());
- }
- }
- Set<Binding> callbackBindings = new HashSet<Binding>();
- if (promotedReference.getCallback() != null) {
- callbackBindings.addAll(promotedReference.getCallback().getBindings());
- }
- if (reference.getCallback() != null) {
- callbackBindings.addAll(reference.getCallback().getBindings());
- }
- promotedReference.setCallback(assemblyFactory.createCallback());
- for (Binding binding : callbackBindings) {
- if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) {
- promotedReference.getCallback().getBindings().add(binding);
- }
- }
- }
private void addPoliciesFromPromotedService(CompositeService compositeService) {
//inherit intents and policies from promoted service
diff --git a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java
index 0c45f7bc9d..1769e7eee9 100644
--- a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java
+++ b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java
@@ -48,16 +48,8 @@ public class ComponentReferenceBindingBuilderImpl implements CompositeBuilder {
}
private void buildReferenceBindings(Composite composite) {
-
- // build bindings recursively
- for (Component component : composite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- buildReferenceBindings((Composite)implementation);
- }
- }
- // find all the component reference bindings
+ // find all the component reference bindings (starting at top level)
for (Component component : composite.getComponents()) {
for (ComponentReference componentReference : component.getReferences()) {
for (Binding binding : componentReference.getBindings()) {
@@ -67,6 +59,14 @@ public class ComponentReferenceBindingBuilderImpl implements CompositeBuilder {
}
}
}
+
+ // build bindings recursively
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ buildReferenceBindings((Composite)implementation);
+ }
+ }
}
}
diff --git a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java
new file mode 100644
index 0000000000..e2677e5a82
--- /dev/null
+++ b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java
@@ -0,0 +1,162 @@
+/*
+ * 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.assembly.builder.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+/**
+ * A composite builder that handles the creation of promoted composite services.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentReferencePromotionWireBuilderImpl implements CompositeBuilder {
+ private AssemblyFactory assemblyFactory;
+ private Monitor monitor;
+
+ public ComponentReferencePromotionWireBuilderImpl(AssemblyFactory assemblyFactory, Monitor monitor) {
+ this.assemblyFactory = assemblyFactory;
+ this.monitor = monitor;
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+ wireCompositeReferences(composite);
+ }
+
+ /**
+ * Wire composite references in nested composites.
+ *
+ * @param composite
+ * @param problems
+ */
+ private void wireCompositeReferences(Composite composite) {
+
+ // Process nested composites recursively
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ wireCompositeReferences((Composite)implementation);
+ }
+ }
+
+ // Process component references declared on components in this composite
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ for (ComponentReference componentReference : component.getReferences()) {
+ Reference implReference = componentReference.getReference();
+ if (implReference != null && implReference instanceof CompositeReference) {
+
+ // If the component reference is wired, it is a promotion override
+ if (!componentReference.getEndpoints().isEmpty()) {
+ componentReference.setPromotionOverride(true);
+ }
+
+ // If the component reference is a promotion override, override the
+ // configuration of the promoted reference
+ if (componentReference.isPromotionOverride()) {
+ CompositeReference compositeReference = (CompositeReference)implReference;
+ List<ComponentReference> promotedReferences =
+ ReferenceConfigurationUtil.getPromotedComponentReferences(compositeReference);
+ for (ComponentReference promotedReference : promotedReferences) {
+ ReferenceConfigurationUtil.reconcileReferenceBindings(
+ componentReference, promotedReference, assemblyFactory, monitor);
+ if (componentReference.getInterfaceContract() != null && // can be null in unit tests
+ componentReference.getInterfaceContract().getCallbackInterface() != null) {
+ SCABinding scaCallbackBinding = promotedReference.getCallbackBinding(SCABinding.class);
+ if (promotedReference.getCallback() != null) {
+ promotedReference.getCallback().getBindings().clear();
+ } else {
+ promotedReference.setCallback(assemblyFactory.createCallback());
+ }
+ if (scaCallbackBinding != null) {
+ promotedReference.getCallback().getBindings().add(scaCallbackBinding);
+ }
+ if (componentReference.getCallback() != null) {
+ promotedReference.getCallback().getBindings().addAll(componentReference
+ .getCallback().getBindings());
+ }
+ }
+
+ // Wire the promoted reference to the actual non-composite component services
+ if (promotedReference.getMultiplicity() == Multiplicity.ONE_ONE) {
+ // promotedReference.getTargets().clear();
+ }
+ for (ComponentService target : componentReference.getTargets()) {
+ if (target.getService() instanceof CompositeService) {
+
+ // Wire to the actual component service
+ // promoted by a composite service
+ CompositeService compositeService = (CompositeService)target.getService();
+ // Find the promoted component service
+ ComponentService componentService =
+ ServiceConfigurationUtil.getPromotedComponentService(compositeService);
+ if (componentService != null) {
+ promotedReference.getTargets().add(componentService);
+ }
+ } else {
+
+ // Wire to a non-composite target service
+ promotedReference.getTargets().add(target);
+ }
+ }
+ }
+ }
+ }
+ }
+ } else {
+ for (ComponentReference componentReference : component.getReferences()) {
+
+ // Wire the component reference to the actual
+ // non-composite component services
+ List<ComponentService> targets = componentReference.getTargets();
+ for (int i = 0, n = targets.size(); i < n; i++) {
+ ComponentService target = targets.get(i);
+ if (target.getService() instanceof CompositeService) {
+
+ // Wire to the actual component service
+ // promoted by a composite service
+ CompositeService compositeService = (CompositeService)target.getService();
+ ComponentService componentService = compositeService.getPromotedService();
+ if (componentService != null) {
+ targets.set(i, componentService);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java
new file mode 100644
index 0000000000..53e6eda1eb
--- /dev/null
+++ b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.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.assembly.builder.impl;
+
+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.Service;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+
+/**
+ * A composite builder that handles the creation of promoted services.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentServicePromotionBuilderImpl implements CompositeBuilder {
+ private AssemblyFactory assemblyFactory;
+
+ public ComponentServicePromotionBuilderImpl(AssemblyFactory assemblyFactory) {
+ this.assemblyFactory = assemblyFactory;
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+
+ // Process nested composites recursively
+ configureNestedCompositeServices(composite);
+ }
+
+ private void configureNestedCompositeServices(Composite composite) {
+
+ // Process nested composites recursively
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+
+ // First process nested composites
+ configureNestedCompositeServices((Composite)implementation);
+
+ // Process the component services declared on components in this composite
+ for (ComponentService componentService : component.getServices()) {
+ Service implService = componentService.getService();
+ if (implService != null && implService instanceof CompositeService) {
+ CompositeService compositeService = (CompositeService)implService;
+
+ // Get the innermost promoted service
+ ComponentService promotedService =
+ ServiceConfigurationUtil.getPromotedComponentService(compositeService);
+ if (promotedService != null) {
+ Component promotedComponent = ServiceConfigurationUtil.getPromotedComponent(compositeService);
+
+ // Create a new component service to represent this
+ // component service on the promoted component
+ ComponentService newComponentService = assemblyFactory.createComponentService();
+ newComponentService.setName("$promoted$." + component.getName() + "." + componentService.getName());
+ promotedComponent.getServices().add(newComponentService);
+ newComponentService.setService(promotedService.getService());
+ newComponentService.getBindings().addAll(componentService.getBindings());
+ newComponentService.setInterfaceContract(componentService.getInterfaceContract());
+
+ if (componentService.getInterfaceContract() != null &&
+ componentService.getInterfaceContract().getCallbackInterface() != null) {
+ newComponentService.setCallback(assemblyFactory.createCallback());
+ newComponentService.getCallback().getBindings()
+ .addAll(componentService.getCallback().getBindings());
+ }
+
+ // Change the composite service to now promote the
+ // newly created component service directly
+ compositeService.setPromotedComponent(promotedComponent);
+ compositeService.setPromotedService(newComponentService);
+ }
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java
new file mode 100644
index 0000000000..4c2c369f3e
--- /dev/null
+++ b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java
@@ -0,0 +1,50 @@
+/*
+ * 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.assembly.builder.impl;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+/**
+ * A composite builder that handles the configuration of binding URIs.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeBindingURIBuilderImpl extends BaseConfigurationBuilderImpl implements CompositeBuilder {
+
+ public CompositeBindingURIBuilderImpl(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ SCADefinitions policyDefinitions,
+ Monitor monitor) {
+ super(assemblyFactory, scaBindingFactory, interfaceContractMapper, policyDefinitions, monitor);
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+ configureBindingURIsAndNames(composite);
+ }
+
+}
diff --git a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
index fb427e5afc..0e8585cc91 100644
--- a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
+++ b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
@@ -42,15 +42,19 @@ import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
public class CompositeBuilderImpl implements CompositeBuilder {
private static final Logger logger = Logger.getLogger(CompositeBuilderImpl.class.getName());
private CompositeBuilder compositeIncludeBuilder;
- private CompositeBuilder componentWireBuilder;
+ private CompositeBuilder componentReferenceWireBuilder;
+ private CompositeBuilder componentReferencePromotionWireBuilder;
private CompositeBuilder compositeReferenceWireBuilder;
private CompositeBuilder compositeCloneBuilder;
private CompositeBuilder componentConfigurationBuilder;
private CompositeBuilder compositeServiceConfigurationBuilder;
+ private CompositeBuilder compositeReferenceConfigurationBuilder;
+ private CompositeBuilder compositeBindingURIBuilder;
+ private CompositeBuilder componentServicePromotionBuilder;
+ private CompositeBuilder compositeServicePromotionBuilder;
private CompositeBuilder compositePromotionBuilder;
private CompositeBuilder compositePolicyBuilder;
private CompositeBuilder componentServiceBindingBuilder;
- private CompositeBuilder compositeServiceBindingBuilder;
private CompositeBuilder componentReferenceBindingBuilder;
/**
@@ -94,15 +98,19 @@ public class CompositeBuilderImpl implements CompositeBuilder {
}
compositeIncludeBuilder = new CompositeIncludeBuilderImpl(monitor);
- componentWireBuilder = new ComponentReferenceWireBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
- compositeReferenceWireBuilder = new CompositeReferenceWireBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ componentReferenceWireBuilder = new ComponentReferenceWireBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ componentReferencePromotionWireBuilder = new ComponentReferencePromotionWireBuilderImpl(assemblyFactory, monitor);
+ compositeReferenceWireBuilder = new CompositeReferenceWireBuilderImpl(assemblyFactory, monitor);
compositeCloneBuilder = new CompositeCloneBuilderImpl(monitor);
componentConfigurationBuilder = new ComponentConfigurationBuilderImpl(assemblyFactory, scaBindingFactory, interfaceContractMapper, policyDefinitions, monitor);
- compositeServiceConfigurationBuilder = new CompositeServiceConfigurationBuilderImpl(assemblyFactory, scaBindingFactory, interfaceContractMapper, policyDefinitions, monitor);
+ compositeServiceConfigurationBuilder = new CompositeServiceConfigurationBuilderImpl(assemblyFactory);
+ compositeReferenceConfigurationBuilder = new CompositeReferenceConfigurationBuilderImpl(assemblyFactory);
+ compositeBindingURIBuilder = new CompositeBindingURIBuilderImpl(assemblyFactory, scaBindingFactory, interfaceContractMapper, policyDefinitions, monitor);
+ componentServicePromotionBuilder = new ComponentServicePromotionBuilderImpl(assemblyFactory);
+ compositeServicePromotionBuilder = new CompositeServicePromotionBuilderImpl(assemblyFactory);
compositePromotionBuilder = new CompositePromotionBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
compositePolicyBuilder = new CompositePolicyBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
componentServiceBindingBuilder = new ComponentServiceBindingBuilderImpl(monitor);
- compositeServiceBindingBuilder = new CompositeServiceBindingBuilderImpl(monitor);
componentReferenceBindingBuilder = new ComponentReferenceBindingBuilderImpl(monitor);
}
@@ -123,17 +131,29 @@ public class CompositeBuilderImpl implements CompositeBuilder {
// Compute the policies across the model hierarchy
compositePolicyBuilder.build(composite);
- // Build component service binding-related information
- componentServiceBindingBuilder.build(composite);
-
- // Build composite service binding-related information
- compositeServiceBindingBuilder.build(composite);
-
// Configure composite services
compositeServiceConfigurationBuilder.build(composite);
+ // Configure composite references
+ compositeReferenceConfigurationBuilder.build(composite);
+
+ // Configure binding URIs
+ compositeBindingURIBuilder.build(composite);
+
+ // Create promoted component services
+ componentServicePromotionBuilder.build(composite);
+
+ // Create promoted composite services
+ compositeServicePromotionBuilder.build(composite);
+
+ // Build component service binding-related information
+ componentServiceBindingBuilder.build(composite);
+
// Wire the components
- componentWireBuilder.build(composite);
+ componentReferenceWireBuilder.build(composite);
+
+ // Wire the promoted component references
+ componentReferencePromotionWireBuilder.build(composite);
// Wire the composite references
compositeReferenceWireBuilder.build(composite);
diff --git a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java
new file mode 100644
index 0000000000..41462b151d
--- /dev/null
+++ b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java
@@ -0,0 +1,224 @@
+/*
+ * 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.assembly.builder.impl;
+
+import java.util.List;
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.builder.AutomaticBinding;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+
+/**
+ * A composite builder that handles the configuration of composite references.
+ *
+ * @version $Rev: 651179 $ $Date: 2008-04-24 08:21:13 +0100 (Thu, 24 Apr 2008) $
+ */
+public class CompositeReferenceConfigurationBuilderImpl implements CompositeBuilder {
+ private AssemblyFactory assemblyFactory;
+
+ public CompositeReferenceConfigurationBuilderImpl(AssemblyFactory assemblyFactory) {
+ this.assemblyFactory = assemblyFactory;
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+
+ // Process nested composites recursively
+ configureNestedCompositeReferences(composite);
+
+ // Process top level composite references
+ for (Reference reference : composite.getReferences()) {
+ CompositeReference compositeReference = (CompositeReference)reference;
+
+ // Get the next lower level promoted reference
+ List<ComponentReference> promotedRefs = compositeReference.getPromotedReferences();
+ if (!promotedRefs.isEmpty()) {
+ if (promotedRefs.size() == 1) {
+ ComponentReference promotedReference = promotedRefs.get(0);
+
+ // Set the bindings using the top level bindings to override the lower level bindings
+ if (bindingsSpecifiedManually(compositeReference.getBindings())) {
+ compositeReference.setPromotionOverride(true);
+ } else if (bindingsSpecifiedManually(promotedReference.getBindings()) ) {
+ compositeReference.getBindings().clear();
+ for (Binding binding : promotedReference.getBindings()) {
+ try {
+ compositeReference.getBindings().add((Binding)binding.clone());
+ } catch (CloneNotSupportedException ex) {
+ // this binding can't be used in the promoted reference
+ }
+ }
+ }
+ if (compositeReference.getInterfaceContract() != null &&
+ compositeReference.getInterfaceContract().getCallbackInterface() != null) {
+ if (compositeReference.getCallback() != null &&
+ bindingsSpecifiedManually(compositeReference.getCallback().getBindings())) {
+ compositeReference.setPromotionOverride(true);
+ } else if (promotedReference.getCallback() != null &&
+ bindingsSpecifiedManually(promotedReference.getCallback().getBindings())) {
+ if (compositeReference.getCallback() != null) {
+ compositeReference.getCallback().getBindings().clear();
+ } else {
+ compositeReference.setCallback(assemblyFactory.createCallback());
+ }
+ for (Binding binding : promotedReference.getCallback().getBindings()) {
+ try {
+ compositeReference.getCallback().getBindings().add((Binding)binding.clone());
+ } catch (CloneNotSupportedException ex) {
+ // this binding can't be used in the promoted reference
+ }
+ }
+ }
+ }
+ } else {
+ // This composite reference promotes multiple component references.
+ // Because the component reference bindings can all be different, we don't
+ // copy any of them up to this composite reference, which will therefore always
+ // have its own binding, even if it's only the default SCA binding.
+ if (bindingsSpecifiedManually(compositeReference.getBindings()) ||
+ (compositeReference.getCallback() != null &&
+ bindingsSpecifiedManually(compositeReference.getCallback().getBindings()))) {
+ compositeReference.setPromotionOverride(true);
+ }
+ }
+ }
+ }
+ }
+
+ private void configureNestedCompositeReferences(Composite composite) {
+
+ // Process nested composites recursively
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+
+ // First process nested composites
+ configureNestedCompositeReferences((Composite)implementation);
+
+ // Process the component references declared on components in this composite
+ for (ComponentReference componentReference : component.getReferences()) {
+ Reference implReference = componentReference.getReference();
+ if (implReference != null && implReference instanceof CompositeReference) {
+ CompositeReference compositeReference = (CompositeReference)implReference;
+
+ // Get the next lower level promoted reference
+ List<ComponentReference> promotedRefs = compositeReference.getPromotedReferences();
+ if (!promotedRefs.isEmpty()) {
+ if (promotedRefs.size() == 1) {
+ ComponentReference promotedReference = promotedRefs.get(0);
+
+ // Set the bindings using the top level bindings to override the lower level bindings
+ if (!bindingsSpecifiedManually(compositeReference.getBindings()) &&
+ bindingsSpecifiedManually(promotedReference.getBindings()) ) {
+ compositeReference.getBindings().clear();
+ for (Binding binding : promotedReference.getBindings()) {
+ try {
+ compositeReference.getBindings().add((Binding)binding.clone());
+ } catch (CloneNotSupportedException ex) {
+ // this binding can't be used in the promoted reference
+ }
+ }
+ }
+ if (bindingsSpecifiedManually(componentReference.getBindings())) {
+ componentReference.setPromotionOverride(true);
+ } else if (bindingsSpecifiedManually(compositeReference.getBindings()) ) {
+ componentReference.getBindings().clear();
+ componentReference.getBindings().addAll(compositeReference.getBindings());
+ }
+ if (componentReference.getInterfaceContract() != null &&
+ componentReference.getInterfaceContract().getCallbackInterface() != null) {
+ if (!(compositeReference.getCallback() != null &&
+ bindingsSpecifiedManually(compositeReference.getCallback().getBindings())) &&
+ promotedReference.getCallback() != null &&
+ bindingsSpecifiedManually(promotedReference.getCallback().getBindings())) {
+ if (compositeReference.getCallback() != null) {
+ compositeReference.getCallback().getBindings().clear();
+ } else {
+ compositeReference.setCallback(assemblyFactory.createCallback());
+ }
+ compositeReference.getCallback().getBindings().addAll(
+ promotedReference.getCallback().getBindings());
+ }
+ if (componentReference.getCallback() != null &&
+ bindingsSpecifiedManually(componentReference.getCallback().getBindings())) {
+ componentReference.setPromotionOverride(true);
+ } else if (compositeReference.getCallback() != null &&
+ bindingsSpecifiedManually(compositeReference.getCallback().getBindings())) {
+ if (componentReference.getCallback() != null) {
+ componentReference.getCallback().getBindings().clear();
+ } else {
+ componentReference.setCallback(assemblyFactory.createCallback());
+ }
+ for (Binding binding : compositeReference.getCallback().getBindings()) {
+ try {
+ componentReference.getCallback().getBindings().add((Binding)binding.clone());
+ } catch (CloneNotSupportedException ex) {
+ // this binding can't be used in the promoted reference
+ }
+ }
+ }
+ }
+ } else {
+ // This component reference promotes multiple lower-level component references.
+ // Because the lower-level component reference bindings can all be different,
+ // we don't copy any of them up to this component reference, which will therefore
+ // always have its own binding, even if it's only the default SCA binding.
+ if (bindingsSpecifiedManually(componentReference.getBindings()) ||
+ (componentReference.getCallback() != null &&
+ bindingsSpecifiedManually(componentReference.getCallback().getBindings()))) {
+ componentReference.setPromotionOverride(true);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * If the bindings are specified in the composite file return true as they should
+ * otherwise return false
+ *
+ * @param bindings
+ * @return true if the bindings were specified manually
+ */
+ private boolean bindingsSpecifiedManually(List<Binding> bindings) {
+
+ if (bindings.size() > 1) {
+ return true;
+ } else if (bindings.size() == 1 &&
+ bindings.get(0) instanceof AutomaticBinding &&
+ ((AutomaticBinding)bindings.get(0)).getIsAutomatic()) {
+ return false;
+ } else if (bindings.size() == 1) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+}
diff --git a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceWireBuilderImpl.java b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceWireBuilderImpl.java
index 56b3fc79dd..be579387ca 100644
--- a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceWireBuilderImpl.java
+++ b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceWireBuilderImpl.java
@@ -19,12 +19,18 @@
package org.apache.tuscany.sca.assembly.builder.impl;
+import java.util.List;
+
import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.EndpointFactory;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.SCABinding;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
import org.apache.tuscany.sca.monitor.Monitor;
/**
@@ -32,13 +38,56 @@ import org.apache.tuscany.sca.monitor.Monitor;
*
* @version $Rev$ $Date$
*/
-public class CompositeReferenceWireBuilderImpl extends BaseWireBuilderImpl implements CompositeBuilder {
+public class CompositeReferenceWireBuilderImpl implements CompositeBuilder {
+ private AssemblyFactory assemblyFactory;
+ private Monitor monitor;
- public CompositeReferenceWireBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, InterfaceContractMapper interfaceContractMapper, Monitor monitor) {
- super(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
+ public CompositeReferenceWireBuilderImpl(AssemblyFactory assemblyFactory, Monitor monitor) {
+ this.assemblyFactory = assemblyFactory;
+ this.monitor = monitor;
}
+ /**
+ * Wire composite references in a deployment composite.
+ *
+ * @param composite
+ */
public void build(Composite composite) throws CompositeBuilderException {
- wireCompositeReferences(composite);
+
+ // Process composite references declared in this composite
+ for (Reference reference : composite.getReferences()) {
+ CompositeReference compositeReference = (CompositeReference)reference;
+
+ // If the composite reference is a promotion override, override the
+ // configuration of the promoted reference.
+ //FIXME: Policy configuration or wiring of domain-level composite references
+ // doesn't cause a promotion override, unless the composite reference has
+ // additional bindings. Do we need to detect this and force an override?
+ if (compositeReference.isPromotionOverride()) {
+ List<ComponentReference> promotedReferences =
+ ReferenceConfigurationUtil.getPromotedComponentReferences(compositeReference);
+ for (ComponentReference promotedReference : promotedReferences) {
+ ReferenceConfigurationUtil.reconcileReferenceBindings(
+ compositeReference, promotedReference, assemblyFactory, monitor);
+ if (compositeReference.getInterfaceContract() != null && // can be null in unit tests
+ compositeReference.getInterfaceContract().getCallbackInterface() != null) {
+ SCABinding scaCallbackBinding = promotedReference.getCallbackBinding(SCABinding.class);
+ if (promotedReference.getCallback() != null) {
+ promotedReference.getCallback().getBindings().clear();
+ } else {
+ promotedReference.setCallback(assemblyFactory.createCallback());
+ }
+ if (scaCallbackBinding != null) {
+ promotedReference.getCallback().getBindings().add(scaCallbackBinding);
+ }
+ if (compositeReference.getCallback() != null) {
+ promotedReference.getCallback().getBindings().addAll(compositeReference.getCallback()
+ .getBindings());
+ }
+ }
+ }
+ }
+ }
}
+
}
diff --git a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java
index fc4c63ae46..51e2da2d64 100644
--- a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java
+++ b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java
@@ -62,7 +62,7 @@ public class CompositeServiceBindingBuilderImpl implements CompositeBuilder {
for (Service service : composite.getServices()) {
for (Binding binding : service.getBindings()) {
if (binding instanceof BindingBuilderExtension) {
- Component component = BaseConfigurationBuilderImpl.getPromotedComponent((CompositeService)service);
+ Component component = ServiceConfigurationUtil.getPromotedComponent((CompositeService)service);
((BindingBuilderExtension)binding).getBuilder().build(component, service, binding, monitor);
}
}
diff --git a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java
index 7303570ac8..a3f31ea2fa 100644
--- a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java
+++ b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java
@@ -19,32 +19,176 @@
package org.apache.tuscany.sca.assembly.builder.impl;
+import java.util.List;
import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.builder.AutomaticBinding;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.monitor.Monitor;
/**
* A composite builder that handles the configuration of composite services.
*
* @version $Rev$ $Date$
*/
-public class CompositeServiceConfigurationBuilderImpl extends BaseConfigurationBuilderImpl implements CompositeBuilder {
-
- public CompositeServiceConfigurationBuilderImpl(AssemblyFactory assemblyFactory,
- SCABindingFactory scaBindingFactory,
- InterfaceContractMapper interfaceContractMapper,
- SCADefinitions policyDefinitions,
- Monitor monitor) {
- super(assemblyFactory, scaBindingFactory, interfaceContractMapper, policyDefinitions, monitor);
+public class CompositeServiceConfigurationBuilderImpl implements CompositeBuilder {
+ private AssemblyFactory assemblyFactory;
+
+ public CompositeServiceConfigurationBuilderImpl(AssemblyFactory assemblyFactory) {
+ this.assemblyFactory = assemblyFactory;
}
public void build(Composite composite) throws CompositeBuilderException {
- configureCompositeServices(composite);
+
+ // Process nested composites recursively
+ configureNestedCompositeServices(composite);
+
+ // Process top level composite services
+ for (Service service : composite.getServices()) {
+ CompositeService compositeService = (CompositeService)service;
+
+ // Get the next lower level promoted service
+ ComponentService promotedService = compositeService.getPromotedService();
+ if (promotedService != null) {
+
+ // Set the bindings using the top level bindings to override the lower level bindings
+ if (!bindingsSpecifiedManually(compositeService.getBindings()) &&
+ bindingsSpecifiedManually(promotedService.getBindings())) {
+ compositeService.getBindings().clear();
+ for (Binding binding : promotedService.getBindings()) {
+ try {
+ compositeService.getBindings().add((Binding)binding.clone());
+ } catch (CloneNotSupportedException ex) {
+ // this binding can't be used in the promoted service
+ }
+ }
+ }
+ if (compositeService.getInterfaceContract() != null &&
+ compositeService.getInterfaceContract().getCallbackInterface() != null) {
+ if (!(compositeService.getCallback() != null &&
+ bindingsSpecifiedManually(compositeService.getCallback().getBindings())) &&
+ promotedService.getCallback() != null &&
+ bindingsSpecifiedManually(promotedService.getCallback().getBindings())) {
+ if (compositeService.getCallback() != null) {
+ compositeService.getCallback().getBindings().clear();
+ } else {
+ compositeService.setCallback(assemblyFactory.createCallback());
+ }
+ for (Binding binding : promotedService.getCallback().getBindings()) {
+ try {
+ compositeService.getCallback().getBindings().add((Binding)binding.clone());
+ } catch (CloneNotSupportedException ex) {
+ // this binding can't be used in the promoted service
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void configureNestedCompositeServices(Composite composite) {
+
+ // Process nested composites recursively
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+
+ // First process nested composites
+ configureNestedCompositeServices((Composite)implementation);
+
+ // Process the component services declared on components in this composite
+ for (ComponentService componentService : component.getServices()) {
+ Service implService = componentService.getService();
+ if (implService != null && implService instanceof CompositeService) {
+ CompositeService compositeService = (CompositeService)implService;
+
+ // Get the next lower level promoted service
+ ComponentService promotedService = compositeService.getPromotedService();
+ if (promotedService != null) {
+
+ // Set the bindings using the top level bindings to override the lower level bindings
+ if (!bindingsSpecifiedManually(compositeService.getBindings()) &&
+ bindingsSpecifiedManually(promotedService.getBindings()) ) {
+ compositeService.getBindings().clear();
+ for (Binding binding : promotedService.getBindings()) {
+ try {
+ compositeService.getBindings().add((Binding)binding.clone());
+ } catch (CloneNotSupportedException ex) {
+ // this binding can't be used in the promoted service
+ }
+ }
+ }
+ if (!bindingsSpecifiedManually(componentService.getBindings()) &&
+ bindingsSpecifiedManually(compositeService.getBindings()) ) {
+ componentService.getBindings().clear();
+ componentService.getBindings().addAll(compositeService.getBindings());
+ }
+ if (componentService.getInterfaceContract() != null &&
+ componentService.getInterfaceContract().getCallbackInterface() != null) {
+ if (!(compositeService.getCallback() != null &&
+ bindingsSpecifiedManually(compositeService.getCallback().getBindings())) &&
+ promotedService.getCallback() != null &&
+ bindingsSpecifiedManually(promotedService.getCallback().getBindings())) {
+ if (compositeService.getCallback() != null) {
+ compositeService.getCallback().getBindings().clear();
+ } else {
+ compositeService.setCallback(assemblyFactory.createCallback());
+ }
+ for (Binding binding : promotedService.getCallback().getBindings()) {
+ try {
+ compositeService.getCallback().getBindings().add((Binding)binding.clone());
+ } catch (CloneNotSupportedException ex) {
+ // this binding can't be used in the promoted service
+ }
+ }
+ }
+ if (!(componentService.getCallback() != null &&
+ bindingsSpecifiedManually(componentService.getCallback().getBindings())) &&
+ compositeService.getCallback() != null &&
+ bindingsSpecifiedManually(compositeService.getCallback().getBindings())) {
+ if (componentService.getCallback() != null) {
+ componentService.getCallback().getBindings().clear();
+ } else {
+ componentService.setCallback(assemblyFactory.createCallback());
+ }
+ componentService.getCallback().getBindings().addAll(
+ compositeService.getCallback().getBindings());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * If the bindings are specified in the composite file return true as they should
+ * otherwise return false
+ *
+ * @param bindings
+ * @return true if the bindings were specified manually
+ */
+ private boolean bindingsSpecifiedManually(List<Binding> bindings) {
+
+ if (bindings.size() > 1) {
+ return true;
+ } else if (bindings.size() == 1 &&
+ bindings.get(0) instanceof AutomaticBinding &&
+ ((AutomaticBinding)bindings.get(0)).getIsAutomatic()) {
+ return false;
+ } else if (bindings.size() == 1) {
+ return true;
+ } else {
+ return false;
+ }
}
}
diff --git a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServicePromotionBuilderImpl.java b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServicePromotionBuilderImpl.java
new file mode 100644
index 0000000000..39d2cec396
--- /dev/null
+++ b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServicePromotionBuilderImpl.java
@@ -0,0 +1,77 @@
+/*
+ * 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.assembly.builder.impl;
+
+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.Service;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+
+/**
+ * A composite builder that handles the creation of promoted composite services.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeServicePromotionBuilderImpl implements CompositeBuilder {
+ private AssemblyFactory assemblyFactory;
+
+ public CompositeServicePromotionBuilderImpl(AssemblyFactory assemblyFactory) {
+ this.assemblyFactory = assemblyFactory;
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+
+ // Process top level composite services
+ for (Service service : composite.getServices()) {
+ CompositeService compositeService = (CompositeService)service;
+
+ // Get the innermost promoted service
+ ComponentService promotedService = ServiceConfigurationUtil.getPromotedComponentService(compositeService);
+ if (promotedService != null) {
+ Component promotedComponent = ServiceConfigurationUtil.getPromotedComponent(compositeService);
+
+ // Create a new component service to represent this composite
+ // service on the promoted component
+ ComponentService newComponentService = assemblyFactory.createComponentService();
+ newComponentService.setName("$promoted$." + compositeService.getName());
+ promotedComponent.getServices().add(newComponentService);
+ newComponentService.setService(promotedService.getService());
+ newComponentService.getBindings().addAll(compositeService.getBindings());
+ newComponentService.setInterfaceContract(compositeService.getInterfaceContract());
+ if (compositeService.getInterfaceContract() != null &&
+ compositeService.getInterfaceContract().getCallbackInterface() != null) {
+ newComponentService.setCallback(assemblyFactory.createCallback());
+ newComponentService.getCallback().getBindings()
+ .addAll(compositeService.getCallback().getBindings());
+ }
+
+ // Change the composite service to now promote the newly
+ // created component service directly
+ compositeService.setPromotedComponent(promotedComponent);
+ compositeService.setPromotedService(newComponentService);
+ }
+ }
+ }
+
+}
diff --git a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceConfigurationUtil.java b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceConfigurationUtil.java
index 5d3d8a3a04..878799f989 100644
--- a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceConfigurationUtil.java
+++ b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceConfigurationUtil.java
@@ -18,11 +18,21 @@
*/
package org.apache.tuscany.sca.assembly.builder.impl;
+import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.CompositeReference;
import org.apache.tuscany.sca.assembly.Multiplicity;
import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
/**
* This class encapsulates utility methods to deal with reference definitions
@@ -30,6 +40,21 @@ import org.apache.tuscany.sca.assembly.OptimizableBinding;
* @version $Rev$ $Date$
*/
abstract class ReferenceConfigurationUtil {
+
+ /**
+ * Report a warning.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private static void warning(Monitor monitor, String message, Object model, String... messageParameters) {
+ if (monitor != null) {
+ Problem problem = new ProblemImpl(ReferenceConfigurationUtil.class.getName(), "assembly-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
+ monitor.problem(problem);
+ }
+ }
+
static boolean isValidMultiplicityOverride(Multiplicity definedMul, Multiplicity overridenMul) {
if (definedMul != overridenMul) {
switch (definedMul) {
@@ -92,4 +117,100 @@ abstract class ReferenceConfigurationUtil {
}
return true;
}
+
+ /**
+ * Follow a reference promotion chain down to the innermost (non composite)
+ * component references.
+ *
+ * @param compositeReference
+ * @return
+ */
+ static List<ComponentReference> getPromotedComponentReferences(CompositeReference compositeReference) {
+ List<ComponentReference> componentReferences = new ArrayList<ComponentReference>();
+ collectPromotedComponentReferences(compositeReference, componentReferences);
+ return componentReferences;
+ }
+
+ /**
+ * Follow a reference promotion chain down to the innermost (non composite)
+ * component references.
+ *
+ * @param compositeReference
+ * @param componentReferences
+ * @return
+ */
+ private static void collectPromotedComponentReferences(CompositeReference compositeReference,
+ List<ComponentReference> componentReferences) {
+ for (ComponentReference componentReference : compositeReference.getPromotedReferences()) {
+ Reference reference = componentReference.getReference();
+ if (reference instanceof CompositeReference) {
+
+ // Continue to follow the reference promotion chain
+ collectPromotedComponentReferences((CompositeReference)reference, componentReferences);
+
+ } else if (reference != null) {
+
+ // Found a non-composite reference
+ componentReferences.add(componentReference);
+ }
+ }
+ }
+
+ /**
+ * Override the bindings for a promoted reference from an outer component
+ * reference
+ *
+ * @param reference
+ * @param promotedReference
+ */
+ static void reconcileReferenceBindings(Reference reference,
+ ComponentReference promotedReference,
+ AssemblyFactory assemblyFactory,
+ Monitor monitor) {
+ List<Binding> bindings = new ArrayList<Binding>();
+
+ // collect the top level bindings first
+ for (Binding binding : reference.getBindings()) {
+ if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) {
+ bindings.add(binding);
+ }
+ }
+
+ // if there are not top level bindings to override the promoted bindings
+ // then collect the promoted bindings
+ if (bindings.size() == 0){
+ for (Binding binding : promotedReference.getBindings()) {
+ if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) {
+ bindings.add(binding);
+ }
+ }
+ } else {
+ // TUSCANY-2324: if bindings are being replaced, use the matching interface contract
+ promotedReference.setInterfaceContract(reference.getInterfaceContract());
+ }
+
+ promotedReference.getBindings().clear();
+ promotedReference.getBindings().addAll(bindings);
+
+ if (promotedReference.getMultiplicity() == Multiplicity.ONE_ONE ||
+ promotedReference.getMultiplicity() == Multiplicity.ZERO_ONE) {
+ if (promotedReference.getBindings().size() > 1) {
+ warning(monitor, "ComponentReferenceMoreWire", promotedReference, promotedReference.getName());
+ }
+ }
+ Set<Binding> callbackBindings = new HashSet<Binding>();
+ if (promotedReference.getCallback() != null) {
+ callbackBindings.addAll(promotedReference.getCallback().getBindings());
+ }
+ if (reference.getCallback() != null) {
+ callbackBindings.addAll(reference.getCallback().getBindings());
+ }
+ promotedReference.setCallback(assemblyFactory.createCallback());
+ for (Binding binding : callbackBindings) {
+ if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) {
+ promotedReference.getCallback().getBindings().add(binding);
+ }
+ }
+ }
+
}
diff --git a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ServiceConfigurationUtil.java b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ServiceConfigurationUtil.java
index 5a8d373eb2..41a8b3f8ba 100644
--- a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ServiceConfigurationUtil.java
+++ b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ServiceConfigurationUtil.java
@@ -18,6 +18,7 @@
*/
package org.apache.tuscany.sca.assembly.builder.impl;
+import org.apache.tuscany.sca.assembly.Component;
import org.apache.tuscany.sca.assembly.ComponentService;
import org.apache.tuscany.sca.assembly.CompositeService;
import org.apache.tuscany.sca.assembly.Service;
@@ -56,4 +57,32 @@ abstract class ServiceConfigurationUtil {
return null;
}
}
+
+ /**
+ * Follow a service promotion chain down to the innermost (non-composite) component.
+ *
+ * @param compositeService
+ * @return
+ */
+ static Component getPromotedComponent(CompositeService compositeService) {
+ ComponentService componentService = compositeService.getPromotedService();
+ if (componentService != null) {
+ Service service = componentService.getService();
+ if (componentService.getName() != null && service instanceof CompositeService) {
+
+ // Continue to follow the service promotion chain
+ return getPromotedComponent((CompositeService)service);
+
+ } else {
+
+ // Found a non-composite service
+ return compositeService.getPromotedComponent();
+ }
+ } else {
+
+ // No promoted service
+ return null;
+ }
+ }
+
}
diff --git a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java
index 297a7c3a99..12dda94b7a 100644
--- a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java
+++ b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java
@@ -40,6 +40,7 @@ public class ReferenceImpl extends AbstractReferenceImpl implements Reference, C
private List<ComponentService> targets = new ArrayList<ComponentService>();
private Callback callback;
private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+ private boolean promotionOverride;
public List<PolicySet> getApplicablePolicySets() {
return applicablePolicySets;
@@ -93,6 +94,14 @@ public class ReferenceImpl extends AbstractReferenceImpl implements Reference, C
this.wiredByImpl = wiredByImpl;
}
+ public boolean isPromotionOverride() {
+ return promotionOverride;
+ }
+
+ public void setPromotionOverride(boolean promotionOverride) {
+ this.promotionOverride = promotionOverride;
+ }
+
public List<PolicySet> getPolicySets() {
return policySets;
}
diff --git a/branches/sca-java-1.3/modules/assembly/src/main/resources/assembly-validation-messages.properties b/branches/sca-java-1.3/modules/assembly/src/main/resources/assembly-validation-messages.properties
index eaf01e0e62..f9760aa3cb 100644
--- a/branches/sca-java-1.3/modules/assembly/src/main/resources/assembly-validation-messages.properties
+++ b/branches/sca-java-1.3/modules/assembly/src/main/resources/assembly-validation-messages.properties
@@ -38,6 +38,7 @@ ReferenceIncompatibleInterface = Incompatible interfaces on component reference
ReferenceIncompatibleComponentInterface = Component reference interface incompatible with reference interface: Component = {0} Reference = {1}
ServiceIncompatibleComponentInterface = Component service interface incompatible with service interface: Component = {0} Service = {1}
MultipleBindingsForService = Multiple bindings with the same name for a service: Binding = {0} Service = {1} Binding = {2}
+MultipleBindingsForReference = Multiple bindings with the same name for a reference: Binding = {0} Reference = {1} Binding = {2}
ReferenceWithoutTargets = No targets for reference: Composite = {0} Reference = {1}
PromotedReferenceNotFound = Promoted component reference not found: Composite = {0} Reference = {1}
PromotedServiceNotFound = Promoted component service not found: Composite = {0} Service = {1}
diff --git a/branches/sca-java-1.3/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java b/branches/sca-java-1.3/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java
index 1c1a6ecd67..770468f147 100644
--- a/branches/sca-java-1.3/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java
+++ b/branches/sca-java-1.3/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java
@@ -206,7 +206,7 @@ public class TestNode {
CompositeService compositeService = (CompositeService)componentService.getService();
if (compositeService != null) {
if (serviceName != null) {
- serviceName = "$promoted$." + serviceName;
+ serviceName = "$promoted$." + component.getName() + "." + serviceName;
}
componentContext =
((RuntimeComponent)compositeService.getPromotedComponent()).getComponentContext();
diff --git a/branches/sca-java-1.3/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java b/branches/sca-java-1.3/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java
index 407877c36d..d2e2e9eb34 100644
--- a/branches/sca-java-1.3/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java
+++ b/branches/sca-java-1.3/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java
@@ -151,13 +151,19 @@ public class WSDLServiceGenerator {
AbstractContract contract,
Monitor monitor) {
+ //[nash] changes to the builder sequence avoid calling this for a CompositeService
+ assert !(contract instanceof CompositeService);
+ /*
// For every promoted composite service, the underlying component
// gets a copy of the service with the name prefixed by "$promoted$."
String contractName = (contract instanceof CompositeService ? "$promoted$." : "") + contract.getName();
+ */
+ String contractName = contract.getName();
List<Port> ports = new ArrayList<Port>();
WSDLDefinition wsdlDefinition = wsBinding.getWSDLDefinition();
if (wsdlDefinition == null) {
+ error(monitor, "NoWsdlInterface", wsBinding, component.getName(), contract.getName());
return null;
}
Definition def = wsdlDefinition.getDefinition();
diff --git a/branches/sca-java-1.3/modules/binding-ws-wsdlgen/src/main/resources/wsdlgen-validation-messages.properties b/branches/sca-java-1.3/modules/binding-ws-wsdlgen/src/main/resources/wsdlgen-validation-messages.properties
index 91e99f1891..4bfbdd2901 100644
--- a/branches/sca-java-1.3/modules/binding-ws-wsdlgen/src/main/resources/wsdlgen-validation-messages.properties
+++ b/branches/sca-java-1.3/modules/binding-ws-wsdlgen/src/main/resources/wsdlgen-validation-messages.properties
@@ -28,3 +28,4 @@ PortTypeNotFound = PortType {0} in {1}/{2} was not found
BindingNotFound = Binding {0} in {1}/{2} was not found
InvalidPort = Port {0}/{1} in {2}/{3} is not supported
NoValidPorts = No valid ports for service {0} in {1}/{2}
+NoWsdlInterface = No WSDL interface definition for {1}/{2}
diff --git a/branches/sca-java-1.3/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java b/branches/sca-java-1.3/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java
index 6edfa94139..875a139ca2 100644
--- a/branches/sca-java-1.3/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java
+++ b/branches/sca-java-1.3/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java
@@ -561,7 +561,7 @@ public class DefaultSCADomain extends SCADomain {
CompositeService compositeService = (CompositeService)componentService.getService();
if (compositeService != null) {
if (serviceName != null) {
- serviceName = "$promoted$." + serviceName;
+ serviceName = "$promoted$." + component.getName() + "." + serviceName;
}
componentContext =
((RuntimeComponent)compositeService.getPromotedComponent()).getComponentContext();
diff --git a/branches/sca-java-1.3/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java b/branches/sca-java-1.3/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java
index 3b578fe1b1..45daf57399 100644
--- a/branches/sca-java-1.3/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java
+++ b/branches/sca-java-1.3/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java
@@ -203,7 +203,7 @@ public class EmbeddedSCADomain extends SCADomain {
CompositeService compositeService = (CompositeService)componentService.getService();
if (compositeService != null) {
if (serviceName != null) {
- serviceName = "$promoted$." + serviceName;
+ serviceName = "$promoted$." + component.getName() + "." + serviceName;
}
componentContext =
((RuntimeComponent)compositeService.getPromotedComponent()).getComponentContext();
diff --git a/branches/sca-java-1.3/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/branches/sca-java-1.3/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
index 17aad5b106..5d20d4e893 100644
--- a/branches/sca-java-1.3/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
+++ b/branches/sca-java-1.3/modules/node2-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
@@ -639,7 +639,7 @@ public class NodeImpl implements SCANode2, SCAClient {
CompositeService compositeService = (CompositeService)componentService.getService();
if (compositeService != null) {
if (serviceName != null) {
- serviceName = "$promoted$." + serviceName;
+ serviceName = "$promoted$." + component.getName() + "." + serviceName;
}
componentContext =
((RuntimeComponent)compositeService.getPromotedComponent()).getComponentContext();
diff --git a/branches/sca-java-1.3/samples/databinding-echo/src/main/resources/EchoDataBinding.composite b/branches/sca-java-1.3/samples/databinding-echo/src/main/resources/EchoDataBinding.composite
index 2f042b8e34..56857fc4d5 100644
--- a/branches/sca-java-1.3/samples/databinding-echo/src/main/resources/EchoDataBinding.composite
+++ b/branches/sca-java-1.3/samples/databinding-echo/src/main/resources/EchoDataBinding.composite
@@ -38,13 +38,13 @@
</component>
<reference name="EchoReference" promote="ComponentB/echoReference">
- <!--
- <interface.java interface="dbecho.Echo"/>
- -->
+ <interface.java interface="dbecho.Echo"/>
+ <!-- Replaced interface.wsdl by interface.java because TUSCANY-2324 fix uses the interface specified here
<interface.wsdl interface="http://example.com/echo.wsdl#wsdl.interface(EchoPortType)"
wsdli:wsdlLocation="http://example.com/echo.wsdl wsdl/echo.wsdl">
<db:databinding xmlns:db="http://tuscany.apache.org/xmlns/sca/databinding/1.0" name="org.apache.axiom.om.OMElement" />
</interface.wsdl>
+ -->
<e:binding.echo/>
</reference>
@@ -55,4 +55,4 @@
</foo>
</property>
-</composite>
+</composite> \ No newline at end of file
diff --git a/branches/sca-java-1.3/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite b/branches/sca-java-1.3/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite
index f078b9ee9f..35306b9f89 100644
--- a/branches/sca-java-1.3/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite
+++ b/branches/sca-java-1.3/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite
@@ -101,7 +101,9 @@
</component>
<reference name="availQuoteProvider" promote="QuoteJoinExternalReferencesComponent/availQuoteProvider">
+ <!-- removed because it doesn't work with TUSCANY-2324 fix
<interface.java interface="xquery.quote.AvailQuoteProviderService" />
+ -->
<binding.ws wsdlElement="http://quote.xquery#wsdl.port(AvailQuoteProviderService/AvailQuoteProviderSoapPort)" />
</reference>
<reference name="quoteJoinWs" promote="QuoteJoinLocalComponent/quoteJoinWs">