Author: rfeng
Date: Tue Jun 29 00:16:21 2010
New Revision: 958795
URL: http://svn.apache.org/viewvc?rev=958795&view=rev
Log:
Allow binding name to be used to look up services implemented by SCA composite
Modified:
tuscany/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
Modified:
tuscany/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
URL:
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java?rev=958795&r1=958794&r2=958795&view=diff
==============================================================================
---
tuscany/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
(original)
+++
tuscany/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
Tue Jun 29 00:16:21 2010
@@ -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;
}