You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by ant elder <an...@gmail.com> on 2007/08/15 10:27:27 UTC
Re: svn commit: r566036 - in /incubator/tuscany/java/sca: modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ modules/assembly/src/main/java/org/apache/tuscan
How come binding.ajax was left out of this change?
...ant
On 8/15/07, jsdelfino@apache.org <js...@apache.org> wrote:
>
> Author: jsdelfino
> Date: Tue Aug 14 23:16:47 2007
> New Revision: 566036
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=566036
> Log:
> Initialize service binding URI to componentURI/bindingName if no URI is
> specified on a binding. Binding extensions do not need to implement the
> logic to determine the default binding URI anymore (except for any binding
> specific logic, including use of a specific protocol scheme), they can
> simply call binding.getURI() to get that URI. Also cleaned up up
> SCABinding as SCABinding.get/setComponent are not needed anymore.
>
> Modified:
>
> incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
>
> incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java
>
> incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java
>
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java
>
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java
>
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingUtil.java
>
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
>
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java
>
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java
>
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java
>
> incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomServiceBindingProvider.java
>
> incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSServiceBindingProvider.java
>
> incubator/tuscany/java/sca/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCService.java
>
> incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java
>
> incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java
>
> incubator/tuscany/java/sca/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java
>
> incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceProvider.java
>
> incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDL.composite
>
> incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanReferenceImpl.java
>
> incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java
>
> incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java
>
> incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/binding/resource/provider/HTTPResourceServiceBindingProvider.java
>
> incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java
>
> incubator/tuscany/java/sca/samples/binding-echo2-extension/src/main/java/echo2/extension/EchoServiceBindingProvider.java
>
> Modified:
> incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
> (original)
> +++
> incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
> Tue Aug 14 23:16:47 2007
> @@ -149,11 +149,28 @@
> compositeService =
> assemblyFactory.createCompositeService();
> contract = compositeService;
> compositeService.setName(getString(reader,
> NAME));
> +
> + String promoted = getString(reader,
> PROMOTE);
> + String promotedComponentName;
> + String promotedServiceName;
> + int s = promoted.indexOf('/');
> + if (s == -1) {
> + promotedComponentName = promoted;
> + promotedServiceName = null;
> + } else {
> + promotedComponentName =
> promoted.substring(0, s);
> + promotedServiceName =
> promoted.substring(s+1);
> + }
>
> - ComponentService promoted =
> assemblyFactory.createComponentService();
> - promoted.setUnresolved(true);
> - promoted.setName(getString(reader,
> PROMOTE));
> - compositeService.setPromotedService
> (promoted);
> + Component promotedComponent =
> assemblyFactory.createComponent();
> + promotedComponent.setUnresolved(true);
> + promotedComponent.setName
> (promotedComponentName);
> + compositeService.setPromotedComponent
> (promotedComponent);
> +
> + ComponentService promotedService =
> assemblyFactory.createComponentService();
> + promotedService.setUnresolved(true);
> + promotedService.setName
> (promotedServiceName);
> + compositeService.setPromotedService
> (promotedService);
>
> composite.getServices
> ().add(compositeService);
> readPolicies(contract, reader);
> @@ -178,7 +195,15 @@
> compositeReference.setName(getString(reader,
> NAME));
> readMultiplicity(compositeReference,
> reader);
> readTargets(compositeReference, reader);
> - readPromotes(compositeReference, reader);
> + String promote = reader.getAttributeValue(null,
> Constants.PROMOTE);
> + if (promote != null) {
> + for (StringTokenizer tokens = new
> StringTokenizer(promote); tokens.hasMoreTokens();) {
> + ComponentReference
> promotedReference = assemblyFactory.createComponentReference();
> + promotedReference.setUnresolved
> (true);
> + promotedReference.setName(
> tokens.nextToken());
> +
> compositeReference.getPromotedReferences().add(promotedReference);
> + }
> + }
> compositeReference.setWiredByImpl(getBoolean(reader,
> WIRED_BY_IMPL));
> composite.getReferences
> ().add(compositeReference);
> readPolicies(contract, reader);
> @@ -349,8 +374,18 @@
>
> for (Service service : composite.getServices()) {
> CompositeService compositeService =
> (CompositeService)service;
> + Component promotedComponent =
> compositeService.getPromotedComponent();
> ComponentService promotedService =
> compositeService.getPromotedService();
> - String promote = promotedService != null ?
> promotedService.getName() : null;
> + String promote;
> + if (promotedService != null) {
> + if (promotedService.getName() != null) {
> + promote = promotedComponent.getName() + '/' +
> promotedService.getService();
> + } else {
> + promote = promotedComponent.getName();
> + }
> + } else {
> + promote = null;
> + }
> writeStart(writer, SERVICE, new XAttr(NAME,
> service.getName()), new XAttr(PROMOTE, promote));
>
> extensionProcessor.write(service.getInterfaceContract(),
> writer);
> @@ -607,23 +642,5 @@
>
> public Class<Composite> getModelType() {
> return Composite.class;
> - }
> -
> - /**
> - * Read list of refence targets
> - * @param reference
> - * @param reader
> - */
> - protected void readPromotes(CompositeReference reference,
> XMLStreamReader reader) {
> - String value = reader.getAttributeValue(null, Constants.PROMOTE);
> - ComponentReference promoted = null;
> - if (value != null) {
> - for (StringTokenizer tokens = new StringTokenizer(value);
> tokens.hasMoreTokens();) {
> - promoted = assemblyFactory.createComponentReference();
> - promoted.setUnresolved(true);
> - promoted.setName(tokens.nextToken());
> - reference.getPromotedReferences().add(promoted);
> - }
> - }
> }
> }
>
> Modified:
> incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java
> (original)
> +++
> incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java
> Tue Aug 14 23:16:47 2007
> @@ -95,7 +95,7 @@
> assertEquals(calcCompositeService.getName(),
> "CalculatorService");
> assertTrue(calcCompositeService.getPromotedService
> ().isUnresolved());
> assertEquals(calcCompositeService.getPromotedService().getName(),
> - "CalculatorServiceComponent/CalculatorService");
> + "CalculatorService");
> assertEquals(calcCompositeService.getRequiredIntents
> ().get(0).getName(),
> new QName("http://test", "confidentiality"));
> assertEquals(calcCompositeService.getPolicySets().get(0).getName(),
> new QName("http://test", "SecureReliablePolicy"));
>
> Modified:
> incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java
> (original)
> +++
> incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java
> Tue Aug 14 23:16:47 2007
> @@ -41,8 +41,6 @@
> private List<Intent> requiredIntents = new ArrayList<Intent>();
> private List<Object> extensions = new ArrayList<Object>();
>
> - private Component component;
> -
> private Component targetComponent;
> private ComponentService targetComponentService;
> private Binding targetBinding;
> @@ -65,14 +63,6 @@
> protected TestSCABindingImpl() {
> }
>
> - public Component getComponent() {
> - return component;
> - }
> -
> - public void setComponent(Component component) {
> - this.component = component;
> - }
> -
> public String getName() {
> return name;
> }
>
> Modified:
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java
> (original)
> +++
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java
> Tue Aug 14 23:16:47 2007
> @@ -26,6 +26,20 @@
> public interface CompositeService extends Service {
>
> /**
> + * Returns the promoted component.
> + *
> + * @return the promoted component.
> + */
> + Component getPromotedComponent();
> +
> + /**
> + * Sets the promoted component
> + *
> + * @param promotedComponent the promoted component.
> + */
> + void setPromotedComponent(Component promotedComponent);
> +
> + /**
> * Returns the promoted component service .
> *
> * @return the promoted component service.
>
> Modified:
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java
> (original)
> +++
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java
> Tue Aug 14 23:16:47 2007
> @@ -24,16 +24,4 @@
> * @version $Rev$ $Date$
> */
> public interface SCABinding extends Binding {
> - /**
> - * This is a hack to navigate to the containing component
> - * @return
> - */
> - @Deprecated
> - Component getComponent();
> - /**
> - * This is a hack to set the containing component
> - * @param component
> - */
> - @Deprecated
> - void setComponent(Component component);
> }
>
> Modified:
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingUtil.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingUtil.java?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingUtil.java
> (original)
> +++
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingUtil.java
> Tue Aug 14 23:16:47 2007
> @@ -22,6 +22,7 @@
> import java.util.List;
>
> 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.SCABinding;
> @@ -32,7 +33,7 @@
> */
> class BindingUtil {
>
> - private static Binding matchBinding(ComponentService service,
> List<Binding> source, List<Binding> target) {
> + private static Binding matchBinding(Component component,
> ComponentService service, List<Binding> source, List<Binding> target) {
> List<Binding> matched = new ArrayList<Binding>();
> // Find the corresponding bindings from the service side
> for (Binding binding : source) {
> @@ -44,11 +45,7 @@
> try {
> cloned =
> (Binding)((WireableBinding)binding).clone();
> WireableBinding endpoint =
> ((WireableBinding)cloned);
> - // FIXME: This is a hack to get the target
> component
> - SCABinding scaBinding = service.getBinding(
> SCABinding.class);
> - if (scaBinding != null) {
> - endpoint.setTargetComponent(
> scaBinding.getComponent());
> - }
> + endpoint.setTargetComponent(component);
> endpoint.setTargetComponentService(service);
> endpoint.setTargetBinding(serviceBinding);
> cloned.setURI(serviceBinding.getURI());
> @@ -84,11 +81,11 @@
> * @param service The component service
> * @return Resolved binding
> */
> - static Binding resolveBindings(ComponentReference reference,
> ComponentService service) {
> + static Binding resolveBindings(ComponentReference reference,
> Component component, ComponentService service) {
> List<Binding> source = reference.getBindings();
> List<Binding> target = service.getBindings();
>
> - return matchBinding(service, source, target);
> + return matchBinding(component, service, source, target);
>
> }
>
> @@ -97,10 +94,10 @@
> * @param service
> * @return
> */
> - static Binding resolveCallbackBindings(ComponentReference reference,
> ComponentService service) {
> + static Binding resolveCallbackBindings(ComponentReference reference,
> Component component, ComponentService service) {
> List<Binding> source = reference.getCallback().getBindings();
> List<Binding> target = service.getCallback().getBindings();
>
> - return matchBinding(service, source, target);
> + return matchBinding(component, service, source, target);
> }
> }
>
> Modified:
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
> (original)
> +++
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
> Tue Aug 14 23:16:47 2007
> @@ -60,9 +60,9 @@
> }
>
> includeBuilder = new CompositeIncludeBuilderImpl(monitor);
> - wireBuilder = new CompositeWireBuilderImpl(assemblyFactory,
> scaBindingFactory, interfaceContractMapper, monitor);
> + wireBuilder = new CompositeWireBuilderImpl(assemblyFactory,
> interfaceContractMapper, monitor);
> cloneBuilder = new CompositeCloneBuilderImpl(monitor);
> - configurationBuilder = new
> CompositeConfigurationBuilderImpl(assemblyFactory, interfaceContractMapper,
> monitor);
> + configurationBuilder = new
> CompositeConfigurationBuilderImpl(assemblyFactory, scaBindingFactory,
> interfaceContractMapper, monitor);
> }
>
> public void build(Composite composite) throws
> CompositeBuilderException {
>
> Modified:
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java
> (original)
> +++
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java
> Tue Aug 14 23:16:47 2007
> @@ -19,9 +19,7 @@
>
> package org.apache.tuscany.sca.assembly.builder.impl;
>
> -import java.util.ArrayList;
> import java.util.HashMap;
> -import java.util.List;
> import java.util.Map;
>
> import org.apache.tuscany.sca.assembly.AssemblyFactory;
> @@ -37,8 +35,8 @@
> import org.apache.tuscany.sca.assembly.Property;
> import org.apache.tuscany.sca.assembly.Reference;
> import org.apache.tuscany.sca.assembly.SCABinding;
> +import org.apache.tuscany.sca.assembly.SCABindingFactory;
> import org.apache.tuscany.sca.assembly.Service;
> -import org.apache.tuscany.sca.assembly.WireableBinding;
> import org.apache.tuscany.sca.assembly.builder.ComponentPreProcessor;
> import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor;
> import org.apache.tuscany.sca.assembly.builder.Problem.Severity;
> @@ -50,11 +48,13 @@
> private String CALLBACK_PREFIX = "$callback$.";
>
> private AssemblyFactory assemblyFactory;
> + private SCABindingFactory scaBindingFactory;
> private CompositeBuilderMonitor monitor;
> private InterfaceContractMapper interfaceContractMapper;
>
> - public CompositeConfigurationBuilderImpl(AssemblyFactory
> assemblyFactory, InterfaceContractMapper interfaceContractMapper,
> CompositeBuilderMonitor monitor) {
> + public CompositeConfigurationBuilderImpl(AssemblyFactory
> assemblyFactory, SCABindingFactory scaBindingFactory,
> InterfaceContractMapper interfaceContractMapper, CompositeBuilderMonitor
> monitor) {
> this.assemblyFactory = assemblyFactory;
> + this.scaBindingFactory = scaBindingFactory;
> this.interfaceContractMapper = interfaceContractMapper;
> this.monitor = monitor;
> }
> @@ -98,12 +98,27 @@
> }
> }
>
> - // Set default binding names
> + // Initialize service bindings
> for (Service service : composite.getServices()) {
> +
> + // Create default SCA binding
> + if (service.getBindings().isEmpty()) {
> + SCABinding scaBinding =
> scaBindingFactory.createSCABinding();
> + service.getBindings().add(scaBinding);
> + }
> +
> + // Initialize binding names and URIs
> for (Binding binding : service.getBindings()) {
> if (binding.getName() == null) {
> binding.setName(service.getName());
> }
> + if (binding.getURI() == null) {
> + if (uri == null) {
> + binding.setURI(binding.getName());
> + } else {
> + binding.setURI(uri + '/' + binding.getName());
> + }
> + }
> }
> if (service.getCallback() != null) {
> for (Binding binding : service.getCallback().getBindings())
> {
> @@ -113,12 +128,23 @@
> }
> }
> }
> +
> + // Initialize reference bindings
> for (Reference reference : composite.getReferences()) {
> +
> + // Create default SCA binding
> + if (reference.getBindings().isEmpty()) {
> + SCABinding scaBinding =
> scaBindingFactory.createSCABinding();
> + reference.getBindings().add(scaBinding);
> + }
> +
> + // Set binding names
> for (Binding binding : reference.getBindings()) {
> if (binding.getName() == null) {
> binding.setName(reference.getName());
> }
> }
> +
> if (reference.getCallback() != null) {
> for (Binding binding : reference.getCallback().getBindings())
> {
> if (binding.getName() == null) {
> @@ -148,17 +174,17 @@
>
> ((ComponentPreProcessor)component.getImplementation()).preProcess(component);
> }
>
> + // Index properties, services and references
> Map<String, Service> services = new HashMap<String,
> Service>();
> Map<String, Reference> references = new HashMap<String,
> Reference>();
> Map<String, Property> properties = new HashMap<String,
> Property>();
> - //Index properties, services and references
> indexImplementationPropertiesServicesAndReferences(component,
> services, references, properties);
>
> + // Index component services, references and properties
> + // Also check for duplicates
> Map<String, ComponentService> componentServices = new
> HashMap<String, ComponentService>();
> Map<String, ComponentReference> componentReferences = new
> HashMap<String, ComponentReference>();
> Map<String, ComponentProperty> componentProperties = new
> HashMap<String, ComponentProperty>();
> - //Index component services, references and properties
> - // Also check for duplicates
> indexComponentPropertiesServicesAndReferences(component,
>
> componentServices,
>
> componentReferences,
> @@ -183,6 +209,58 @@
> if (!(component.getImplementation() instanceof Composite)) {
> createSelfReferences(component);
> }
> +
> +
> + // Initialize service bindings
> + for (ComponentService componentService: component.getServices())
> {
> +
> + // Create default SCA binding
> + if (componentService.getBindings().isEmpty()) {
> + SCABinding scaBinding =
> scaBindingFactory.createSCABinding();
> + componentService.getBindings().add(scaBinding);
> + }
> +
> + // Set binding names and URIs
> + for (Binding binding : componentService.getBindings()) {
> + if (binding.getName() == null) {
> + binding.setName(componentService.getName());
> + }
> + if (binding.getURI() == null) {
> + binding.setURI(component.getURI() + '/' +
> binding.getName());
> + }
> + }
> + if (componentService.getCallback() != null) {
> + for (Binding binding : componentService.getCallback().getBindings())
> {
> + if (binding.getName() == null) {
> + binding.setName(componentService.getName());
> + }
> + }
> + }
> + }
> +
> + // Initialize reference bindings
> + for (ComponentReference componentReference:
> component.getReferences()) {
> +
> + // Create default SCA binding
> + if (componentReference.getBindings().isEmpty()) {
> + SCABinding scaBinding =
> scaBindingFactory.createSCABinding();
> + componentReference.getBindings().add(scaBinding);
> + }
> +
> + // Set binding names
> + for (Binding binding : componentReference.getBindings())
> {
> + if (binding.getName() == null) {
> + binding.setName(componentReference.getName());
> + }
> + }
> + if (componentReference.getCallback() != null) {
> + for (Binding binding : componentReference.getCallback().getBindings())
> {
> + if (binding.getName() == null) {
> + binding.setName(CALLBACK_PREFIX +
> componentReference.getName());
> + }
> + }
> + }
> + }
> }
> }
>
> @@ -490,20 +568,6 @@
> } else {
> componentServices.put(componentService.getName(),
> componentService);
> }
> -
> - // Initialize binding names
> - for (Binding binding : componentService.getBindings()) {
> - if (binding.getName() == null) {
> - binding.setName(componentService.getName());
> - }
> - }
> - if (componentService.getCallback() != null) {
> - for (Binding binding : componentService.getCallback().getBindings())
> {
> - if (binding.getName() == null) {
> - binding.setName(componentService.getName());
> - }
> - }
> - }
> }
> for (ComponentReference componentReference :
> component.getReferences()) {
> if (componentReferences.containsKey(
> componentReference.getName())) {
> @@ -513,20 +577,6 @@
> } else {
> componentReferences.put(componentReference.getName(),
> componentReference);
> }
> -
> - // Initialize binding names
> - for (Binding binding : componentReference.getBindings()) {
> - if (binding.getName() == null) {
> - binding.setName(componentReference.getName());
> - }
> - }
> - if (componentReference.getCallback() != null) {
> - for (Binding binding : componentReference.getCallback().getBindings())
> {
> - if (binding.getName() == null) {
> - binding.setName(CALLBACK_PREFIX +
> componentReference.getName());
> - }
> - }
> - }
> }
> for (ComponentProperty componentProperty :
> component.getProperties()) {
> if (componentProperties.containsKey(componentProperty.getName()))
> {
> @@ -723,13 +773,10 @@
> componentReference.setName("$self$." + service.getName());
> componentReference.getBindings().addAll(service.getBindings());
> componentReference.setCallback(service.getCallback());
> - /*
> ComponentService componentService =
> assemblyFactory.createComponentService();
> - componentService.setName(component.getName() + "/" +
> service.getName());
> + componentService.setName(component.getName() + '/' +
> service.getName());
> componentService.setUnresolved(true);
> componentReference.getTargets().add(componentService);
> - */
> - componentReference.getTargets().add(service);
> componentReference.getPolicySets().addAll(service.getPolicySets
> ());
> componentReference.getRequiredIntents().addAll(
> service.getRequiredIntents());
>
> @@ -784,6 +831,7 @@
> // Get the inner most promoted service
> ComponentService promotedService =
> getPromotedComponentService(compositeService);
> if (promotedService != null) {
> + Component promotedComponent =
> getPromotedComponent(compositeService);
>
> // Default to use the interface from the
> promoted service
> if (compositeService.getInterfaceContract()
> == null) {
> @@ -795,47 +843,30 @@
>
> // Create a new component service to
> represent this composite
> // service on the promoted component
> - SCABinding scaBinding =
> promotedService.getBinding(SCABinding.class);
> - if (scaBinding != null) {
> - Component promotedComponent =
> scaBinding.getComponent();
> - ComponentService newComponentService =
> assemblyFactory.createComponentService();
> - newComponentService.setName("$promoted$."
> + compositeService.getName());
>
> - //newComponentService.setService(compositeService);
> - promotedComponent.getServices
> ().add(newComponentService);
> - newComponentService.getBindings
> ().add(scaBinding);
> - newComponentService.getBindings().addAll(
> compositeService.getBindings());
> - newComponentService.setInterfaceContract(
> compositeService.getInterfaceContract());
> - if (compositeService.getInterfaceContract()
> != null && // can be null in unit tests
> - compositeService.getInterfaceContract().getCallbackInterface()
> != null) {
> - SCABinding scaCallbackBinding =
> -
> promotedService.getCallbackBinding(SCABinding.class);
> - newComponentService.setCallback(
> assemblyFactory.createCallback());
> - if (scaCallbackBinding != null) {
> - newComponentService.getCallback
> ().getBindings().add(scaCallbackBinding);
> - }
> - if (compositeService.getCallback() !=
> null) {
> - newComponentService.getCallback
> ().getBindings().addAll(compositeService
>
> - .getCallback().getBindings());
> - }
> + ComponentService newComponentService =
> assemblyFactory.createComponentService();
> + newComponentService.setName("$promoted$." +
> compositeService.getName());
> + promotedComponent.getServices
> ().add(newComponentService);
> + newComponentService.setService(
> promotedService.getService());
> + newComponentService.getBindings().addAll(
> compositeService.getBindings());
> + newComponentService.setInterfaceContract(
> compositeService.getInterfaceContract());
> + if (compositeService.getInterfaceContract()
> != null && compositeService.getInterfaceContract().getCallbackInterface()
> != null) {
> + newComponentService.setCallback(
> assemblyFactory.createCallback());
> + if (compositeService.getCallback() !=
> null) {
> + newComponentService.getCallback
> ().getBindings().addAll(
> +
> compositeService.getCallback().getBindings());
> }
> -
> - // FIXME: [rfeng] Set the service to
> promoted
> - newComponentService.setService(
> promotedService.getService());
> -
> - // Create a self-reference for the
> promoted service
> - ComponentReference selfRef =
> createSelfReference(promotedComponent, newComponentService);
> - Binding binding =
> BindingUtil.resolveBindings(selfRef, newComponentService);
> - selfRef.getBindings().clear();
> - selfRef.getBindings().add(binding);
> - selfRef.getTargets().clear();
> -
> - // Change the composite service to now
> promote the newly
> - // created component service directly
> - compositeService.setPromotedService
> (newComponentService);
> -
> - } else {
> - warning("Promoted component service not
> found: " + promotedService.getName(), composite);
> }
> +
> + // Create a self-reference for the promoted
> service
> + ComponentReference selfReference =
> createSelfReference(promotedComponent, newComponentService);
> + Binding binding = BindingUtil.resolveBindings(selfReference,
> promotedComponent, newComponentService);
> + selfReference.getBindings().clear();
> + selfReference.getBindings().add(binding);
> + selfReference.getTargets().clear();
> +
> + // Change the composite service to now
> promote the newly
> + // created component service directly
> + compositeService.setPromotedService
> (newComponentService);
> }
> }
> }
> @@ -849,6 +880,7 @@
> // Get the inner most promoted service
> ComponentService promotedService =
> getPromotedComponentService(compositeService);
> if (promotedService != null) {
> + Component promotedComponent =
> getPromotedComponent(compositeService);
>
> // Default to use the interface from the promoted service
> if (compositeService.getInterfaceContract() == null &&
> promotedService.getInterfaceContract() != null) {
> @@ -857,38 +889,23 @@
>
> // Create a new component service to represent this
> composite
> // service on the promoted component
> - SCABinding scaBinding = promotedService.getBinding(
> SCABinding.class);
> - if (scaBinding != null) {
> - Component promotedComponent = scaBinding.getComponent
> ();
> - ComponentService newComponentService =
> assemblyFactory.createComponentService();
> - newComponentService.setName("$promoted$." +
> compositeService.getName());
> - //newComponentService.setService(compositeService);
> - promotedComponent.getServices
> ().add(newComponentService);
> - newComponentService.getBindings().add(scaBinding);
> - newComponentService.getBindings().addAll(
> compositeService.getBindings());
> - newComponentService.setInterfaceContract(
> compositeService.getInterfaceContract());
> - if (compositeService.getInterfaceContract() != null
> && // can be null in unit tests
> - compositeService.getInterfaceContract().getCallbackInterface()
> != null) {
> - SCABinding scaCallbackBinding =
> promotedService.getCallbackBinding(SCABinding.class);
> - newComponentService.setCallback(
> assemblyFactory.createCallback());
> - if (scaCallbackBinding != null) {
> - newComponentService.getCallback
> ().getBindings().add(scaCallbackBinding);
> - }
> - if (compositeService.getCallback() != null) {
> - newComponentService.getCallback
> ().getBindings().addAll(compositeService.getCallback()
> - .getBindings());
> - }
> + ComponentService newComponentService =
> assemblyFactory.createComponentService();
> + newComponentService.setName("$promoted$." +
> compositeService.getName());
> + promotedComponent.getServices().add(newComponentService);
> + newComponentService.setService(promotedService.getService
> ());
> + newComponentService.getBindings().addAll(
> compositeService.getBindings());
> + newComponentService.setInterfaceContract(
> compositeService.getInterfaceContract());
> + if (compositeService.getInterfaceContract() != null &&
> compositeService.getInterfaceContract().getCallbackInterface() != null) {
> + newComponentService.setCallback(
> assemblyFactory.createCallback());
> + if (compositeService.getCallback() != null) {
> + newComponentService.getCallback
> ().getBindings().addAll(
> +
> compositeService.getCallback().getBindings());
> }
> -
> - // FIXME: [rfeng] Set the service to promoted
> - newComponentService.setService(
> promotedService.getService());
> -
> - // Change the composite service to now promote the
> newly
> - // created component service directly
> - compositeService.setPromotedService
> (newComponentService);
> - } else {
> - warning("Promoted component service not found: " +
> promotedService.getName(), composite);
> }
> +
> + // Change the composite service to now promote the newly
> + // created component service directly
> + compositeService.setPromotedService(newComponentService);
> }
> }
> }
> @@ -913,6 +930,34 @@
>
> // Found a non-composite service
> return componentService;
> + }
> + } else {
> +
> + // No promoted service
> + return null;
> + }
> + }
> +
> + /**
> + * Follow a service promotion chain down to the inner most (non
> composite)
> + * component.
> + *
> + * @param compositeService
> + * @return
> + */
> + private Component getPromotedComponent(CompositeService
> compositeService) {
> + ComponentService componentService =
> compositeService.getPromotedService();
> + if (componentService != null) {
> + Service service = componentService.getService();
> + if (componentService.getName() != null && service instanceof
> CompositeService) {
> +
> + // Continue to follow the service promotion chain
> + return getPromotedComponent((CompositeService)service);
> +
> + } else {
> +
> + // Found a non-composite service
> + return compositeService.getPromotedComponent();
> }
> } else {
>
>
> Modified:
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java
> (original)
> +++
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java
> Tue Aug 14 23:16:47 2007
> @@ -40,7 +40,6 @@
> import org.apache.tuscany.sca.assembly.Property;
> import org.apache.tuscany.sca.assembly.Reference;
> import org.apache.tuscany.sca.assembly.SCABinding;
> -import org.apache.tuscany.sca.assembly.SCABindingFactory;
> import org.apache.tuscany.sca.assembly.Service;
> import org.apache.tuscany.sca.assembly.Wire;
> import org.apache.tuscany.sca.assembly.WireableBinding;
> @@ -52,12 +51,10 @@
>
> private CompositeBuilderMonitor monitor;
> private AssemblyFactory assemblyFactory;
> - private SCABindingFactory scaBindingFactory;
> private InterfaceContractMapper interfaceContractMapper;
>
> - public CompositeWireBuilderImpl(AssemblyFactory assemblyFactory,
> SCABindingFactory scaBindingFactory, InterfaceContractMapper
> interfaceContractMapper, CompositeBuilderMonitor monitor) {
> + public CompositeWireBuilderImpl(AssemblyFactory assemblyFactory,
> InterfaceContractMapper interfaceContractMapper, CompositeBuilderMonitor
> monitor) {
> this.assemblyFactory = assemblyFactory;
> - this.scaBindingFactory = scaBindingFactory;
> this.interfaceContractMapper = interfaceContractMapper;
> this.monitor = monitor;
> }
> @@ -78,20 +75,19 @@
> }
> }
>
> - // Index and bind all component services and references
> + // Index components, services and references
> + Map<String, Component> components = new HashMap<String,
> Component>();
> Map<String, ComponentService> componentServices = new
> HashMap<String, ComponentService>();
> Map<String, ComponentReference> componentReferences = new
> HashMap<String, ComponentReference>();
> -
> - // Create SCA bindings on all component services and references
> - createSCABindings(composite, componentServices,
> componentReferences);
> + indexComponentsServicesAndReferences(composite, components,
> componentServices, componentReferences);
>
> // Connect composite services and references to the component
> // services and references that they promote
> - connectCompositeServices(composite, componentServices);
> + connectCompositeServices(composite, components,
> componentServices);
> connectCompositeReferences(composite, componentReferences);
>
> // Connect component references to their targets
> - connectComponentReferences(composite, componentServices,
> componentReferences);
> + connectComponentReferences(composite, components,
> componentServices, componentReferences);
>
> // Connect component references as described in wires
> connectWires(composite, componentServices, componentReferences);
> @@ -124,20 +120,21 @@
> }
> }
> }
> -
> +
> /**
> - * Create SCA bindings for component services and references.
> - *
> + * Index components, services and references inside a composite.
> * @param composite
> + * @param components
> * @param componentServices
> * @param componentReferences
> - * @param problems
> */
> - private void createSCABindings(Composite composite,
> - Map<String, ComponentService>
> componentServices,
> - Map<String, ComponentReference>
> componentReferences) {
> -
> + private void indexComponentsServicesAndReferences(Composite
> composite,
> + Map<String, Component>
> components,
> + Map<String,
> ComponentService> componentServices,
> + Map<String,
> ComponentReference> componentReferences) {
> +
> for (Component component : composite.getComponents()) {
> + components.put(component.getName(), component);
> int i = 0;
> for (ComponentService componentService :
> component.getServices()) {
> String uri = component.getName() + '/' +
> componentService.getName();
> @@ -146,36 +143,12 @@
> componentServices.put(component.getName(),
> componentService);
> }
> i++;
> -
> - // Create and configure an SCA binding for the service
> - if (componentService.getBindings().isEmpty()) {
> - SCABinding scaBinding = componentService.getBinding(
> SCABinding.class);
> - if (scaBinding == null) {
> - scaBinding = scaBindingFactory.createSCABinding
> ();
> - scaBinding.setName(componentService.getName());
> - componentService.getBindings().add(scaBinding);
> - }
> - scaBinding.setComponent(component);
> - scaBinding.setURI(uri);
> - }
> }
> for (ComponentReference componentReference :
> component.getReferences()) {
> String uri = component.getName() + '/' +
> componentReference.getName();
> componentReferences.put(uri, componentReference);
> -
> - if (componentReference.getBindings().isEmpty()) {
> - // Create and configure an SCA binding for the
> reference
> - SCABinding scaBinding = componentReference.getBinding
> (SCABinding.class);
> - if (scaBinding == null) {
> - scaBinding = scaBindingFactory.createSCABinding
> ();
> - scaBinding.setName(componentReference.getName());
> - componentReference.getBindings().add(scaBinding);
> - }
> - scaBinding.setComponent(component);
> - }
> }
> }
> -
> }
>
> /**
> @@ -196,7 +169,7 @@
> * @param componentServices
> * @param problems
> */
> - private void connectCompositeServices(Composite composite,
> Map<String, ComponentService> componentServices) {
> + private void connectCompositeServices(Composite composite,
> Map<String, Component> components, Map<String, ComponentService>
> componentServices) {
>
> // Propagate interfaces from inner composite components' services
> to
> // their component services
> @@ -216,13 +189,24 @@
> // Connect composite services to the component services that they
> // promote
> for (Service service : composite.getServices()) {
> -
> CompositeService compositeService =
> (CompositeService)service;
> ComponentService componentService =
> compositeService.getPromotedService();
> if (componentService != null && componentService.isUnresolved())
> {
> - ComponentService promotedService = componentServices.get(
> componentService.getName());
> +
> + String promotedComponentName =
> compositeService.getPromotedComponent().getName();
> + String promotedServiceName;
> + if (componentService.getName() != null) {
> + promotedServiceName = promotedComponentName + '/' +
> componentService.getName();
> + } else {
> + promotedServiceName = promotedComponentName;
> + }
> + ComponentService promotedService = componentServices.get
> (promotedServiceName);
> if (promotedService != null) {
>
> + // Point to the resolved component
> + Component promotedComponent = components.get
> (promotedComponentName);
> + compositeService.setPromotedComponent
> (promotedComponent);
> +
> // Point to the resolved component service
> compositeService.setPromotedService(promotedService);
>
> @@ -233,7 +217,7 @@
> }
>
> } else {
> - warning("Promoted component service not found: " +
> componentService.getName(), composite);
> + warning("Promoted component service not found: " +
> promotedServiceName, composite);
> }
> }
> }
> @@ -303,24 +287,43 @@
> * @param problems
> */
> private void connectComponentReferences(Composite composite,
> + Map<String, Component>
> components,
> Map<String, ComponentService>
> componentServices,
> Map<String,
> ComponentReference> componentReferences) {
> +
> + // Represents a target component and service
> + class Target {
> + Component component;
> + ComponentService service;
> +
> + Target(Component component, ComponentService service) {
> + this.component = component;
> + this.service = service;
> + }
> +
> + Component getComponent() {
> + return component;
> + }
> +
> + ComponentService getService() {
> + return service;
> + }
> + };
>
> for (ComponentReference componentReference :
> componentReferences.values()) {
> - List<ComponentService> targets =
> componentReference.getTargets();
> + List<Target> targets = new ArrayList<Target>();
>
> if (componentReference.isAutowire()) {
>
> // Find suitable targets in the current composite for an
> // autowired reference
> Multiplicity multiplicity =
> componentReference.getMultiplicity();
> - for (Component component : composite.getComponents()) {
> - for (ComponentService componentService :
> component.getServices()) {
> - if (componentReference.getInterfaceContract() ==
> null || interfaceContractMapper
> - .isCompatible(
> componentReference.getInterfaceContract(), componentService
> - .getInterfaceContract())) {
> -
> - targets.add(componentService);
> + for (Component targetComponent : composite.getComponents())
> {
> + for (ComponentService targetComponentService :
> targetComponent.getServices()) {
> + if (componentReference.getInterfaceContract() ==
> null ||
> + interfaceContractMapper.isCompatible(
> componentReference.getInterfaceContract(),
> targetComponentService.getInterfaceContract())) {
> + Target target = new Target(targetComponent,
> targetComponentService);
> + targets.add(target);
> if (multiplicity == Multiplicity.ZERO_ONE ||
> multiplicity == Multiplicity.ONE_ONE) {
> break;
> }
> @@ -328,108 +331,119 @@
> }
> }
>
> - } else if (!targets.isEmpty()) {
> + } else if (!componentReference.getTargets().isEmpty()) {
>
> // Resolve targets specified on the component reference
> - for (int i = 0, n = targets.size(); i < n; i++) {
> - ComponentService target = targets.get(i);
> - if (target.isUnresolved()) {
> - ComponentService resolved = componentServices.get
> (target.getName());
> - if (resolved != null) {
> -
> - // Check that the target component service
> provides
> - // a superset of
> - // the component reference interface
> - if (componentReference.getInterfaceContract()
> == null || interfaceContractMapper
> - .isCompatible(
> componentReference.getInterfaceContract(), resolved
> - .getInterfaceContract())) {
> -
> - targets.set(i, resolved);
> - } else {
> - warning("Incompatible interfaces on
> component reference and target: " + componentReference
> - .getName()
> - + " : "
> - + target.getName(),
> - composite);
> - }
> + for (ComponentService componentService :
> componentReference.getTargets()) {
> +
> + // Resolve the target component and service
> + String name = componentService.getName();
> + ComponentService targetComponentService =
> componentServices.get(name);
> + Component targetComponent;
> + int s = name.indexOf('/');
> + if (s == -1) {
> + targetComponent = components.get(name);
> + } else {
> + targetComponent = components.get(name.substring(0,
> s));
> + }
> +
> + if (targetComponentService != null) {
> +
> + // Check that the target component service
> provides
> + // a superset of the component reference
> interface
> + if (componentReference.getInterfaceContract() ==
> null ||
> + interfaceContractMapper.isCompatible(
> componentReference.getInterfaceContract(),
> targetComponentService.getInterfaceContract())) {
> +
> + Target target = new Target(targetComponent,
> targetComponentService);
> + targets.add(target);
> } else {
> - // put all the reference bindings into the
> target so that they
> - // can be used for comparison when the target
> is resolved at runtime
> - target.getBindings().addAll(
> componentReference.getBindings());
> -
> - warning("Component reference target not
> found, it might be a remote service: " + target.getName(), composite);
> + warning("Incompatible interfaces on component
> reference and target: " + componentReference
> + .getName()
> + + " : "
> + + componentService.getName(),
> + composite);
> }
> + } else {
> + warning("Component reference target not found, it
> might be a remote service: " + componentService.getName(), composite);
> }
> }
> } else if (componentReference.getReference() != null) {
>
> // Resolve targets from the corresponding reference in
> the
> // componentType
> - for (ComponentService target :
> componentReference.getReference().getTargets()) {
> - if (target.isUnresolved()) {
> - ComponentService resolved = componentServices.get
> (target.getName());
> - if (resolved != null) {
> -
> - // Check that the target component service
> provides
> - // a superset of
> - // the component reference interface
> - if (componentReference.getInterfaceContract()
> == null || interfaceContractMapper
> - .isCompatible(
> componentReference.getInterfaceContract(), resolved
> - .getInterfaceContract())) {
> -
> - targets.add(resolved);
> - } else {
> - warning("Incompatible interfaces on
> component reference and target: " + componentReference
> - .getName()
> - + " : "
> - + target.getName(),
> - composite);
> - }
> + for (ComponentService componentService :
> componentReference.getReference().getTargets()) {
> +
> + // Resolve the target component and service
> + String name = componentService.getName();
> + ComponentService targetComponentService =
> componentServices.get(name);
> + Component targetComponent;
> + int s = name.indexOf('/');
> + if (s == -1) {
> + targetComponent = components.get(name);
> + } else {
> + targetComponent = components.get(name.substring(0,
> s));
> + }
> +
> + if (targetComponentService != null) {
> +
> + // Check that the target component service
> provides
> + // a superset of
> + // the component reference interface
> + if (componentReference.getInterfaceContract() ==
> null ||
> + interfaceContractMapper.isCompatible(
> componentReference.getInterfaceContract(),
> targetComponentService.getInterfaceContract())) {
> +
> + Target target = new Target(targetComponent,
> targetComponentService);
> + targets.add(target);
> } else {
> - warning("Reference target not found: " +
> target.getName(), composite);
> + warning("Incompatible interfaces on component
> reference and target: " + componentReference
> + .getName()
> + + " : "
> + + componentService.getName(),
> + composite);
> }
> + } else {
> + warning("Reference target not found: " +
> componentService.getName(), composite);
> }
> }
> }
> - // [rfeng] For any targets, select the matching binding for
> the reference
> +
> + // Select the reference bindings matching the target service
> bindings
> List<Binding> selectedBindings = new ArrayList<Binding>();
>
> // Handle callback
> boolean bidirectional = false;
> - if (componentReference.getInterfaceContract() != null &&
> componentReference.getInterfaceContract()
> - .getCallbackInterface() != null) {
> + if (componentReference.getInterfaceContract() != null &&
> componentReference.getInterfaceContract().getCallbackInterface() != null)
> {
> bidirectional = true;
> }
> List<Binding> selectedCallbackBindings = bidirectional ? new
> ArrayList<Binding>() : null;
>
> - for (ComponentService service : targets) {
> - ComponentService target = service;
> -
> - // if the target is unresolved it will now have a list of
> the reference
> - // bindings so ignore it
> - if (!target.isUnresolved()){
> + for (Target target : targets) {
>
> - if (service.getService() instanceof CompositeService)
> {
> - // Normalize the service to be the final target
> - target =
> ((CompositeService)service.getService()).getPromotedService();
> - }
> - Binding selected = BindingUtil.resolveBindings(componentReference,
> target);
> - if (selected == null) {
> - warning("Component reference doesn't have a
> matching binding", componentReference);
> - } else {
> - selectedBindings.add(selected);
> - }
> - if (bidirectional) {
> - Binding selectedCallback =
> BindingUtil.resolveCallbackBindings(componentReference, target);
> - if (selectedCallback != null) {
> - selectedCallbackBindings.add
> (selectedCallback);
> - }
> + Component targetComponent = target.getComponent();
> + ComponentService targetComponentService =
> target.getService();
> + if (targetComponentService.getService() instanceof
> CompositeService) {
> +
> + // Find the promoted component service
> + targetComponentService =
> ((CompositeService)targetComponentService.getService()).getPromotedService();
> + }
> +
> + // Match the binding against the bindings of the target
> service
> + Binding selected = BindingUtil.resolveBindings(componentReference,
> targetComponent, targetComponentService);
> + if (selected == null) {
> + warning("Component reference doesn't have a matching
> binding", componentReference);
> + } else {
> + selectedBindings.add(selected);
> + }
> + if (bidirectional) {
> + Binding selectedCallback =
> BindingUtil.resolveCallbackBindings(componentReference, targetComponent,
> targetComponentService);
> + if (selectedCallback != null) {
> + selectedCallbackBindings.add(selectedCallback);
> }
> }
> -
> }
>
> if (!targets.isEmpty()) {
> +
> // Add all the effective bindings
> componentReference.getBindings().clear();
> componentReference.getBindings
> ().addAll(selectedBindings);
> @@ -437,10 +451,6 @@
> componentReference.getCallback
> ().getBindings().clear();
> componentReference.getCallback
> ().getBindings().addAll(selectedCallbackBindings);
> }
> - // Remove the targets since they have been normalized as
> bindings
> - // TODO - leave then in for the case where there are
> still unresolved
> - // targets that will be resolved at runtime
> - //targets.clear();
> }
> }
> }
>
> Modified:
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java
> (original)
> +++
> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java
> Tue Aug 14 23:16:47 2007
> @@ -19,6 +19,7 @@
>
> package org.apache.tuscany.sca.assembly.impl;
>
> +import org.apache.tuscany.sca.assembly.Component;
> import org.apache.tuscany.sca.assembly.ComponentService;
> import org.apache.tuscany.sca.assembly.CompositeService;
>
> @@ -29,6 +30,7 @@
> */
> public class CompositeServiceImpl extends ServiceImpl implements
> CompositeService, Cloneable {
> private ComponentService promotedService;
> + private Component promotedComponent;
>
> /**
> * Constructs a new composite service.
> @@ -48,4 +50,13 @@
> public void setPromotedService(ComponentService promotedService) {
> this.promotedService = promotedService;
> }
> +
> + public Component getPromotedComponent() {
> + return promotedComponent;
> + }
> +
> + public void setPromotedComponent(Component promotedComponent) {
> + this.promotedComponent = promotedComponent;
> + }
> +
> }
>
> Modified:
> incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomServiceBindingProvider.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomServiceBindingProvider.java?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomServiceBindingProvider.java
> (original)
> +++
> incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomServiceBindingProvider.java
> Tue Aug 14 23:16:47 2007
> @@ -51,9 +51,6 @@
> this.servletHost = servletHost;
> this.messageFactory = messageFactory;
> uri = binding.getURI();
> - if (uri == null) {
> - uri = "/" + this.component.getName();
> - }
> }
>
> public InterfaceContract getBindingInterfaceContract() {
>
> Modified:
> incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSServiceBindingProvider.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSServiceBindingProvider.java?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSServiceBindingProvider.java
> (original)
> +++
> incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSServiceBindingProvider.java
> Tue Aug 14 23:16:47 2007
> @@ -51,9 +51,6 @@
> this.servletHost = servletHost;
> this.messageFactory = messageFactory;
> uri = binding.getURI();
> - if (uri == null) {
> - uri = "/" + this.component.getName();
> - }
> }
>
> public InterfaceContract getBindingInterfaceContract() {
>
> Modified:
> incubator/tuscany/java/sca/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCService.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCService.java?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCService.java
> (original)
> +++
> incubator/tuscany/java/sca/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCService.java
> Tue Aug 14 23:16:47 2007
> @@ -71,16 +71,11 @@
> Object instance = component.createSelfReference
> (serviceInterface).getService();
> JSONRPCServiceServlet serviceServlet = new JSONRPCServiceServlet(
> binding.getName(), serviceInterface, instance);
> int port;
> - if (binding.getURI() != null) {
> - servletHost.addServletMapping(binding.getURI(),
> serviceServlet);
> - URI uri = URI.create(binding.getURI());
> - port = uri.getPort();
> - if (port == -1)
> - port = 8080;
> - } else {
> - servletHost.addServletMapping(SERVICE_PREFIX +
> binding.getName(), serviceServlet);
> + servletHost.addServletMapping(binding.getURI(), serviceServlet);
> + URI uri = URI.create(binding.getURI());
> + port = uri.getPort();
> + if (port == -1)
> port = 8080;
> - }
>
> // get the ScaDomainScriptServlet, if it doesn't yet exist create
> one
> // this uses removeServletMapping / addServletMapping as theres
> no getServletMapping facility
> @@ -100,16 +95,11 @@
>
> // Unregister from the service servlet mapping
> int port;
> - if (binding.getURI() != null) {
> - servletHost.removeServletMapping(binding.getURI());
> - URI uri = URI.create(binding.getURI());
> - port = uri.getPort();
> - if (port == -1)
> - port = 8080;
> - } else {
> - servletHost.removeServletMapping(SERVICE_PREFIX +
> binding.getName());
> + servletHost.removeServletMapping(binding.getURI());
> + URI uri = URI.create(binding.getURI());
> + port = uri.getPort();
> + if (port == -1)
> port = 8080;
> - }
>
> // Unregister the service from the scaDomain script servlet
> // don't unregister the scaDomain script servlet if it still has
> other service names
>
> Modified:
> incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java
> (original)
> +++
> incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java
> Tue Aug 14 23:16:47 2007
> @@ -118,8 +118,8 @@
> SCABinding referenceSCABinding = (SCABinding)
> composite.getComponents
> ().get(0).getReferences().get(0).getBindings().get(0);
> SCABinding serviceSCABinding = (SCABinding)
> composite.getComponents
> ().get(1).getServices().get(0).getBindings().get(0);
>
> - Assert.assertEquals("addService", referenceSCABinding.getName());
> - Assert.assertEquals(null, serviceSCABinding.getName());
> + Assert.assertNotNull(referenceSCABinding);
> + Assert.assertNotNull(serviceSCABinding);
>
> //new PrintUtil(System.out).print(composite);
> }
>
> Modified:
> incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java
> (original)
> +++
> incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java
> Tue Aug 14 23:16:47 2007
> @@ -42,8 +42,6 @@
> private List<Intent> requiredIntents = new ArrayList<Intent>();
> private List<Object> extensions = new ArrayList<Object>();
>
> - private Component component;
> -
> private Component targetComponent;
> private ComponentService targetComponentService;
> private Binding targetBinding;
> @@ -77,14 +75,6 @@
> protected SCABindingImpl() {
> }
>
> - public Component getComponent() {
> - return component;
> - }
> -
> - public void setComponent(Component component) {
> - this.component = component;
> - }
> -
> public String getName() {
> return name;
> }
>
> Modified:
> incubator/tuscany/java/sca/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java
> (original)
> +++
> incubator/tuscany/java/sca/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java
> Tue Aug 14 23:16:47 2007
> @@ -107,8 +107,8 @@
> SCABinding referenceSCABinding = (SCABinding)
> composite.getComponents
> ().get(0).getReferences().get(0).getBindings().get(0);
> SCABinding serviceSCABinding = (SCABinding)
> composite.getComponents
> ().get(1).getServices().get(0).getBindings().get(0);
>
> - Assert.assertEquals("addService",
> referenceSCABinding.getName());
> - Assert.assertEquals(null, serviceSCABinding.getName());
> + Assert.assertNotNull(referenceSCABinding);
> + Assert.assertNotNull(serviceSCABinding);
> } catch (Exception ex) {
> Assert.fail(ex.getMessage());
> }
>
> Modified:
> incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceProvider.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceProvider.java?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceProvider.java
> (original)
> +++
> incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceProvider.java
> Tue Aug 14 23:16:47 2007
> @@ -146,19 +146,13 @@
> wsdlURI = getEndpoint(wsBinding.getPort());
> }
> if (wsdlURI != null && wsdlURI.isAbsolute()) {
> - if (wsBinding.getURI() != null && (wsBinding.getServiceName()
> != null && wsBinding.getBindingName() == null)) {
> - throw new IllegalArgumentException("binding URI cannot be
> used with absolute WSDL endpoint URI");
> - }
> return URI.create(wsdlURI.toString());
> }
>
> // either there is no wsdl port endpoint URI or that URI is
> relative
>
> - URI bindingURI = null;
> - if (wsBinding.getURI() != null) {
> - bindingURI = URI.create(wsBinding.getURI());
> - }
> - if (bindingURI != null && bindingURI.isAbsolute()) {
> + URI bindingURI = URI.create(wsBinding.getURI());
> + if (bindingURI.isAbsolute()) {
> // there is an absoulte uri specified on the binding: <
> binding.ws
> // uri="xxx"
> if (wsdlURI != null) {
> @@ -167,36 +161,10 @@
> } else {
> return bindingURI;
> }
> - }
> -
> - // both the WSDL endpoint and binding uri are either unspecified
> or relative
> - // so the endpoint is based on the component name and service
> binding URI
> -
> - URI componentURI = URI.create(component.getName());
> -
> - String actualURI;
> - if (componentURI.isAbsolute()) {
> - actualURI = componentURI.toString();
> } else {
> - actualURI = baseURI + "/" + componentURI;
> + bindingURI = URI.create(baseURI + "/" + wsBinding.getURI());
> + return bindingURI;
> }
> -
> - // for service bindings with multiple services, the default
> binding URI is the binding name
> - if (bindingURI == null && component.getServices().size() > 1) {
> - bindingURI = URI.create(wsBinding.getName());
> - }
> -
> - // add any relative binding URI
> - if (bindingURI != null) {
> - actualURI += "/" + bindingURI;
> - }
> -
> - // add any relative WSDL port URI
> - if (wsdlURI != null) {
> - actualURI += "/" + wsdlURI.toString();
> - }
> -
> - return URI.create(actualURI);
> }
>
> /**
>
> Modified:
> incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDL.composite
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDL.composite?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDL.composite
> (original)
> +++
> incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDL.composite
> Tue Aug 14 23:16:47 2007
> @@ -37,7 +37,7 @@
> <reference name="helloWorldWS"
> promote="HelloWorldComponent/helloWorldWS">
> <!-- interface.wsdl interface="
> http://helloworld#wsdl.interface(HelloWorld)" / -->
> <!-- interface.java interface="
> org.apache.tuscany.sca.binding.axis2.itests.HelloWorld" / -->
> - <binding.ws uri="
> http://localhost:8085/HelloWorldService/helloWorld"/>
> + <binding.ws uri="http://localhost:8085/helloWorld"/>
> </reference>
>
> <service name="Echo" promote="EchoService">
> @@ -54,7 +54,7 @@
> </component>
>
> <reference name="echoWS" promote="EchoComponent/echoWS">
> - <binding.ws uri="http://localhost:8085/EchoService/Echo"/>
> + <binding.ws uri="http://localhost:8085/Echo"/>
> </reference>
>
> </composite>
>
> Modified:
> incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanReferenceImpl.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanReferenceImpl.java?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanReferenceImpl.java
> (original)
> +++
> incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanReferenceImpl.java
> Tue Aug 14 23:16:47 2007
> @@ -20,7 +20,6 @@
>
> import org.apache.tuscany.sca.assembly.Reference;
> import org.apache.tuscany.sca.assembly.SCABinding;
> -import org.apache.tuscany.sca.assembly.WireableBinding;
> import org.springframework.beans.factory.config.RuntimeBeanReference;
>
> /**
> @@ -39,11 +38,12 @@
>
> public String getBeanName() {
> SCABinding binding = reference.getBinding(SCABinding.class);
> - if (binding instanceof WireableBinding) {
> - return ((WireableBinding)
> binding).getTargetComponent().getURI();
> - } else {
> - return null;
> + String name = binding.getURI();
> + int s = name.lastIndexOf('/');
> + if (s != -1) {
> + name = name.substring(0, s);
> }
> + return name;
> }
>
> public boolean equals(Object other) {
>
> Modified:
> incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java
> (original)
> +++
> incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java
> Tue Aug 14 23:16:47 2007
> @@ -37,7 +37,6 @@
> import org.apache.tuscany.sca.assembly.ComponentService;
> import org.apache.tuscany.sca.assembly.Composite;
> import org.apache.tuscany.sca.assembly.CompositeService;
> -import org.apache.tuscany.sca.assembly.SCABinding;
> import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
> import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
> import org.apache.tuscany.sca.contribution.Contribution;
> @@ -350,24 +349,16 @@
> ComponentContext componentContext = null;
>
> // If the component is a composite, then we need to find the
> - // non-composite
> - // component that provides the requested service
> + // non-composite component that provides the requested service
> if (component.getImplementation() instanceof Composite) {
> - ComponentService promotedService = null;
> for (ComponentService componentService :
> component.getServices()) {
> if (serviceName == null || serviceName.equals(
> componentService.getName())) {
> -
> CompositeService compositeService =
> (CompositeService)componentService.getService();
> if (compositeService != null) {
> - promotedService =
> compositeService.getPromotedService();
> - SCABinding scaBinding =
> promotedService.getBinding(SCABinding.class);
> - if (scaBinding != null) {
> - Component promotedComponent =
> scaBinding.getComponent();
> - if (serviceName != null) {
> - serviceName = "$promoted$." +
> serviceName;
> - }
> - componentContext =
> (ComponentContext)promotedComponent;
> + if (serviceName != null) {
> + serviceName = "$promoted$." + serviceName;
> }
> + componentContext =
> (ComponentContext)compositeService.getPromotedComponent();
> }
> break;
> }
>
> Modified:
> incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java
> (original)
> +++
> incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java
> Tue Aug 14 23:16:47 2007
> @@ -167,21 +167,15 @@
> // non-composite
> // component that provides the requested service
> if (component.getImplementation() instanceof Composite) {
> - ComponentService promotedService = null;
> for (ComponentService componentService :
> component.getServices()) {
> if (serviceName == null || serviceName.equals(
> componentService.getName())) {
>
> CompositeService compositeService =
> (CompositeService)componentService.getService();
> if (compositeService != null) {
> - promotedService =
> compositeService.getPromotedService();
> - SCABinding scaBinding =
> promotedService.getBinding(SCABinding.class);
> - if (scaBinding != null) {
> - Component promotedComponent =
> scaBinding.getComponent();
> - if (serviceName != null) {
> - serviceName = "$promoted$." +
> serviceName;
> - }
> - componentContext =
> (ComponentContext)promotedComponent;
> + if (serviceName != null) {
> + serviceName = "$promoted$." + serviceName;
> }
> + componentContext =
> (ComponentContext)compositeService.getPromotedComponent();
> }
> break;
> }
>
> Modified:
> incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/binding/resource/provider/HTTPResourceServiceBindingProvider.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/binding/resource/provider/HTTPResourceServiceBindingProvider.java?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/binding/resource/provider/HTTPResourceServiceBindingProvider.java
> (original)
> +++
> incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/binding/resource/provider/HTTPResourceServiceBindingProvider.java
> Tue Aug 14 23:16:47 2007
> @@ -52,16 +52,12 @@
> this.binding = binding;
> this.servletHost = servletHost;
>
> - if (binding.getURI() != null) {
> - uri = binding.getURI();
> - if (!uri.endsWith("/")) {
> - uri += "/";
> - }
> - if (!uri.endsWith("*")) {
> - uri += "*";
> - }
> - } else {
> - uri = "/" + this.component.getName() + "/*";
> + uri = binding.getURI();
> + if (!uri.endsWith("/")) {
> + uri += "/";
> + }
> + if (!uri.endsWith("*")) {
> + uri += "*";
> }
> }
>
>
> Modified:
> incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java
> (original)
> +++
> incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java
> Tue Aug 14 23:16:47 2007
> @@ -61,9 +61,6 @@
>
> // Register with the hosting server
> String uri = binding.getURI();
> - if (uri == null) {
> - uri = component.getURI() + "/" + binding.getName();
> - }
> EchoServer.getServer().register(uri, new EchoServiceListener(
> chain.getHeadInvoker(), messageFactory));
> }
>
>
> Modified:
> incubator/tuscany/java/sca/samples/binding-echo2-extension/src/main/java/echo2/extension/EchoServiceBindingProvider.java
> URL:
> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo2-extension/src/main/java/echo2/extension/EchoServiceBindingProvider.java?view=diff&rev=566036&r1=566035&r2=566036
>
> ==============================================================================
> ---
> incubator/tuscany/java/sca/samples/binding-echo2-extension/src/main/java/echo2/extension/EchoServiceBindingProvider.java
> (original)
> +++
> incubator/tuscany/java/sca/samples/binding-echo2-extension/src/main/java/echo2/extension/EchoServiceBindingProvider.java
> Tue Aug 14 23:16:47 2007
> @@ -60,9 +60,6 @@
>
> // Register with the hosting server
> String uri = binding.getURI();
> - if (uri == null) {
> - uri = component.getURI() + "/" + binding.getName();
> - }
> EchoServer.getServer().register(uri, new EchoServiceListener(
> chain.getHeadInvoker(), messageFactory));
> }
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-commits-help@ws.apache.org
>
>
Re: svn commit: r566036 - in /incubator/tuscany/java/sca: modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/
modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ modules/assembly/src/main/java/org/apache/tuscan
Posted by Jean-Sebastien Delfino <js...@apache.org>.
ant elder wrote:
> How come binding.ajax was left out of this change?
>
> ...ant
>
>
I went through all the bindings that used the binding URI, but
binding.ajax does not seem to use the URI at all. I don't really
understand how it registers its servlet but it seems to use a fixed
hardcoded URI (and is it using a single servlet for all services??). Can
you help understand what it does and how it should be changed?
> On 8/15/07, jsdelfino@apache.org <js...@apache.org> wrote:
>
>> Author: jsdelfino
>> Date: Tue Aug 14 23:16:47 2007
>> New Revision: 566036
>>
>> URL: http://svn.apache.org/viewvc?view=rev&rev=566036
>> Log:
>> Initialize service binding URI to componentURI/bindingName if no URI is
>> specified on a binding. Binding extensions do not need to implement the
>> logic to determine the default binding URI anymore (except for any binding
>> specific logic, including use of a specific protocol scheme), they can
>> simply call binding.getURI() to get that URI. Also cleaned up up
>> SCABinding as SCABinding.get/setComponent are not needed anymore.
>>
>> Modified:
>>
>> incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
>>
>> incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java
>>
>> incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java
>>
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java
>>
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java
>>
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingUtil.java
>>
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
>>
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java
>>
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java
>>
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java
>>
>> incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomServiceBindingProvider.java
>>
>> incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSServiceBindingProvider.java
>>
>> incubator/tuscany/java/sca/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCService.java
>>
>> incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java
>>
>> incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java
>>
>> incubator/tuscany/java/sca/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java
>>
>> incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceProvider.java
>>
>> incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDL.composite
>>
>> incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanReferenceImpl.java
>>
>> incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java
>>
>> incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java
>>
>> incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/binding/resource/provider/HTTPResourceServiceBindingProvider.java
>>
>> incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java
>>
>> incubator/tuscany/java/sca/samples/binding-echo2-extension/src/main/java/echo2/extension/EchoServiceBindingProvider.java
>>
>> Modified:
>> incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
>> (original)
>> +++
>> incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
>> Tue Aug 14 23:16:47 2007
>> @@ -149,11 +149,28 @@
>> compositeService =
>> assemblyFactory.createCompositeService();
>> contract = compositeService;
>> compositeService.setName(getString(reader,
>> NAME));
>> +
>> + String promoted = getString(reader,
>> PROMOTE);
>> + String promotedComponentName;
>> + String promotedServiceName;
>> + int s = promoted.indexOf('/');
>> + if (s == -1) {
>> + promotedComponentName = promoted;
>> + promotedServiceName = null;
>> + } else {
>> + promotedComponentName =
>> promoted.substring(0, s);
>> + promotedServiceName =
>> promoted.substring(s+1);
>> + }
>>
>> - ComponentService promoted =
>> assemblyFactory.createComponentService();
>> - promoted.setUnresolved(true);
>> - promoted.setName(getString(reader,
>> PROMOTE));
>> - compositeService.setPromotedService
>> (promoted);
>> + Component promotedComponent =
>> assemblyFactory.createComponent();
>> + promotedComponent.setUnresolved(true);
>> + promotedComponent.setName
>> (promotedComponentName);
>> + compositeService.setPromotedComponent
>> (promotedComponent);
>> +
>> + ComponentService promotedService =
>> assemblyFactory.createComponentService();
>> + promotedService.setUnresolved(true);
>> + promotedService.setName
>> (promotedServiceName);
>> + compositeService.setPromotedService
>> (promotedService);
>>
>> composite.getServices
>> ().add(compositeService);
>> readPolicies(contract, reader);
>> @@ -178,7 +195,15 @@
>> compositeReference.setName(getString(reader,
>> NAME));
>> readMultiplicity(compositeReference,
>> reader);
>> readTargets(compositeReference, reader);
>> - readPromotes(compositeReference, reader);
>> + String promote = reader.getAttributeValue(null,
>> Constants.PROMOTE);
>> + if (promote != null) {
>> + for (StringTokenizer tokens = new
>> StringTokenizer(promote); tokens.hasMoreTokens();) {
>> + ComponentReference
>> promotedReference = assemblyFactory.createComponentReference();
>> + promotedReference.setUnresolved
>> (true);
>> + promotedReference.setName(
>> tokens.nextToken());
>> +
>> compositeReference.getPromotedReferences().add(promotedReference);
>> + }
>> + }
>> compositeReference.setWiredByImpl(getBoolean(reader,
>> WIRED_BY_IMPL));
>> composite.getReferences
>> ().add(compositeReference);
>> readPolicies(contract, reader);
>> @@ -349,8 +374,18 @@
>>
>> for (Service service : composite.getServices()) {
>> CompositeService compositeService =
>> (CompositeService)service;
>> + Component promotedComponent =
>> compositeService.getPromotedComponent();
>> ComponentService promotedService =
>> compositeService.getPromotedService();
>> - String promote = promotedService != null ?
>> promotedService.getName() : null;
>> + String promote;
>> + if (promotedService != null) {
>> + if (promotedService.getName() != null) {
>> + promote = promotedComponent.getName() + '/' +
>> promotedService.getService();
>> + } else {
>> + promote = promotedComponent.getName();
>> + }
>> + } else {
>> + promote = null;
>> + }
>> writeStart(writer, SERVICE, new XAttr(NAME,
>> service.getName()), new XAttr(PROMOTE, promote));
>>
>> extensionProcessor.write(service.getInterfaceContract(),
>> writer);
>> @@ -607,23 +642,5 @@
>>
>> public Class<Composite> getModelType() {
>> return Composite.class;
>> - }
>> -
>> - /**
>> - * Read list of refence targets
>> - * @param reference
>> - * @param reader
>> - */
>> - protected void readPromotes(CompositeReference reference,
>> XMLStreamReader reader) {
>> - String value = reader.getAttributeValue(null, Constants.PROMOTE);
>> - ComponentReference promoted = null;
>> - if (value != null) {
>> - for (StringTokenizer tokens = new StringTokenizer(value);
>> tokens.hasMoreTokens();) {
>> - promoted = assemblyFactory.createComponentReference();
>> - promoted.setUnresolved(true);
>> - promoted.setName(tokens.nextToken());
>> - reference.getPromotedReferences().add(promoted);
>> - }
>> - }
>> }
>> }
>>
>> Modified:
>> incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java
>> (original)
>> +++
>> incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java
>> Tue Aug 14 23:16:47 2007
>> @@ -95,7 +95,7 @@
>> assertEquals(calcCompositeService.getName(),
>> "CalculatorService");
>> assertTrue(calcCompositeService.getPromotedService
>> ().isUnresolved());
>> assertEquals(calcCompositeService.getPromotedService().getName(),
>> - "CalculatorServiceComponent/CalculatorService");
>> + "CalculatorService");
>> assertEquals(calcCompositeService.getRequiredIntents
>> ().get(0).getName(),
>> new QName("http://test", "confidentiality"));
>> assertEquals(calcCompositeService.getPolicySets().get(0).getName(),
>> new QName("http://test", "SecureReliablePolicy"));
>>
>> Modified:
>> incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java
>> (original)
>> +++
>> incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java
>> Tue Aug 14 23:16:47 2007
>> @@ -41,8 +41,6 @@
>> private List<Intent> requiredIntents = new ArrayList<Intent>();
>> private List<Object> extensions = new ArrayList<Object>();
>>
>> - private Component component;
>> -
>> private Component targetComponent;
>> private ComponentService targetComponentService;
>> private Binding targetBinding;
>> @@ -65,14 +63,6 @@
>> protected TestSCABindingImpl() {
>> }
>>
>> - public Component getComponent() {
>> - return component;
>> - }
>> -
>> - public void setComponent(Component component) {
>> - this.component = component;
>> - }
>> -
>> public String getName() {
>> return name;
>> }
>>
>> Modified:
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java
>> (original)
>> +++
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java
>> Tue Aug 14 23:16:47 2007
>> @@ -26,6 +26,20 @@
>> public interface CompositeService extends Service {
>>
>> /**
>> + * Returns the promoted component.
>> + *
>> + * @return the promoted component.
>> + */
>> + Component getPromotedComponent();
>> +
>> + /**
>> + * Sets the promoted component
>> + *
>> + * @param promotedComponent the promoted component.
>> + */
>> + void setPromotedComponent(Component promotedComponent);
>> +
>> + /**
>> * Returns the promoted component service .
>> *
>> * @return the promoted component service.
>>
>> Modified:
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java
>> (original)
>> +++
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java
>> Tue Aug 14 23:16:47 2007
>> @@ -24,16 +24,4 @@
>> * @version $Rev$ $Date$
>> */
>> public interface SCABinding extends Binding {
>> - /**
>> - * This is a hack to navigate to the containing component
>> - * @return
>> - */
>> - @Deprecated
>> - Component getComponent();
>> - /**
>> - * This is a hack to set the containing component
>> - * @param component
>> - */
>> - @Deprecated
>> - void setComponent(Component component);
>> }
>>
>> Modified:
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingUtil.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingUtil.java?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingUtil.java
>> (original)
>> +++
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingUtil.java
>> Tue Aug 14 23:16:47 2007
>> @@ -22,6 +22,7 @@
>> import java.util.List;
>>
>> 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.SCABinding;
>> @@ -32,7 +33,7 @@
>> */
>> class BindingUtil {
>>
>> - private static Binding matchBinding(ComponentService service,
>> List<Binding> source, List<Binding> target) {
>> + private static Binding matchBinding(Component component,
>> ComponentService service, List<Binding> source, List<Binding> target) {
>> List<Binding> matched = new ArrayList<Binding>();
>> // Find the corresponding bindings from the service side
>> for (Binding binding : source) {
>> @@ -44,11 +45,7 @@
>> try {
>> cloned =
>> (Binding)((WireableBinding)binding).clone();
>> WireableBinding endpoint =
>> ((WireableBinding)cloned);
>> - // FIXME: This is a hack to get the target
>> component
>> - SCABinding scaBinding = service.getBinding(
>> SCABinding.class);
>> - if (scaBinding != null) {
>> - endpoint.setTargetComponent(
>> scaBinding.getComponent());
>> - }
>> + endpoint.setTargetComponent(component);
>> endpoint.setTargetComponentService(service);
>> endpoint.setTargetBinding(serviceBinding);
>> cloned.setURI(serviceBinding.getURI());
>> @@ -84,11 +81,11 @@
>> * @param service The component service
>> * @return Resolved binding
>> */
>> - static Binding resolveBindings(ComponentReference reference,
>> ComponentService service) {
>> + static Binding resolveBindings(ComponentReference reference,
>> Component component, ComponentService service) {
>> List<Binding> source = reference.getBindings();
>> List<Binding> target = service.getBindings();
>>
>> - return matchBinding(service, source, target);
>> + return matchBinding(component, service, source, target);
>>
>> }
>>
>> @@ -97,10 +94,10 @@
>> * @param service
>> * @return
>> */
>> - static Binding resolveCallbackBindings(ComponentReference reference,
>> ComponentService service) {
>> + static Binding resolveCallbackBindings(ComponentReference reference,
>> Component component, ComponentService service) {
>> List<Binding> source = reference.getCallback().getBindings();
>> List<Binding> target = service.getCallback().getBindings();
>>
>> - return matchBinding(service, source, target);
>> + return matchBinding(component, service, source, target);
>> }
>> }
>>
>> Modified:
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
>> (original)
>> +++
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
>> Tue Aug 14 23:16:47 2007
>> @@ -60,9 +60,9 @@
>> }
>>
>> includeBuilder = new CompositeIncludeBuilderImpl(monitor);
>> - wireBuilder = new CompositeWireBuilderImpl(assemblyFactory,
>> scaBindingFactory, interfaceContractMapper, monitor);
>> + wireBuilder = new CompositeWireBuilderImpl(assemblyFactory,
>> interfaceContractMapper, monitor);
>> cloneBuilder = new CompositeCloneBuilderImpl(monitor);
>> - configurationBuilder = new
>> CompositeConfigurationBuilderImpl(assemblyFactory, interfaceContractMapper,
>> monitor);
>> + configurationBuilder = new
>> CompositeConfigurationBuilderImpl(assemblyFactory, scaBindingFactory,
>> interfaceContractMapper, monitor);
>> }
>>
>> public void build(Composite composite) throws
>> CompositeBuilderException {
>>
>> Modified:
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java
>> (original)
>> +++
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java
>> Tue Aug 14 23:16:47 2007
>> @@ -19,9 +19,7 @@
>>
>> package org.apache.tuscany.sca.assembly.builder.impl;
>>
>> -import java.util.ArrayList;
>> import java.util.HashMap;
>> -import java.util.List;
>> import java.util.Map;
>>
>> import org.apache.tuscany.sca.assembly.AssemblyFactory;
>> @@ -37,8 +35,8 @@
>> import org.apache.tuscany.sca.assembly.Property;
>> import org.apache.tuscany.sca.assembly.Reference;
>> import org.apache.tuscany.sca.assembly.SCABinding;
>> +import org.apache.tuscany.sca.assembly.SCABindingFactory;
>> import org.apache.tuscany.sca.assembly.Service;
>> -import org.apache.tuscany.sca.assembly.WireableBinding;
>> import org.apache.tuscany.sca.assembly.builder.ComponentPreProcessor;
>> import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor;
>> import org.apache.tuscany.sca.assembly.builder.Problem.Severity;
>> @@ -50,11 +48,13 @@
>> private String CALLBACK_PREFIX = "$callback$.";
>>
>> private AssemblyFactory assemblyFactory;
>> + private SCABindingFactory scaBindingFactory;
>> private CompositeBuilderMonitor monitor;
>> private InterfaceContractMapper interfaceContractMapper;
>>
>> - public CompositeConfigurationBuilderImpl(AssemblyFactory
>> assemblyFactory, InterfaceContractMapper interfaceContractMapper,
>> CompositeBuilderMonitor monitor) {
>> + public CompositeConfigurationBuilderImpl(AssemblyFactory
>> assemblyFactory, SCABindingFactory scaBindingFactory,
>> InterfaceContractMapper interfaceContractMapper, CompositeBuilderMonitor
>> monitor) {
>> this.assemblyFactory = assemblyFactory;
>> + this.scaBindingFactory = scaBindingFactory;
>> this.interfaceContractMapper = interfaceContractMapper;
>> this.monitor = monitor;
>> }
>> @@ -98,12 +98,27 @@
>> }
>> }
>>
>> - // Set default binding names
>> + // Initialize service bindings
>> for (Service service : composite.getServices()) {
>> +
>> + // Create default SCA binding
>> + if (service.getBindings().isEmpty()) {
>> + SCABinding scaBinding =
>> scaBindingFactory.createSCABinding();
>> + service.getBindings().add(scaBinding);
>> + }
>> +
>> + // Initialize binding names and URIs
>> for (Binding binding : service.getBindings()) {
>> if (binding.getName() == null) {
>> binding.setName(service.getName());
>> }
>> + if (binding.getURI() == null) {
>> + if (uri == null) {
>> + binding.setURI(binding.getName());
>> + } else {
>> + binding.setURI(uri + '/' + binding.getName());
>> + }
>> + }
>> }
>> if (service.getCallback() != null) {
>> for (Binding binding : service.getCallback().getBindings())
>> {
>> @@ -113,12 +128,23 @@
>> }
>> }
>> }
>> +
>> + // Initialize reference bindings
>> for (Reference reference : composite.getReferences()) {
>> +
>> + // Create default SCA binding
>> + if (reference.getBindings().isEmpty()) {
>> + SCABinding scaBinding =
>> scaBindingFactory.createSCABinding();
>> + reference.getBindings().add(scaBinding);
>> + }
>> +
>> + // Set binding names
>> for (Binding binding : reference.getBindings()) {
>> if (binding.getName() == null) {
>> binding.setName(reference.getName());
>> }
>> }
>> +
>> if (reference.getCallback() != null) {
>> for (Binding binding : reference.getCallback().getBindings())
>> {
>> if (binding.getName() == null) {
>> @@ -148,17 +174,17 @@
>>
>> ((ComponentPreProcessor)component.getImplementation()).preProcess(component);
>> }
>>
>> + // Index properties, services and references
>> Map<String, Service> services = new HashMap<String,
>> Service>();
>> Map<String, Reference> references = new HashMap<String,
>> Reference>();
>> Map<String, Property> properties = new HashMap<String,
>> Property>();
>> - //Index properties, services and references
>> indexImplementationPropertiesServicesAndReferences(component,
>> services, references, properties);
>>
>> + // Index component services, references and properties
>> + // Also check for duplicates
>> Map<String, ComponentService> componentServices = new
>> HashMap<String, ComponentService>();
>> Map<String, ComponentReference> componentReferences = new
>> HashMap<String, ComponentReference>();
>> Map<String, ComponentProperty> componentProperties = new
>> HashMap<String, ComponentProperty>();
>> - //Index component services, references and properties
>> - // Also check for duplicates
>> indexComponentPropertiesServicesAndReferences(component,
>>
>> componentServices,
>>
>> componentReferences,
>> @@ -183,6 +209,58 @@
>> if (!(component.getImplementation() instanceof Composite)) {
>> createSelfReferences(component);
>> }
>> +
>> +
>> + // Initialize service bindings
>> + for (ComponentService componentService: component.getServices())
>> {
>> +
>> + // Create default SCA binding
>> + if (componentService.getBindings().isEmpty()) {
>> + SCABinding scaBinding =
>> scaBindingFactory.createSCABinding();
>> + componentService.getBindings().add(scaBinding);
>> + }
>> +
>> + // Set binding names and URIs
>> + for (Binding binding : componentService.getBindings()) {
>> + if (binding.getName() == null) {
>> + binding.setName(componentService.getName());
>> + }
>> + if (binding.getURI() == null) {
>> + binding.setURI(component.getURI() + '/' +
>> binding.getName());
>> + }
>> + }
>> + if (componentService.getCallback() != null) {
>> + for (Binding binding : componentService.getCallback().getBindings())
>> {
>> + if (binding.getName() == null) {
>> + binding.setName(componentService.getName());
>> + }
>> + }
>> + }
>> + }
>> +
>> + // Initialize reference bindings
>> + for (ComponentReference componentReference:
>> component.getReferences()) {
>> +
>> + // Create default SCA binding
>> + if (componentReference.getBindings().isEmpty()) {
>> + SCABinding scaBinding =
>> scaBindingFactory.createSCABinding();
>> + componentReference.getBindings().add(scaBinding);
>> + }
>> +
>> + // Set binding names
>> + for (Binding binding : componentReference.getBindings())
>> {
>> + if (binding.getName() == null) {
>> + binding.setName(componentReference.getName());
>> + }
>> + }
>> + if (componentReference.getCallback() != null) {
>> + for (Binding binding : componentReference.getCallback().getBindings())
>> {
>> + if (binding.getName() == null) {
>> + binding.setName(CALLBACK_PREFIX +
>> componentReference.getName());
>> + }
>> + }
>> + }
>> + }
>> }
>> }
>>
>> @@ -490,20 +568,6 @@
>> } else {
>> componentServices.put(componentService.getName(),
>> componentService);
>> }
>> -
>> - // Initialize binding names
>> - for (Binding binding : componentService.getBindings()) {
>> - if (binding.getName() == null) {
>> - binding.setName(componentService.getName());
>> - }
>> - }
>> - if (componentService.getCallback() != null) {
>> - for (Binding binding : componentService.getCallback().getBindings())
>> {
>> - if (binding.getName() == null) {
>> - binding.setName(componentService.getName());
>> - }
>> - }
>> - }
>> }
>> for (ComponentReference componentReference :
>> component.getReferences()) {
>> if (componentReferences.containsKey(
>> componentReference.getName())) {
>> @@ -513,20 +577,6 @@
>> } else {
>> componentReferences.put(componentReference.getName(),
>> componentReference);
>> }
>> -
>> - // Initialize binding names
>> - for (Binding binding : componentReference.getBindings()) {
>> - if (binding.getName() == null) {
>> - binding.setName(componentReference.getName());
>> - }
>> - }
>> - if (componentReference.getCallback() != null) {
>> - for (Binding binding : componentReference.getCallback().getBindings())
>> {
>> - if (binding.getName() == null) {
>> - binding.setName(CALLBACK_PREFIX +
>> componentReference.getName());
>> - }
>> - }
>> - }
>> }
>> for (ComponentProperty componentProperty :
>> component.getProperties()) {
>> if (componentProperties.containsKey(componentProperty.getName()))
>> {
>> @@ -723,13 +773,10 @@
>> componentReference.setName("$self$." + service.getName());
>> componentReference.getBindings().addAll(service.getBindings());
>> componentReference.setCallback(service.getCallback());
>> - /*
>> ComponentService componentService =
>> assemblyFactory.createComponentService();
>> - componentService.setName(component.getName() + "/" +
>> service.getName());
>> + componentService.setName(component.getName() + '/' +
>> service.getName());
>> componentService.setUnresolved(true);
>> componentReference.getTargets().add(componentService);
>> - */
>> - componentReference.getTargets().add(service);
>> componentReference.getPolicySets().addAll(service.getPolicySets
>> ());
>> componentReference.getRequiredIntents().addAll(
>> service.getRequiredIntents());
>>
>> @@ -784,6 +831,7 @@
>> // Get the inner most promoted service
>> ComponentService promotedService =
>> getPromotedComponentService(compositeService);
>> if (promotedService != null) {
>> + Component promotedComponent =
>> getPromotedComponent(compositeService);
>>
>> // Default to use the interface from the
>> promoted service
>> if (compositeService.getInterfaceContract()
>> == null) {
>> @@ -795,47 +843,30 @@
>>
>> // Create a new component service to
>> represent this composite
>> // service on the promoted component
>> - SCABinding scaBinding =
>> promotedService.getBinding(SCABinding.class);
>> - if (scaBinding != null) {
>> - Component promotedComponent =
>> scaBinding.getComponent();
>> - ComponentService newComponentService =
>> assemblyFactory.createComponentService();
>> - newComponentService.setName("$promoted$."
>> + compositeService.getName());
>>
>> - //newComponentService.setService(compositeService);
>> - promotedComponent.getServices
>> ().add(newComponentService);
>> - newComponentService.getBindings
>> ().add(scaBinding);
>> - newComponentService.getBindings().addAll(
>> compositeService.getBindings());
>> - newComponentService.setInterfaceContract(
>> compositeService.getInterfaceContract());
>> - if (compositeService.getInterfaceContract()
>> != null && // can be null in unit tests
>> - compositeService.getInterfaceContract().getCallbackInterface()
>> != null) {
>> - SCABinding scaCallbackBinding =
>> -
>> promotedService.getCallbackBinding(SCABinding.class);
>> - newComponentService.setCallback(
>> assemblyFactory.createCallback());
>> - if (scaCallbackBinding != null) {
>> - newComponentService.getCallback
>> ().getBindings().add(scaCallbackBinding);
>> - }
>> - if (compositeService.getCallback() !=
>> null) {
>> - newComponentService.getCallback
>> ().getBindings().addAll(compositeService
>>
>> - .getCallback().getBindings());
>> - }
>> + ComponentService newComponentService =
>> assemblyFactory.createComponentService();
>> + newComponentService.setName("$promoted$." +
>> compositeService.getName());
>> + promotedComponent.getServices
>> ().add(newComponentService);
>> + newComponentService.setService(
>> promotedService.getService());
>> + newComponentService.getBindings().addAll(
>> compositeService.getBindings());
>> + newComponentService.setInterfaceContract(
>> compositeService.getInterfaceContract());
>> + if (compositeService.getInterfaceContract()
>> != null && compositeService.getInterfaceContract().getCallbackInterface()
>> != null) {
>> + newComponentService.setCallback(
>> assemblyFactory.createCallback());
>> + if (compositeService.getCallback() !=
>> null) {
>> + newComponentService.getCallback
>> ().getBindings().addAll(
>> +
>> compositeService.getCallback().getBindings());
>> }
>> -
>> - // FIXME: [rfeng] Set the service to
>> promoted
>> - newComponentService.setService(
>> promotedService.getService());
>> -
>> - // Create a self-reference for the
>> promoted service
>> - ComponentReference selfRef =
>> createSelfReference(promotedComponent, newComponentService);
>> - Binding binding =
>> BindingUtil.resolveBindings(selfRef, newComponentService);
>> - selfRef.getBindings().clear();
>> - selfRef.getBindings().add(binding);
>> - selfRef.getTargets().clear();
>> -
>> - // Change the composite service to now
>> promote the newly
>> - // created component service directly
>> - compositeService.setPromotedService
>> (newComponentService);
>> -
>> - } else {
>> - warning("Promoted component service not
>> found: " + promotedService.getName(), composite);
>> }
>> +
>> + // Create a self-reference for the promoted
>> service
>> + ComponentReference selfReference =
>> createSelfReference(promotedComponent, newComponentService);
>> + Binding binding = BindingUtil.resolveBindings(selfReference,
>> promotedComponent, newComponentService);
>> + selfReference.getBindings().clear();
>> + selfReference.getBindings().add(binding);
>> + selfReference.getTargets().clear();
>> +
>> + // Change the composite service to now
>> promote the newly
>> + // created component service directly
>> + compositeService.setPromotedService
>> (newComponentService);
>> }
>> }
>> }
>> @@ -849,6 +880,7 @@
>> // Get the inner most promoted service
>> ComponentService promotedService =
>> getPromotedComponentService(compositeService);
>> if (promotedService != null) {
>> + Component promotedComponent =
>> getPromotedComponent(compositeService);
>>
>> // Default to use the interface from the promoted service
>> if (compositeService.getInterfaceContract() == null &&
>> promotedService.getInterfaceContract() != null) {
>> @@ -857,38 +889,23 @@
>>
>> // Create a new component service to represent this
>> composite
>> // service on the promoted component
>> - SCABinding scaBinding = promotedService.getBinding(
>> SCABinding.class);
>> - if (scaBinding != null) {
>> - Component promotedComponent = scaBinding.getComponent
>> ();
>> - ComponentService newComponentService =
>> assemblyFactory.createComponentService();
>> - newComponentService.setName("$promoted$." +
>> compositeService.getName());
>> - //newComponentService.setService(compositeService);
>> - promotedComponent.getServices
>> ().add(newComponentService);
>> - newComponentService.getBindings().add(scaBinding);
>> - newComponentService.getBindings().addAll(
>> compositeService.getBindings());
>> - newComponentService.setInterfaceContract(
>> compositeService.getInterfaceContract());
>> - if (compositeService.getInterfaceContract() != null
>> && // can be null in unit tests
>> - compositeService.getInterfaceContract().getCallbackInterface()
>> != null) {
>> - SCABinding scaCallbackBinding =
>> promotedService.getCallbackBinding(SCABinding.class);
>> - newComponentService.setCallback(
>> assemblyFactory.createCallback());
>> - if (scaCallbackBinding != null) {
>> - newComponentService.getCallback
>> ().getBindings().add(scaCallbackBinding);
>> - }
>> - if (compositeService.getCallback() != null) {
>> - newComponentService.getCallback
>> ().getBindings().addAll(compositeService.getCallback()
>> - .getBindings());
>> - }
>> + ComponentService newComponentService =
>> assemblyFactory.createComponentService();
>> + newComponentService.setName("$promoted$." +
>> compositeService.getName());
>> + promotedComponent.getServices().add(newComponentService);
>> + newComponentService.setService(promotedService.getService
>> ());
>> + newComponentService.getBindings().addAll(
>> compositeService.getBindings());
>> + newComponentService.setInterfaceContract(
>> compositeService.getInterfaceContract());
>> + if (compositeService.getInterfaceContract() != null &&
>> compositeService.getInterfaceContract().getCallbackInterface() != null) {
>> + newComponentService.setCallback(
>> assemblyFactory.createCallback());
>> + if (compositeService.getCallback() != null) {
>> + newComponentService.getCallback
>> ().getBindings().addAll(
>> +
>> compositeService.getCallback().getBindings());
>> }
>> -
>> - // FIXME: [rfeng] Set the service to promoted
>> - newComponentService.setService(
>> promotedService.getService());
>> -
>> - // Change the composite service to now promote the
>> newly
>> - // created component service directly
>> - compositeService.setPromotedService
>> (newComponentService);
>> - } else {
>> - warning("Promoted component service not found: " +
>> promotedService.getName(), composite);
>> }
>> +
>> + // Change the composite service to now promote the newly
>> + // created component service directly
>> + compositeService.setPromotedService(newComponentService);
>> }
>> }
>> }
>> @@ -913,6 +930,34 @@
>>
>> // Found a non-composite service
>> return componentService;
>> + }
>> + } else {
>> +
>> + // No promoted service
>> + return null;
>> + }
>> + }
>> +
>> + /**
>> + * Follow a service promotion chain down to the inner most (non
>> composite)
>> + * component.
>> + *
>> + * @param compositeService
>> + * @return
>> + */
>> + private Component getPromotedComponent(CompositeService
>> compositeService) {
>> + ComponentService componentService =
>> compositeService.getPromotedService();
>> + if (componentService != null) {
>> + Service service = componentService.getService();
>> + if (componentService.getName() != null && service instanceof
>> CompositeService) {
>> +
>> + // Continue to follow the service promotion chain
>> + return getPromotedComponent((CompositeService)service);
>> +
>> + } else {
>> +
>> + // Found a non-composite service
>> + return compositeService.getPromotedComponent();
>> }
>> } else {
>>
>>
>> Modified:
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java
>> (original)
>> +++
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeWireBuilderImpl.java
>> Tue Aug 14 23:16:47 2007
>> @@ -40,7 +40,6 @@
>> import org.apache.tuscany.sca.assembly.Property;
>> import org.apache.tuscany.sca.assembly.Reference;
>> import org.apache.tuscany.sca.assembly.SCABinding;
>> -import org.apache.tuscany.sca.assembly.SCABindingFactory;
>> import org.apache.tuscany.sca.assembly.Service;
>> import org.apache.tuscany.sca.assembly.Wire;
>> import org.apache.tuscany.sca.assembly.WireableBinding;
>> @@ -52,12 +51,10 @@
>>
>> private CompositeBuilderMonitor monitor;
>> private AssemblyFactory assemblyFactory;
>> - private SCABindingFactory scaBindingFactory;
>> private InterfaceContractMapper interfaceContractMapper;
>>
>> - public CompositeWireBuilderImpl(AssemblyFactory assemblyFactory,
>> SCABindingFactory scaBindingFactory, InterfaceContractMapper
>> interfaceContractMapper, CompositeBuilderMonitor monitor) {
>> + public CompositeWireBuilderImpl(AssemblyFactory assemblyFactory,
>> InterfaceContractMapper interfaceContractMapper, CompositeBuilderMonitor
>> monitor) {
>> this.assemblyFactory = assemblyFactory;
>> - this.scaBindingFactory = scaBindingFactory;
>> this.interfaceContractMapper = interfaceContractMapper;
>> this.monitor = monitor;
>> }
>> @@ -78,20 +75,19 @@
>> }
>> }
>>
>> - // Index and bind all component services and references
>> + // Index components, services and references
>> + Map<String, Component> components = new HashMap<String,
>> Component>();
>> Map<String, ComponentService> componentServices = new
>> HashMap<String, ComponentService>();
>> Map<String, ComponentReference> componentReferences = new
>> HashMap<String, ComponentReference>();
>> -
>> - // Create SCA bindings on all component services and references
>> - createSCABindings(composite, componentServices,
>> componentReferences);
>> + indexComponentsServicesAndReferences(composite, components,
>> componentServices, componentReferences);
>>
>> // Connect composite services and references to the component
>> // services and references that they promote
>> - connectCompositeServices(composite, componentServices);
>> + connectCompositeServices(composite, components,
>> componentServices);
>> connectCompositeReferences(composite, componentReferences);
>>
>> // Connect component references to their targets
>> - connectComponentReferences(composite, componentServices,
>> componentReferences);
>> + connectComponentReferences(composite, components,
>> componentServices, componentReferences);
>>
>> // Connect component references as described in wires
>> connectWires(composite, componentServices, componentReferences);
>> @@ -124,20 +120,21 @@
>> }
>> }
>> }
>> -
>> +
>> /**
>> - * Create SCA bindings for component services and references.
>> - *
>> + * Index components, services and references inside a composite.
>> * @param composite
>> + * @param components
>> * @param componentServices
>> * @param componentReferences
>> - * @param problems
>> */
>> - private void createSCABindings(Composite composite,
>> - Map<String, ComponentService>
>> componentServices,
>> - Map<String, ComponentReference>
>> componentReferences) {
>> -
>> + private void indexComponentsServicesAndReferences(Composite
>> composite,
>> + Map<String, Component>
>> components,
>> + Map<String,
>> ComponentService> componentServices,
>> + Map<String,
>> ComponentReference> componentReferences) {
>> +
>> for (Component component : composite.getComponents()) {
>> + components.put(component.getName(), component);
>> int i = 0;
>> for (ComponentService componentService :
>> component.getServices()) {
>> String uri = component.getName() + '/' +
>> componentService.getName();
>> @@ -146,36 +143,12 @@
>> componentServices.put(component.getName(),
>> componentService);
>> }
>> i++;
>> -
>> - // Create and configure an SCA binding for the service
>> - if (componentService.getBindings().isEmpty()) {
>> - SCABinding scaBinding = componentService.getBinding(
>> SCABinding.class);
>> - if (scaBinding == null) {
>> - scaBinding = scaBindingFactory.createSCABinding
>> ();
>> - scaBinding.setName(componentService.getName());
>> - componentService.getBindings().add(scaBinding);
>> - }
>> - scaBinding.setComponent(component);
>> - scaBinding.setURI(uri);
>> - }
>> }
>> for (ComponentReference componentReference :
>> component.getReferences()) {
>> String uri = component.getName() + '/' +
>> componentReference.getName();
>> componentReferences.put(uri, componentReference);
>> -
>> - if (componentReference.getBindings().isEmpty()) {
>> - // Create and configure an SCA binding for the
>> reference
>> - SCABinding scaBinding = componentReference.getBinding
>> (SCABinding.class);
>> - if (scaBinding == null) {
>> - scaBinding = scaBindingFactory.createSCABinding
>> ();
>> - scaBinding.setName(componentReference.getName());
>> - componentReference.getBindings().add(scaBinding);
>> - }
>> - scaBinding.setComponent(component);
>> - }
>> }
>> }
>> -
>> }
>>
>> /**
>> @@ -196,7 +169,7 @@
>> * @param componentServices
>> * @param problems
>> */
>> - private void connectCompositeServices(Composite composite,
>> Map<String, ComponentService> componentServices) {
>> + private void connectCompositeServices(Composite composite,
>> Map<String, Component> components, Map<String, ComponentService>
>> componentServices) {
>>
>> // Propagate interfaces from inner composite components' services
>> to
>> // their component services
>> @@ -216,13 +189,24 @@
>> // Connect composite services to the component services that they
>> // promote
>> for (Service service : composite.getServices()) {
>> -
>> CompositeService compositeService =
>> (CompositeService)service;
>> ComponentService componentService =
>> compositeService.getPromotedService();
>> if (componentService != null && componentService.isUnresolved())
>> {
>> - ComponentService promotedService = componentServices.get(
>> componentService.getName());
>> +
>> + String promotedComponentName =
>> compositeService.getPromotedComponent().getName();
>> + String promotedServiceName;
>> + if (componentService.getName() != null) {
>> + promotedServiceName = promotedComponentName + '/' +
>> componentService.getName();
>> + } else {
>> + promotedServiceName = promotedComponentName;
>> + }
>> + ComponentService promotedService = componentServices.get
>> (promotedServiceName);
>> if (promotedService != null) {
>>
>> + // Point to the resolved component
>> + Component promotedComponent = components.get
>> (promotedComponentName);
>> + compositeService.setPromotedComponent
>> (promotedComponent);
>> +
>> // Point to the resolved component service
>> compositeService.setPromotedService(promotedService);
>>
>> @@ -233,7 +217,7 @@
>> }
>>
>> } else {
>> - warning("Promoted component service not found: " +
>> componentService.getName(), composite);
>> + warning("Promoted component service not found: " +
>> promotedServiceName, composite);
>> }
>> }
>> }
>> @@ -303,24 +287,43 @@
>> * @param problems
>> */
>> private void connectComponentReferences(Composite composite,
>> + Map<String, Component>
>> components,
>> Map<String, ComponentService>
>> componentServices,
>> Map<String,
>> ComponentReference> componentReferences) {
>> +
>> + // Represents a target component and service
>> + class Target {
>> + Component component;
>> + ComponentService service;
>> +
>> + Target(Component component, ComponentService service) {
>> + this.component = component;
>> + this.service = service;
>> + }
>> +
>> + Component getComponent() {
>> + return component;
>> + }
>> +
>> + ComponentService getService() {
>> + return service;
>> + }
>> + };
>>
>> for (ComponentReference componentReference :
>> componentReferences.values()) {
>> - List<ComponentService> targets =
>> componentReference.getTargets();
>> + List<Target> targets = new ArrayList<Target>();
>>
>> if (componentReference.isAutowire()) {
>>
>> // Find suitable targets in the current composite for an
>> // autowired reference
>> Multiplicity multiplicity =
>> componentReference.getMultiplicity();
>> - for (Component component : composite.getComponents()) {
>> - for (ComponentService componentService :
>> component.getServices()) {
>> - if (componentReference.getInterfaceContract() ==
>> null || interfaceContractMapper
>> - .isCompatible(
>> componentReference.getInterfaceContract(), componentService
>> - .getInterfaceContract())) {
>> -
>> - targets.add(componentService);
>> + for (Component targetComponent : composite.getComponents())
>> {
>> + for (ComponentService targetComponentService :
>> targetComponent.getServices()) {
>> + if (componentReference.getInterfaceContract() ==
>> null ||
>> + interfaceContractMapper.isCompatible(
>> componentReference.getInterfaceContract(),
>> targetComponentService.getInterfaceContract())) {
>> + Target target = new Target(targetComponent,
>> targetComponentService);
>> + targets.add(target);
>> if (multiplicity == Multiplicity.ZERO_ONE ||
>> multiplicity == Multiplicity.ONE_ONE) {
>> break;
>> }
>> @@ -328,108 +331,119 @@
>> }
>> }
>>
>> - } else if (!targets.isEmpty()) {
>> + } else if (!componentReference.getTargets().isEmpty()) {
>>
>> // Resolve targets specified on the component reference
>> - for (int i = 0, n = targets.size(); i < n; i++) {
>> - ComponentService target = targets.get(i);
>> - if (target.isUnresolved()) {
>> - ComponentService resolved = componentServices.get
>> (target.getName());
>> - if (resolved != null) {
>> -
>> - // Check that the target component service
>> provides
>> - // a superset of
>> - // the component reference interface
>> - if (componentReference.getInterfaceContract()
>> == null || interfaceContractMapper
>> - .isCompatible(
>> componentReference.getInterfaceContract(), resolved
>> - .getInterfaceContract())) {
>> -
>> - targets.set(i, resolved);
>> - } else {
>> - warning("Incompatible interfaces on
>> component reference and target: " + componentReference
>> - .getName()
>> - + " : "
>> - + target.getName(),
>> - composite);
>> - }
>> + for (ComponentService componentService :
>> componentReference.getTargets()) {
>> +
>> + // Resolve the target component and service
>> + String name = componentService.getName();
>> + ComponentService targetComponentService =
>> componentServices.get(name);
>> + Component targetComponent;
>> + int s = name.indexOf('/');
>> + if (s == -1) {
>> + targetComponent = components.get(name);
>> + } else {
>> + targetComponent = components.get(name.substring(0,
>> s));
>> + }
>> +
>> + if (targetComponentService != null) {
>> +
>> + // Check that the target component service
>> provides
>> + // a superset of the component reference
>> interface
>> + if (componentReference.getInterfaceContract() ==
>> null ||
>> + interfaceContractMapper.isCompatible(
>> componentReference.getInterfaceContract(),
>> targetComponentService.getInterfaceContract())) {
>> +
>> + Target target = new Target(targetComponent,
>> targetComponentService);
>> + targets.add(target);
>> } else {
>> - // put all the reference bindings into the
>> target so that they
>> - // can be used for comparison when the target
>> is resolved at runtime
>> - target.getBindings().addAll(
>> componentReference.getBindings());
>> -
>> - warning("Component reference target not
>> found, it might be a remote service: " + target.getName(), composite);
>> + warning("Incompatible interfaces on component
>> reference and target: " + componentReference
>> + .getName()
>> + + " : "
>> + + componentService.getName(),
>> + composite);
>> }
>> + } else {
>> + warning("Component reference target not found, it
>> might be a remote service: " + componentService.getName(), composite);
>> }
>> }
>> } else if (componentReference.getReference() != null) {
>>
>> // Resolve targets from the corresponding reference in
>> the
>> // componentType
>> - for (ComponentService target :
>> componentReference.getReference().getTargets()) {
>> - if (target.isUnresolved()) {
>> - ComponentService resolved = componentServices.get
>> (target.getName());
>> - if (resolved != null) {
>> -
>> - // Check that the target component service
>> provides
>> - // a superset of
>> - // the component reference interface
>> - if (componentReference.getInterfaceContract()
>> == null || interfaceContractMapper
>> - .isCompatible(
>> componentReference.getInterfaceContract(), resolved
>> - .getInterfaceContract())) {
>> -
>> - targets.add(resolved);
>> - } else {
>> - warning("Incompatible interfaces on
>> component reference and target: " + componentReference
>> - .getName()
>> - + " : "
>> - + target.getName(),
>> - composite);
>> - }
>> + for (ComponentService componentService :
>> componentReference.getReference().getTargets()) {
>> +
>> + // Resolve the target component and service
>> + String name = componentService.getName();
>> + ComponentService targetComponentService =
>> componentServices.get(name);
>> + Component targetComponent;
>> + int s = name.indexOf('/');
>> + if (s == -1) {
>> + targetComponent = components.get(name);
>> + } else {
>> + targetComponent = components.get(name.substring(0,
>> s));
>> + }
>> +
>> + if (targetComponentService != null) {
>> +
>> + // Check that the target component service
>> provides
>> + // a superset of
>> + // the component reference interface
>> + if (componentReference.getInterfaceContract() ==
>> null ||
>> + interfaceContractMapper.isCompatible(
>> componentReference.getInterfaceContract(),
>> targetComponentService.getInterfaceContract())) {
>> +
>> + Target target = new Target(targetComponent,
>> targetComponentService);
>> + targets.add(target);
>> } else {
>> - warning("Reference target not found: " +
>> target.getName(), composite);
>> + warning("Incompatible interfaces on component
>> reference and target: " + componentReference
>> + .getName()
>> + + " : "
>> + + componentService.getName(),
>> + composite);
>> }
>> + } else {
>> + warning("Reference target not found: " +
>> componentService.getName(), composite);
>> }
>> }
>> }
>> - // [rfeng] For any targets, select the matching binding for
>> the reference
>> +
>> + // Select the reference bindings matching the target service
>> bindings
>> List<Binding> selectedBindings = new ArrayList<Binding>();
>>
>> // Handle callback
>> boolean bidirectional = false;
>> - if (componentReference.getInterfaceContract() != null &&
>> componentReference.getInterfaceContract()
>> - .getCallbackInterface() != null) {
>> + if (componentReference.getInterfaceContract() != null &&
>> componentReference.getInterfaceContract().getCallbackInterface() != null)
>> {
>> bidirectional = true;
>> }
>> List<Binding> selectedCallbackBindings = bidirectional ? new
>> ArrayList<Binding>() : null;
>>
>> - for (ComponentService service : targets) {
>> - ComponentService target = service;
>> -
>> - // if the target is unresolved it will now have a list of
>> the reference
>> - // bindings so ignore it
>> - if (!target.isUnresolved()){
>> + for (Target target : targets) {
>>
>> - if (service.getService() instanceof CompositeService)
>> {
>> - // Normalize the service to be the final target
>> - target =
>> ((CompositeService)service.getService()).getPromotedService();
>> - }
>> - Binding selected = BindingUtil.resolveBindings(componentReference,
>> target);
>> - if (selected == null) {
>> - warning("Component reference doesn't have a
>> matching binding", componentReference);
>> - } else {
>> - selectedBindings.add(selected);
>> - }
>> - if (bidirectional) {
>> - Binding selectedCallback =
>> BindingUtil.resolveCallbackBindings(componentReference, target);
>> - if (selectedCallback != null) {
>> - selectedCallbackBindings.add
>> (selectedCallback);
>> - }
>> + Component targetComponent = target.getComponent();
>> + ComponentService targetComponentService =
>> target.getService();
>> + if (targetComponentService.getService() instanceof
>> CompositeService) {
>> +
>> + // Find the promoted component service
>> + targetComponentService =
>> ((CompositeService)targetComponentService.getService()).getPromotedService();
>> + }
>> +
>> + // Match the binding against the bindings of the target
>> service
>> + Binding selected = BindingUtil.resolveBindings(componentReference,
>> targetComponent, targetComponentService);
>> + if (selected == null) {
>> + warning("Component reference doesn't have a matching
>> binding", componentReference);
>> + } else {
>> + selectedBindings.add(selected);
>> + }
>> + if (bidirectional) {
>> + Binding selectedCallback =
>> BindingUtil.resolveCallbackBindings(componentReference, targetComponent,
>> targetComponentService);
>> + if (selectedCallback != null) {
>> + selectedCallbackBindings.add(selectedCallback);
>> }
>> }
>> -
>> }
>>
>> if (!targets.isEmpty()) {
>> +
>> // Add all the effective bindings
>> componentReference.getBindings().clear();
>> componentReference.getBindings
>> ().addAll(selectedBindings);
>> @@ -437,10 +451,6 @@
>> componentReference.getCallback
>> ().getBindings().clear();
>> componentReference.getCallback
>> ().getBindings().addAll(selectedCallbackBindings);
>> }
>> - // Remove the targets since they have been normalized as
>> bindings
>> - // TODO - leave then in for the case where there are
>> still unresolved
>> - // targets that will be resolved at runtime
>> - //targets.clear();
>> }
>> }
>> }
>>
>> Modified:
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java
>> (original)
>> +++
>> incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java
>> Tue Aug 14 23:16:47 2007
>> @@ -19,6 +19,7 @@
>>
>> package org.apache.tuscany.sca.assembly.impl;
>>
>> +import org.apache.tuscany.sca.assembly.Component;
>> import org.apache.tuscany.sca.assembly.ComponentService;
>> import org.apache.tuscany.sca.assembly.CompositeService;
>>
>> @@ -29,6 +30,7 @@
>> */
>> public class CompositeServiceImpl extends ServiceImpl implements
>> CompositeService, Cloneable {
>> private ComponentService promotedService;
>> + private Component promotedComponent;
>>
>> /**
>> * Constructs a new composite service.
>> @@ -48,4 +50,13 @@
>> public void setPromotedService(ComponentService promotedService) {
>> this.promotedService = promotedService;
>> }
>> +
>> + public Component getPromotedComponent() {
>> + return promotedComponent;
>> + }
>> +
>> + public void setPromotedComponent(Component promotedComponent) {
>> + this.promotedComponent = promotedComponent;
>> + }
>> +
>> }
>>
>> Modified:
>> incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomServiceBindingProvider.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomServiceBindingProvider.java?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomServiceBindingProvider.java
>> (original)
>> +++
>> incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/AtomServiceBindingProvider.java
>> Tue Aug 14 23:16:47 2007
>> @@ -51,9 +51,6 @@
>> this.servletHost = servletHost;
>> this.messageFactory = messageFactory;
>> uri = binding.getURI();
>> - if (uri == null) {
>> - uri = "/" + this.component.getName();
>> - }
>> }
>>
>> public InterfaceContract getBindingInterfaceContract() {
>>
>> Modified:
>> incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSServiceBindingProvider.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSServiceBindingProvider.java?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSServiceBindingProvider.java
>> (original)
>> +++
>> incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/RSSServiceBindingProvider.java
>> Tue Aug 14 23:16:47 2007
>> @@ -51,9 +51,6 @@
>> this.servletHost = servletHost;
>> this.messageFactory = messageFactory;
>> uri = binding.getURI();
>> - if (uri == null) {
>> - uri = "/" + this.component.getName();
>> - }
>> }
>>
>> public InterfaceContract getBindingInterfaceContract() {
>>
>> Modified:
>> incubator/tuscany/java/sca/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCService.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCService.java?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCService.java
>> (original)
>> +++
>> incubator/tuscany/java/sca/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCService.java
>> Tue Aug 14 23:16:47 2007
>> @@ -71,16 +71,11 @@
>> Object instance = component.createSelfReference
>> (serviceInterface).getService();
>> JSONRPCServiceServlet serviceServlet = new JSONRPCServiceServlet(
>> binding.getName(), serviceInterface, instance);
>> int port;
>> - if (binding.getURI() != null) {
>> - servletHost.addServletMapping(binding.getURI(),
>> serviceServlet);
>> - URI uri = URI.create(binding.getURI());
>> - port = uri.getPort();
>> - if (port == -1)
>> - port = 8080;
>> - } else {
>> - servletHost.addServletMapping(SERVICE_PREFIX +
>> binding.getName(), serviceServlet);
>> + servletHost.addServletMapping(binding.getURI(), serviceServlet);
>> + URI uri = URI.create(binding.getURI());
>> + port = uri.getPort();
>> + if (port == -1)
>> port = 8080;
>> - }
>>
>> // get the ScaDomainScriptServlet, if it doesn't yet exist create
>> one
>> // this uses removeServletMapping / addServletMapping as theres
>> no getServletMapping facility
>> @@ -100,16 +95,11 @@
>>
>> // Unregister from the service servlet mapping
>> int port;
>> - if (binding.getURI() != null) {
>> - servletHost.removeServletMapping(binding.getURI());
>> - URI uri = URI.create(binding.getURI());
>> - port = uri.getPort();
>> - if (port == -1)
>> - port = 8080;
>> - } else {
>> - servletHost.removeServletMapping(SERVICE_PREFIX +
>> binding.getName());
>> + servletHost.removeServletMapping(binding.getURI());
>> + URI uri = URI.create(binding.getURI());
>> + port = uri.getPort();
>> + if (port == -1)
>> port = 8080;
>> - }
>>
>> // Unregister the service from the scaDomain script servlet
>> // don't unregister the scaDomain script servlet if it still has
>> other service names
>>
>> Modified:
>> incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java
>> (original)
>> +++
>> incubator/tuscany/java/sca/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java
>> Tue Aug 14 23:16:47 2007
>> @@ -118,8 +118,8 @@
>> SCABinding referenceSCABinding = (SCABinding)
>> composite.getComponents
>> ().get(0).getReferences().get(0).getBindings().get(0);
>> SCABinding serviceSCABinding = (SCABinding)
>> composite.getComponents
>> ().get(1).getServices().get(0).getBindings().get(0);
>>
>> - Assert.assertEquals("addService", referenceSCABinding.getName());
>> - Assert.assertEquals(null, serviceSCABinding.getName());
>> + Assert.assertNotNull(referenceSCABinding);
>> + Assert.assertNotNull(serviceSCABinding);
>>
>> //new PrintUtil(System.out).print(composite);
>> }
>>
>> Modified:
>> incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java
>> (original)
>> +++
>> incubator/tuscany/java/sca/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java
>> Tue Aug 14 23:16:47 2007
>> @@ -42,8 +42,6 @@
>> private List<Intent> requiredIntents = new ArrayList<Intent>();
>> private List<Object> extensions = new ArrayList<Object>();
>>
>> - private Component component;
>> -
>> private Component targetComponent;
>> private ComponentService targetComponentService;
>> private Binding targetBinding;
>> @@ -77,14 +75,6 @@
>> protected SCABindingImpl() {
>> }
>>
>> - public Component getComponent() {
>> - return component;
>> - }
>> -
>> - public void setComponent(Component component) {
>> - this.component = component;
>> - }
>> -
>> public String getName() {
>> return name;
>> }
>>
>> Modified:
>> incubator/tuscany/java/sca/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java
>> (original)
>> +++
>> incubator/tuscany/java/sca/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java
>> Tue Aug 14 23:16:47 2007
>> @@ -107,8 +107,8 @@
>> SCABinding referenceSCABinding = (SCABinding)
>> composite.getComponents
>> ().get(0).getReferences().get(0).getBindings().get(0);
>> SCABinding serviceSCABinding = (SCABinding)
>> composite.getComponents
>> ().get(1).getServices().get(0).getBindings().get(0);
>>
>> - Assert.assertEquals("addService",
>> referenceSCABinding.getName());
>> - Assert.assertEquals(null, serviceSCABinding.getName());
>> + Assert.assertNotNull(referenceSCABinding);
>> + Assert.assertNotNull(serviceSCABinding);
>> } catch (Exception ex) {
>> Assert.fail(ex.getMessage());
>> }
>>
>> Modified:
>> incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceProvider.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceProvider.java?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceProvider.java
>> (original)
>> +++
>> incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceProvider.java
>> Tue Aug 14 23:16:47 2007
>> @@ -146,19 +146,13 @@
>> wsdlURI = getEndpoint(wsBinding.getPort());
>> }
>> if (wsdlURI != null && wsdlURI.isAbsolute()) {
>> - if (wsBinding.getURI() != null && (wsBinding.getServiceName()
>> != null && wsBinding.getBindingName() == null)) {
>> - throw new IllegalArgumentException("binding URI cannot be
>> used with absolute WSDL endpoint URI");
>> - }
>> return URI.create(wsdlURI.toString());
>> }
>>
>> // either there is no wsdl port endpoint URI or that URI is
>> relative
>>
>> - URI bindingURI = null;
>> - if (wsBinding.getURI() != null) {
>> - bindingURI = URI.create(wsBinding.getURI());
>> - }
>> - if (bindingURI != null && bindingURI.isAbsolute()) {
>> + URI bindingURI = URI.create(wsBinding.getURI());
>> + if (bindingURI.isAbsolute()) {
>> // there is an absoulte uri specified on the binding: <
>> binding.ws
>> // uri="xxx"
>> if (wsdlURI != null) {
>> @@ -167,36 +161,10 @@
>> } else {
>> return bindingURI;
>> }
>> - }
>> -
>> - // both the WSDL endpoint and binding uri are either unspecified
>> or relative
>> - // so the endpoint is based on the component name and service
>> binding URI
>> -
>> - URI componentURI = URI.create(component.getName());
>> -
>> - String actualURI;
>> - if (componentURI.isAbsolute()) {
>> - actualURI = componentURI.toString();
>> } else {
>> - actualURI = baseURI + "/" + componentURI;
>> + bindingURI = URI.create(baseURI + "/" + wsBinding.getURI());
>> + return bindingURI;
>> }
>> -
>> - // for service bindings with multiple services, the default
>> binding URI is the binding name
>> - if (bindingURI == null && component.getServices().size() > 1) {
>> - bindingURI = URI.create(wsBinding.getName());
>> - }
>> -
>> - // add any relative binding URI
>> - if (bindingURI != null) {
>> - actualURI += "/" + bindingURI;
>> - }
>> -
>> - // add any relative WSDL port URI
>> - if (wsdlURI != null) {
>> - actualURI += "/" + wsdlURI.toString();
>> - }
>> -
>> - return URI.create(actualURI);
>> }
>>
>> /**
>>
>> Modified:
>> incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDL.composite
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDL.composite?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDL.composite
>> (original)
>> +++
>> incubator/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldNoWSDL.composite
>> Tue Aug 14 23:16:47 2007
>> @@ -37,7 +37,7 @@
>> <reference name="helloWorldWS"
>> promote="HelloWorldComponent/helloWorldWS">
>> <!-- interface.wsdl interface="
>> http://helloworld#wsdl.interface(HelloWorld)" / -->
>> <!-- interface.java interface="
>> org.apache.tuscany.sca.binding.axis2.itests.HelloWorld" / -->
>> - <binding.ws uri="
>> http://localhost:8085/HelloWorldService/helloWorld"/>
>> + <binding.ws uri="http://localhost:8085/helloWorld"/>
>> </reference>
>>
>> <service name="Echo" promote="EchoService">
>> @@ -54,7 +54,7 @@
>> </component>
>>
>> <reference name="echoWS" promote="EchoComponent/echoWS">
>> - <binding.ws uri="http://localhost:8085/EchoService/Echo"/>
>> + <binding.ws uri="http://localhost:8085/Echo"/>
>> </reference>
>>
>> </composite>
>>
>> Modified:
>> incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanReferenceImpl.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanReferenceImpl.java?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanReferenceImpl.java
>> (original)
>> +++
>> incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanReferenceImpl.java
>> Tue Aug 14 23:16:47 2007
>> @@ -20,7 +20,6 @@
>>
>> import org.apache.tuscany.sca.assembly.Reference;
>> import org.apache.tuscany.sca.assembly.SCABinding;
>> -import org.apache.tuscany.sca.assembly.WireableBinding;
>> import org.springframework.beans.factory.config.RuntimeBeanReference;
>>
>> /**
>> @@ -39,11 +38,12 @@
>>
>> public String getBeanName() {
>> SCABinding binding = reference.getBinding(SCABinding.class);
>> - if (binding instanceof WireableBinding) {
>> - return ((WireableBinding)
>> binding).getTargetComponent().getURI();
>> - } else {
>> - return null;
>> + String name = binding.getURI();
>> + int s = name.lastIndexOf('/');
>> + if (s != -1) {
>> + name = name.substring(0, s);
>> }
>> + return name;
>> }
>>
>> public boolean equals(Object other) {
>>
>> Modified:
>> incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java
>> (original)
>> +++
>> incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java
>> Tue Aug 14 23:16:47 2007
>> @@ -37,7 +37,6 @@
>> import org.apache.tuscany.sca.assembly.ComponentService;
>> import org.apache.tuscany.sca.assembly.Composite;
>> import org.apache.tuscany.sca.assembly.CompositeService;
>> -import org.apache.tuscany.sca.assembly.SCABinding;
>> import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
>> import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
>> import org.apache.tuscany.sca.contribution.Contribution;
>> @@ -350,24 +349,16 @@
>> ComponentContext componentContext = null;
>>
>> // If the component is a composite, then we need to find the
>> - // non-composite
>> - // component that provides the requested service
>> + // non-composite component that provides the requested service
>> if (component.getImplementation() instanceof Composite) {
>> - ComponentService promotedService = null;
>> for (ComponentService componentService :
>> component.getServices()) {
>> if (serviceName == null || serviceName.equals(
>> componentService.getName())) {
>> -
>> CompositeService compositeService =
>> (CompositeService)componentService.getService();
>> if (compositeService != null) {
>> - promotedService =
>> compositeService.getPromotedService();
>> - SCABinding scaBinding =
>> promotedService.getBinding(SCABinding.class);
>> - if (scaBinding != null) {
>> - Component promotedComponent =
>> scaBinding.getComponent();
>> - if (serviceName != null) {
>> - serviceName = "$promoted$." +
>> serviceName;
>> - }
>> - componentContext =
>> (ComponentContext)promotedComponent;
>> + if (serviceName != null) {
>> + serviceName = "$promoted$." + serviceName;
>> }
>> + componentContext =
>> (ComponentContext)compositeService.getPromotedComponent();
>> }
>> break;
>> }
>>
>> Modified:
>> incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java
>> (original)
>> +++
>> incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java
>> Tue Aug 14 23:16:47 2007
>> @@ -167,21 +167,15 @@
>> // non-composite
>> // component that provides the requested service
>> if (component.getImplementation() instanceof Composite) {
>> - ComponentService promotedService = null;
>> for (ComponentService componentService :
>> component.getServices()) {
>> if (serviceName == null || serviceName.equals(
>> componentService.getName())) {
>>
>> CompositeService compositeService =
>> (CompositeService)componentService.getService();
>> if (compositeService != null) {
>> - promotedService =
>> compositeService.getPromotedService();
>> - SCABinding scaBinding =
>> promotedService.getBinding(SCABinding.class);
>> - if (scaBinding != null) {
>> - Component promotedComponent =
>> scaBinding.getComponent();
>> - if (serviceName != null) {
>> - serviceName = "$promoted$." +
>> serviceName;
>> - }
>> - componentContext =
>> (ComponentContext)promotedComponent;
>> + if (serviceName != null) {
>> + serviceName = "$promoted$." + serviceName;
>> }
>> + componentContext =
>> (ComponentContext)compositeService.getPromotedComponent();
>> }
>> break;
>> }
>>
>> Modified:
>> incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/binding/resource/provider/HTTPResourceServiceBindingProvider.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/binding/resource/provider/HTTPResourceServiceBindingProvider.java?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/binding/resource/provider/HTTPResourceServiceBindingProvider.java
>> (original)
>> +++
>> incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/binding/resource/provider/HTTPResourceServiceBindingProvider.java
>> Tue Aug 14 23:16:47 2007
>> @@ -52,16 +52,12 @@
>> this.binding = binding;
>> this.servletHost = servletHost;
>>
>> - if (binding.getURI() != null) {
>> - uri = binding.getURI();
>> - if (!uri.endsWith("/")) {
>> - uri += "/";
>> - }
>> - if (!uri.endsWith("*")) {
>> - uri += "*";
>> - }
>> - } else {
>> - uri = "/" + this.component.getName() + "/*";
>> + uri = binding.getURI();
>> + if (!uri.endsWith("/")) {
>> + uri += "/";
>> + }
>> + if (!uri.endsWith("*")) {
>> + uri += "*";
>> }
>> }
>>
>>
>> Modified:
>> incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java
>> (original)
>> +++
>> incubator/tuscany/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java
>> Tue Aug 14 23:16:47 2007
>> @@ -61,9 +61,6 @@
>>
>> // Register with the hosting server
>> String uri = binding.getURI();
>> - if (uri == null) {
>> - uri = component.getURI() + "/" + binding.getName();
>> - }
>> EchoServer.getServer().register(uri, new EchoServiceListener(
>> chain.getHeadInvoker(), messageFactory));
>> }
>>
>>
>> Modified:
>> incubator/tuscany/java/sca/samples/binding-echo2-extension/src/main/java/echo2/extension/EchoServiceBindingProvider.java
>> URL:
>> http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-echo2-extension/src/main/java/echo2/extension/EchoServiceBindingProvider.java?view=diff&rev=566036&r1=566035&r2=566036
>>
>> ==============================================================================
>> ---
>> incubator/tuscany/java/sca/samples/binding-echo2-extension/src/main/java/echo2/extension/EchoServiceBindingProvider.java
>> (original)
>> +++
>> incubator/tuscany/java/sca/samples/binding-echo2-extension/src/main/java/echo2/extension/EchoServiceBindingProvider.java
>> Tue Aug 14 23:16:47 2007
>> @@ -60,9 +60,6 @@
>>
>> // Register with the hosting server
>> String uri = binding.getURI();
>> - if (uri == null) {
>> - uri = component.getURI() + "/" + binding.getName();
>> - }
>> EchoServer.getServer().register(uri, new EchoServiceListener(
>> chain.getHeadInvoker(), messageFactory));
>> }
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
>> For additional commands, e-mail: tuscany-commits-help@ws.apache.org
>>
>>
>>
>
>
--
Jean-Sebastien
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org