TUSCANY-4027 - tweak to this change to ignore any callback endpoints in the registry that match

git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1301371 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
slaws 2012-03-16 08:22:38 +00:00
parent 64fa14787b
commit a83d219c6e

View file

@ -19,6 +19,7 @@
package org.apache.tuscany.sca.client.impl;
import java.util.Iterator;
import java.util.List;
import org.apache.tuscany.sca.assembly.ComponentService;
@ -38,6 +39,16 @@ public class DefaultEndpointFinder implements EndpointFinder {
if (eps == null || eps.size() < 1) {
throw new NoSuchServiceException(serviceName);
}
// remove any callback services from the array as we aren't
// expecting SCA clients to connect to callback service
Iterator<Endpoint> iterator = eps.iterator();
while (iterator.hasNext()){
Endpoint ep = iterator.next();
if (ep.getService().isForCallback()){
iterator.remove();
}
}
// If lookup is by component name only and there are multiple matches, verify all matches
// are from the same service. Otherwise it is ambiguous which service the client wants.