Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2014-01-24 17:12:49 -0500
committerslewis2014-01-24 17:12:49 -0500
commitcf4ef0bacdd290b2f9e3be6660b696f8fb9fa46f (patch)
tree0a09beb1024e9ab2a1e6a43e6620115b5c52fa3a
parent8f6cb46a980adeecc6e68e1fe8d772a4ebbdb860 (diff)
parentba7d9c9fe5774dfb2ba82d216edb4a7df576a562 (diff)
downloadorg.eclipse.ecf-cf4ef0bacdd290b2f9e3be6660b696f8fb9fa46f.tar.gz
org.eclipse.ecf-cf4ef0bacdd290b2f9e3be6660b696f8fb9fa46f.tar.xz
org.eclipse.ecf-cf4ef0bacdd290b2f9e3be6660b696f8fb9fa46f.zip
Merge remote-tracking branch 'origin/master'
-rw-r--r--framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/internal/discovery/DiscoveryServiceListener.java49
1 files changed, 37 insertions, 12 deletions
diff --git a/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/internal/discovery/DiscoveryServiceListener.java b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/internal/discovery/DiscoveryServiceListener.java
index 396ca3397..45dc01b3c 100644
--- a/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/internal/discovery/DiscoveryServiceListener.java
+++ b/framework/bundles/org.eclipse.ecf.discovery/src/org/eclipse/ecf/internal/discovery/DiscoveryServiceListener.java
@@ -10,6 +10,8 @@
******************************************************************************/
package org.eclipse.ecf.internal.discovery;
+import org.eclipse.ecf.discovery.identity.IServiceTypeID;
+
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.ecf.core.identity.*;
@@ -64,13 +66,19 @@ public class DiscoveryServiceListener implements ServiceListener {
final ServiceReference serviceReference = references[i];
if (listenerClass.getName()
.equals(IServiceListener.class.getName())) {
- final IServiceTypeID aType = getIServiceTypeID(serviceReference);
- if (aType == null) {
- continue;
+ if (isAllWildcards(serviceReference)) {
+ final IServiceListener aListener = (IServiceListener) context
+ .getService(serviceReference);
+ discoveryContainer.addServiceListener(aListener);
+ } else {
+ final IServiceTypeID aType = getIServiceTypeID(serviceReference);
+ if (aType == null) {
+ continue;
+ }
+ final IServiceListener aListener = (IServiceListener) context
+ .getService(serviceReference);
+ discoveryContainer.addServiceListener(aType, aListener);
}
- final IServiceListener aListener = (IServiceListener) context
- .getService(serviceReference);
- discoveryContainer.addServiceListener(aType, aListener);
} else {
final IServiceTypeListener aListener = (IServiceTypeListener) context
.getService(serviceReference);
@@ -91,13 +99,19 @@ public class DiscoveryServiceListener implements ServiceListener {
final ServiceReference serviceReference = references[i];
if (listenerClass.getName()
.equals(IServiceListener.class.getName())) {
- final IServiceTypeID aType = getIServiceTypeID(serviceReference);
- if (aType == null) {
- continue;
+ if (isAllWildcards(serviceReference)) {
+ final IServiceListener aListener = (IServiceListener) context
+ .getService(serviceReference);
+ discoveryContainer.removeServiceListener(aListener);
+ } else {
+ final IServiceTypeID aType = getIServiceTypeID(serviceReference);
+ if (aType == null) {
+ continue;
+ }
+ final IServiceListener aListener = (IServiceListener) context
+ .getService(serviceReference);
+ discoveryContainer.removeServiceListener(aType, aListener);
}
- final IServiceListener aListener = (IServiceListener) context
- .getService(serviceReference);
- discoveryContainer.removeServiceListener(aType, aListener);
} else {
final IServiceTypeListener aListener = (IServiceTypeListener) context
.getService(serviceReference);
@@ -110,6 +124,17 @@ public class DiscoveryServiceListener implements ServiceListener {
removeServiceListener(new ServiceReference[] { reference });
}
+ private boolean isAllWildcards(ServiceReference serviceReference) {
+ return serviceReference
+ .getProperty("org.eclipse.ecf.discovery.namingauthority") == null
+ && serviceReference
+ .getProperty("org.eclipse.ecf.discovery.services") == null
+ && serviceReference
+ .getProperty("org.eclipse.ecf.discovery.scopes") == null
+ && serviceReference
+ .getProperty("org.eclipse.ecf.discovery.protocols") == null;
+ }
+
private IServiceTypeID getIServiceTypeID(ServiceReference serviceReference) {
String namingAuthority = (String) serviceReference
.getProperty("org.eclipse.ecf.discovery.namingauthority"); //$NON-NLS-1$

Back to the top