From dcbff0df93448ef786c2e5cb0320f3895759171b Mon Sep 17 00:00:00 2001 From: slaws Date: Thu, 19 Mar 2009 16:12:22 +0000 Subject: 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 --- .../org/apache/tuscany/sca/assembly/Endpoint2.java | 17 + .../assembly/builder/EndpointReferenceBuilder.java | 17 - .../sca/assembly/builder/impl/BaseBuilderImpl.java | 1 + .../impl/ComponentConfigurationBuilderImpl.java | 2 +- ...onentReferenceEndpointReferenceBuilderImpl.java | 435 +++++++++++++++++++++ .../ComponentReferencePromotionBuilderImpl.java | 171 ++++++++ ...ComponentReferencePromotionWireBuilderImpl.java | 7 +- .../impl/ComponentReferenceWireBuilderImpl.java | 8 +- .../impl/ComponentServiceEndpointBuilderImpl.java | 153 ++++++++ .../builder/impl/CompositeBuilderImpl.java | 91 +++-- ...CompositeReferenceConfigurationBuilderImpl.java | 1 + ...ositeReferenceEndpointReferenceBuilderImpl.java | 418 -------------------- .../CompositeServiceConfigurationBuilderImpl.java | 1 + .../impl/CompositeServiceEndpointBuilderImpl.java | 124 ------ .../builder/impl/ReferenceConfigurationUtil.java | 76 +--- .../tuscany/sca/assembly/impl/Endpoint2Impl.java | 24 +- .../sca/assembly/impl/EndpointReference2Impl.java | 8 +- .../tuscany/sca/assembly/impl/ReferenceImpl.java | 2 + 18 files changed, 882 insertions(+), 674 deletions(-) create mode 100644 java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java create mode 100644 java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionBuilderImpl.java create mode 100644 java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceEndpointBuilderImpl.java delete mode 100644 java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceEndpointReferenceBuilderImpl.java delete mode 100644 java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceEndpointBuilderImpl.java (limited to 'java/sca/modules/assembly/src') 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 getCallbackEndpointReferences(); + + /** + * Set the reference callback endpoint refefences + * + * @param callbackEndpoint the reference callback endpoint + */ + void setCallbackEndpointReferences(List 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 @@ -38,23 +38,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 components, - Map 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/ComponentReferenceEndpointReferenceBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java new file mode 100644 index 0000000000..1c60428afa --- /dev/null +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java @@ -0,0 +1,435 @@ +/* + * 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.net.URI; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.sca.assembly.AssemblyFactory; +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.Component; +import org.apache.tuscany.sca.assembly.ComponentReference; +import org.apache.tuscany.sca.assembly.ComponentService; +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.assembly.CompositeReference; +import org.apache.tuscany.sca.assembly.Endpoint; +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.Multiplicity; +import org.apache.tuscany.sca.assembly.OptimizableBinding; +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.assembly.builder.DefaultEndpointBuilder; +import org.apache.tuscany.sca.definitions.Definitions; +import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.policy.PolicySet; +import org.apache.tuscany.sca.policy.PolicySubject; + +/** + * A composite builder that creates endpoint reference models. + * + * @version $Rev$ $Date$ + */ +public class ComponentReferenceEndpointReferenceBuilderImpl extends BaseBuilderImpl implements CompositeBuilder { + + + public ComponentReferenceEndpointReferenceBuilderImpl(AssemblyFactory assemblyFactory, InterfaceContractMapper interfaceContractMapper) { + super(assemblyFactory, null, null, null, interfaceContractMapper); + } + + public String getID() { + return "org.apache.tuscany.sca.assembly.builder.ComponentReferenceEndpointReferenceBuilder"; + } + + /** + * Create endpoint references for all component references. + * + * @param composite + */ + public void build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException + { + // process top level composite references + // TODO - I don't think OASIS allows for these + // + //processCompositeReferences(composite); + + // process component services + processComponentReferences(composite, monitor); + } + + private void processCompositeReferences(Composite composite) { + // TODO do we need this for OASIS? + } + + private void processComponentReferences(Composite composite, Monitor monitor) { + + // index all of the components in the composite + Map components = new HashMap(); + indexComponents(composite, components); + + // index all of the services in the composite + Map componentServices = new HashMap(); + indexServices(composite, componentServices); + + // create endpoint references for each component's references + for (Component component : composite.getComponents()) { + // recurse for composite implementations + Implementation implementation = component.getImplementation(); + if (implementation instanceof Composite) { + processComponentReferences((Composite)implementation, monitor); + } + + // create endpoint references to represent the component reference + for (ComponentReference reference : component.getReferences()) { + createReferenceEndpointReferences(composite, component, reference, components, componentServices, monitor); + } + } + } + + private void createReferenceEndpointReferences(Composite composite, + Component component, + ComponentReference reference, + Map components, + Map 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) { + // 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; + } + + // 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/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 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 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/ComponentServiceEndpointBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceEndpointBuilderImpl.java new file mode 100644 index 0000000000..1205bfeef4 --- /dev/null +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceEndpointBuilderImpl.java @@ -0,0 +1,153 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.sca.assembly.builder.impl; + +import java.util.List; + +import org.apache.tuscany.sca.assembly.AssemblyFactory; +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.Component; +import org.apache.tuscany.sca.assembly.ComponentReference; +import org.apache.tuscany.sca.assembly.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.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; +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.definitions.Definitions; +import org.apache.tuscany.sca.monitor.Monitor; + +/** + * A composite builder that creates endpoint models for component services. + * + * @version $Rev$ $Date$ + */ +public class ComponentServiceEndpointBuilderImpl implements CompositeBuilder { + private AssemblyFactory assemblyFactory; + + public ComponentServiceEndpointBuilderImpl(AssemblyFactory assemblyFactory) { + this.assemblyFactory = assemblyFactory; + } + + public String getID() { + return "org.apache.tuscany.sca.assembly.builder.ComponentReferenceEndpointReferenceBuilder"; + } + + /** + * Create endpoint models for all component services. + * + * @param composite + */ + public void build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException { + + // process top level composite services + // TODO - I don't think OASIS spec doesn't allows composite references in the domain composite + // + // processCompositeServices(composite); + + // process component services + processComponentServices(composite); + + } + + private void processCompositeServices(Composite composite) { + // top level services are treated slightly differently + // as no component will use these top level services + // as part of its component type. In this case we push down + // the service configuration to create a new endpoint on the + // component from which the service is promoted + for (Service service : composite.getServices()) { + + Component promotedComponent = ((CompositeService)service).getPromotedComponent(); + ComponentService promotedService = ((CompositeService)service).getPromotedService(); + + if (promotedService != null) { + for (Binding binding : service.getBindings()){ + Endpoint2 endpoint = assemblyFactory.createEndpoint(); + endpoint.setComponent(promotedComponent); + endpoint.setService(promotedService); + endpoint.setBinding(binding); + endpoint.setUnresolved(false); + promotedService.getEndpoints().add(endpoint); + } + } + } + } + + private void processComponentServices(Composite composite) { + + for (Component component : composite.getComponents()) { + + // recurse for composite implementations + Implementation implementation = component.getImplementation(); + if (implementation instanceof Composite) { + processComponentServices((Composite)implementation); + } + + // 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 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(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/CompositeReferenceEndpointReferenceBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceEndpointReferenceBuilderImpl.java deleted file mode 100644 index 5de60c114d..0000000000 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceEndpointReferenceBuilderImpl.java +++ /dev/null @@ -1,418 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.builder.impl; - -import java.net.URI; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.ComponentReference; -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.CompositeReference; -import org.apache.tuscany.sca.assembly.Endpoint; -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.Multiplicity; -import org.apache.tuscany.sca.assembly.OptimizableBinding; -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.assembly.builder.DefaultEndpointBuilder; -import org.apache.tuscany.sca.definitions.Definitions; -import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; -import org.apache.tuscany.sca.monitor.Monitor; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySubject; - -/** - * A composite builder that creates endpoint reference models. - * - * @version $Rev$ $Date$ - */ -public class CompositeReferenceEndpointReferenceBuilderImpl extends BaseBuilderImpl implements CompositeBuilder { - - - public CompositeReferenceEndpointReferenceBuilderImpl(AssemblyFactory assemblyFactory, InterfaceContractMapper interfaceContractMapper) { - super(assemblyFactory, null, null, null, interfaceContractMapper); - } - - public String getID() { - return "org.apache.tuscany.sca.assembly.builder.ComponentReferenceEndpointReferenceBuilder"; - } - - /** - * Create endpoint references for all component references. - * - * @param composite - */ - public void build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException - { - // process top level composite references - // TODO - I don't think OASIS allows for these - // - //processCompositeReferences(composite); - - // process component services - processComponentReferences(composite, monitor); - } - - private void processCompositeReferences(Composite composite) { - // TODO do we need this for OASIS? - } - - private void processComponentReferences(Composite composite, Monitor monitor) { - - // index all of the components in the composite - Map components = new HashMap(); - indexComponents(composite, components); - - // index all of the services in the composite - Map componentServices = new HashMap(); - indexServices(composite, componentServices); - - // create endpoint references for each component's references - for (Component component : composite.getComponents()) { - // recurse for composite implementations - Implementation implementation = component.getImplementation(); - if (implementation instanceof Composite) { - processComponentReferences((Composite)implementation, monitor); - } - - // create endpoint references to represent the component reference - for (ComponentReference reference : component.getReferences()) { - createReferenceEndpointReferences(composite, component, reference, components, componentServices, monitor); - } - } - } - - private void createReferenceEndpointReferences(Composite composite, - Component component, - ComponentReference reference, - Map components, - Map 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/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/CompositeServiceEndpointBuilderImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceEndpointBuilderImpl.java deleted file mode 100644 index a933fd6991..0000000000 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceEndpointBuilderImpl.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.builder.impl; - -import java.util.List; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.ComponentReference; -import org.apache.tuscany.sca.assembly.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.Endpoint2; -import org.apache.tuscany.sca.assembly.EndpointFactory; -import org.apache.tuscany.sca.assembly.Implementation; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.SCABinding; -import org.apache.tuscany.sca.assembly.Service; -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 creates endpoint models for component services. - * - * @version $Rev$ $Date$ - */ -public class CompositeServiceEndpointBuilderImpl implements CompositeBuilder { - private AssemblyFactory assemblyFactory; - - public CompositeServiceEndpointBuilderImpl(AssemblyFactory assemblyFactory) { - this.assemblyFactory = assemblyFactory; - } - - public String getID() { - return "org.apache.tuscany.sca.assembly.builder.ComponentReferenceEndpointReferenceBuilder"; - } - - /** - * Create endpoint models for all component services. - * - * @param composite - */ - public void build(Composite composite, Definitions definitions, Monitor monitor) throws CompositeBuilderException { - - // process top level composite services - // TODO - I don't think OASIS spec doesn't allows composite references in the domain composite - // - // processCompositeServices(composite); - - // process component services - processComponentServices(composite); - - } - - private void processCompositeServices(Composite composite) { - // top level services are treated slightly differently - // as no component will use these top level services - // as part of its component type. In this case we push down - // the service configuration to create a new endpoint on the - // component from which the service is promoted - for (Service service : composite.getServices()) { - - Component promotedComponent = ((CompositeService)service).getPromotedComponent(); - ComponentService promotedService = ((CompositeService)service).getPromotedService(); - - if (promotedService != null) { - for (Binding binding : service.getBindings()){ - Endpoint2 endpoint = assemblyFactory.createEndpoint(); - endpoint.setComponent(promotedComponent); - endpoint.setService(promotedService); - endpoint.setBinding(binding); - endpoint.setUnresolved(false); - promotedService.getEndpoints().add(endpoint); - } - } - } - } - - private void processComponentServices(Composite composite) { - - for (Component component : composite.getComponents()) { - - // recurse for composite implementations - Implementation implementation = component.getImplementation(); - if (implementation instanceof Composite) { - processComponentServices((Composite)implementation); - } - - // create an endpoint for each component service binding - for (ComponentService service : component.getServices()) { - for (Binding binding : service.getBindings()){ - Endpoint2 endpoint = assemblyFactory.createEndpoint(); - endpoint.setComponent(component); - endpoint.setService(service); - endpoint.setBinding(binding); - endpoint.setUnresolved(false); - service.getEndpoints().add(endpoint); - } - } - } - } - -} 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 bindingsToCopyDown = new ArrayList(); - List endpointsToCopyDown = new ArrayList(); - - 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 callbackBindings = new HashSet(); 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 callbackEndpointReferences; //private String uri; private List policySets = new ArrayList(); private List requiredIntents = new ArrayList(); @@ -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 getCallbackEndpointReferences(){ + return callbackEndpointReferences; + } + + /** + * Set the reference callback endpoint refefences + * + * @param callbackEndpoint the reference callback endpoint + */ + public void setCallbackEndpointReferences(List 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(); clone.targets.addAll(getTargets()); + clone.endpointReferences = new ArrayList(); + clone.endpointReferences.addAll(getEndpointReferences()); return clone; } -- cgit v1.2.3