diff options
Diffstat (limited to 'sca-java-2.x/trunk/modules/endpoint-zookeeper/src/main/java')
-rw-r--r-- | sca-java-2.x/trunk/modules/endpoint-zookeeper/src/main/java/org/apache/tuscany/sca/endpoint/zookeeper/DistributedRegistry.java | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/sca-java-2.x/trunk/modules/endpoint-zookeeper/src/main/java/org/apache/tuscany/sca/endpoint/zookeeper/DistributedRegistry.java b/sca-java-2.x/trunk/modules/endpoint-zookeeper/src/main/java/org/apache/tuscany/sca/endpoint/zookeeper/DistributedRegistry.java index b000640e18..0e74bcb092 100644 --- a/sca-java-2.x/trunk/modules/endpoint-zookeeper/src/main/java/org/apache/tuscany/sca/endpoint/zookeeper/DistributedRegistry.java +++ b/sca-java-2.x/trunk/modules/endpoint-zookeeper/src/main/java/org/apache/tuscany/sca/endpoint/zookeeper/DistributedRegistry.java @@ -189,23 +189,28 @@ public class DistributedRegistry extends AbstractDistributedMap<Endpoint> implem if (endpointReference.getReference() != null) { Endpoint targetEndpoint = endpointReference.getTargetEndpoint(); - for (Object v : values()) { - Endpoint endpoint = (Endpoint)v; - // TODO: implement more complete matching - logger.fine("Matching against - " + endpoint); - if (matches(targetEndpoint.getURI(), endpoint.getURI())) { - // if (!entry.isPrimary()) { - ((RuntimeEndpoint)endpoint).bind(registry, this); - // } - foundEndpoints.add(endpoint); - logger.fine("Found endpoint with matching service - " + endpoint); - } - // else the service name doesn't match - } + String uri = targetEndpoint.getURI(); + lookup(foundEndpoints, uri); } return foundEndpoints; } + private void lookup(List<Endpoint> foundEndpoints, String uri) { + for (Object v : values()) { + Endpoint endpoint = (Endpoint)v; + // TODO: implement more complete matching + logger.fine("Matching against - " + endpoint); + if (matches(uri, endpoint.getURI())) { + // if (!entry.isPrimary()) { + ((RuntimeEndpoint)endpoint).bind(registry, this); + // } + foundEndpoints.add(endpoint); + logger.fine("Found endpoint with matching service - " + endpoint); + } + // else the service name doesn't match + } + } + public List<EndpointReference> findEndpointReference(Endpoint endpoint) { return endpointreferences; } @@ -293,4 +298,10 @@ public class DistributedRegistry extends AbstractDistributedMap<Endpoint> implem return endpointreferences; } + public List<Endpoint> findEndpoint(String uri) { + List<Endpoint> endpoints = new ArrayList<Endpoint>(); + lookup(endpoints, uri); + return endpoints; + } + } |