diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-08-04 08:54:07 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-08-04 08:54:07 +0000 |
commit | 145673fce295ef2075f9ee82d23dfeb23504d464 (patch) | |
tree | 8e89443b48fec088478be5bb82ea630880801517 /sca-java-2.x | |
parent | 85e5f81a68ccbaae7ea100ec802fb78de275720d (diff) |
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
Diffstat (limited to '')
-rw-r--r-- | sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentImpl.java | 41 |
1 files changed, 7 insertions, 34 deletions
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 <B> ServiceReference<B> getServiceReference(Class<B> 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); } + } } |