diff options
author | slewis | 2010-05-18 05:21:49 +0000 |
---|---|---|
committer | slewis | 2010-05-18 05:21:49 +0000 |
commit | d704977646c9f032f1e30cb7979e8da477a518f3 (patch) | |
tree | a93b005bc50934736b40ca5a2cd38f48802305c8 | |
parent | 7606bb747c32206564ec6cc0a2d451820b2d3441 (diff) | |
download | org.eclipse.ecf-d704977646c9f032f1e30cb7979e8da477a518f3.tar.gz org.eclipse.ecf-d704977646c9f032f1e30cb7979e8da477a518f3.tar.xz org.eclipse.ecf-d704977646c9f032f1e30cb7979e8da477a518f3.zip |
Generalized to support connect target usage.
3 files changed, 17 insertions, 8 deletions
diff --git a/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/osgi/services/distribution/AbstractContainerFinder.java b/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/osgi/services/distribution/AbstractContainerFinder.java index d7a9296fa..91e1d8cba 100644 --- a/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/osgi/services/distribution/AbstractContainerFinder.java +++ b/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/osgi/services/distribution/AbstractContainerFinder.java @@ -219,7 +219,12 @@ public abstract class AbstractContainerFinder { this.getClass(), message); } - protected boolean matchConnectNamespace(IContainer container, ID endpointID) { + protected boolean matchConnectNamespace(IContainer container, + ID endpointID, ID connectTargetID) { + if (connectTargetID != null) { + return connectTargetID.getNamespace().getName() + .equals(container.getConnectNamespace().getName()); + } if (endpointID == null) return false; return endpointID.getNamespace().getName() diff --git a/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/osgi/services/distribution/AbstractProxyContainerFinder.java b/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/osgi/services/distribution/AbstractProxyContainerFinder.java index 0dcbd7a5d..f6b6a3aec 100644 --- a/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/osgi/services/distribution/AbstractProxyContainerFinder.java +++ b/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/osgi/services/distribution/AbstractProxyContainerFinder.java @@ -34,7 +34,7 @@ public abstract class AbstractProxyContainerFinder extends AbstractContainerFinder { protected Collection findExistingProxyContainers(ID endpointID, - String[] remoteSupportedConfigs) { + String[] remoteSupportedConfigs, ID connectTargetID) { List results = new ArrayList(); // Get all containers available @@ -51,14 +51,16 @@ public abstract class AbstractProxyContainerFinder extends IRemoteServiceContainerAdapter adapter = hasRemoteServiceContainerAdapter(containers[i]); // Container must have adapter if (adapter != null - // And it must match the connect namespace - && matchConnectNamespace(containers[i], endpointID) + // And it must match the connect namespace + && matchConnectNamespace(containers[i], endpointID, + connectTargetID) // and it must match the configs && matchProxySupportedConfigs(containers[i], remoteSupportedConfigs) // and the container should either not be connected or // already be connected to the desired endpointID - && matchNotConnected(containers[i], endpointID)) { + && matchNotConnected(containers[i], endpointID, + connectTargetID)) { trace("findExistingProxyContainers", //$NON-NLS-1$ "MATCH of existing remote service container id=" //$NON-NLS-1$ + containers[i].getID() @@ -84,11 +86,13 @@ public abstract class AbstractProxyContainerFinder extends return results; } - protected boolean matchNotConnected(IContainer container, ID endpointID) { + protected boolean matchNotConnected(IContainer container, ID endpointID, + ID connectTargetID) { // if the container is not connected, OR it's connected to the desired // endpointID already then we've got a match ID connectedID = container.getConnectedID(); - if (connectedID == null || connectedID.equals(endpointID)) + if (connectedID == null || connectedID.equals(endpointID) + || connectedID.equals(connectTargetID)) return true; return false; } diff --git a/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/osgi/services/distribution/DefaultProxyContainerFinder.java b/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/osgi/services/distribution/DefaultProxyContainerFinder.java index d43874027..afc73540b 100644 --- a/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/osgi/services/distribution/DefaultProxyContainerFinder.java +++ b/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/osgi/services/distribution/DefaultProxyContainerFinder.java @@ -45,7 +45,7 @@ public class DefaultProxyContainerFinder extends AbstractProxyContainerFinder // Find any/all existing containers for the proxy that // match the endpointID namespace and the remoteSupportedConfigs Collection rsContainers = findExistingProxyContainers(endpointID, - remoteSupportedConfigs); + remoteSupportedConfigs, connectTargetID); // If we haven't found any existing containers then we create one // from the remoteSupportedConfigs...*iff* autoCreateContainer is |