diff options
author | mkuppe | 2009-02-16 13:31:42 +0000 |
---|---|---|
committer | mkuppe | 2009-02-16 13:31:42 +0000 |
commit | 9ba472f113d849b6dfa92f9a36bf10bfc41ff886 (patch) | |
tree | f4096a4da37d5fbfc4727d424367d32eeb89e67a /providers | |
parent | f6f1a908854a82ee18c93269a2565a21d49ded65 (diff) | |
download | org.eclipse.ecf-9ba472f113d849b6dfa92f9a36bf10bfc41ff886.tar.gz org.eclipse.ecf-9ba472f113d849b6dfa92f9a36bf10bfc41ff886.tar.xz org.eclipse.ecf-9ba472f113d849b6dfa92f9a36bf10bfc41ff886.zip |
NEW - bug 218308: [Discovery][jSLP] org.eclipse.ecf.discovery.IDiscoveryContainerAdapter.getServices() doesn't return all "reachable" services
https://bugs.eclipse.org/bugs/show_bug.cgi?id=218308
Diffstat (limited to 'providers')
-rw-r--r-- | providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/internal/provider/jslp/LocatorDecoratorImpl.java | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/internal/provider/jslp/LocatorDecoratorImpl.java b/providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/internal/provider/jslp/LocatorDecoratorImpl.java index de571c407..a1fc66ba0 100644 --- a/providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/internal/provider/jslp/LocatorDecoratorImpl.java +++ b/providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/internal/provider/jslp/LocatorDecoratorImpl.java @@ -10,9 +10,13 @@ ******************************************************************************/ package org.eclipse.ecf.internal.provider.jslp; +import java.util.List; + import ch.ethz.iks.slp.*; import java.util.*; import org.eclipse.core.runtime.Assert; +import org.eclipse.ecf.core.util.StringUtils; +import org.eclipse.ecf.discovery.identity.IServiceTypeID; /** * This decorator add additional methods which will eventually be moved to jSLP itself @@ -85,17 +89,34 @@ public class LocatorDecoratorImpl implements LocatorDecorator { * @see org.eclipse.ecf.internal.provider.jslp.LocatorDecorator#getServiceURLs() */ public Map getServiceURLs() throws ServiceLocationException { - Enumeration stEnum = findServiceTypes(null, null); + List scopeHints = getScopeHints(); + Enumeration stEnum = findServiceTypes(null, scopeHints); Set aSet = new HashSet(Collections.list(stEnum)); Map result = new HashMap(); for (Iterator itr = aSet.iterator(); itr.hasNext();) { String type = (String) itr.next(); - ServiceLocationEnumeration services = findServices(new ServiceType(type), null, null); + ServiceLocationEnumeration services = findServices(new ServiceType(type), scopeHints, null); while (services.hasMoreElements()) { ServiceURL url = (ServiceURL) services.next(); - result.put(url, Collections.list(findAttributes(url, null, null))); + result.put(url, Collections.list(findAttributes(url, scopeHints, null))); } } return result; } + + //TODO because of https://bugs.eclipse.org/218308 as consumer is allowed to pass additional hints + private List getScopeHints() { + String hints = System.getProperty("net.slp.scopeHints"); //$NON-NLS-1$ + if (hints != null) { + hints = hints.toLowerCase(); + String[] scopes = StringUtils.split(hints, ","); //$NON-NLS-1$ + List scopeList = Arrays.asList(scopes); + List defaultScope = Arrays.asList(IServiceTypeID.DEFAULT_SCOPE); + List result = new ArrayList(); // j9 throws UnsupportedOperation on addAll on scopeList + result.addAll(defaultScope); + result.addAll(scopeList); + return result; + } + return null; + } } |