From 630599c9de5bce09c7fb1f1b657ae36164c5cc40 Mon Sep 17 00:00:00 2001 From: antelder Date: Wed, 20 Jan 2010 16:42:59 +0000 Subject: Start of making the Tuscany sca client impl work for both local or remote nodes and to be generic for any binding. Work in progress, only local invocations work presently git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@901270 13f79535-47bb-0310-9956-ffa450edef68 --- .../hazelcast/HazelcastEndpointRegistry.java | 35 +++++++++++----------- 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'sca-java-2.x/trunk/modules/endpoint-hazelcast') diff --git a/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java b/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java index f9ec30011e..3bc9fa9f66 100644 --- a/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java +++ b/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java @@ -197,32 +197,31 @@ public class HazelcastEndpointRegistry implements EndpointRegistry, LifeCycleLis } public List findEndpoint(EndpointReference endpointReference) { - List foundEndpoints = new ArrayList(); - logger.fine("Find endpoint for reference - " + endpointReference); - if (endpointReference.getReference() != null) { Endpoint targetEndpoint = endpointReference.getTargetEndpoint(); - - for (Object v : map.values()) { - Endpoint endpoint = (Endpoint)v; - logger.fine("Matching against - " + endpoint); - if (matches(targetEndpoint.getURI(), endpoint.getURI())) { - if (!isLocal(endpoint)) { - endpoint.setRemote(true); - } - // if (!entry.isPrimary()) { - ((RuntimeEndpoint)endpoint).bind(registry, this); - // } - foundEndpoints.add(endpoint); - logger.fine("Found endpoint with matching service - " + endpoint); + return findEndpoint(targetEndpoint.getURI()); + } + return new ArrayList(); + } + + public List findEndpoint(String uri) { + List foundEndpoints = new ArrayList(); + for (Object v : map.values()) { + Endpoint endpoint = (Endpoint)v; + logger.fine("Matching against - " + endpoint); + if (matches(uri, endpoint.getURI())) { + if (!isLocal(endpoint)) { + endpoint.setRemote(true); } - // else the service name doesn't match + ((RuntimeEndpoint)endpoint).bind(registry, this); + foundEndpoints.add(endpoint); + logger.fine("Found endpoint with matching service - " + endpoint); } } - return foundEndpoints; } + private boolean isLocal(Endpoint endpoint) { return localEndpoints.contains(endpoint.getURI()); -- cgit v1.2.3