diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-19 16:12:22 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-19 16:12:22 +0000 |
commit | dcbff0df93448ef786c2e5cb0320f3895759171b (patch) | |
tree | 444d508a0e30ac3c8b00ff394cf46fc64b9f4aab /java/sca/modules | |
parent | 40f139f0e78679d6e9ce837de910f603f819b917 (diff) |
Switch over to new endpoint reference/endpoint model. These are the changes required to exploit the model in the runtime up to the point were the old EndpointReference is retrieved from a wire. The next step is to convert this over too and exploit the new endpoint references fully. There is still tidying to do (search for TODO - EPR) in particular I haven't removed any of the old files yet. So beware don't put changes into CompositeActivator or RuntimeWire as the runtime isn't using them
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@756070 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules')
49 files changed, 725 insertions, 716 deletions
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint2.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint2.java index 2fe3595292..254432434c 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint2.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint2.java @@ -18,6 +18,8 @@ */ package org.apache.tuscany.sca.assembly; +import java.util.List; + import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.policy.PolicySubject; @@ -95,6 +97,21 @@ public interface Endpoint2 extends Base, PolicySubject, Cloneable { */ void setInterfaceContract(InterfaceContract interfaceContract); + /** + * Get the services callbacl enpoint references that + * represent endpoint references from which callbacks + * originate + * + * @return callbackEndpoint the reference callback endpoint + */ + List<EndpointReference2> getCallbackEndpointReferences(); + + /** + * Set the reference callback endpoint refefences + * + * @param callbackEndpoint the reference callback endpoint + */ + void setCallbackEndpointReferences(List<EndpointReference2> callbackEndpointReferences); // not sure these are required diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/EndpointReferenceBuilder.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/EndpointReferenceBuilder.java index f84648c203..d8e9888aef 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/EndpointReferenceBuilder.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/EndpointReferenceBuilder.java @@ -39,23 +39,6 @@ import org.apache.tuscany.sca.monitor.Monitor; public interface EndpointReferenceBuilder { /** - * Create endpoint references for a component reference - * - * @param composite - * @param component - * @param reference - * @param components - * @param componentServices - * @param monitor - */ - public void createEndpointReferences(Composite composite, - Component component, - ComponentReference reference, - Map<String, Component> components, - Map<String, ComponentService> componentServices, - Monitor monitor); - - /** * Build an endpoint reference matching reference bindings * with service bindings. * diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseBuilderImpl.java index 3e8022863d..6720aecb50 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseBuilderImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseBuilderImpl.java @@ -199,6 +199,7 @@ public abstract class BaseBuilderImpl implements CompositeBuilder { String uri = component.getName() + '/' + componentService.getName(); componentServices.put(uri, componentService); + // TODO - EPR - $promoted$ no longer used but it doesn't do any harm here boolean promotedService = false; if (componentService.getName() != null && componentService.getName().indexOf("$promoted$") > -1) { promotedService = true; diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java index 64747978a5..812e06942a 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java @@ -233,7 +233,7 @@ public class ComponentConfigurationBuilderImpl extends BaseBuilderImpl implement for (ComponentReference reference : component.getReferences()) { if (reference.getInterfaceContract() != null && // can be null in // unit tests - reference.getInterfaceContract().getCallbackInterface() != null) { + reference.getInterfaceContract().getCallbackInterface() != null) { ComponentService service = componentServices.get(reference.getName()); if (service == null) { diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceEndpointReferenceBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java index 5de60c114d..1c60428afa 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceEndpointReferenceBuilderImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java @@ -55,10 +55,10 @@ import org.apache.tuscany.sca.policy.PolicySubject; * * @version $Rev$ $Date$ */ -public class CompositeReferenceEndpointReferenceBuilderImpl extends BaseBuilderImpl implements CompositeBuilder { +public class ComponentReferenceEndpointReferenceBuilderImpl extends BaseBuilderImpl implements CompositeBuilder { - public CompositeReferenceEndpointReferenceBuilderImpl(AssemblyFactory assemblyFactory, InterfaceContractMapper interfaceContractMapper) { + public ComponentReferenceEndpointReferenceBuilderImpl(AssemblyFactory assemblyFactory, InterfaceContractMapper interfaceContractMapper) { super(assemblyFactory, null, null, null, interfaceContractMapper); } @@ -333,6 +333,23 @@ public class CompositeReferenceEndpointReferenceBuilderImpl extends BaseBuilderI // user hasn't put a uri on the binding so it's not a target // name if (uri == null) { + // create endpoint reference for manually configured bindings + EndpointReference2 endpointRef = assemblyFactory.createEndpointReference(); + endpointRef.setComponent(component); + endpointRef.setReference(reference); + endpointRef.setBinding(binding); + endpointRef.setTargetName(null); + endpointRef.setTargetEndpoint(null); + endpointRef.setUnresolved(false); + + // create a resolved endpoint to signify that this + // reference is pointing at some unwired endpoint + Endpoint2 endpoint = assemblyFactory.createEndpoint(); + endpoint.setUnresolved(false); + endpointRef.setTargetEndpoint(endpoint); + + reference.getEndpointReferences().add(endpointRef); + continue; } diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionBuilderImpl.java new file mode 100644 index 0000000000..2d3c89ca7b --- /dev/null +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionBuilderImpl.java @@ -0,0 +1,171 @@ +/* + * 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.EndpointFactory; +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.definitions.Definitions; +import org.apache.tuscany.sca.monitor.Monitor; + +/** + * A composite builder that handles the creation of promoted composite services. + * + * @version $Rev$ $Date$ + */ +public class ComponentReferencePromotionBuilderImpl implements CompositeBuilder { + private AssemblyFactory assemblyFactory; + private EndpointFactory endpointFactory; + + public ComponentReferencePromotionBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory) { + this.assemblyFactory = assemblyFactory; + this.endpointFactory = endpointFactory; + } + + public void build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException { + configureNestedCompositeReferences(composite, monitor); + } + + public String getID() { + return "org.apache.tuscany.sca.assembly.builder.ComponentReferencePromotionBuilder"; + } + + /** + * Push down reference configuration into nested composites. + * + * @param composite + * @param problems + */ + private void configureNestedCompositeReferences(Composite composite, Monitor monitor) { + + // Process nested composites recursively + for (Component component : composite.getComponents()) { + Implementation implementation = component.getImplementation(); + if (implementation instanceof Composite) { + configureNestedCompositeReferences((Composite)implementation, monitor); + } + } + + // 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.getEndpointReferences().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, endpointFactory, 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()); + } + } + /* TODO - let endpoint references worry about target service + // 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 { +/* TODO - let endpoint references worry about target servicep + 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/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java index 4ceb4bb079..c6b6b38851 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java @@ -85,7 +85,7 @@ public class ComponentReferencePromotionWireBuilderImpl implements CompositeBuil if (implReference != null && implReference instanceof CompositeReference) { // If the component reference is wired, it is a promotion override - if (!componentReference.getEndpoints().isEmpty()) { + if (!componentReference.getEndpointReferences().isEmpty()) { componentReference.setPromotionOverride(true); } @@ -114,7 +114,7 @@ public class ComponentReferencePromotionWireBuilderImpl implements CompositeBuil .getCallback().getBindings()); } } - + /* TODO - let endpoint references worry about target service // Wire the promoted reference to the actual non-composite component services if (promotedReference.getMultiplicity() == Multiplicity.ONE_ONE) { // promotedReference.getTargets().clear(); @@ -137,11 +137,13 @@ public class ComponentReferencePromotionWireBuilderImpl implements CompositeBuil promotedReference.getTargets().add(target); } } +*/ } } } } } else { +/* TODO - let endpoint references worry about target servicep for (ComponentReference componentReference : component.getReferences()) { // Wire the component reference to the actual @@ -161,6 +163,7 @@ public class ComponentReferencePromotionWireBuilderImpl implements CompositeBuil } } } +*/ } } } diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java index dc99d1dc3d..99d4defb21 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java @@ -104,7 +104,7 @@ public class ComponentReferenceWireBuilderImpl extends BaseBuilderImpl implement connectWires(composite, componentServices, componentReferences, monitor); // Connect component references to their targets - connectComponentReferences(composite, components, componentServices, componentReferences, monitor); +// connectComponentReferences(composite, components, componentServices, componentReferences, monitor); // Validate that references are wired or promoted, according // to their multiplicity @@ -133,9 +133,9 @@ public class ComponentReferenceWireBuilderImpl extends BaseBuilderImpl implement // Finally clear the original reference target lists as we now have // bindings to represent the targets - for (ComponentReference componentReference : componentReferences.values()) { - componentReference.getTargets().clear(); - } + // for (ComponentReference componentReference : componentReferences.values()) { + // componentReference.getTargets().clear(); + // } } /** diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceEndpointBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceEndpointBuilderImpl.java index a933fd6991..1205bfeef4 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceEndpointBuilderImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceEndpointBuilderImpl.java @@ -31,6 +31,7 @@ import org.apache.tuscany.sca.assembly.CompositeReference; import org.apache.tuscany.sca.assembly.CompositeService; import org.apache.tuscany.sca.assembly.Endpoint2; import org.apache.tuscany.sca.assembly.EndpointFactory; +import org.apache.tuscany.sca.assembly.EndpointReference2; import org.apache.tuscany.sca.assembly.Implementation; import org.apache.tuscany.sca.assembly.Reference; import org.apache.tuscany.sca.assembly.SCABinding; @@ -45,10 +46,10 @@ import org.apache.tuscany.sca.monitor.Monitor; * * @version $Rev$ $Date$ */ -public class CompositeServiceEndpointBuilderImpl implements CompositeBuilder { +public class ComponentServiceEndpointBuilderImpl implements CompositeBuilder { private AssemblyFactory assemblyFactory; - public CompositeServiceEndpointBuilderImpl(AssemblyFactory assemblyFactory) { + public ComponentServiceEndpointBuilderImpl(AssemblyFactory assemblyFactory) { this.assemblyFactory = assemblyFactory; } @@ -109,11 +110,39 @@ public class CompositeServiceEndpointBuilderImpl implements CompositeBuilder { // create an endpoint for each component service binding for (ComponentService service : component.getServices()) { + + Component endpointComponent = component; + ComponentService endpointService = service; + + // TODO - EPR - We maintain all endpoints at the right level now + // but endpoints for promoting services must point down + // to the services they promote. + if (service.getService() instanceof CompositeService) { + CompositeService compositeService = (CompositeService)service.getService(); + endpointService = ServiceConfigurationUtil.getPromotedComponentService(compositeService); + endpointComponent = ServiceConfigurationUtil.getPromotedComponent(compositeService); + } + + // if this service has a callback get the callback endpoint references + List<EndpointReference2> callbackEndpointReferences = null; + + if ((service.getInterfaceContract() != null) && + (service.getInterfaceContract().getCallbackInterface() != null)){ + // find the callback reference + for ( Reference reference : component.getReferences()){ + if ( reference.getName().equals(service.getName())){ + callbackEndpointReferences = reference.getEndpointReferences(); + break; + } + } + } + for (Binding binding : service.getBindings()){ Endpoint2 endpoint = assemblyFactory.createEndpoint(); - endpoint.setComponent(component); - endpoint.setService(service); + endpoint.setComponent(endpointComponent); + endpoint.setService(endpointService); endpoint.setBinding(binding); + endpoint.setCallbackEndpointReferences(callbackEndpointReferences); endpoint.setUnresolved(false); service.getEndpoints().add(endpoint); } 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 7157d8a217..6c8228d58a 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 @@ -46,22 +46,23 @@ public class CompositeBuilderImpl implements CompositeBuilder { private static final Logger logger = Logger.getLogger(CompositeBuilderImpl.class.getName()); private CompositeBuilder compositeIncludeBuilder; private CompositeBuilder componentReferenceWireBuilder; - private CompositeBuilder componentReferencePromotionWireBuilder; - private CompositeBuilder compositeReferenceWireBuilder; + //private CompositeBuilder componentReferencePromotionWireBuilder; + private CompositeBuilder componentReferencePromotionBuilder; + //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 componentServicePromotionBuilder; + //private CompositeBuilder compositeServicePromotionBuilder; private CompositeBuilder compositePromotionBuilder; private CompositeBuilder compositePolicyBuilder; private CompositeBuilder componentServiceBindingBuilder; private CompositeBuilder componentReferenceBindingBuilder; - private CompositeBuilder compositeReferenceEndpointReferenceBuilder; - private CompositeBuilder compositeServiceEndpointBuilder; + private CompositeBuilder componentReferenceEndpointReferenceBuilder; + private CompositeBuilder componentServiceEndpointBuilder; //private CompositeBuilder endpointReferenceBuilder; public CompositeBuilderImpl(FactoryExtensionPoint factories, InterfaceContractMapper mapper) { @@ -161,22 +162,23 @@ public class CompositeBuilderImpl implements CompositeBuilder { compositeIncludeBuilder = new CompositeIncludeBuilderImpl(); componentReferenceWireBuilder = new ComponentReferenceWireBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper); - componentReferencePromotionWireBuilder = new ComponentReferencePromotionWireBuilderImpl(assemblyFactory, endpointFactory); - compositeReferenceWireBuilder = new CompositeReferenceWireBuilderImpl(assemblyFactory, endpointFactory); + //componentReferencePromotionWireBuilder = new ComponentReferencePromotionWireBuilderImpl(assemblyFactory, endpointFactory); + componentReferencePromotionBuilder = new ComponentReferencePromotionBuilderImpl(assemblyFactory, endpointFactory); + //compositeReferenceWireBuilder = new CompositeReferenceWireBuilderImpl(assemblyFactory, endpointFactory); compositeCloneBuilder = new CompositeCloneBuilderImpl(); componentConfigurationBuilder = new ComponentConfigurationBuilderImpl(assemblyFactory, scaBindingFactory, documentBuilderFactory, transformerFactory, interfaceContractMapper); compositeServiceConfigurationBuilder = new CompositeServiceConfigurationBuilderImpl(assemblyFactory); compositeReferenceConfigurationBuilder = new CompositeReferenceConfigurationBuilderImpl(assemblyFactory); compositeBindingURIBuilder = new CompositeBindingURIBuilderImpl(assemblyFactory, scaBindingFactory, documentBuilderFactory, transformerFactory, interfaceContractMapper); - componentServicePromotionBuilder = new ComponentServicePromotionBuilderImpl(assemblyFactory); - compositeServicePromotionBuilder = new CompositeServicePromotionBuilderImpl(assemblyFactory); + //componentServicePromotionBuilder = new ComponentServicePromotionBuilderImpl(assemblyFactory); + //compositeServicePromotionBuilder = new CompositeServicePromotionBuilderImpl(assemblyFactory); compositePromotionBuilder = new CompositePromotionBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper); compositePolicyBuilder = new CompositePolicyBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper); componentServiceBindingBuilder = new ComponentServiceBindingBuilderImpl(); componentReferenceBindingBuilder = new ComponentReferenceBindingBuilderImpl(); - compositeReferenceEndpointReferenceBuilder = new CompositeReferenceEndpointReferenceBuilderImpl(assemblyFactory, interfaceContractMapper); - compositeServiceEndpointBuilder = new CompositeServiceEndpointBuilderImpl(assemblyFactory); + componentReferenceEndpointReferenceBuilder = new ComponentReferenceEndpointReferenceBuilderImpl(assemblyFactory, interfaceContractMapper); + componentServiceEndpointBuilder = new ComponentServiceEndpointBuilderImpl(assemblyFactory); //endpointReferenceBuilder = new EndpointReference2BuilderImpl(assemblyFactory, interfaceContractMapper); } @@ -201,51 +203,58 @@ public class CompositeBuilderImpl implements CompositeBuilder { // Compute the policies across the model hierarchy compositePolicyBuilder.build(composite, definitions, monitor); - // Configure composite services + // Configure composite services by copying bindings up the promotion + // hierarchy overwriting automatic bindings with those added manually compositeServiceConfigurationBuilder.build(composite, definitions, monitor); - // Configure composite references + // Configure composite references by copying bindings down promotion + // hierarchy overwriting automatic bindings with those added manually compositeReferenceConfigurationBuilder.build(composite, definitions, monitor); - // Configure binding URIs + // Configure service binding URIs and names. Creates an SCA defined URI based + // on the scheme base URI, the component name and the binding name compositeBindingURIBuilder.build(composite, definitions, monitor); - // Create promoted component services - componentServicePromotionBuilder.build(composite, definitions, monitor); + // Create $promoted$ component services on bottom level components + // to represent promoted services + // TODO - EPR replaced by endpoints on the promoted services + //componentServicePromotionBuilder.build(composite, definitions, monitor); - // Create promoted composite services - compositeServicePromotionBuilder.build(composite, definitions, monitor); + // Create $promoted$ component services on bottom level components + // to represent promoted composite services + // TODO - EPR OASIS doesn't deploy top level composite services + // if it did it would be replaced by endpoints + //compositeServicePromotionBuilder.build(composite, definitions, monitor); - // Build component service binding-related information + // Perform and service binding related build activities. The binding + // will provide the builder. componentServiceBindingBuilder.build(composite, definitions, monitor); - // =============================================== - // TODO - temporarily add OASIS endpoint builders - // create service endpoint models - compositeServiceEndpointBuilder.build(composite, definitions, monitor); - // create reference enpointreference models - compositeReferenceEndpointReferenceBuilder.build(composite, definitions, monitor); - // =============================================== - + // create endpoints on component services. + componentServiceEndpointBuilder.build(composite, definitions, monitor); - // Wire the components + // Apply any wires in the composite to create new component reference targets componentReferenceWireBuilder.build(composite, definitions, monitor); + + // create reference endpoint reference models + componentReferenceEndpointReferenceBuilder.build(composite, definitions, monitor); + + // Push down configuration from promoted references to the + // references they promote + componentReferencePromotionBuilder.build(composite, definitions, monitor); - // Wire the promoted component references - componentReferencePromotionWireBuilder.build(composite, definitions, monitor); + // Push down configuration from promoted references to the + // references they promote + // TODO - EPR Seems to be a repeat of compositeReferenceConfigurationBuilder + // componentReferencePromotionWireBuilder.build(composite, definitions, monitor); // Wire the composite references - compositeReferenceWireBuilder.build(composite, definitions, monitor); - - // Build component reference binding-related information - componentReferenceBindingBuilder.build(composite, definitions, monitor); + // TODO - EPR OASIS doesn't deploy top level composite references + // compositeReferenceWireBuilder.build(composite, definitions, monitor); - // =============================================== - // TODO this needs to be offloaded to a plugpoint - // could be called upon when rebuilding wires - // wire endpoint references to endpoints - //endpointReferenceBuilder.build(composite, definitions, monitor); - // =============================================== + // Perform and reference binding related build activities. The binding + // will provide the builder. + componentReferenceBindingBuilder.build(composite, definitions, monitor); } } diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java index a89f0d402f..1623591a9f 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java @@ -56,6 +56,7 @@ public class CompositeReferenceConfigurationBuilderImpl implements CompositeBuil configureNestedCompositeReferences(composite); // Process top level composite references + // TODO - In OASIS the treament of top level composite references is different so need to review for (Reference reference : composite.getReferences()) { CompositeReference compositeReference = (CompositeReference)reference; diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java index 2fc5e571b2..2bdcf7b19d 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java @@ -55,6 +55,7 @@ public class CompositeServiceConfigurationBuilderImpl implements CompositeBuilde // Process nested composites recursively configureNestedCompositeServices(composite); + // TODO - In OASIS the treatment of top level composite services it different // Process top level composite services for (Service service : composite.getServices()) { CompositeService compositeService = (CompositeService)service; diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceConfigurationUtil.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceConfigurationUtil.java index 0612f9ae0e..adf03a1b32 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceConfigurationUtil.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceConfigurationUtil.java @@ -174,76 +174,22 @@ abstract class ReferenceConfigurationUtil { if (promotedReference.getMultiplicity() == Multiplicity.ONE_ONE || promotedReference.getMultiplicity() == Multiplicity.ZERO_ONE) { - // if necessary override the promoted endpoints (and bindings) with the top level bindings - if (reference.getBindings().size() > 0 ){ - - List<Binding> bindingsToCopyDown = new ArrayList<Binding>(); - List<Endpoint> endpointsToCopyDown = new ArrayList<Endpoint>(); - - for (Binding binding : reference.getBindings()) { - if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) { - bindingsToCopyDown.add(binding); - - if (reference instanceof ComponentReference){ - for (Endpoint endpoint : ((ComponentReference)reference).getEndpoints()){ - if ( endpoint.getSourceBinding() == binding){ - endpointsToCopyDown.add(endpoint); - break; - } - } - } else { - // create a new endpoint to represent this promoted binding - Endpoint endpoint = endpointFactory.createEndpoint(); - endpoint.setTargetName(binding.getURI()); - endpoint.setSourceComponent(null); // TODO - fixed up at start - endpoint.setSourceComponentReference(promotedReference); - endpoint.setInterfaceContract(reference.getInterfaceContract()); - endpoint.setSourceBinding(binding); - endpointsToCopyDown.add(endpoint); - } - } - } - - if (bindingsToCopyDown.size() > 0) { - promotedReference.getBindings().clear(); - promotedReference.getBindings().addAll(bindingsToCopyDown); - - promotedReference.getEndpoints().clear(); - promotedReference.getEndpoints().addAll(endpointsToCopyDown); - } + // override the promoted endpoint references (and bindings) + // with configuration from the top level + + if (reference.getEndpointReferences().size() > 0){ + promotedReference.getEndpointReferences().clear(); + promotedReference.getEndpointReferences().addAll(reference.getEndpointReferences()); } - if (promotedReference.getBindings().size() > 1) { + if (promotedReference.getEndpointReferences().size() > 1) { warning(monitor, "ComponentReferenceMoreWire", promotedReference, promotedReference.getName()); } } else { - // if necessary merge the promoted endpoints (and bindings) with the top level bindings - if (reference.getBindings().size() > 0 ){ - - for (Binding binding : reference.getBindings()) { - if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) { - promotedReference.getBindings().add(binding); - - if (reference instanceof ComponentReference){ - for (Endpoint endpoint : ((ComponentReference)reference).getEndpoints()){ - if ( endpoint.getSourceBinding() == binding){ - promotedReference.getEndpoints().add(endpoint); - break; - } - } - } else { - // create a new endpoint to represent this promoted binding - Endpoint endpoint = endpointFactory.createEndpoint(); - endpoint.setTargetName(binding.getURI()); - endpoint.setSourceComponent(null); // TODO - fixed up at start - endpoint.setSourceComponentReference(promotedReference); - endpoint.setInterfaceContract(reference.getInterfaceContract()); - endpoint.setSourceBinding(binding); - promotedReference.getEndpoints().add(endpoint); - } - } - } - } + // merge the promoted endpoint reference with the those from the top level + if (reference.getEndpointReferences().size() > 0){ + promotedReference.getEndpointReferences().addAll(reference.getEndpointReferences()); + } } Set<Binding> callbackBindings = new HashSet<Binding>(); diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/Endpoint2Impl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/Endpoint2Impl.java index 67041fc66a..d1fc0123eb 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/Endpoint2Impl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/Endpoint2Impl.java @@ -25,6 +25,7 @@ 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.Endpoint2; +import org.apache.tuscany.sca.assembly.EndpointReference2; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.policy.ExtensionType; import org.apache.tuscany.sca.policy.Intent; @@ -42,8 +43,8 @@ public class Endpoint2Impl implements Endpoint2 { private Component component; private ComponentService service; private Binding binding; - private Binding callbackBinding; private InterfaceContract interfaceContract; + private List<EndpointReference2> callbackEndpointReferences; //private String uri; private List<PolicySet> policySets = new ArrayList<PolicySet>(); private List<Intent> requiredIntents = new ArrayList<Intent>(); @@ -95,6 +96,27 @@ public class Endpoint2Impl implements Endpoint2 { public void setInterfaceContract(InterfaceContract interfaceContract) { this.interfaceContract = interfaceContract; } + + /** + * Get the services callbacl enpoint references that + * represent endpoint references from which callbacks + * originate + * + * @return callbackEndpoint the reference callback endpoint + */ + public List<EndpointReference2> getCallbackEndpointReferences(){ + return callbackEndpointReferences; + } + + /** + * Set the reference callback endpoint refefences + * + * @param callbackEndpoint the reference callback endpoint + */ + public void setCallbackEndpointReferences(List<EndpointReference2> callbackEndpointReferences) + { + this.callbackEndpointReferences = callbackEndpointReferences; + } /* public String getURI() { return uri; diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReference2Impl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReference2Impl.java index 699d2e89f4..e47eb1c6fe 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReference2Impl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReference2Impl.java @@ -62,7 +62,13 @@ public class EndpointReference2Impl implements EndpointReference2 { @Override public Object clone() throws CloneNotSupportedException { - return super.clone(); + EndpointReference2 cloned = (EndpointReference2)super.clone(); + + if (targetEndpoint != null){ + cloned.setTargetEndpoint((Endpoint2)targetEndpoint.clone()); + } + + return cloned; } public boolean isUnresolved() { diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java index 82026b40db..41d090c9d4 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java @@ -55,6 +55,8 @@ public class ReferenceImpl extends AbstractReferenceImpl implements Reference, C clone.bindings.addAll(getBindings()); clone.targets = new ArrayList<ComponentService>(); clone.targets.addAll(getTargets()); + clone.endpointReferences = new ArrayList<EndpointReference2>(); + clone.endpointReferences.addAll(getEndpointReferences()); return clone; } diff --git a/java/sca/modules/binding-rmi-runtime/src/test/resources/RMIBindingTest.composite b/java/sca/modules/binding-rmi-runtime/src/test/resources/RMIBindingTest.composite index b71d789c74..dd74f849ac 100644 --- a/java/sca/modules/binding-rmi-runtime/src/test/resources/RMIBindingTest.composite +++ b/java/sca/modules/binding-rmi-runtime/src/test/resources/RMIBindingTest.composite @@ -20,24 +20,21 @@ <composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1" name="HelloWorldRmiComposite"> - - <service name="HelloWorldRmiService" promote="HelloWorldServiceComponent"> - <interface.java interface="helloworld.HelloWorldService"/> - <tuscany:binding.rmi uri="rmi://localhost:8099/HelloWorldRemoteService" /> - </service> - + <component name="HelloWorldServiceComponent"> <implementation.java class="helloworld.HelloWorldImpl"/> + <service name="HelloWorldService" > + <interface.java interface="helloworld.HelloWorldService"/> + <tuscany:binding.rmi uri="rmi://localhost:8099/HelloWorldRemoteService"/> + </service> </component> - <component name="HelloWorldRmiServiceComponent"> + <component name="HelloWorldRmiServiceComponent"> <implementation.java class="helloworld.HelloWorldRmiImpl"/> - <reference name="extService"></reference> + <reference name="extService"> + <interface.java interface="helloworld.HelloWorldService"/> + <tuscany:binding.rmi uri="rmi://localhost:8099/HelloWorldRemoteService" /> + </reference> </component> - <reference name="HelloWorldRmiReference" promote="HelloWorldRmiServiceComponent/extService"> - <interface.java interface="helloworld.HelloWorldService"/> - <tuscany:binding.rmi uri="rmi://localhost:8099/HelloWorldRemoteService" /> - </reference> - </composite> diff --git a/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCase.java b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCase.java index 6c62d52cc6..15807c76de 100644 --- a/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCase.java +++ b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCase.java @@ -68,7 +68,9 @@ public class QuestionMarkWSDLImportTestCase extends TestCase { Definition definition = wsdlReader.readWSDL("http://localhost:8086/AccountService?wsdl");
assertNotNull(definition);
- Service service = definition.getService(new QName("http://account2/AccountService/$promoted$ep1", "AccountService"));
+ // TODO - EPR - $promoted$ no longer used
+ //Service service = definition.getService(new QName("http://account2/AccountService/$promoted$ep1", "AccountService"));
+ Service service = definition.getService(new QName("http://account2/AccountService/Account", "AccountService"));
Port port = service.getPort("AccountSoapPort");
String endpoint = getEndpoint(port);
diff --git a/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCase.java b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCase.java index a9d31fb9a8..fd95ff7473 100644 --- a/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCase.java +++ b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCase.java @@ -68,7 +68,9 @@ public class QuestionMarkWSDLIncludeTestCase extends TestCase { Definition definition = wsdlReader.readWSDL("http://localhost:8085/AccountService?wsdl");
assertNotNull(definition);
- Service service = definition.getService(new QName("http://accounts/AccountService/$promoted$ep1", "AccountService"));
+ // TODO - EPR - $promoted$ no longer used
+ //Service service = definition.getService(new QName("http://accounts/AccountService/$promoted$ep1", "AccountService"));
+ Service service = definition.getService(new QName("http://accounts/AccountService/Account", "AccountService"));
Port port = service.getPort("AccountSoapPort");
String endpoint = getEndpoint(port);
diff --git a/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java index 63026f95f7..bbec9dd342 100644 --- a/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java +++ b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java @@ -68,8 +68,11 @@ public class QuestionMarkWSDLTestCase extends TestCase { Definition definition = wsdlReader.readWSDL("http://localhost:8085/services/HelloWorldWebService?wsdl"); assertNotNull(definition); - Service service = definition.getService(new QName("http://helloworld/HelloWorldService/$promoted$ep1", - "HelloWorldService")); + // TODO - EPR - $promoted$ no longer used + //Service service = definition.getService(new QName("http://helloworld/HelloWorldService/$promoted$ep1", + // "HelloWorldService")); + Service service = definition.getService(new QName("http://helloworld/HelloWorldService/HelloWorld", + "HelloWorldService")); Port port = service.getPort("HelloWorldSoapPort"); String endpoint = getEndpoint(port); diff --git a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.composite b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.composite index 37c9f336f9..061b68450c 100644 --- a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.composite +++ b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.composite @@ -22,30 +22,26 @@ targetNamespace="http://www.tuscany.apache.org/tests/binding/ws/axis2"
name="HelloWorld">
- <service name="helloWorld" promote="HelloWorldService">
- <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
- <!-- interface.java interface="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorld" / -->
- <binding.ws wsdlElement="http://helloworld#wsdl.binding(HelloWorldSoapBinding)">
- <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
- <wsa:Address>http://localhost:8085/services/HelloWorldWebService</wsa:Address>
- </wsa:EndpointReference>
- </binding.ws>
-
- </service>
-
<component name="HelloWorldService">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldService"/>
+ <service name="HelloWorld">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.binding(HelloWorldSoapBinding)">
+ <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
+ <wsa:Address>http://localhost:8085/services/HelloWorldWebService</wsa:Address>
+ </wsa:EndpointReference>
+ </binding.ws>
+ </service>
</component>
<component name="HelloWorldComponent">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldComponent"/>
- <reference name="helloWorldWS" />
+ <reference name="helloWorldWS">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/>
+ </reference>
</component>
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
- <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
- <!-- interface.java interface="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorld" / -->
- <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/>
- </reference>
+
</composite>
diff --git a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDL.composite b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDL.composite index 471c9bf42c..992d4463de 100644 --- a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDL.composite +++ b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDL.composite @@ -22,41 +22,32 @@ targetNamespace="http://www.tuscany.apache.org/tests/binding/ws/axis2"
name="HelloWorldNoWSDL">
- <service name="helloWorld" promote="HelloWorldService">
- <!-- interface.java interface="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorld" / -->
- <binding.ws uri="http://localhost:8085/helloWorld"/>
- </service>
-
<component name="HelloWorldService">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldService"/>
+ <service name="HelloWorld" >
+ <binding.ws uri="http://localhost:8085/helloWorld"/>
+ </service>
</component>
<component name="HelloWorldComponent">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldComponent"/>
- <reference name="helloWorldWS" />
+ <reference name="helloWorldWS" >
+ <binding.ws uri="http://localhost:8085/helloWorld"/>
+ </reference>
</component>
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
- <!-- interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" / -->
- <!-- interface.java interface="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorld" / -->
- <binding.ws uri="http://localhost:8085/helloWorld"/>
- </reference>
-
- <service name="Echo" promote="EchoService">
- <binding.ws uri="http://localhost:8085/Echo"/>
- </service>
-
<component name="EchoService">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.EchoImpl"/>
+ <service name="Echo">
+ <binding.ws uri="http://localhost:8085/Echo"/>
+ </service>
</component>
<component name="EchoComponent">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.EchoComponent"/>
- <reference name="echoWS" />
+ <reference name="echoWS">
+ <binding.ws uri="http://localhost:8085/Echo"/>
+ </reference>
</component>
- <reference name="echoWS" promote="EchoComponent/echoWS">
- <binding.ws uri="http://localhost:8085/Echo"/>
- </reference>
-
</composite>
diff --git a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiService.composite b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiService.composite index 85c26b78c1..0c5646e888 100644 --- a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiService.composite +++ b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiService.composite @@ -28,25 +28,26 @@ http://localhost:8085/HelloWorldService/service1
-->
- <service name="helloWorld" promote="HelloWorldService/HelloWorldOM">
- <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
- <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld" - wsdlElement="http://helloworld-om#wsdl.binding(HelloWorldSoapBinding)"/>
- </service>
+
<component name="HelloWorldService">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldMultiService"/>
+ <service name="HelloWorldOM">
+ <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld"
+ wsdlElement="http://helloworld-om#wsdl.binding(HelloWorldSoapBinding)"/>
+ </service>
</component>
<component name="HelloWorldComponent">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
- <reference name="helloWorldWS" />
+ <reference name="helloWorldWS">
+ <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om#wsdl.binding(HelloWorldSoapBinding)"
+ uri="http://localhost:8085/HelloWorldService/helloWorld"/>
+ </reference>
</component>
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
- <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om#wsdl.binding(HelloWorldSoapBinding)"
- uri="http://localhost:8085/HelloWorldService/helloWorld"/>
- </reference>
+
</composite>
diff --git a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleService.composite b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleService.composite index 1096b867e2..5778f98593 100644 --- a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleService.composite +++ b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleService.composite @@ -28,25 +28,24 @@ so for this composite: http://localhost:8085/HelloWorldService
-->
- <service name="helloWorld" promote="HelloWorldService">
- <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
- <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld" - wsdlElement="http://helloworld-om#wsdl.binding(HelloWorldSoapBinding)"/>
- </service>
-
<component name="HelloWorldService">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
+ <service name="HelloWorldOM">
+ <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld"
+ wsdlElement="http://helloworld-om#wsdl.binding(HelloWorldSoapBinding)"/>
+ </service>
</component>
<component name="HelloWorldComponent">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
- <reference name="helloWorldWS" />
+ <reference name="helloWorldWS">
+ <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om#wsdl.binding(HelloWorldSoapBinding)"
+ uri="http://localhost:8085/HelloWorldService/helloWorld"/>
+ </reference>
</component>
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
- <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om#wsdl.binding(HelloWorldSoapBinding)"
- uri="http://localhost:8085/HelloWorldService/helloWorld"/>
- </reference>
+
</composite>
diff --git a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURI.composite b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURI.composite index 0cf9a9ef90..990093bc8c 100644 --- a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURI.composite +++ b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURI.composite @@ -27,24 +27,24 @@ so for this composite the service is: http://localhost:8085/myExplicitURI
-->
- <service name="helloWorld" promote="HelloWorldService">
- <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
- </service>
<component name="HelloWorldService">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
+ <service name="HelloWorldOM">
+ <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
+ </service>
</component>
<component name="HelloWorldComponent">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
- <reference name="helloWorldWS" />
+ <reference name="helloWorldWS">
+ <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.binding(HelloWorldSoapBinding)"
+ uri="http://localhost:8085/myExplicitURI"/>
+ </reference>
</component>
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
- <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.binding(HelloWorldSoapBinding)"
- uri="http://localhost:8085/myExplicitURI"/>
- </reference>
+
</composite>
diff --git a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURI.composite b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURI.composite index 0c74144385..ea598f8e23 100644 --- a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURI.composite +++ b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURI.composite @@ -27,24 +27,25 @@ so for this composite the service is: http://localhost:8085/HelloWorldService/myRelativeURI
-->
- <service name="helloWorld" promote="HelloWorldService">
- <interface.wsdl interface="http://helloworld-om-relative-uri#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om-relative-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
- </service>
+
<component name="HelloWorldService">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
+ <service name="HelloWorldOM">
+ <interface.wsdl interface="http://helloworld-om-relative-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-relative-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
+ </service>
</component>
<component name="HelloWorldComponent">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
- <reference name="helloWorldWS" />
+ <reference name="helloWorldWS">
+ <interface.wsdl interface="http://helloworld-om-relative-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-relative-uri#wsdl.binding(HelloWorldSoapBinding)"
+ uri="http://localhost:8085/HelloWorldService/helloWorld/myRelativeURI"/>
+ </reference>
</component>
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
- <interface.wsdl interface="http://helloworld-om-relative-uri#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om-relative-uri#wsdl.binding(HelloWorldSoapBinding)"
- uri="http://localhost:8085/HelloWorldService/helloWorld/myRelativeURI"/>
- </reference>
+
</composite>
diff --git a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorld.composite b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorld.composite index 5554b79216..ef012f1803 100644 --- a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorld.composite +++ b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorld.composite @@ -22,30 +22,27 @@ targetNamespace="http://www.tuscany.apache.org/tests/binding/ws/axis2"
name="HelloWorld">
- <service name="helloWorld" promote="HelloWorldService">
- <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
- <binding.ws>
- <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
- <wsa:Address>http://localhost:8085/myService</wsa:Address>
- </wsa:EndpointReference>
- </binding.ws>
- </service>
-
<component name="HelloWorldService">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldService"/>
+ <service name="HelloWorld">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws>
+ <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
+ <wsa:Address>http://localhost:8085/myService</wsa:Address>
+ </wsa:EndpointReference>
+ </binding.ws>
+ </service>
</component>
<component name="HelloWorldComponent">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldComponent"/>
- <reference name="helloWorldWS" />
+ <reference name="helloWorldWS">
+ <binding.ws>
+ <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
+ <wsa:Address>http://localhost:8085/myService</wsa:Address>
+ </wsa:EndpointReference>
+ </binding.ws>
+ </reference>
</component>
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
- <binding.ws>
- <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
- <wsa:Address>http://localhost:8085/myService</wsa:Address>
- </wsa:EndpointReference>
- </binding.ws>
- </reference>
-
</composite>
diff --git a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-merged.composite b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-merged.composite index 24594744e5..023f392085 100644 --- a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-merged.composite +++ b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-merged.composite @@ -22,22 +22,22 @@ targetNamespace="http://www.tuscany.apache.org/tests/binding/ws/axis2"
name="HelloWorldOM-Merged">
- <service name="helloWorld" promote="HelloWorldMergedService">
- <interface.wsdl interface="http://helloworld-om-merged#wsdl.interface(HelloWorld)" />
- <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld"/>
- </service>
<component name="HelloWorldMergedService">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
+ <service name="HelloWorldOM">
+ <interface.wsdl interface="http://helloworld-om-merged#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld"/>
+ </service>
</component>
<component name="HelloWorldWSDLMergedComponent">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
- </component>
-
- <reference name="mergedHelloWorldWS" promote="HelloWorldWSDLMergedComponent/helloWorldWS">
- <interface.wsdl interface="http://helloworld-om-merged#wsdl.interface(HelloWorld)" />
- <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld" />
+ <reference name="helloWorldWS">
+ <interface.wsdl interface="http://helloworld-om-merged#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld" />
</reference>
+ </component>
+
</composite>
diff --git a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.composite b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.composite index 3d966117f4..ccd3082f88 100644 --- a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.composite +++ b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.composite @@ -21,24 +21,22 @@ xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200903"
targetNamespace="http://www.tuscany.apache.org/tests/binding/ws/axis2"
name="HelloWorldOM">
-
- <service name="helloWorld" promote="HelloWorldService">
- <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
- <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld"/>
- </service>
<component name="HelloWorldService">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
+ <service name="HelloWorldOM">
+ <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld"/>
+ </service>
</component>
<component name="HelloWorldComponent">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
- <reference name="helloWorldWS" />
+ <reference name="helloWorldWS">
+ <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld" />
+ </reference>
</component>
-
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
- <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
- <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld" />
- </reference>
+
</composite>
diff --git a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-prec.composite b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-prec.composite index 38509f9d2d..91175c476c 100644 --- a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-prec.composite +++ b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-prec.composite @@ -25,24 +25,22 @@ targetNamespace="http://www.tuscany.apache.org/tests/binding/ws/axis2"
name="HelloWorldPrec">
- <service name="helloWorld" promote="HelloWorldService">
- <interface.wsdl interface="http://helloworld-prec#wsdl.interface(HelloWorld)" />
- <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld"/>
- </service>
<component name="HelloWorldService">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
+ <service name="HelloWorldOM">
+ <interface.wsdl interface="http://helloworld-prec#wsdl.interface(HelloWorld)" />
+ <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld"/>
+ </service>
</component>
<component name="HelloWorldComponent">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
- <reference name="helloWorldWS" />
+ <reference name="helloWorldWS">
+ <interface.wsdl interface="http://helloworld-prec#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-prec#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://INVALID.END.POINT" />
+ </reference>
</component>
-
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
- <interface.wsdl interface="http://helloworld-prec#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-prec#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
- uri="http://INVALID.END.POINT" />
- </reference>
</composite>
diff --git a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl-import.composite b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl-import.composite index f92c4356a8..a8fd8d4d5d 100644 --- a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl-import.composite +++ b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl-import.composite @@ -21,12 +21,11 @@ targetNamespace="http://www.tuscany.apache.org/tests/binding/ws/axis2"
name="QuestionMarkWSDLImport">
- <service name="ep1" promote="AccountService">
- <binding.ws wsdlElement="http://account2#wsdl.port(AccountService/AccountSoapPort)" />
- </service>
-
<component name="AccountService">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.AccountService" />
+ <service name="Account">
+ <binding.ws wsdlElement="http://account2#wsdl.port(AccountService/AccountSoapPort)" />
+ </service>
</component>
</composite>
diff --git a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl-include.composite b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl-include.composite index 73804b87ca..d795329db0 100644 --- a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl-include.composite +++ b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl-include.composite @@ -21,12 +21,11 @@ targetNamespace="http://www.tuscany.apache.org/tests/binding/ws/axis2"
name="QuestionMarkWSDLInclude">
- <service name="ep1" promote="AccountService">
- <binding.ws wsdlElement="http://accounts#wsdl.port(AccountService/AccountSoapPort)" />
- </service>
-
<component name="AccountService">
<implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.AccountService" />
+ <service name="Account" promote="AccountService">
+ <binding.ws wsdlElement="http://accounts#wsdl.port(AccountService/AccountSoapPort)" />
+ </service>
</component>
</composite>
diff --git a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.composite b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.composite index affedb23a8..3ed8b206a7 100644 --- a/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.composite +++ b/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.composite @@ -22,19 +22,12 @@ targetNamespace="http://www.tuscany.apache.org/tests/binding/ws/axis2" name="QuestionMarkWSDLTests"> - <service name="ep1" promote="HelloWorldService"> - <binding.ws wsdlElement="http://helloworld#wsdl.service(HelloWorldService)"/> - <!-- - <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/> - --> - </service> - - <service name="ep2" promote="HelloWorldService"> - <binding.ws uri="http://localhost:8085/foo/bar" /> - </service> - <component name="HelloWorldService"> <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldService"/> + <service name="HelloWorld"> + <binding.ws name="ep1" uri="http://localhost:8085/foo/bar" /> + <binding.ws name="ep2" wsdlElement="http://helloworld#wsdl.service(HelloWorldService)"/> + </service> </component> </composite> diff --git a/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java b/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java index 6d11febc5b..c573f5f62e 100644 --- a/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java +++ b/java/sca/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java @@ -131,6 +131,7 @@ public class WSDLServiceGenerator { //[nash] changes to the builder sequence avoid calling this for a CompositeService assert !(contract instanceof CompositeService); + // TODO - EPR - $promoted$ no longer used /* // For every promoted composite service, the underlying component // gets a copy of the service with the name prefixed by "$promoted$." diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java index 44ae7f552a..84e2f4588b 100644 --- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java +++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java @@ -24,6 +24,7 @@ import java.util.List; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.assembly.ComponentReference; import org.apache.tuscany.sca.assembly.Endpoint; +import org.apache.tuscany.sca.assembly.EndpointReference2; import org.apache.tuscany.sca.endpointresolver.EndpointResolver; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Invoker; @@ -52,6 +53,13 @@ public interface RuntimeComponentReference extends ComponentReference { * @return The runtime wire */ RuntimeWire getRuntimeWire(Binding binding); + + /** + * Get the runtime wire for the given endpoint reference + * @param endpointReference The assembly model endpoint reference + * @return The runtime wire + */ + RuntimeWire getRuntimeWire(EndpointReference2 endpointReference); /** * Returns the reference binding provider associated with this diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java index a2e7152202..7366d511ae 100644 --- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java +++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java @@ -22,6 +22,7 @@ package org.apache.tuscany.sca.runtime; import java.lang.reflect.InvocationTargetException; import java.util.List; +import org.apache.tuscany.sca.assembly.EndpointReference2; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.InvocationChain; import org.apache.tuscany.sca.invocation.Message; @@ -34,6 +35,11 @@ import org.apache.tuscany.sca.invocation.Message; */ public interface RuntimeWire extends Cloneable { + + // ================================================================= + // TODO - EPR - remove the following three methods when we have + // changes the rest of the instructure over to using EndpointReference2 + // and EndpointReference2 throughout /** * Get the source of the wire * @@ -54,6 +60,15 @@ public interface RuntimeWire extends Cloneable { */ void setTarget(EndpointReference target); + //================================================================== + + /** + * return the endpoint reference that configured this wire + * + * @return the endpoint reference that configured this wire + */ + EndpointReference2 getEndpointReference(); + /** * Force the invocation chains to be rebuilt */ diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl2.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl2.java index b84717467f..8efee3a0ec 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl2.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl2.java @@ -289,9 +289,14 @@ public class CompositeActivatorImpl2 implements CompositeActivator { } return; } + + /* TODO - EPR - activate services at all levels as promoted endpoin references are maintained + * on the higher level services if (service.getService() instanceof CompositeService) { return; } + */ + if (logger.isLoggable(Level.FINE)) { logger.fine("Activating component service: " + component.getURI() + "#" + service.getName()); } @@ -367,6 +372,7 @@ public class CompositeActivatorImpl2 implements CompositeActivator { // so we need to represent the reference that will call us EndpointReference2 endpointReference = assemblyFactory.createEndpointReference(); endpointReference.setBinding(endpoint.getBinding()); + endpointReference.setTargetEndpoint(endpoint); // create the interface contract for the binding and service ends of the wire // that are created as forward only contracts @@ -496,7 +502,7 @@ public class CompositeActivatorImpl2 implements CompositeActivator { return; } - // TODO - what is this all about? + // TODO - EPR what is this all about? // [rfeng] Comment out the following statements to avoid the on-demand activation // RuntimeComponentReference runtimeRef = (RuntimeComponentReference)reference; // runtimeRef.getRuntimeWires().clear(); @@ -539,7 +545,7 @@ public class CompositeActivatorImpl2 implements CompositeActivator { configureComponentContext(runtimeComponent); -/* TODO - won't start until reference is actually started later +/* TODO - EPR won't start until reference is actually started later for (ComponentReference reference : component.getReferences()) { if (logger.isLoggable(Level.FINE)) { logger.fine("Starting component reference: " + component.getURI() + "#" + reference.getName()); @@ -679,11 +685,11 @@ public class CompositeActivatorImpl2 implements CompositeActivator { // Service start/stop - // TODO - done as part of the component start above + // TODO - EPR done as part of the component start above // Reference start/stop // Used by component context start - // TODO - I don't know why reference wires don't get added until component start + // TODO - EPR I don't know why reference wires don't get added until component start public void start(RuntimeComponent component, RuntimeComponentReference componentReference) { synchronized (componentReference) { @@ -692,13 +698,12 @@ public class CompositeActivatorImpl2 implements CompositeActivator { return; } - // create wire for all endpoint references. An endpoint reference says that a + // create a wire for each endpoint reference. An endpoint reference says that a // target has been specified and hence the reference has been wired in some way. // The service may not have been found yet, depending on the way the composite // is deployed, but it is expected to be found. In the case where the reference // is unwired (a target has not been specified) there will be no endpoint // reference and this will lead to null being injected - for (EndpointReference2 endpointReference : componentReference.getEndpointReferences()){ // if there is a binding an endpoint has been found for the endpoint reference @@ -762,7 +767,7 @@ public class CompositeActivatorImpl2 implements CompositeActivator { endpointReference.setInterfaceContract(sourceContract.makeUnidirectional(false)); -/* TODO - should have been done previously during matching +/* TODO - EPR should have been done previously during matching ComponentService callbackService = reference.getCallbackService(); if (callbackService != null) { // select a reference callback binding to pass with invocations on this wire @@ -790,7 +795,7 @@ public class CompositeActivatorImpl2 implements CompositeActivator { Endpoint2 endpoint = endpointReference.getTargetEndpoint(); endpoint.setInterfaceContract(bindingContract); -/* TODO - review in the light of new matching code +/* TODO - EPR review in the light of new matching code // TUSCANY-2029 - We should use the URI of the serviceBinding because the target may be a Component in a // nested composite. if (serviceBinding != null) { diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointWireImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointWireImpl.java index b089abba4f..1e11c7062e 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointWireImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointWireImpl.java @@ -23,6 +23,7 @@ import java.lang.reflect.InvocationTargetException; import java.util.List; import org.apache.tuscany.sca.assembly.Endpoint; +import org.apache.tuscany.sca.assembly.EndpointReference2; import org.apache.tuscany.sca.assembly.Reference; import org.apache.tuscany.sca.core.assembly.CompositeActivator; import org.apache.tuscany.sca.core.invocation.impl.InvocationChainImpl; @@ -183,4 +184,8 @@ public class EndpointWireImpl implements RuntimeWire { EndpointWireImpl copy = (EndpointWireImpl)super.clone(); return copy; } + + public EndpointReference2 getEndpointReference(){ + return null; + } } diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentReferenceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentReferenceImpl.java index eda274bd29..994094ab23 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentReferenceImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentReferenceImpl.java @@ -25,6 +25,7 @@ import java.util.List; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.assembly.Endpoint; +import org.apache.tuscany.sca.assembly.EndpointReference2; import org.apache.tuscany.sca.assembly.impl.ComponentReferenceImpl; import org.apache.tuscany.sca.endpointresolver.EndpointResolver; import org.apache.tuscany.sca.interfacedef.Operation; @@ -63,6 +64,7 @@ public class RuntimeComponentReferenceImpl extends ComponentReferenceImpl implem return wires; } + // TODO - EPR - shouldn't rely on this anymore public RuntimeWire getRuntimeWire(Binding binding) { for (RuntimeWire wire : getRuntimeWires()) { if (wire.getSource().getBinding() == binding) { @@ -70,17 +72,16 @@ public class RuntimeComponentReferenceImpl extends ComponentReferenceImpl implem } } - // TODO: TUSCANY-2580: before returning null see if a candidate binding matches + return null; + } + + public RuntimeWire getRuntimeWire(EndpointReference2 endpointReference) { for (RuntimeWire wire : getRuntimeWires()) { - if (wire instanceof EndpointWireImpl) { - Endpoint endpoint = ((EndpointWireImpl)wire).getEndpoint(); - for (Binding b : endpoint.getCandidateBindings()) { - if (b == binding) { - return wire; - } - } + if (wire.getEndpointReference() == endpointReference) { + return wire; } } + return null; } diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl.java index 62c2791060..a9ff97d770 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl.java @@ -28,6 +28,7 @@ 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.Contract; +import org.apache.tuscany.sca.assembly.EndpointReference2; import org.apache.tuscany.sca.core.conversation.ConversationManager; import org.apache.tuscany.sca.core.invocation.NonBlockingInterceptor; import org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker; @@ -458,4 +459,8 @@ public class RuntimeWireImpl implements RuntimeWire { private void setClonedFrom(RuntimeWireImpl wire) { clonedFrom = wire; } + + public EndpointReference2 getEndpointReference(){ + return null; + } } diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl2.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl2.java index a9150a8dc7..945045ed32 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl2.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl2.java @@ -275,16 +275,32 @@ public class RuntimeWireImpl2 implements RuntimeWire { } + // =============================================================== + // TODO - EPR remove when we convert fully over to EndpointReference2 + // TODO - remove. Just here during development static EndpointReference epr; public EndpointReference getSource() { - // TODO - convert this into method that returns EndpointReference2 + // TODO - EPR convert this into method that returns EndpointReference2 + + // convert the source info into old endpoint reference format epr = new EndpointReferenceImpl((RuntimeComponent)endpointReference.getComponent(), endpointReference.getReference(), endpointReference.getBinding(), endpointReference.getInterfaceContract()); + if (endpointReference.getCallbackEndpoint() != null){ + // convert the source callback endpoint into old endpoint reference format + EndpointReference cepr; + cepr = new EndpointReferenceImpl((RuntimeComponent)endpointReference.getComponent(), + endpointReference.getCallbackEndpoint().getService(), + endpointReference.getCallbackEndpoint().getBinding(), + endpointReference.getCallbackEndpoint().getInterfaceContract()); + epr.setCallbackEndpoint(cepr); + } + + // TODO - somtimes used to reset the interface contract so we // copy it back in in the rebuild method below return epr; @@ -293,8 +309,9 @@ public class RuntimeWireImpl2 implements RuntimeWire { public EndpointReference getTarget() { - // TODO - convert this into method that return Endpoint2 + // TODO - EPR convert this into method that returns Endpoint2 + // convert the target info into old endpoint reference format EndpointReference epr = new EndpointReferenceImpl((RuntimeComponent)endpoint.getComponent(), endpoint.getService(), endpoint.getBinding(), @@ -306,6 +323,8 @@ public class RuntimeWireImpl2 implements RuntimeWire { // TODO - can we use the idea of setTarget to rebuild the wire? } + + // =================================================================== public void rebuild() { // TODO - can we use the idea of setTarget to rebuild the wire? @@ -317,6 +336,10 @@ public class RuntimeWireImpl2 implements RuntimeWire { // to call this when it resets the interface contract endpointReference.setInterfaceContract(epr.getInterfaceContract()); } + + public EndpointReference2 getEndpointReference(){ + return endpointReference; + } /** * Add the interceptor for a reference binding @@ -440,7 +463,7 @@ public class RuntimeWireImpl2 implements RuntimeWire { public Object clone() throws CloneNotSupportedException { RuntimeWireImpl2 copy = (RuntimeWireImpl2)super.clone(); copy.endpointReference = (EndpointReference2)endpointReference.clone(); - copy.endpoint = (Endpoint2)endpoint.clone(); + copy.endpoint = copy.endpointReference.getTargetEndpoint(); copy.invoker = new RuntimeWireInvoker(copy.messageFactory, copy.conversationManager, copy); copy.cachedWire = null; // TUSCANY-2630 return copy; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallableReferenceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallableReferenceImpl.java index c2264302b4..9e5bf6b1ff 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallableReferenceImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallableReferenceImpl.java @@ -31,6 +31,7 @@ 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.CompositeService; +import org.apache.tuscany.sca.assembly.EndpointReference2; import org.apache.tuscany.sca.assembly.OptimizableBinding; import org.apache.tuscany.sca.assembly.Reference; import org.apache.tuscany.sca.assembly.SCABinding; @@ -81,7 +82,10 @@ public class CallableReferenceImpl<B> implements CallableReferenceExt<B> { protected transient RuntimeComponent component; protected transient RuntimeComponentReference reference; + // TODO - EPR - remove wire indexing on bindings as enpoint references + // can share reference bindings protected transient Binding binding; + protected transient EndpointReference2 endpointReference; protected String scdl; @@ -89,8 +93,6 @@ public class CallableReferenceImpl<B> implements CallableReferenceExt<B> { private transient ReferenceParameters refParams; private transient XMLStreamReader xmlReader; - private transient RuntimeWire endpointWire; - /* * Public constructor for Externalizable serialization/deserialization */ @@ -133,6 +135,16 @@ public class CallableReferenceImpl<B> implements CallableReferenceExt<B> { } } } + + // TODO - EPR - If not binding specified assume default binding and find the enpoint reference + // related to it + for (EndpointReference2 endpointReference : this.reference.getEndpointReferences()){ + if ((endpointReference.getBinding() != null) && + (endpointReference.getBinding() instanceof SCABinding)){ + this.endpointReference = endpointReference; + break; + } + } } // FIXME: Should we normalize the componentName/serviceName URI into an absolute SCA URI in the SCA binding? @@ -151,8 +163,8 @@ public class CallableReferenceImpl<B> implements CallableReferenceExt<B> { public RuntimeWire getRuntimeWire() { try { resolve(); - if (endpointWire != null) { - return endpointWire; + if (endpointReference != null){ + return reference.getRuntimeWire(endpointReference); } else if (reference != null) { return reference.getRuntimeWire(binding); } else { @@ -165,13 +177,10 @@ public class CallableReferenceImpl<B> implements CallableReferenceExt<B> { protected void bind(RuntimeWire wire) { if (wire != null) { - - if (wire instanceof EndpointWireImpl) { - endpointWire = wire; - } this.component = wire.getSource().getComponent(); this.reference = (RuntimeComponentReference)wire.getSource().getContract(); this.binding = wire.getSource().getBinding(); + this.endpointReference = wire.getEndpointReference(); this.compositeActivator = ((ComponentContextExt)component.getComponentContext()).getCompositeActivator(); this.conversationManager = this.compositeActivator.getCompositeContext().getConversationManager(); initCallbackID(); diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java index d935f6b93a..75c82a8861 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java @@ -23,6 +23,8 @@ import java.io.Reader; import java.io.Writer; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; +import java.util.Map; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.Binding; @@ -30,10 +32,15 @@ import org.apache.tuscany.sca.assembly.Component; import org.apache.tuscany.sca.assembly.ComponentProperty; import org.apache.tuscany.sca.assembly.ComponentReference; import org.apache.tuscany.sca.assembly.ComponentService; +import org.apache.tuscany.sca.assembly.Endpoint2; +import org.apache.tuscany.sca.assembly.EndpointReference2; 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.assembly.Service; +import org.apache.tuscany.sca.assembly.builder.CompositeBuilder; +import org.apache.tuscany.sca.assembly.builder.CompositeBuilderExtensionPoint; +import org.apache.tuscany.sca.assembly.builder.EndpointReferenceBuilder; import org.apache.tuscany.sca.context.ContextFactoryExtensionPoint; import org.apache.tuscany.sca.context.PropertyValueFactory; import org.apache.tuscany.sca.context.RequestContextFactory; @@ -51,6 +58,8 @@ import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; import org.apache.tuscany.sca.interfacedef.java.JavaInterface; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentReference; import org.apache.tuscany.sca.runtime.RuntimeComponentService; @@ -73,6 +82,8 @@ public class ComponentContextImpl implements ComponentContextExt { private final AssemblyFactory assemblyFactory; private final JavaInterfaceFactory javaInterfaceFactory; private final PropertyValueFactory propertyFactory; + private final EndpointReferenceBuilder endpointReferenceBuilder; + private final Monitor monitor; public ComponentContextImpl(ExtensionPointRegistry registry, RuntimeComponent component) { this.component = component; @@ -85,6 +96,11 @@ public class ComponentContextImpl implements ComponentContextExt { registry.getExtensionPoint(ContextFactoryExtensionPoint.class).getFactory(RequestContextFactory.class); this.proxyFactory = new ExtensibleProxyFactory(registry.getExtensionPoint(ProxyFactoryExtensionPoint.class)); this.propertyFactory = factories.getFactory(PropertyValueFactory.class); + + this.endpointReferenceBuilder = utilities.getUtility(EndpointReferenceBuilder.class); + + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + this.monitor = monitorFactory.createMonitor(); } public String getURI() { @@ -304,6 +320,7 @@ public class ComponentContextImpl implements ComponentContextExt { InvalidInterfaceException { ComponentReference componentReference = assemblyFactory.createComponentReference(); componentReference.setName("$self$." + service.getName()); + for (Binding binding : service.getBindings()) { if (binding instanceof OptimizableBinding) { OptimizableBinding optimizableBinding = (OptimizableBinding)((OptimizableBinding)binding).clone(); @@ -330,6 +347,26 @@ public class ComponentContextImpl implements ComponentContextExt { componentReference.setInterfaceContract(interfaceContract); componentReference.setMultiplicity(Multiplicity.ONE_ONE); // component.getReferences().add(componentReference); + + // create endpoint reference + EndpointReference2 endpointReference = assemblyFactory + .createEndpointReference(); + endpointReference.setComponent(component); + endpointReference.setReference(componentReference); + endpointReference.setUnresolved(false); + + // create endpoint. + Endpoint2 endpoint = assemblyFactory.createEndpoint(); + endpoint.setComponent(component); + endpoint.setService(service); + endpoint.setUnresolved(true); + endpointReference.setTargetEndpoint(endpoint); + + componentReference.getEndpointReferences().add(endpointReference); + + // do binding matching + endpointReferenceBuilder.build(endpointReference, monitor); + return componentReference; } diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/CallbackReferenceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/CallbackReferenceImpl.java index 79daf537ea..fe2b5a6bde 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/CallbackReferenceImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/CallbackReferenceImpl.java @@ -27,10 +27,13 @@ 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.Contract;
+import org.apache.tuscany.sca.assembly.Endpoint2;
+import org.apache.tuscany.sca.assembly.EndpointReference2;
import org.apache.tuscany.sca.assembly.OptimizableBinding;
import org.apache.tuscany.sca.core.assembly.impl.EndpointReferenceImpl;
import org.apache.tuscany.sca.core.assembly.impl.RuntimeComponentReferenceImpl;
import org.apache.tuscany.sca.core.assembly.impl.RuntimeWireImpl;
+import org.apache.tuscany.sca.core.assembly.impl.RuntimeWireImpl2;
import org.apache.tuscany.sca.core.context.CompositeContext;
import org.apache.tuscany.sca.core.context.impl.CallableReferenceImpl;
import org.apache.tuscany.sca.core.invocation.ProxyFactory;
@@ -149,7 +152,7 @@ public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> { private RuntimeWire cloneAndBind(RuntimeWire wire) {
RuntimeWire boundWire = null;
if (resolvedEndpoint != null) {
- boundWire = ((RuntimeWireImpl)wire).lookupCache(resolvedEndpoint);
+ boundWire = ((RuntimeWireImpl2)wire).lookupCache(resolvedEndpoint);
if (boundWire != null) {
return boundWire;
}
@@ -157,20 +160,27 @@ public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> { Contract contract = resolvedEndpoint.getContract();
RuntimeComponentReference ref = null;
if (contract == null) {
+ //TODO - EPR - does it ever go through here?
boundWire = (RuntimeWire)wire.clone();
} else if (contract instanceof RuntimeComponentReference) {
ref = (RuntimeComponentReference)contract;
- boundWire = ref.getRuntimeWire(resolvedEndpoint.getBinding());
+ //TODO - EPR - get the bound wire based on endpont reference no binding
+ //boundWire = ref.getRuntimeWire(resolvedEndpoint.getBinding());
+ for (RuntimeWire runtimeWire : ref.getRuntimeWires()){
+ if (runtimeWire.getEndpointReference().getBinding().getName().equals(resolvedEndpoint.getBinding().getName())){
+ boundWire = runtimeWire;
+ break;
+ }
+ }
} else { // contract instanceof RuntimeComponentService
ref = bind((RuntimeComponentReference)wire.getSource().getContract(),
- resolvedEndpoint.getComponent(),
- (RuntimeComponentService)contract);
+ resolvedEndpoint);
boundWire = ref.getRuntimeWires().get(0);
}
configureWire(boundWire);
- ((RuntimeWireImpl)wire).addToCache(resolvedEndpoint, boundWire);
+ ((RuntimeWireImpl2)wire).addToCache(resolvedEndpoint, boundWire);
} catch (CloneNotSupportedException e) {
// will not happen
}
@@ -178,9 +188,12 @@ public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> { return boundWire;
}
+ // TODO - EPR - why static & convert to ne endpoint reference
private static RuntimeComponentReference bind(RuntimeComponentReference reference,
- RuntimeComponent component,
- RuntimeComponentService service) throws CloneNotSupportedException {
+ EndpointReference resolvedEndpoint) throws CloneNotSupportedException {
+ RuntimeComponent component = resolvedEndpoint.getComponent();
+ RuntimeComponentService service = (RuntimeComponentService)resolvedEndpoint.getContract();
+
RuntimeComponentReference ref = (RuntimeComponentReference)reference.clone();
ref.getTargets().add(service);
ref.getBindings().clear();
@@ -195,10 +208,28 @@ public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> { ref.getBindings().add(binding);
}
}
+
+ ref.getEndpointReferences().clear();
+
+ for(EndpointReference2 endpointReference : reference.getEndpointReferences()){
+ EndpointReference2 clone = (EndpointReference2)endpointReference.clone();
+
+ clone.setReference(ref);
+ clone.getBinding().setURI(resolvedEndpoint.getURI());
+
+ clone.getTargetEndpoint().setComponent(resolvedEndpoint.getComponent());
+ clone.getTargetEndpoint().setService((ComponentService)resolvedEndpoint.getContract());
+ clone.getTargetEndpoint().setBinding(resolvedEndpoint.getBinding());
+
+ ref.getEndpointReferences().add(clone);
+ }
+
return ref;
}
- private void configureWire(RuntimeWire wire) {
+ private void configureWire(RuntimeWire wire ) {
+
+ // TODO - EPR - do we actiually need this code? Combine with bind?
// need to set the endpoint on the binding also so that when the chains are created next
// the sca binding can decide whether to provide local or remote invokers.
// TODO - there is a problem here though in that I'm setting a target on a
@@ -208,10 +239,12 @@ public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> { Binding binding = wire.getSource().getBinding();
binding.setURI(resolvedEndpoint.getURI());
- // also need to set the target contract as it varies for the sca binding depending on
+ // set the target contract as it varies for the sca binding depending on
// whether it is local or remote
RuntimeComponentReference ref = (RuntimeComponentReference)wire.getSource().getContract();
- wire.getTarget().setInterfaceContract(ref.getBindingProvider(binding).getBindingInterfaceContract());
+
+ // TODO - EPR
+ wire.getEndpointReference().getTargetEndpoint().setInterfaceContract(ref.getBindingProvider(binding).getBindingInterfaceContract());
}
/**
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKCallbackInvocationHandler.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKCallbackInvocationHandler.java index 2d88ed36d9..0a8d40c8db 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKCallbackInvocationHandler.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKCallbackInvocationHandler.java @@ -22,6 +22,7 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.apache.tuscany.sca.core.assembly.impl.RuntimeWireImpl; +import org.apache.tuscany.sca.core.assembly.impl.RuntimeWireImpl2; import org.apache.tuscany.sca.core.context.impl.CallableReferenceImpl; import org.apache.tuscany.sca.core.conversation.ConversationState; import org.apache.tuscany.sca.invocation.InvocationChain; @@ -78,7 +79,7 @@ public class JDKCallbackInvocationHandler extends JDKInvocationHandler { if (convID == null) { convID = ((CallbackReferenceImpl)callableReference).getConvID(); if (convID != null) { - conversation = ((RuntimeWireImpl)wire).getConversationManager().getConversation(convID); + conversation = ((RuntimeWireImpl2)wire).getConversationManager().getConversation(convID); if (callableReference != null) { ((CallableReferenceImpl)callableReference).attachConversation(conversation); } @@ -103,7 +104,7 @@ public class JDKCallbackInvocationHandler extends JDKInvocationHandler { throw e; } finally { // allow the cloned wire to be reused by subsequent callbacks - ((RuntimeWireImpl)wire).releaseWire(); + ((RuntimeWireImpl2)wire).releaseWire(); } } diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java index ff58a116b7..6f3e3514bc 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java @@ -29,6 +29,7 @@ import java.util.Map; import java.util.UUID; import org.apache.tuscany.sca.core.assembly.impl.RuntimeWireImpl; +import org.apache.tuscany.sca.core.assembly.impl.RuntimeWireImpl2; import org.apache.tuscany.sca.core.context.CallableReferenceExt; import org.apache.tuscany.sca.core.context.impl.CallableReferenceImpl; import org.apache.tuscany.sca.core.conversation.ConversationExt; @@ -100,6 +101,7 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable { } protected void init(RuntimeWire wire) { + // TODO - EPR needs fixing when we remove the old EndpointReference if (wire != null) { try { // Clone the endpoint reference so that reference parameters can be changed @@ -387,7 +389,7 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable { return; } - ConversationManager conversationManager = ((RuntimeWireImpl)wire).getConversationManager(); + ConversationManager conversationManager = ((RuntimeWireImpl2)wire).getConversationManager(); if (conversation == null || conversation.getState() == ConversationState.ENDED) { diff --git a/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.assembly.CompositeActivator b/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.assembly.CompositeActivator index d5e13292d2..67f5bede89 100644 --- a/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.assembly.CompositeActivator +++ b/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.assembly.CompositeActivator @@ -15,4 +15,4 @@ # specific language governing permissions and limitations
# under the License.
-org.apache.tuscany.sca.core.assembly.impl.CompositeActivatorImpl
+org.apache.tuscany.sca.core.assembly.impl.CompositeActivatorImpl2
diff --git a/java/sca/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointReferenceBuilderImpl.java b/java/sca/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointReferenceBuilderImpl.java index e99d2cc63c..004b907d78 100644 --- a/java/sca/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointReferenceBuilderImpl.java +++ b/java/sca/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointReferenceBuilderImpl.java @@ -36,6 +36,7 @@ import org.apache.tuscany.sca.assembly.Implementation; import org.apache.tuscany.sca.assembly.Multiplicity; import org.apache.tuscany.sca.assembly.OptimizableBinding; import org.apache.tuscany.sca.assembly.SCABinding; +import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.assembly.builder.CompositeBuilder; import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException; import org.apache.tuscany.sca.assembly.builder.EndpointReferenceBuilder; @@ -243,11 +244,9 @@ public class EndpointReferenceBuilderImpl implements CompositeBuilder, EndpointR // TODO - bring resolution and binding matching together // just do binding matching matchForwardBinding(endpointReference, - endpointReference.getTargetEndpoint().getService(), monitor); matchCallbackBinding(endpointReference, - endpointReference.getTargetEndpoint().getService(), monitor); } else { // resolve the endpoint reference in the domain and then @@ -256,19 +255,19 @@ public class EndpointReferenceBuilderImpl implements CompositeBuilder, EndpointR } } - // TODO - In OASIS case there are no bindings to match with on the - // reference side. This code will be factored out into a pluggable - // piece + // TODO - EPR - In OASIS case there are no bindings to match with on the + // reference side. private void matchForwardBinding(EndpointReference2 endpointReference, - ComponentService service, Monitor monitor) { + + Endpoint2 endpoint = endpointReference.getTargetEndpoint(); List<Binding> matchedReferenceBinding = new ArrayList<Binding>(); List<Endpoint2> matchedServiceEndpoint = new ArrayList<Endpoint2>(); // Find the corresponding bindings from the service side for (Binding referenceBinding : endpointReference.getReference().getBindings()) { - for (Endpoint2 serviceEndpoint : service.getEndpoints()) { + for (Endpoint2 serviceEndpoint : endpoint.getService().getEndpoints()) { if (referenceBinding.getClass() == serviceEndpoint.getBinding().getClass() && hasCompatiblePolicySets(referenceBinding, serviceEndpoint.getBinding())) { @@ -287,7 +286,7 @@ public class EndpointReferenceBuilderImpl implements CompositeBuilder, EndpointR "NoMatchingBinding", endpointReference.getReference(), endpointReference.getReference().getName(), - service.getName()); + endpoint.getService().getName()); return; } else { // default to using the first matched binding @@ -314,7 +313,7 @@ public class EndpointReferenceBuilderImpl implements CompositeBuilder, EndpointR cloned.setURI(serviceEndpoint.getBinding().getURI()); } - // TODO - can we remove this? + // TODO - EPR can we remove this? if (cloned instanceof OptimizableBinding) { OptimizableBinding optimizableBinding = (OptimizableBinding)cloned; optimizableBinding.setTargetComponent(serviceEndpoint.getComponent()); @@ -322,7 +321,7 @@ public class EndpointReferenceBuilderImpl implements CompositeBuilder, EndpointR optimizableBinding.setTargetBinding(serviceEndpoint.getBinding()); } - endpointReference.setBinding(referenceBinding); + endpointReference.setBinding(cloned); endpointReference.setTargetEndpoint(serviceEndpoint); } catch (Exception ex) { @@ -331,68 +330,61 @@ public class EndpointReferenceBuilderImpl implements CompositeBuilder, EndpointR } } - // TODO - // Pretty much a duplicate of matchForwardBinding to handle callback bindings - // will rationalize when I understand what we need to do with callbacks + // TODO - EPR + // Find the callback endpoint for the endpoint reference by matching + // callback bindings between reference and service private void matchCallbackBinding(EndpointReference2 endpointReference, - ComponentService service, Monitor monitor) { - // if no callback on the interface do nothing + // if no callback on the interface or we are creating a self reference do nothing if (endpointReference.getReference().getInterfaceContract() == null || - endpointReference.getReference().getInterfaceContract().getCallbackInterface() == null){ + endpointReference.getReference().getInterfaceContract().getCallbackInterface() == null || + endpointReference.getReference().getName().startsWith("$self$.")){ return; } - List<Binding> matchedReferenceBinding = new ArrayList<Binding>(); - List<Binding> matchedServiceBinding = new ArrayList<Binding>(); + Endpoint2 endpoint = endpointReference.getTargetEndpoint(); - // Find the corresponding bindings from the service side - for (Binding referenceBinding : endpointReference.getReference().getCallback().getBindings()) { - for (Binding serviceBinding : service.getCallback().getBindings()) { - - if (referenceBinding.getClass() == serviceBinding.getClass() && - hasCompatiblePolicySets(referenceBinding, serviceBinding)) { - - matchedReferenceBinding.add(referenceBinding); - matchedServiceBinding.add(serviceBinding); + List<Endpoint2> callbackEndpoints = endpointReference.getReference().getCallbackService().getEndpoints(); + List<EndpointReference2> callbackEndpointReferences = endpoint.getCallbackEndpointReferences(); + + List<Endpoint2> matchedEndpoint = new ArrayList<Endpoint2>(); + + if ((callbackEndpoints != null) && (callbackEndpointReferences != null)){ + // Find the corresponding bindings from the service side + for (EndpointReference2 epr : callbackEndpointReferences) { + for (Endpoint2 ep : callbackEndpoints) { + + if (epr.getBinding().getClass() == ep.getBinding().getClass() && + hasCompatiblePolicySets(epr.getBinding(), ep.getBinding())) { + + matchedEndpoint.add(ep); + } } } } - if (matchedReferenceBinding.isEmpty()) { + if (matchedEndpoint.isEmpty()) { // No matching binding endpointReference.setCallbackEndpoint(null); warning(monitor, "NoMatchingCallbackBinding", endpointReference.getReference(), endpointReference.getReference().getName(), - service.getName()); + endpoint.getService().getName()); return; } else { // default to using the first matched binding - int selectedBinding = 0; + int selectedEndpoint = 0; - for (int i = 0; i < matchedReferenceBinding.size(); i++){ + for (int i = 0; i < matchedEndpoint.size(); i++){ // If binding.sca is present, use it - if (SCABinding.class.isInstance(matchedReferenceBinding.get(i))) { - selectedBinding = i; + if (SCABinding.class.isInstance(matchedEndpoint.get(i).getBinding())) { + selectedEndpoint = i; } } - Binding selectedCallbackBinding = matchedReferenceBinding.get(selectedBinding); - - ComponentService callbackService = endpointReference.getReference().getCallbackService(); - - if (callbackService != null) { - // find the callback endpoint that has the selected binding - for (Endpoint2 endpoint : callbackService.getEndpoints()){ - if (endpoint.getBinding().getName().startsWith(selectedCallbackBinding.getName())){ - endpointReference.setCallbackEndpoint(endpoint); - break; - } - } - } + endpointReference.setCallbackEndpoint(matchedEndpoint.get(selectedEndpoint)); } } @@ -416,326 +408,4 @@ public class EndpointReferenceBuilderImpl implements CompositeBuilder, EndpointR } return isCompatible; } - - public void createEndpointReferences(Composite composite, - Component component, - ComponentReference reference, - Map<String, Component> components, - Map<String, ComponentService> componentServices, - Monitor monitor) { - - if (reference.getAutowire() == Boolean.TRUE - && reference.getTargets().isEmpty()) { - - // Find suitable targets in the current composite for an - // autowired reference - Multiplicity multiplicity = reference.getMultiplicity(); - for (Component targetComponent : composite.getComponents()) { - - // prevent autowire connecting to self - boolean skipSelf = false; - for (ComponentReference targetComponentReference : targetComponent - .getReferences()) { - if (reference == targetComponentReference) { - skipSelf = true; - } - } - - if (!skipSelf) { - for (ComponentService targetComponentService : targetComponent - .getServices()) { - if (reference.getInterfaceContract() == null - || interfaceContractMapper.isCompatible( - reference.getInterfaceContract(), - targetComponentService - .getInterfaceContract())) { - // create endpoint reference - EndpointReference2 endpointRef = assemblyFactory - .createEndpointReference(); - endpointRef.setComponent(component); - endpointRef.setReference(reference); - endpointRef.setTargetName(targetComponentService - .getName()); - endpointRef.setUnresolved(false); - - // create dummy endpoint. This will be replaced when - // policies - // are matched and bindings are configured later - Endpoint2 endpoint = assemblyFactory - .createEndpoint(); - endpoint.setComponent(targetComponent); - endpoint.setService(targetComponentService); - endpoint.setUnresolved(true); - endpointRef.setTargetEndpoint(endpoint); - - reference.getEndpointReferences().add(endpointRef); - - if (multiplicity == Multiplicity.ZERO_ONE - || multiplicity == Multiplicity.ONE_ONE) { - break; - } - } - } - } - } - - if (multiplicity == Multiplicity.ONE_N - || multiplicity == Multiplicity.ONE_ONE) { - if (reference.getEndpointReferences().size() == 0) { - warning(monitor, "NoComponentReferenceTarget", reference, - reference.getName()); - } - } - - } else if (!reference.getTargets().isEmpty()) { - - // Check that the component reference does not mix the use of - // endpoint references specified via the target attribute with - // the presence of binding elements - if (reference.getBindings().size() > 0) { - warning(monitor, "ReferenceEndPointMixWithTarget", composite, - reference.getName()); - } - - // Resolve targets specified on the component reference - for (ComponentService target : reference.getTargets()) { - - String targetName = target.getName(); - ComponentService targetComponentService = componentServices - .get(targetName); - - Component targetComponent; - int s = targetName.indexOf('/'); - if (s == -1) { - targetComponent = components.get(targetName); - } else { - targetComponent = components - .get(targetName.substring(0, s)); - } - - if (targetComponentService != null) { - - // Check that the target component service provides - // a superset of the component reference interface - if (reference.getInterfaceContract() == null - || interfaceContractMapper.isCompatible(reference - .getInterfaceContract(), - targetComponentService - .getInterfaceContract())) { - - // create endpoint reference - EndpointReference2 endpointRef = assemblyFactory - .createEndpointReference(); - endpointRef.setComponent(component); - endpointRef.setReference(reference); - endpointRef.setTargetName(targetComponentService - .getName()); - endpointRef.setUnresolved(false); - - // create dummy endpoint. This will be replaced when - // policies - // are matched and bindings are configured later - Endpoint2 endpoint = assemblyFactory.createEndpoint(); - endpoint.setComponent(targetComponent); - endpoint.setService(targetComponentService); - endpoint.setUnresolved(true); - endpointRef.setTargetEndpoint(endpoint); - - reference.getEndpointReferences().add(endpointRef); - } else { - warning(monitor, "ReferenceIncompatibleInterface", - composite, composite.getName().toString(), - reference.getName(), targetName); - } - } else { - // add an unresolved endpoint reference - EndpointReference2 endpointRef = assemblyFactory - .createEndpointReference(); - endpointRef.setComponent(component); - endpointRef.setReference(reference); - endpointRef.setTargetName(targetName); - endpointRef.setUnresolved(true); - - // create an unresolved endpoint to go with it - Endpoint2 endpoint = assemblyFactory.createEndpoint(); - endpoint.setUnresolved(true); - endpointRef.setTargetEndpoint(endpoint); - - warning(monitor, "ComponentReferenceTargetNotFound", - composite, composite.getName().toString(), - targetName); - } - } - } else if ((reference.getReference() != null) - && (!reference.getReference().getTargets().isEmpty())) { - - // Resolve targets from the corresponding reference in the - // componentType - for (ComponentService target : reference.getReference() - .getTargets()) { - - String targetName = target.getName(); - ComponentService targetComponentService = componentServices - .get(targetName); - - Component targetComponent; - int s = targetName.indexOf('/'); - if (s == -1) { - targetComponent = components.get(targetName); - } else { - targetComponent = components - .get(targetName.substring(0, s)); - } - - if (targetComponentService != null) { - - // Check that the target component service provides - // a superset of the component reference interface - if (reference.getInterfaceContract() == null - || interfaceContractMapper.isCompatible(reference - .getInterfaceContract(), - targetComponentService - .getInterfaceContract())) { - - // create endpoint reference - EndpointReference2 endpointRef = assemblyFactory - .createEndpointReference(); - endpointRef.setComponent(component); - endpointRef.setReference(reference); - endpointRef.setTargetName(targetComponentService - .getName()); - endpointRef.setUnresolved(false); - - // create dummy endpoint. This will be replaced when - // policies - // are matched and bindings are configured later - Endpoint2 endpoint = assemblyFactory.createEndpoint(); - endpoint.setComponent(targetComponent); - endpoint.setService(targetComponentService); - endpoint.setUnresolved(true); - endpointRef.setTargetEndpoint(endpoint); - - reference.getEndpointReferences().add(endpointRef); - } else { - warning(monitor, "ReferenceIncompatibleInterface", - composite, composite.getName().toString(), - reference.getName(), targetName); - } - } else { - // add an unresolved endpoint reference - EndpointReference2 endpointRef = assemblyFactory - .createEndpointReference(); - endpointRef.setComponent(component); - endpointRef.setReference(reference); - endpointRef.setTargetName(targetName); - endpointRef.setUnresolved(true); - - // create an unresolved endpoint to go with it - Endpoint2 endpoint = assemblyFactory.createEndpoint(); - endpoint.setUnresolved(true); - endpointRef.setTargetEndpoint(endpoint); - - warning(monitor, "ComponentReferenceTargetNotFound", - composite, composite.getName().toString(), - targetName); - } - } - } - - // if no endpoints have found so far the bindings become targets. - if (reference.getEndpointReferences().isEmpty()) { - for (Binding binding : reference.getBindings()) { - - String uri = binding.getURI(); - - // user hasn't put a uri on the binding so it's not a target - // name - if (uri == null) { - continue; - } - - // user might have put a local target name in the uri - // see if it refers to a target we know about - // - if it does the reference binding will be matched with a - // service binding - // - if it doesn't it is assumed to be an external reference - Component targetComponent = null; - ComponentService targetComponentService = null; - - if (uri.startsWith("/")) { - uri = uri.substring(1); - } - - // Resolve the target component and service - targetComponentService = componentServices.get(uri); - int s = uri.indexOf('/'); - if (s == -1) { - targetComponent = components.get(uri); - } else { - targetComponent = components.get(uri.substring(0, s)); - } - - // if the binding URI matches a component in the - // composite then configure an endpoint reference with this - // component as - // the target. If not then the binding URI will be assumed to - // reference an - // external service - if (targetComponentService != null) { - - // Check that the target component service provides - // a superset of the component reference interface - if (reference.getInterfaceContract() == null - || interfaceContractMapper.isCompatible(reference - .getInterfaceContract(), - targetComponentService - .getInterfaceContract())) { - // create enpoint reference - EndpointReference2 endpointRef = assemblyFactory - .createEndpointReference(); - endpointRef.setComponent(component); - endpointRef.setReference(reference); - endpointRef.setBinding(binding); - endpointRef.setTargetName(targetComponentService - .getName()); - endpointRef.setUnresolved(false); - - // create dummy endpoint. This will be replaced when - // policies - // are matched and bindings are configured later - Endpoint2 endpoint = assemblyFactory.createEndpoint(); - endpoint.setComponent(targetComponent); - endpoint.setService(targetComponentService); - endpoint.setUnresolved(true); - endpointRef.setTargetEndpoint(endpoint); - - reference.getEndpointReferences().add(endpointRef); - } else { - warning(monitor, "ReferenceIncompatibleInterface", - composite, composite.getName().toString(), - reference.getName(), uri); - } - } else { - // create endpoint reference for manually configured - // bindings - EndpointReference2 endpointRef = assemblyFactory - .createEndpointReference(); - endpointRef.setComponent(component); - endpointRef.setReference(reference); - endpointRef.setBinding(binding); - endpointRef.setTargetName(null); - endpointRef.setTargetEndpoint(null); - endpointRef.setUnresolved(false); - - // create a resolved endpoint to signify that this - // reference is pointing at some unwired endpoint - Endpoint2 endpoint = assemblyFactory.createEndpoint(); - endpoint.setUnresolved(false); - endpointRef.setTargetEndpoint(endpoint); - - reference.getEndpointReferences().add(endpointRef); - } - } - } -} } diff --git a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java index 1f9e085590..f841f96e75 100644 --- a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java +++ b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java @@ -124,6 +124,7 @@ public class NodeImpl implements Node, Client { private XMLInputFactory inputFactory; private ContributionBuilder contributionDependencyBuilder; private CompositeBuilder compositeBuilder; + private CompositeBuilder endpointReferenceBuilder; private StAXArtifactProcessorExtensionPoint xmlProcessors; private StAXArtifactProcessor<Composite> compositeProcessor; private ProxyFactory proxyFactory; @@ -358,6 +359,10 @@ public class NodeImpl implements Node, Client { CompositeBuilderExtensionPoint compositeBuilders = extensionPoints.getExtensionPoint(CompositeBuilderExtensionPoint.class); compositeBuilder = compositeBuilders.getCompositeBuilder("org.apache.tuscany.sca.assembly.builder.CompositeBuilder"); + // Get endpoint builders + // TODO - new extension point? + endpointReferenceBuilder = compositeBuilders.getCompositeBuilder("org.apache.tuscany.sca.endpoint.impl.EndpointReferenceBuilderImpl"); + // Initialize runtime // Get proxy factory @@ -549,6 +554,10 @@ public class NodeImpl implements Node, Client { compositeBuilder.build(composite, systemDefinitions, monitor); analyzeProblems(); + // build the endpoint references + endpointReferenceBuilder.build(composite, systemDefinitions, monitor); + analyzeProblems(); + // Create a top level composite to host our composite // This is temporary to make the activator happy Composite tempComposite = assemblyFactory.createComposite(); @@ -673,9 +682,10 @@ public class NodeImpl implements Node, Client { if (serviceName == null || serviceName.equals(componentService.getName())) { CompositeService compositeService = (CompositeService)componentService.getService(); if (compositeService != null) { - if (serviceName != null) { - serviceName = "$promoted$" + component.getName() + "$slash$" + serviceName; - } + // TODO - EPR - $promoted$ no longer used + //if (serviceName != null) { + // serviceName = "$promoted$" + component.getName() + "$slash$" + serviceName; + //} componentContext = ((RuntimeComponent)compositeService.getPromotedComponent()).getComponentContext(); return componentContext.createSelfReference(businessInterface, compositeService |