diff options
Diffstat (limited to 'java/sca/modules/assembly')
-rw-r--r-- | java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java (renamed from java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceBindingBuilderImpl.java) | 7 | ||||
-rw-r--r-- | java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java | 72 | ||||
-rw-r--r-- | java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java | 15 | ||||
-rw-r--r-- | java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java | 15 |
4 files changed, 86 insertions, 23 deletions
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceBindingBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java index 90144ce49e..dc0628a54f 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceBindingBuilderImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java @@ -19,7 +19,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.ComponentReference; @@ -32,14 +31,14 @@ 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. + * component reference bindings may need. Used for WSDL generation. * * @version $Rev$ $Date$ */ -public class CompositeReferenceBindingBuilderImpl implements CompositeBuilder { +public class ComponentReferenceBindingBuilderImpl implements CompositeBuilder { private Monitor monitor; - public CompositeReferenceBindingBuilderImpl(Monitor monitor) { + public ComponentReferenceBindingBuilderImpl(Monitor monitor) { this.monitor = monitor; } diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java new file mode 100644 index 0000000000..d508a49073 --- /dev/null +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.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.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/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java index 5b0268dcbc..76c8146654 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java +++ b/java/sca/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/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java index f5508b4ba1..3842fee909 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java @@ -19,10 +19,8 @@ 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 +32,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 +57,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()) { |