From b2a32b253de8c2bc120cb7ce8aa71982d6da8a2b Mon Sep 17 00:00:00 2001 From: nash Date: Wed, 2 Jul 2008 07:43:01 +0000 Subject: Fix TUSCANY-2449 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@673307 13f79535-47bb-0310-9956-ffa450edef68 --- .../impl/ComponentReferenceBindingBuilderImpl.java | 72 +++++++++++++++++++++ .../impl/ComponentServiceBindingBuilderImpl.java | 73 ++++++++++++++++++++++ .../builder/impl/CompositeBuilderImpl.java | 15 +++-- .../impl/CompositeReferenceBindingBuilderImpl.java | 72 --------------------- .../impl/CompositeServiceBindingBuilderImpl.java | 14 +---- 5 files changed, 156 insertions(+), 90 deletions(-) create mode 100644 branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java create mode 100644 branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java delete mode 100644 branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceBindingBuilderImpl.java 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 new file mode 100644 index 0000000000..0c45f7bc9d --- /dev/null +++ b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java @@ -0,0 +1,72 @@ +/* + * 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.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.Implementation; +import org.apache.tuscany.sca.assembly.builder.BindingBuilderExtension; +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 performs any additional building steps that + * component reference bindings may need. Used for WSDL generation. + * + * @version $Rev$ $Date$ + */ +public class ComponentReferenceBindingBuilderImpl implements CompositeBuilder { + private Monitor monitor; + + public ComponentReferenceBindingBuilderImpl(Monitor monitor) { + this.monitor = monitor; + } + + public void build(Composite composite) throws CompositeBuilderException { + buildReferenceBindings(composite); + } + + 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 + for (Component component : composite.getComponents()) { + for (ComponentReference componentReference : component.getReferences()) { + for (Binding binding : componentReference.getBindings()) { + if (binding instanceof BindingBuilderExtension) { + ((BindingBuilderExtension)binding).getBuilder().build(component, componentReference, binding, monitor); + } + } + } + } + } + +} diff --git a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java new file mode 100644 index 0000000000..c4c6462c60 --- /dev/null +++ b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java @@ -0,0 +1,73 @@ +/* + * 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.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.Implementation; +import org.apache.tuscany.sca.assembly.Service; +import org.apache.tuscany.sca.assembly.builder.BindingBuilderExtension; +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 performs any additional building steps that + * component service bindings may need. Used for WSDL generation. + * + * @version $Rev$ $Date$ + */ +public class ComponentServiceBindingBuilderImpl implements CompositeBuilder { + private Monitor monitor; + + public ComponentServiceBindingBuilderImpl(Monitor monitor) { + this.monitor = monitor; + } + + public void build(Composite composite) throws CompositeBuilderException { + buildServiceBindings(composite); + } + + private void buildServiceBindings(Composite composite) { + + // build bindings recursively + for (Component component : composite.getComponents()) { + Implementation implementation = component.getImplementation(); + if (implementation instanceof Composite) { + buildServiceBindings((Composite)implementation); + } + } + + // find all the component service bindings + for (Component component : composite.getComponents()) { + for (ComponentService componentService : component.getServices()) { + for (Binding binding : componentService.getBindings()) { + if (binding instanceof BindingBuilderExtension) { + ((BindingBuilderExtension)binding).getBuilder().build(component, componentService, binding, monitor); + } + } + } + } + } + +} 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 5b0268dcbc..76c8146654 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 @@ -49,8 +49,9 @@ public class CompositeBuilderImpl implements CompositeBuilder { private CompositeBuilder compositeServiceConfigurationBuilder; private CompositeBuilder compositePromotionBuilder; private CompositeBuilder compositePolicyBuilder; + private CompositeBuilder componentServiceBindingBuilder; private CompositeBuilder compositeServiceBindingBuilder; - private CompositeBuilder compositeReferenceBindingBuilder; + private CompositeBuilder componentReferenceBindingBuilder; /** * Constructs a new composite builder. @@ -100,8 +101,9 @@ public class CompositeBuilderImpl implements CompositeBuilder { compositeServiceConfigurationBuilder = new CompositeServiceConfigurationBuilderImpl(assemblyFactory, scaBindingFactory, interfaceContractMapper, policyDefinitions, monitor); compositePromotionBuilder = new CompositePromotionBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor); compositePolicyBuilder = new CompositePolicyBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor); + componentServiceBindingBuilder = new ComponentServiceBindingBuilderImpl(monitor); compositeServiceBindingBuilder = new CompositeServiceBindingBuilderImpl(monitor); - compositeReferenceBindingBuilder = new CompositeReferenceBindingBuilderImpl(monitor); + componentReferenceBindingBuilder = new ComponentReferenceBindingBuilderImpl(monitor); } public void build(Composite composite) throws CompositeBuilderException { @@ -121,7 +123,10 @@ public class CompositeBuilderImpl implements CompositeBuilder { // Compute the policies across the model hierarchy compositePolicyBuilder.build(composite); - // Build service binding-related information + // Build component service binding-related information + componentServiceBindingBuilder.build(composite); + + // Build composite service binding-related information compositeServiceBindingBuilder.build(composite); // Wire the components @@ -133,8 +138,8 @@ public class CompositeBuilderImpl implements CompositeBuilder { // Wire the composite references compositeReferenceWireBuilder.build(composite); - // Build reference binding-related information - compositeReferenceBindingBuilder.build(composite); + // Build component reference binding-related information + componentReferenceBindingBuilder.build(composite); // Fuse nested composites //FIXME do this later diff --git a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceBindingBuilderImpl.java b/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceBindingBuilderImpl.java deleted file mode 100644 index 90144ce49e..0000000000 --- a/branches/sca-java-1.3/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceBindingBuilderImpl.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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.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.Implementation; -import org.apache.tuscany.sca.assembly.builder.BindingBuilderExtension; -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 performs any additional building steps that - * reference bindings may need. Used for WSDL generation. - * - * @version $Rev$ $Date$ - */ -public class CompositeReferenceBindingBuilderImpl implements CompositeBuilder { - private Monitor monitor; - - public CompositeReferenceBindingBuilderImpl(Monitor monitor) { - this.monitor = monitor; - } - - public void build(Composite composite) throws CompositeBuilderException { - buildReferenceBindings(composite); - } - - 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 - for (Component component : composite.getComponents()) { - for (ComponentReference componentReference : component.getReferences()) { - for (Binding binding : componentReference.getBindings()) { - if (binding instanceof BindingBuilderExtension) { - ((BindingBuilderExtension)binding).getBuilder().build(component, componentReference, binding, monitor); - } - } - } - } - } - -} 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 f5508b4ba1..fc4c63ae46 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 @@ -22,7 +22,6 @@ package org.apache.tuscany.sca.assembly.builder.impl; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.ComponentService; import org.apache.tuscany.sca.assembly.Composite; import org.apache.tuscany.sca.assembly.CompositeService; import org.apache.tuscany.sca.assembly.Implementation; @@ -34,7 +33,7 @@ import org.apache.tuscany.sca.monitor.Monitor; /** * A composite builder that performs any additional building steps that - * service bindings may need. Used for WSDL generation. + * composite service bindings may need. Used for WSDL generation. * * @version $Rev$ $Date$ */ @@ -59,17 +58,6 @@ public class CompositeServiceBindingBuilderImpl implements CompositeBuilder { } } - // find all the component service bindings - for (Component component : composite.getComponents()) { - for (ComponentService componentService : component.getServices()) { - for (Binding binding : componentService.getBindings()) { - if (binding instanceof BindingBuilderExtension) { - ((BindingBuilderExtension)binding).getBuilder().build(component, componentService, binding, monitor); - } - } - } - } - // find all the composite service bindings for (Service service : composite.getServices()) { for (Binding binding : service.getBindings()) { -- cgit v1.2.3