From 145673fce295ef2075f9ee82d23dfeb23504d464 Mon Sep 17 00:00:00 2001 From: slaws Date: Thu, 4 Aug 2011 08:54:07 +0000 Subject: TUSCANY-3904 - Apply Greg's patch so that the correct endpoint is picked up when SCAClientFactory.getService() references a promoted service. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1153789 13f79535-47bb-0310-9956-ffa450edef68 --- .../core/assembly/impl/RuntimeComponentImpl.java | 41 ++++------------------ 1 file changed, 7 insertions(+), 34 deletions(-) (limited to 'sca-java-2.x') diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentImpl.java index a71c823c11..3059b1ce67 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentImpl.java @@ -118,41 +118,14 @@ public class RuntimeComponentImpl extends ComponentImpl implements RuntimeCompon public ServiceReference getServiceReference(Class businessInterface, String serviceName) { RuntimeComponentContext componentContext = null; - // If the component is a composite, then we need to find the - // non-composite component that provides the requested service - if (getImplementation() instanceof Composite) { - for (ComponentService componentService : getServices()) { - String bindingName = null; - if (serviceName != null) { - int index = serviceName.indexOf('/'); - if (index != -1) { - bindingName = serviceName.substring(index + 1); - serviceName = serviceName.substring(0, index); - } - } - if (serviceName == null || serviceName.equals(componentService.getName())) { - CompositeService compositeService = (CompositeService)componentService.getService(); - if (compositeService != null) { - componentContext = - ((RuntimeComponent)compositeService.getPromotedComponent()).getComponentContext(); - serviceName = compositeService.getPromotedService().getName(); - if (bindingName != null) { - serviceName = serviceName + "/" + bindingName; - } - return componentContext.createSelfReference(businessInterface, serviceName); - } - break; - } - } - // No matching service found - throw new ServiceRuntimeException("Composite service not found: " + serviceName); + // TUSCANY-3904 Removed implementation.composite path + + componentContext = getComponentContext(); + if (serviceName != null) { + return componentContext.createSelfReference(businessInterface, serviceName); } else { - componentContext = getComponentContext(); - if (serviceName != null) { - return componentContext.createSelfReference(businessInterface, serviceName); - } else { - return componentContext.createSelfReference(businessInterface); - } + return componentContext.createSelfReference(businessInterface); } + } } -- cgit v1.2.3