diff options
author | slewis | 2009-04-28 05:16:40 +0000 |
---|---|---|
committer | slewis | 2009-04-28 05:16:40 +0000 |
commit | 44465fccd77dffea2d6203a2d79c0e43a7aa89b9 (patch) | |
tree | 3a51e56b9d64a6ea7173669ee0ac6e49dec8400f | |
parent | 685d5bd2fd541d48ff17260b0e61b1e8ddf701e2 (diff) | |
download | org.eclipse.ecf-44465fccd77dffea2d6203a2d79c0e43a7aa89b9.tar.gz org.eclipse.ecf-44465fccd77dffea2d6203a2d79c0e43a7aa89b9.tar.xz org.eclipse.ecf-44465fccd77dffea2d6203a2d79c0e43a7aa89b9.zip |
Changed osgi cmpn version 20090427
5 files changed, 48 insertions, 50 deletions
diff --git a/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/Activator.java b/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/Activator.java index b3fd8fd5b..e05353ec5 100644 --- a/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/Activator.java +++ b/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/Activator.java @@ -62,10 +62,10 @@ public class Activator implements BundleActivator { // register the discovery service which is provided by SPH Dictionary props = new Hashtable(); - props.put(Discovery.PROP_KEY_VENDOR_NAME, "Eclipse.org"); - props.put(Discovery.PROP_KEY_PRODUCT_NAME, "ECF Discovery"); - props.put(Discovery.PROP_KEY_PRODUCT_VERSION, "1.0.0"); - props.put(Discovery.PROP_KEY_SUPPORTED_PROTOCOLS, "SLP|mDNS|DNS-SRV"); + props.put(Discovery.VENDOR_NAME, "Eclipse.org"); + props.put(Discovery.PRODUCT_NAME, "ECF Discovery"); + props.put(Discovery.PRODUCT_VERSION, "1.0.0"); + props.put(Discovery.SUPPORTED_PROTOCOLS, "SLP|mDNS|DNS-SRV"); ctxt.registerService(Discovery.class.getName(), servicePublicationHandler, props); diff --git a/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/ECFServiceEndpointDescriptionImpl.java b/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/ECFServiceEndpointDescriptionImpl.java index b1d608c62..25efd0cf6 100644 --- a/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/ECFServiceEndpointDescriptionImpl.java +++ b/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/ECFServiceEndpointDescriptionImpl.java @@ -32,13 +32,13 @@ public class ECFServiceEndpointDescriptionImpl extends IServiceProperties serviceProperties = serviceInfo .getServiceProperties(); final byte[] endpointBytes = serviceProperties - .getPropertyBytes(IServicePublication.PROP_KEY_ENDPOINT_CONTAINERID); + .getPropertyBytes(IServicePublication.ENDPOINT_CONTAINERID); if (endpointBytes == null) throw new IDCreateException( "ServiceEndpointDescription endpointBytes cannot be null"); final String endpointStr = new String(endpointBytes); final String namespaceStr = serviceProperties - .getPropertyString(IServicePublication.PROP_KEY_ENDPOINT_CONTAINERID_NAMESPACE); + .getPropertyString(IServicePublication.ENDPOINT_CONTAINERID_NAMESPACE); if (namespaceStr == null) { throw new IDCreateException( "ServiceEndpointDescription namespaceStr cannot be null"); @@ -47,12 +47,12 @@ public class ECFServiceEndpointDescriptionImpl extends // create the target id, if it's there final byte[] targetBytes = serviceProperties - .getPropertyBytes(IServicePublication.PROP_KEY_TARGET_CONTAINERID); + .getPropertyBytes(IServicePublication.TARGET_CONTAINERID); // If this is null, we're ok with it if (targetBytes != null) { final String targetStr = new String(endpointBytes); String targetNamespaceStr = serviceProperties - .getPropertyString(IServicePublication.PROP_KEY_TARGET_CONTAINERID_NAMESPACE); + .getPropertyString(IServicePublication.TARGET_CONTAINERID_NAMESPACE); if (targetNamespaceStr == null) targetNamespaceStr = namespaceStr; targetId = IDFactory.getDefault().createID(targetNamespaceStr, diff --git a/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/ServicePublicationHandler.java b/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/ServicePublicationHandler.java index 10c24c201..2baeea159 100644 --- a/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/ServicePublicationHandler.java +++ b/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/internal/osgi/services/discovery/ServicePublicationHandler.java @@ -147,7 +147,7 @@ public class ServicePublicationHandler implements ServiceTrackerCustomizer, // should be a // Collection of Strings Collection svcInterfaces = ServicePropertyUtils.getCollectionProperty( - reference, ServicePublication.PROP_KEY_SERVICE_INTERFACE_NAME); + reference, ServicePublication.SERVICE_INTERFACE_NAME); // If it's not there, then we ignore this ServicePublication and return if (svcInterfaces == null) { logError( @@ -160,13 +160,13 @@ public class ServicePublicationHandler implements ServiceTrackerCustomizer, } IServiceProperties discoveryServiceProperties = new ServiceProperties(); discoveryServiceProperties.setPropertyString( - ServicePublication.PROP_KEY_SERVICE_INTERFACE_NAME, - ServicePropertyUtils.createStringFromCollection(svcInterfaces)); + ServicePublication.SERVICE_INTERFACE_NAME, ServicePropertyUtils + .createStringFromCollection(svcInterfaces)); // We also use the optional RFC 119 property PROP_KEY_SERVICE_PROPERTIES Map servicePublicationServiceProperties = ServicePropertyUtils .getMapProperty(reference, - ServicePublication.PROP_KEY_SERVICE_PROPERTIES); + ServicePublication.SERVICE_PROPERTIES); if (servicePublicationServiceProperties == null) { logError( "handleServicePublication", //$NON-NLS-1$ @@ -183,9 +183,9 @@ public class ServicePublicationHandler implements ServiceTrackerCustomizer, // See EventHookImpl.getServicePublicationProperties() // Get and then serialize and set - // IServicePublication.PROP_KEY_ENDPOINT_CONTAINERID + // IServicePublication.ENDPOINT_CONTAINERID ID endpointContainerID = (ID) reference - .getProperty(IServicePublication.PROP_KEY_ENDPOINT_CONTAINERID); + .getProperty(IServicePublication.ENDPOINT_CONTAINERID); // This is required for ecf endpoints so if it's not found then it's an // error if (endpointContainerID == null) { @@ -193,36 +193,36 @@ public class ServicePublicationHandler implements ServiceTrackerCustomizer, "handleServicePublication", //$NON-NLS-1$ "ignoring " //$NON-NLS-1$ + reference - + ". IServicePublication.PROP_KEY_ENDPOINT_CONTAINERID not set", //$NON-NLS-1$ + + ". IServicePublication.ENDPOINT_CONTAINERID not set", //$NON-NLS-1$ null); return; } // Add endpoint container id.toExternalForm().getBytes...so AS byte [] discoveryServiceProperties.setPropertyBytes( - IServicePublication.PROP_KEY_ENDPOINT_CONTAINERID, + IServicePublication.ENDPOINT_CONTAINERID, endpointContainerID.toExternalForm().getBytes()); // Add endpoint container id namespace name String endpointNamespace = endpointContainerID.getNamespace().getName(); discoveryServiceProperties.setPropertyString( - IServicePublication.PROP_KEY_ENDPOINT_CONTAINERID_NAMESPACE, + IServicePublication.ENDPOINT_CONTAINERID_NAMESPACE, endpointNamespace); // See EventHookImpl.getServicePublicationProperties() // Get and then serialize and set - // IServicePublication.PROP_KEY_TARGET_CONTAINERID + // IServicePublication.TARGET_CONTAINERID ID targetContainerID = (ID) reference - .getProperty(IServicePublication.PROP_KEY_TARGET_CONTAINERID); + .getProperty(IServicePublication.TARGET_CONTAINERID); // the target ID is optional, so only add it if it's been added // via the EventHookImpl if (targetContainerID != null) { // Add endpoint container id.toExternalForm().getBytes...so AS byte // [] discoveryServiceProperties.setPropertyBytes( - IServicePublication.PROP_KEY_TARGET_CONTAINERID, + IServicePublication.TARGET_CONTAINERID, targetContainerID.toExternalForm().getBytes()); String targetNamespace = targetContainerID.getNamespace().getName(); discoveryServiceProperties.setPropertyString( - IServicePublication.PROP_KEY_TARGET_CONTAINERID_NAMESPACE, + IServicePublication.TARGET_CONTAINERID_NAMESPACE, targetNamespace); } @@ -257,7 +257,7 @@ public class ServicePublicationHandler implements ServiceTrackerCustomizer, String serviceName = getPropertyWithDefault( servicePublicationServiceProperties, - IServicePublication.SERVICE_NAME_PROP, + IServicePublication.SERVICE_NAME, (IServicePublication.DEFAULT_SERVICE_NAME_PREFIX + remoteServiceID)); svcInfo = new ServiceInfo(uri, serviceName, serviceTypeID, @@ -365,12 +365,12 @@ public class ServicePublicationHandler implements ServiceTrackerCustomizer, throws IDCreateException { String namingAuthority = getPropertyWithDefault( servicePublicationProperties, - IServicePublication.NAMING_AUTHORITY_PROP, + IServicePublication.NAMING_AUTHORITY, IServiceTypeID.DEFAULT_NA); String scope = getPropertyWithDefault(servicePublicationProperties, - IServicePublication.SCOPE_PROP, IServiceTypeID.DEFAULT_SCOPE[0]); + IServicePublication.SCOPE, IServiceTypeID.DEFAULT_SCOPE[0]); String protocol = getPropertyWithDefault(servicePublicationProperties, - IServicePublication.SERVICE_PROTOCOL_PROP, + IServicePublication.SERVICE_PROTOCOL, IServiceTypeID.DEFAULT_PROTO[0]); return ServiceIDFactory.getDefault().createServiceTypeID(aNamespace, diff --git a/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/osgi/services/discovery/ECFServiceEndpointDescription.java b/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/osgi/services/discovery/ECFServiceEndpointDescription.java index 4a3637dd7..9561b64fb 100644 --- a/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/osgi/services/discovery/ECFServiceEndpointDescription.java +++ b/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/osgi/services/discovery/ECFServiceEndpointDescription.java @@ -9,8 +9,8 @@ ******************************************************************************/ package org.eclipse.ecf.osgi.services.discovery; -import java.net.MalformedURLException; -import java.net.URL; +import java.net.URI; +import java.net.URISyntaxException; import java.util.*; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; @@ -36,8 +36,7 @@ public abstract class ECFServiceEndpointDescription implements * org.osgi.service.discovery.ServiceEndpointDescription#getEndpointID() */ public String getEndpointID() { - Object o = serviceProperties - .get(ServicePublication.PROP_KEY_ENDPOINT_ID); + Object o = serviceProperties.get(ServicePublication.ENDPOINT_ID); if (o instanceof String) { return (String) o; } @@ -54,7 +53,7 @@ public abstract class ECFServiceEndpointDescription implements if (interfaceName == null) return null; Object o = serviceProperties - .get(ServicePublication.PROP_KEY_ENDPOINT_INTERFACE_NAME); + .get(ServicePublication.ENDPOINT_INTERFACE_NAME); if (o == null || !(o instanceof String)) { return null; } @@ -82,24 +81,23 @@ public abstract class ECFServiceEndpointDescription implements * * @see org.osgi.service.discovery.ServiceEndpointDescription#getLocation() */ - public URL getLocation() { - Object o = serviceProperties - .get(ServicePublication.PROP_KEY_ENDPOINT_LOCATION); + public URI getLocation() { + Object o = serviceProperties.get(ServicePublication.ENDPOINT_LOCATION); if (o == null || !(o instanceof String)) { return null; } - String urlExternalForm = (String) o; - URL url = null; + String uriExternalForm = (String) o; + URI uri = null; try { - url = new URL(urlExternalForm); - } catch (MalformedURLException e) { + uri = new URI(uriExternalForm); + } catch (URISyntaxException e) { Activator.getDefault() .log( new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, - "Exception getting location URL", e));//$NON-NLS-1$ + "Exception getting location URI", e));//$NON-NLS-1$ } - return url; + return uri; } /* @@ -142,7 +140,7 @@ public abstract class ECFServiceEndpointDescription implements */ public Collection getProvidedInterfaces() { Object o = serviceProperties - .get(ServicePublication.PROP_KEY_SERVICE_INTERFACE_NAME); + .get(ServicePublication.SERVICE_INTERFACE_NAME); if (o == null || !(o instanceof String)) { throw new NullPointerException(); } @@ -193,7 +191,7 @@ public abstract class ECFServiceEndpointDescription implements public String getRemoteServicesFilter() { Object o = serviceProperties - .get(IServicePublication.PROP_KEY_REMOTE_SERVICE_FILTER); + .get(IServicePublication.REMOTE_SERVICE_FILTER); if (o instanceof String) return (String) o; return null; diff --git a/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/osgi/services/discovery/IServicePublication.java b/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/osgi/services/discovery/IServicePublication.java index aff8af28b..71bd68bae 100644 --- a/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/osgi/services/discovery/IServicePublication.java +++ b/compendium/bundles/org.eclipse.ecf.osgi.services.discovery/src/org/eclipse/ecf/osgi/services/discovery/IServicePublication.java @@ -31,14 +31,14 @@ public interface IServicePublication extends ServicePublication { * DEFAULT_SERVICE_NAME_PREFIX+serviceID as described above. The value * provided for this property must be of type String. */ - public static final String SERVICE_NAME_PROP = "ecf.sp.svcname"; //$NON-NLS-1$ + public static final String SERVICE_NAME = "ecf.sp.svcname"; //$NON-NLS-1$ /** * Discovery naming authority property. If the specified serviceproperty is * non-null, the discovery naming authority will override the default value, * which is IServiceID#DEFAULT_NA ("iana"). The value provided for this * property must be of type String. */ - public static final String NAMING_AUTHORITY_PROP = "ecf.sp.namingauth"; //$NON-NLS-1$ + public static final String NAMING_AUTHORITY = "ecf.sp.namingauth"; //$NON-NLS-1$ /** * Discovery scope property. If the specified service property is non-null, * the discovery scope will override the default value, which is @@ -46,7 +46,7 @@ public interface IServicePublication extends ServicePublication { * property must be of type String, which can be split into a String[] using * ';' as the delimiter (e.g. 'scope1;scope2;scope3'). */ - public static final String SCOPE_PROP = "ecf.sp.scope"; //$NON-NLS-1$ + public static final String SCOPE = "ecf.sp.scope"; //$NON-NLS-1$ /** * Discovery protocol property. If the specified service property is * non-null, the discovery protocol will override the default value, which @@ -54,30 +54,30 @@ public interface IServicePublication extends ServicePublication { * must be of type String, which can be split into a String[] using ';' as * the delimiter (e.g. 'proto1;proto1;proto1'). */ - public static final String SERVICE_PROTOCOL_PROP = "ecf.sp.protocol"; //$NON-NLS-1$ + public static final String SERVICE_PROTOCOL = "ecf.sp.protocol"; //$NON-NLS-1$ /** * Endpoint container ID property. The value for this property must be of * type byte[] which is a UTF-8 encoding of a String. */ - public static final String PROP_KEY_ENDPOINT_CONTAINERID = "ecf.sp.cid"; //$NON-NLS-1$ + public static final String ENDPOINT_CONTAINERID = "ecf.sp.cid"; //$NON-NLS-1$ /** * Endpoint container ID namespace property. The value provided for this * property must be of type String. */ - public static final String PROP_KEY_ENDPOINT_CONTAINERID_NAMESPACE = "ecf.sp.cns"; //$NON-NLS-1$ + public static final String ENDPOINT_CONTAINERID_NAMESPACE = "ecf.sp.cns"; //$NON-NLS-1$ /** * Target container ID property. The value for this property must be of type * byte[] which is a UTF-8 encoding of a String. */ - public static final String PROP_KEY_TARGET_CONTAINERID = "ecf.sp.tid"; //$NON-NLS-1$ + public static final String TARGET_CONTAINERID = "ecf.sp.tid"; //$NON-NLS-1$ /** * Target container ID namespace property. The value provided for this * property must be of type String. */ - public static final String PROP_KEY_TARGET_CONTAINERID_NAMESPACE = "ecf.sp.tns"; //$NON-NLS-1$ + public static final String TARGET_CONTAINERID_NAMESPACE = "ecf.sp.tns"; //$NON-NLS-1$ /** * Client remote service filter property. The value provided for this * property must be of type String. */ - public static final String PROP_KEY_REMOTE_SERVICE_FILTER = "ecf.client.filter"; //$NON-NLS-1$ + public static final String REMOTE_SERVICE_FILTER = "ecf.client.filter"; //$NON-NLS-1$ } |