Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkuppe2009-03-10 16:04:50 +0000
committermkuppe2009-03-10 16:04:50 +0000
commit098c2e7a17c44581a2d3cd1a2f3e2c0c5a11d598 (patch)
tree709f81f239b7259feb408b6ffe5b52c8b48a11cb /providers
parent8aad8ead0f4970df2281b98611681809d944a816 (diff)
downloadorg.eclipse.ecf-098c2e7a17c44581a2d3cd1a2f3e2c0c5a11d598.tar.gz
org.eclipse.ecf-098c2e7a17c44581a2d3cd1a2f3e2c0c5a11d598.tar.xz
org.eclipse.ecf-098c2e7a17c44581a2d3cd1a2f3e2c0c5a11d598.zip
NEW - bug 266723: [Discovery] specify how clients can determine service uniqueness
https://bugs.eclipse.org/bugs/show_bug.cgi?id=266723
Diffstat (limited to 'providers')
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/internal/provider/discovery/CompositeNamespace.java12
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/internal/provider/discovery/CompositeServiceID.java8
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/provider/discovery/CompositeDiscoveryContainer.java11
3 files changed, 19 insertions, 12 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/internal/provider/discovery/CompositeNamespace.java b/providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/internal/provider/discovery/CompositeNamespace.java
index 118f78342..2ea270343 100644
--- a/providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/internal/provider/discovery/CompositeNamespace.java
+++ b/providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/internal/provider/discovery/CompositeNamespace.java
@@ -10,6 +10,7 @@
******************************************************************************/
package org.eclipse.ecf.internal.provider.discovery;
+import java.net.URI;
import org.eclipse.ecf.core.identity.*;
import org.eclipse.ecf.discovery.identity.IServiceTypeID;
import org.eclipse.ecf.discovery.identity.ServiceTypeID;
@@ -25,10 +26,13 @@ public class CompositeNamespace extends Namespace {
public ID createInstance(final Object[] parameters) {
if (parameters == null || parameters.length < 1 || parameters.length > 2) {
throw new IDCreateException(Messages.CompositeNamespace_WrongParameterCount);
- } else if (parameters[0] instanceof String) {
- return new CompositeServiceID(this, new ServiceTypeID(this, (String) parameters[0]), (String) parameters[1]);
- } else if (parameters[0] instanceof IServiceTypeID) {
- return new CompositeServiceID(this, (IServiceTypeID) parameters[0], (String) parameters[1]);
+ } else if (parameters.length == 2 && parameters[0] instanceof String && parameters[1] instanceof URI) {
+ return new CompositeServiceID(this, new ServiceTypeID(this, (String) parameters[0]), (URI) parameters[1]);
+ } else if (parameters.length == 2 && parameters[0] instanceof IServiceTypeID && parameters[1] instanceof URI) {
+ return new CompositeServiceID(this, (IServiceTypeID) parameters[0], (URI) parameters[1]);
+ } else if (parameters.length == 1 && parameters[0] instanceof IServiceTypeID) {
+ final IServiceTypeID iServiceTypeID = (IServiceTypeID) parameters[0];
+ return new ServiceTypeID(this, iServiceTypeID.getName());
} else {
throw new IDCreateException(Messages.CompositeNamespace_WrongParameters);
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/internal/provider/discovery/CompositeServiceID.java b/providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/internal/provider/discovery/CompositeServiceID.java
index c819498e4..f56b218d1 100644
--- a/providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/internal/provider/discovery/CompositeServiceID.java
+++ b/providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/internal/provider/discovery/CompositeServiceID.java
@@ -10,6 +10,8 @@
******************************************************************************/
package org.eclipse.ecf.internal.provider.discovery;
+import java.net.URI;
+
import org.eclipse.ecf.discovery.identity.IServiceTypeID;
import org.eclipse.ecf.discovery.identity.ServiceID;
@@ -20,9 +22,9 @@ public class CompositeServiceID extends ServiceID {
/**
* @param compositeNamespace
* @param serviceTypeID
- * @param string
+ * @param anURI
*/
- public CompositeServiceID(final CompositeNamespace compositeNamespace, final IServiceTypeID serviceTypeID, final String string) {
- super(compositeNamespace, serviceTypeID, string);
+ public CompositeServiceID(final CompositeNamespace compositeNamespace, final IServiceTypeID serviceTypeID, final URI anURI) {
+ super(compositeNamespace, serviceTypeID, anURI);
}
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/provider/discovery/CompositeDiscoveryContainer.java b/providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/provider/discovery/CompositeDiscoveryContainer.java
index 406ec91d3..536826fe0 100644
--- a/providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/provider/discovery/CompositeDiscoveryContainer.java
+++ b/providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/provider/discovery/CompositeDiscoveryContainer.java
@@ -198,7 +198,7 @@ public class CompositeDiscoveryContainer extends AbstractDiscoveryContainerAdapt
private IServiceID getServiceIDForDiscoveryContainer(final IServiceID service, final IDiscoveryLocator dca) {
final Namespace connectNamespace = dca.getServicesNamespace();
if (!connectNamespace.equals(service.getNamespace())) {
- return ServiceIDFactory.getDefault().createServiceID(connectNamespace, service.getServiceTypeID().getName(), service.getServiceName());
+ return (IServiceID) connectNamespace.createInstance(new Object[] {service.getServiceTypeID().getName(), service.getLocation()});
}
return service;
}
@@ -222,8 +222,10 @@ public class CompositeDiscoveryContainer extends AbstractDiscoveryContainerAdapt
}
private IServiceInfo getServiceInfoForDiscoveryContainer(final IServiceInfo aSi, final IDiscoveryLocator idca) {
- final IServiceID serviceID = getServiceIDForDiscoveryContainer(aSi.getServiceID(), idca);
- return new ServiceInfo(aSi.getLocation(), serviceID, aSi.getPriority(), aSi.getWeight(), aSi.getServiceProperties());
+ final IServiceID serviceId = aSi.getServiceID();
+ final IServiceID sid = getServiceIDForDiscoveryContainer(serviceId, idca);
+ final IServiceTypeID serviceTypeID = sid.getServiceTypeID();
+ return new ServiceInfo(serviceId.getLocation(), aSi.getServiceName(), serviceTypeID, aSi.getPriority(), aSi.getWeight(), aSi.getServiceProperties());
}
/* (non-Javadoc)
@@ -261,8 +263,7 @@ public class CompositeDiscoveryContainer extends AbstractDiscoveryContainerAdapt
private IServiceTypeID getServiceTypeIDForDiscoveryContainer(final IServiceTypeID type, final IDiscoveryLocator dca) {
final Namespace connectNamespace = dca.getServicesNamespace();
if (!connectNamespace.equals(type.getNamespace())) {
- final IServiceID serviceID = (IServiceID) connectNamespace.createInstance(new Object[] {type, null});
- return serviceID.getServiceTypeID();
+ return ServiceIDFactory.getDefault().createServiceTypeID(connectNamespace, type);
}
return type;
}

Back to the top