From 7916b5e85a3ee51aac8e3a77ad72b9f530ba5b98 Mon Sep 17 00:00:00 2001 From: rfeng Date: Tue, 29 Jun 2010 00:16:21 +0000 Subject: Allow binding name to be used to look up services implemented by SCA composite git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@958795 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/tuscany/sca/node/impl/NodeImpl.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'sca-java-2.x/trunk') diff --git a/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java index c3943ce914..c767c94452 100644 --- a/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java +++ b/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java @@ -269,13 +269,24 @@ public class NodeImpl implements Node { // non-composite component that provides the requested service if (component.getImplementation() instanceof Composite) { for (ComponentService componentService : component.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(); - return componentContext.createSelfReference(businessInterface, compositeService - .getPromotedService()); + serviceName = compositeService.getPromotedService().getName(); + if (bindingName != null) { + serviceName = serviceName + "/" + bindingName; + } + return componentContext.createSelfReference(businessInterface, serviceName); } break; } -- cgit v1.2.3