Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis@composent.com2010-10-24 16:43:30 +0000
committerslewis@composent.com2010-10-24 16:43:30 +0000
commitf275011c575bb97ea3ca3fff8a960289bf18e280 (patch)
tree34075fd489f2d3e3b9331f87ce7f6cbee7c04332
parent299c48783f03e9a114bdcef61d28018f00943e06 (diff)
downloadorg.eclipse.ecf-f275011c575bb97ea3ca3fff8a960289bf18e280.tar.gz
org.eclipse.ecf-f275011c575bb97ea3ca3fff8a960289bf18e280.tar.xz
org.eclipse.ecf-f275011c575bb97ea3ca3fff8a960289bf18e280.zip
Additions for rsa.
-rw-r--r--incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/internal/osgi/services/remoteserviceadmin/Activator.java15
-rw-r--r--incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractMetadataFactory.java336
-rw-r--r--incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractServiceInfoFactory.java47
-rw-r--r--incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/EndpointDescription.java10
-rw-r--r--incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteConstants.java31
-rw-r--r--incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/src/org/eclipse/ecf/provider/internal/endpointdescription/localdiscovery/Activator.java14
6 files changed, 393 insertions, 60 deletions
diff --git a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/internal/osgi/services/remoteserviceadmin/Activator.java b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/internal/osgi/services/remoteserviceadmin/Activator.java
index 310a9cd22..9c66f2572 100644
--- a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/internal/osgi/services/remoteserviceadmin/Activator.java
+++ b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/internal/osgi/services/remoteserviceadmin/Activator.java
@@ -8,6 +8,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.UUID;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -404,4 +405,18 @@ public class Activator implements BundleActivator {
}
}
+ public String getFrameworkUUID() {
+ if (context == null) return null;
+ // code get and set the framework uuid property as specified in r2.enterprise.pdf pg 297
+ synchronized ("org.osgi.framework.uuid") {
+ String result = context.getProperty("org.osgi.framework.uuid");
+ if (result == null) {
+ UUID newUUID = UUID.randomUUID();
+ result = newUUID.toString();
+ System.setProperty("org.osgi.framework.uuid", newUUID.toString());
+ }
+ return result;
+ }
+ }
+
}
diff --git a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractMetadataFactory.java b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractMetadataFactory.java
index 21d3f3118..abf5d7406 100644
--- a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractMetadataFactory.java
+++ b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractMetadataFactory.java
@@ -1,13 +1,49 @@
package org.eclipse.ecf.osgi.services.remoteserviceadmin;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.eclipse.ecf.core.identity.ID;
+import org.eclipse.ecf.core.identity.IDCreateException;
+import org.eclipse.ecf.core.identity.IDFactory;
+import org.eclipse.ecf.discovery.IServiceProperties;
+import org.eclipse.ecf.internal.osgi.services.remoteserviceadmin.Activator;
public abstract class AbstractMetadataFactory {
- protected String[] getStringArrayPropertyWithDefault(
- Map<String, Object> properties, String key,
- String[] def) {
- if (properties == null) return def;
+ protected static final String COLLECTION_SEPARATOR = ",";
+ protected static final List standardProperties = Arrays
+ .asList(new String[] {
+ // OSGi properties
+ org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_ID,
+ org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_SERVICE_ID,
+ org.osgi.framework.Constants.OBJECTCLASS,
+ org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_FRAMEWORK_UUID,
+ org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED_CONFIGS,
+ org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_INTENTS,
+ // ECF properties
+ RemoteConstants.ENDPOINT_ID,
+ RemoteConstants.ENDPOINT_ID_NAMESPACE,
+ RemoteConstants.ENDPOINT_TARGET_ID,
+ RemoteConstants.ENDPOINT_TARGET_ID_NAMESPACE,
+ RemoteConstants.ENDPOINT_IDFILTER_IDS,
+ RemoteConstants.ENDPOINT_IDFILTER_NAMESPACES,
+ RemoteConstants.ENDPOINT_REMOTESERVICE_ID,
+ RemoteConstants.ENDPOINT_REMOTESERVICEFILTER
+ });
+
+
+ protected String[] getStringArrayWithDefault(
+ Map<String, Object> properties, String key, String[] def) {
+ if (properties == null)
+ return def;
Object o = properties.get(key);
if (o instanceof String) {
return new String[] { (String) o };
@@ -17,14 +53,298 @@ public abstract class AbstractMetadataFactory {
return def;
}
- protected String getStringPropertyWithDefault(Map props,
- String key, String def) {
- if (props == null) return def;
+ protected String getStringWithDefault(Map props, String key, String def) {
+ if (props == null)
+ return def;
Object o = props.get(key);
- if (o == null || (!(o instanceof String))) return def;
+ if (o == null || (!(o instanceof String)))
+ return def;
return (String) o;
}
+ protected void encodeString(IServiceProperties props, String name,
+ String value) {
+ byte[] bytes = value.getBytes();
+ props.setPropertyBytes(name, bytes);
+ }
+
+ protected String decodeString(IServiceProperties props, String name) {
+ byte[] bytes = props.getPropertyBytes(name);
+ if (bytes == null)
+ return null;
+ return new String(bytes);
+ }
+
+ protected void encodeLong(IServiceProperties result, String name, Long value) {
+ result.setPropertyString(name, value.toString());
+ }
+
+ protected Long decodeLong(IServiceProperties props, String name) {
+ String longAsString = props.getPropertyString(name);
+ if (longAsString == null)
+ return new Long(0);
+ return new Long(longAsString);
+ }
+
+ protected void encodeList(IServiceProperties props, String name,
+ List<String> value) {
+ final StringBuffer result = new StringBuffer();
+ for (final Iterator<String> i = value.iterator(); i.hasNext();) {
+ final String item = (String) i.next();
+ result.append(item);
+ if (i.hasNext()) {
+ result.append(COLLECTION_SEPARATOR);
+ }
+ }
+ // Now add to props
+ props.setPropertyString(name, result.toString());
+ }
+
+ protected List decodeList(IServiceProperties props, String name) {
+ String value = props.getPropertyString(name);
+ if (value == null)
+ return Collections.EMPTY_LIST;
+ List result = new ArrayList();
+ final StringTokenizer t = new StringTokenizer(value,
+ COLLECTION_SEPARATOR);
+ while (t.hasMoreTokens()) {
+ result.add(t.nextToken());
+ }
+ return result;
+ }
+
+ protected void encodeIDArray(IServiceProperties result, String idsname,
+ String idnamespaces, ID[] idFilter) {
+ List<String> idef = new ArrayList<String>();
+ List<String> idns = new ArrayList<String>();
+ for (int i = 0; i < idFilter.length; i++) {
+ idef.add(idFilter[i].toExternalForm());
+ idns.add(idFilter[i].getNamespace().getName());
+ }
+ encodeList(result, idsname, idef);
+ encodeList(result, idnamespaces, idns);
+ }
+
+ protected ID[] decodeIDArray(IServiceProperties props, String idsname,
+ String idnamespaces) {
+ String idef = props.getPropertyString(idsname);
+ if (idef == null)
+ return null;
+ String idns = props.getPropertyString(idnamespaces);
+ if (idns == null)
+ return null;
+ List<String> idsl = decodeList(props, idef);
+ List<String> idnsl = decodeList(props, idns);
+ List result = new ArrayList();
+ for (int i = 0; i < idsl.size(); i++) {
+ ID id = createID(idnsl.get(i), idsl.get(i));
+ if (id != null)
+ result.add(id);
+ }
+ return (ID[]) result.toArray(new ID[] {});
+ }
+
+ protected ID createID(String namespace, String name) {
+ try {
+ return IDFactory.getDefault().createID(namespace, name);
+ } catch (IDCreateException e) {
+ logError("createID", "Exception creating id for namespace="
+ + namespace + ",name=" + name, e);
+ return null;
+ }
+ }
+
+ protected Map decodeServiceProperties(IServiceProperties props) {
+ Map result = new HashMap();
+ // OSGI
+ // endpoint.id
+ String endpointId = decodeString(props,org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_ID);
+ result.put(org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_ID, endpointId);
+ // endpoint.service.id
+ Long endpointServiceId = decodeLong(props, org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_SERVICE_ID);
+ result.put(org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_SERVICE_ID, endpointServiceId);
+ // objectClass
+ List<String> interfaces = decodeList(props,org.osgi.framework.Constants.OBJECTCLASS);
+ result.put(org.osgi.framework.Constants.OBJECTCLASS, (String[]) interfaces.toArray(new String[] {}));
+ // framework uuid
+ String fwkuuid = decodeString(props,org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_FRAMEWORK_UUID);
+ result.put(org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_FRAMEWORK_UUID, fwkuuid);
+ // configuration types
+ List<String> configTypes = decodeList(props,org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED_CONFIGS);
+ if (configTypes != null) result.put(org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED_CONFIGS, (String[]) configTypes.toArray(new String[] {}));
+ // service intents
+ List<String> intents = decodeList(props,org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_INTENTS);
+ if (configTypes != null) result.put(org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_INTENTS, (String[]) intents.toArray(new String[] {}));
+
+ // endpoint ID
+ String endpointName = decodeString(props,RemoteConstants.ENDPOINT_ID);
+ String endpointNamespace = decodeString(props,RemoteConstants.ENDPOINT_ID_NAMESPACE);
+ ID endpointID = createID(endpointName,endpointNamespace);
+ if (endpointID != null) {
+ result.put(RemoteConstants.ENDPOINT_ID,endpointID);
+ }
+ // remote service id
+ Long remoteServiceId = decodeLong(props,RemoteConstants.ENDPOINT_REMOTESERVICE_ID);
+ result.put(RemoteConstants.ENDPOINT_REMOTESERVICE_ID, remoteServiceId);
+ // target ID
+ String targetName = decodeString(props,RemoteConstants.ENDPOINT_TARGET_ID);
+ String targetNamespace = decodeString(props,RemoteConstants.ENDPOINT_ID_NAMESPACE);
+ ID targetID = createID(targetName,targetNamespace);
+ if (targetID != null) {
+ result.put(RemoteConstants.ENDPOINT_TARGET_ID,targetID);
+ }
+ // ID filter
+ ID[] idFilter = decodeIDArray(props, RemoteConstants.ENDPOINT_IDFILTER_IDS, RemoteConstants.ENDPOINT_IDFILTER_NAMESPACES);
+ if (idFilter != null) {
+ result.put(RemoteConstants.ENDPOINT_IDFILTER_IDS, idFilter);
+ }
+ // remote service filter
+ String remoteServiceFilter = decodeString(props,RemoteConstants.ENDPOINT_REMOTESERVICEFILTER);
+ if (remoteServiceFilter != null) {
+ result.put(RemoteConstants.ENDPOINT_REMOTESERVICEFILTER, remoteServiceFilter);
+ }
+ decodeNonStandardServiceProperties(props,result);
+ return result;
+ }
+
+ protected void encodeServiceProperties(
+ EndpointDescription endpointDescription, IServiceProperties result) {
+ // OSGi service properties
+ // endpoint.id == endpointDescription.getId()
+ String endpointId = endpointDescription.getId();
+ encodeString(
+ result,
+ org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_ID,
+ endpointId);
+
+ // OSGi endpoint.service.id = endpointDescription.getServiceId()
+ long endpointServiceId = endpointDescription.getServiceId();
+ encodeLong(
+ result,
+ org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_SERVICE_ID,
+ new Long(endpointServiceId));
+
+ // OSGi objectClass = endpointDescription.getInterfaces();
+ List<String> interfaces = endpointDescription.getInterfaces();
+ encodeList(result, org.osgi.framework.Constants.OBJECTCLASS, interfaces);
+
+ // OSGi frameworkUUID = endpointDescription.getFrameworkUUID()
+ String frameworkUUID = endpointDescription.getFrameworkUUID();
+ if (frameworkUUID == null) {
+ frameworkUUID = Activator.getDefault().getFrameworkUUID();
+ }
+ if (frameworkUUID != null)
+ encodeString(
+ result,
+ org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_FRAMEWORK_UUID,
+ frameworkUUID);
+ // OSGi configuration types =
+ // endpointDescription.getConfigurationTypes();
+ List<String> configurationTypes = endpointDescription
+ .getConfigurationTypes();
+ if (configurationTypes.size() > 0) {
+ encodeList(
+ result,
+ org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED_CONFIGS,
+ configurationTypes);
+ }
+ // OSGI service intents = endpointDescription.getIntents()
+ List<String> serviceIntents = endpointDescription.getIntents();
+ if (serviceIntents.size() > 0) {
+ encodeList(
+ result,
+ org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_INTENTS,
+ serviceIntents);
+ }
+
+ // ECF endpoint ID = endpointDescription.getID()
+ ID endpointID = endpointDescription.getID();
+ // external form of ID
+ encodeString(result, RemoteConstants.ENDPOINT_ID,
+ endpointID.toExternalForm());
+ // namespace
+ encodeString(result, RemoteConstants.ENDPOINT_ID_NAMESPACE, endpointID
+ .getNamespace().getName());
+ // ECF remote service id = endpointDescription.getRemoteServiceId()
+ long remoteServiceId = endpointDescription.getRemoteServiceId();
+ encodeLong(result, RemoteConstants.ENDPOINT_REMOTESERVICE_ID, new Long(
+ remoteServiceId));
+ // ECF connectTargetID = endpointDescription.getConnectTargetID()
+ ID connectTargetID = endpointDescription.getTargetID();
+ if (connectTargetID != null) {
+ // external form of ID
+ encodeString(result, RemoteConstants.ENDPOINT_TARGET_ID,
+ connectTargetID.toExternalForm());
+ // namespace
+ encodeString(result, RemoteConstants.ENDPOINT_TARGET_ID_NAMESPACE,
+ connectTargetID.getNamespace().getName());
+ }
+ // ECF idFilter = endpointDescription.getIDFilter();
+ ID[] idFilter = endpointDescription.getIDFilter();
+ if (idFilter != null && idFilter.length > 0) {
+ encodeIDArray(result, RemoteConstants.ENDPOINT_IDFILTER_IDS,
+ RemoteConstants.ENDPOINT_IDFILTER_NAMESPACES, idFilter);
+ }
+
+ // ECF remote service filter =
+ // endpointDescription.getRemoteServiceFilter()
+ String remoteFilter = endpointDescription.getRemoteServiceFilter();
+ if (remoteFilter != null) {
+ encodeString(result, RemoteConstants.ENDPOINT_REMOTESERVICEFILTER,
+ remoteFilter);
+ }
+ // encode non standar properties
+ encodeNonStandardServiceProperties(endpointDescription.getProperties(),
+ result);
+ }
+
+ protected void encodeNonStandardServiceProperties(
+ Map<String, Object> properties, IServiceProperties result) {
+ for (String key : properties.keySet()) {
+ if (!standardProperties.contains(key)) {
+ Object val = properties.get(key);
+ if (val instanceof byte[]) {
+ result.setPropertyBytes(key, (byte[]) val);
+ } else if (val instanceof String) {
+ result.setPropertyString(key, (String) val);
+ } else {
+ result.setProperty(key, val);
+ }
+ }
+ }
+ }
+
+ protected void decodeNonStandardServiceProperties(IServiceProperties props, Map<String, Object> result) {
+ for(Enumeration keys=props.getPropertyNames(); keys.hasMoreElements(); ) {
+ String key = (String) keys.nextElement();
+ if (!standardProperties.contains(key)) {
+ byte[] bytes = props.getPropertyBytes(key);
+ if (bytes != null) {
+ result.put(key, bytes);
+ continue;
+ }
+ String str = props.getPropertyString(key);
+ if (str != null) {
+ result.put(key, str);
+ continue;
+ }
+ Object obj = props.getProperty(key);
+ if (obj != null) {
+ result.put(key,obj);
+ continue;
+ }
+ }
+ }
+ }
+
+ protected void logInfo(String methodName, String message, Throwable t) {
+ // XXX todo
+ }
+
+ protected void logError(String methodName, String message, Throwable t) {
+ // XXX todo
+ }
+
public void close() {
// nothing to do
}
diff --git a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractServiceInfoFactory.java b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractServiceInfoFactory.java
index adc825afe..1efb90480 100644
--- a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractServiceInfoFactory.java
+++ b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/AbstractServiceInfoFactory.java
@@ -12,6 +12,7 @@ import org.eclipse.ecf.discovery.IDiscoveryAdvertiser;
import org.eclipse.ecf.discovery.IServiceInfo;
import org.eclipse.ecf.discovery.IServiceProperties;
import org.eclipse.ecf.discovery.ServiceInfo;
+import org.eclipse.ecf.discovery.ServiceProperties;
import org.eclipse.ecf.discovery.identity.IServiceTypeID;
import org.eclipse.ecf.discovery.identity.ServiceIDFactory;
@@ -53,17 +54,18 @@ public abstract class AbstractServiceInfoFactory extends
EndpointDescription endpointDescription,
IDiscoveryAdvertiser advertiser) {
Namespace advertiserNamespace = advertiser.getServicesNamespace();
- ServiceInfoKey key = new ServiceInfoKey(endpointDescription,advertiserNamespace);
+ ServiceInfoKey key = new ServiceInfoKey(endpointDescription,
+ advertiserNamespace);
IServiceInfo existingServiceInfo = null;
synchronized (serviceInfos) {
existingServiceInfo = serviceInfos.get(key);
// If it's already there, then we return null
if (existingServiceInfo != null)
return null;
- IServiceTypeID serviceTypeID = createServiceTypeID(endpointDescription,
- advertiser);
- String serviceName = createServiceName(endpointDescription, advertiser,
- serviceTypeID);
+ IServiceTypeID serviceTypeID = createServiceTypeID(
+ endpointDescription, advertiser);
+ String serviceName = createServiceName(endpointDescription,
+ advertiser, serviceTypeID);
URI uri = null;
try {
uri = createURI(endpointDescription, advertiser, serviceTypeID,
@@ -75,22 +77,24 @@ public abstract class AbstractServiceInfoFactory extends
throw new RuntimeException(message, e);
}
IServiceProperties serviceProperties = createServiceProperties(
- endpointDescription, advertiser, serviceTypeID, serviceName,
- uri);
- IServiceInfo newServiceInfo = new ServiceInfo(uri,
- serviceName, serviceTypeID, serviceProperties);
+ endpointDescription, advertiser, serviceTypeID,
+ serviceName, uri);
+ IServiceInfo newServiceInfo = new ServiceInfo(uri, serviceName,
+ serviceTypeID, serviceProperties);
// put into map using key
- serviceInfos.put(key, newServiceInfo);
+ serviceInfos.put(key, newServiceInfo);
return newServiceInfo;
}
}
+
protected IServiceProperties createServiceProperties(
EndpointDescription endpointDescription,
IDiscoveryAdvertiser advertiser, IServiceTypeID serviceTypeID,
String serviceName, URI uri) {
- // TODO Auto-generated method stub
- return null;
+ ServiceProperties result = new ServiceProperties();
+ encodeServiceProperties(endpointDescription, result);
+ return result;
}
protected URI createURI(EndpointDescription endpointDescription,
@@ -142,21 +146,13 @@ public abstract class AbstractServiceInfoFactory extends
return new URI(scheme, null, host, port, path, null, null);
}
- protected void logInfo(String methodName, String message, Throwable t) {
- // XXX todo
- }
-
- protected void logError(String methodName, String message, Throwable t) {
- // XXX todo
- }
-
protected String createServiceName(EndpointDescription endpointDescription,
IDiscoveryAdvertiser advertiser, IServiceTypeID serviceTypeID) {
// First create unique default name
String defaultServiceName = createDefaultServiceName(
endpointDescription, advertiser, serviceTypeID);
// Look for service name that was explicitly set
- String serviceName = getStringPropertyWithDefault(
+ String serviceName = getStringWithDefault(
endpointDescription.getProperties(),
RemoteConstants.DISCOVERY_SERVICE_NAME, defaultServiceName);
return serviceName;
@@ -173,12 +169,12 @@ public abstract class AbstractServiceInfoFactory extends
EndpointDescription endpointDescription,
IDiscoveryAdvertiser advertiser) {
Map props = endpointDescription.getProperties();
- String[] scopes = getStringArrayPropertyWithDefault(props,
+ String[] scopes = getStringArrayWithDefault(props,
RemoteConstants.DISCOVERY_SCOPE, IServiceTypeID.DEFAULT_SCOPE);
- String[] protocols = getStringArrayPropertyWithDefault(props,
+ String[] protocols = getStringArrayWithDefault(props,
RemoteConstants.DISCOVERY_PROTOCOLS,
IServiceTypeID.DEFAULT_SCOPE);
- String namingAuthority = getStringPropertyWithDefault(props,
+ String namingAuthority = getStringWithDefault(props,
RemoteConstants.DISCOVERY_NAMING_AUTHORITY,
IServiceTypeID.DEFAULT_NA);
return ServiceIDFactory.getDefault().createServiceTypeID(
@@ -191,7 +187,8 @@ public abstract class AbstractServiceInfoFactory extends
EndpointDescription endpointDescription,
IDiscoveryAdvertiser advertiser) {
Namespace advertiserNamespace = advertiser.getServicesNamespace();
- ServiceInfoKey key = new ServiceInfoKey(endpointDescription,advertiserNamespace);
+ ServiceInfoKey key = new ServiceInfoKey(endpointDescription,
+ advertiserNamespace);
synchronized (serviceInfos) {
return serviceInfos.remove(key);
}
diff --git a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/EndpointDescription.java b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/EndpointDescription.java
index b7c248c3b..3cd765127 100644
--- a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/EndpointDescription.java
+++ b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/EndpointDescription.java
@@ -42,24 +42,24 @@ public class EndpointDescription extends
private void initRemoteServiceProperties() {
Map properties = getProperties();
- containerID = (ID) properties.get(RemoteConstants.CONTAINER_ID_PROPNAME);
+ containerID = (ID) properties.get(RemoteConstants.ENDPOINT_ID);
if (containerID == null)
throw new NullPointerException(
"ECF EndpointDescription must include non-null containerID");
- Object rsid = properties.get(RemoteConstants.REMOTE_SERVICE_ID_PROPNAME);
+ Object rsid = properties.get(RemoteConstants.ENDPOINT_REMOTESERVICE_ID);
if (rsid != null)
remoteServiceId = ((Long) rsid).longValue();
- Object ctid = properties.get(RemoteConstants.CONNECT_TARGET_ID_PROPNAME);
+ Object ctid = properties.get(RemoteConstants.ENDPOINT_TARGET_ID);
if (ctid != null)
connectTargetID = (ID) ctid;
- Object idf = properties.get(RemoteConstants.IDFILTER_PROPNAME);
+ Object idf = properties.get(RemoteConstants.ENDPOINT_IDFILTER_IDS);
if (idf != null)
idFilter = (ID[]) idf;
- Object rsf = properties.get(RemoteConstants.REMOTESERVICE_FILTER_PROPNAME);
+ Object rsf = properties.get(RemoteConstants.ENDPOINT_REMOTESERVICEFILTER);
if (rsf != null)
rsFilter = (String) rsFilter;
}
diff --git a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteConstants.java b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteConstants.java
index f5aa3e6d7..eaba42212 100644
--- a/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteConstants.java
+++ b/incubation/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteConstants.java
@@ -6,25 +6,26 @@ public class RemoteConstants {
public static final String DISCOVERY_SCOPE = "ecf.endpoint.discovery.scope";
public static final String DISCOVERY_PROTOCOLS = "ecf.endpoint.discovery.protocols";
- public static final String DISCOVERY_NAMING_AUTHORITY = "ecf.endpoint.discovery.na";
+ public static final String DISCOVERY_NAMING_AUTHORITY = "ecf.endpoint.discovery.nameingauthority";
public static final String DISCOVERY_SERVICE_NAME = "ecf.endpoint.discovery.servicename";
public static final String DISCOVERY_DEFAULT_SERVICE_NAME_PREFIX = "osgirsvc_";
-
- // value of this property is expected to be of type ID
- public static final String CONTAINER_ID_PROPNAME = "ecf.endpoint.containerid";
- public static final String CONTAINER_ID_NAMESPACE_PROPNAME = "ecf.endpoint.containerid.namespace";
- // value of this property is expected to be of type Long
- public static final String REMOTE_SERVICE_ID_PROPNAME = "ecf.endpoint.remoteserviceid";
+ // ECF endpoint description properties <-> service info properties
+ // container id external form
+ public static final String ENDPOINT_ID = "ecf.endpoint.id";
+ // container id namespace
+ public static final String ENDPOINT_ID_NAMESPACE = "ecf.endpoint.id.ns";
+ // remote service id
+ public static final String ENDPOINT_REMOTESERVICE_ID = "ecf.endpoint.rs.id";
- // value of this property is expected to be ID
- public static final String CONNECT_TARGET_ID_PROPNAME = "ecf.endpoint.connecttargetid";
- public static final String CONNECT_TARGET_ID_NAMESPACE_PROPNAME = "ecf.endpoint.connecttargetid.namespace";
+ public static final String ENDPOINT_TARGET_ID = "ecf.endpoint.target.id";
+ public static final String ENDPOINT_TARGET_ID_NAMESPACE = "ecf.endpoint.target.id.ns";
- // value of this property is expected to be ID[]
- public static final String IDFILTER_PROPNAME = "ecf.endpoint.idfilter";
- public static final String IDFILTER_NAMESPACE_PROPNAME = "ecf.endpoint.idfilter.namespace";
- // value of this property is expected to be String
- public static final String REMOTESERVICE_FILTER_PROPNAME = "ecf.endpoint.remoteservicefilter";
+// id filter external form
+ public static final String ENDPOINT_IDFILTER_IDS = "ecf.endpoint.idfilter.ids";
+ // id filter namespaces
+ public static final String ENDPOINT_IDFILTER_NAMESPACES = "ecf.endpoint.idfilter.ids.ns";
+ // remote service filter
+ public static final String ENDPOINT_REMOTESERVICEFILTER = "ecf.endpoint.rsfilter";
}
diff --git a/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/src/org/eclipse/ecf/provider/internal/endpointdescription/localdiscovery/Activator.java b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/src/org/eclipse/ecf/provider/internal/endpointdescription/localdiscovery/Activator.java
index b11e3ad37..d94d4c851 100644
--- a/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/src/org/eclipse/ecf/provider/internal/endpointdescription/localdiscovery/Activator.java
+++ b/incubation/bundles/org.eclipse.ecf.provider.endpointdescription.localdiscovery/src/org/eclipse/ecf/provider/internal/endpointdescription/localdiscovery/Activator.java
@@ -45,8 +45,8 @@ public class Activator implements BundleActivator {
testParseServiceDescription();
}
- private Map convertProperties(Map properties) {
- Map result = new HashMap();
+ private Map<String,Object> convertProperties(Map properties) {
+ Map<String,Object> result = new HashMap<String,Object>();
String svcimportedcfgs = (String) properties.get(org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED_CONFIGS);
result.put(org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED_CONFIGS,svcimportedcfgs);
@@ -63,12 +63,12 @@ public class Activator implements BundleActivator {
String endpointfmkid = (String) properties.get(org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_FRAMEWORK_UUID);
result.put(org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_FRAMEWORK_UUID, endpointfmkid);
- String containerid = (String) properties.get(RemoteConstants.CONTAINER_ID_PROPNAME);
- String containerns = (String) properties.get(RemoteConstants.CONTAINER_ID_NAMESPACE_PROPNAME);
- result.put(RemoteConstants.CONTAINER_ID_PROPNAME, IDFactory.getDefault().createID(containerns, containerid));
+ String containerid = (String) properties.get(RemoteConstants.ENDPOINT_ID);
+ String containerns = (String) properties.get(RemoteConstants.ENDPOINT_ID_NAMESPACE);
+ result.put(RemoteConstants.ENDPOINT_ID, IDFactory.getDefault().createID(containerns, containerid));
- String rsid = (String) properties.get(RemoteConstants.REMOTE_SERVICE_ID_PROPNAME);
- result.put(RemoteConstants.REMOTE_SERVICE_ID_PROPNAME, new Long(rsid));
+ String rsid = (String) properties.get(RemoteConstants.ENDPOINT_REMOTESERVICE_ID);
+ result.put(RemoteConstants.ENDPOINT_REMOTESERVICE_ID, new Long(rsid));
return result;
}

Back to the top