Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkuppe2010-09-30 10:05:13 +0000
committermkuppe2010-09-30 10:05:13 +0000
commit0684504e0b0da56917b85f3c4dd46f6185009629 (patch)
tree8384eb50e5b62bf480bf70ab92fbbffadca7d2cc /providers/bundles
parent89c42a908f2e0f69d1a86b8ded8effb202a8c413 (diff)
downloadorg.eclipse.ecf-0684504e0b0da56917b85f3c4dd46f6185009629.tar.gz
org.eclipse.ecf-0684504e0b0da56917b85f3c4dd46f6185009629.tar.xz
org.eclipse.ecf-0684504e0b0da56917b85f3c4dd46f6185009629.zip
RESOLVED - bug 326652: [Discovery][RemoteSrvs] Local discovery provider may create endpoint from scheme part of URI
https://bugs.eclipse.org/bugs/show_bug.cgi?id=326652
Diffstat (limited to 'providers/bundles')
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.localdiscovery/src/org/eclipse/ecf/provider/localdiscovery/RemoteServiceEndpointDescriptionImpl.java7
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.localdiscovery/src/org/eclipse/ecf/provider/localdiscovery/ServiceEndpointDescriptionFactory.java23
2 files changed, 26 insertions, 4 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.localdiscovery/src/org/eclipse/ecf/provider/localdiscovery/RemoteServiceEndpointDescriptionImpl.java b/providers/bundles/org.eclipse.ecf.provider.localdiscovery/src/org/eclipse/ecf/provider/localdiscovery/RemoteServiceEndpointDescriptionImpl.java
index 39293b265..68360cac9 100644
--- a/providers/bundles/org.eclipse.ecf.provider.localdiscovery/src/org/eclipse/ecf/provider/localdiscovery/RemoteServiceEndpointDescriptionImpl.java
+++ b/providers/bundles/org.eclipse.ecf.provider.localdiscovery/src/org/eclipse/ecf/provider/localdiscovery/RemoteServiceEndpointDescriptionImpl.java
@@ -32,6 +32,13 @@ public class RemoteServiceEndpointDescriptionImpl extends
endpointId = anEndpointId;
}
+ public RemoteServiceEndpointDescriptionImpl(ServiceEndpointDescription sed,
+ ID anEndpointId, Map properties) {
+ super(properties);
+ serviceEndpoint = sed;
+ endpointId = anEndpointId;
+ }
+
/*
* (non-Javadoc)
*
diff --git a/providers/bundles/org.eclipse.ecf.provider.localdiscovery/src/org/eclipse/ecf/provider/localdiscovery/ServiceEndpointDescriptionFactory.java b/providers/bundles/org.eclipse.ecf.provider.localdiscovery/src/org/eclipse/ecf/provider/localdiscovery/ServiceEndpointDescriptionFactory.java
index 332d78266..ba94d314d 100644
--- a/providers/bundles/org.eclipse.ecf.provider.localdiscovery/src/org/eclipse/ecf/provider/localdiscovery/ServiceEndpointDescriptionFactory.java
+++ b/providers/bundles/org.eclipse.ecf.provider.localdiscovery/src/org/eclipse/ecf/provider/localdiscovery/ServiceEndpointDescriptionFactory.java
@@ -20,6 +20,9 @@ import org.eclipse.ecf.osgi.services.discovery.ServiceEndpointDescription;
public class ServiceEndpointDescriptionFactory implements IAdapterFactory {
+ private static final String ECF_IDENTITY_STRING_ID = "org.eclipse.ecf.core.identity.StringID"; //$NON-NLS-1$
+ private static final String ECF_SP_ECT = "ecf.sp.ect"; //$NON-NLS-1$
+
/*
* (non-Javadoc)
*
@@ -30,21 +33,33 @@ public class ServiceEndpointDescriptionFactory implements IAdapterFactory {
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (adapterType.equals(RemoteServiceEndpointDescription.class)
&& adaptableObject instanceof ServiceEndpointDescription) {
- ServiceEndpointDescription sed = (ServiceEndpointDescription) adaptableObject;
- Map properties = sed.getProperties();
+ final ServiceEndpointDescription sed = (ServiceEndpointDescription) adaptableObject;
+ final Map properties = sed.getProperties();
Object obj1 = properties
.get(RemoteServicePublication.ENDPOINT_CONTAINERID);
- Object obj2 = properties
+ final Object obj2 = properties
.get(RemoteServicePublication.ENDPOINT_CONTAINERID_NAMESPACE);
if (obj1 instanceof byte[]) {
obj1 = new String(((byte[]) obj1));
}
- if (obj1 instanceof String && obj2 instanceof String) {
+ if (obj2 != null && obj1 instanceof String && obj2 instanceof String) {
// create the endpoint id
final String endpointStr = (String) obj1;
final String namespaceStr = (String) obj2;
return new RemoteServiceEndpointDescriptionImpl(sed, IDFactory
.getDefault().createID(namespaceStr, endpointStr));
+ } else if(obj2 == null && obj1 instanceof String) {
+ // create the endpoint id via the endpoint str for known containers
+ final String endpointStr = (String) obj1;
+ if (endpointStr.startsWith("ecftcp://")) { //$NON-NLS-1$
+ properties.put(ECF_SP_ECT, "ecf.generic.server"); //$NON-NLS-1$
+ } else if(endpointStr.startsWith("r-osgi://")) { //$NON-NLS-1$
+ properties.put(ECF_SP_ECT, "ecf.r_osgi.peer"); //$NON-NLS-1$
+ } else {
+ return null;
+ }
+ return new RemoteServiceEndpointDescriptionImpl(sed, IDFactory
+ .getDefault().createID(ECF_IDENTITY_STRING_ID, endpointStr), properties); //$NON-NLS-1$
}
}
return null;

Back to the top