diff options
author | slewis | 2015-08-19 21:51:07 +0000 |
---|---|---|
committer | slewis | 2015-08-19 21:51:07 +0000 |
commit | 59c0ea3dd70455894bf87122364bfb54c1a5ce79 (patch) | |
tree | 2891b9d5fcf84c4bfbfcfeb65369538ef41e4857 | |
parent | 09d07f54d3c389d949b03ba588a8551195a2b85b (diff) | |
download | org.eclipse.ecf-59c0ea3dd70455894bf87122364bfb54c1a5ce79.tar.gz org.eclipse.ecf-59c0ea3dd70455894bf87122364bfb54c1a5ce79.tar.xz org.eclipse.ecf-59c0ea3dd70455894bf87122364bfb54c1a5ce79.zip |
Initial design and implementation for enhancement
https://bugs.eclipse.org/bugs/show_bug.cgi?id=475426
Change-Id: Ia2bc83f800770cf317897aa3fa8f70a6db065ed9
3 files changed, 18 insertions, 31 deletions
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/internal/remoteservice/Activator.java b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/internal/remoteservice/Activator.java index e7412dbfe..2d175cc6d 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/internal/remoteservice/Activator.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/internal/remoteservice/Activator.java @@ -89,8 +89,13 @@ public class Activator implements BundleActivator { BundleContext bundleContext = getContext(); IRemoteServiceDistributionProvider dProvider = bundleContext.getService(reference); if (dProvider != null) { - ServiceRegistration<ContainerTypeDescription> ctdSR = dProvider.registerContainerTypeDescription(bundleContext); - ServiceRegistration<Namespace> nsSR = dProvider.registerNamespace(bundleContext); + ContainerTypeDescription ctd = dProvider.createContainerTypeDescription(); + Dictionary<String, ?> ctdProps = dProvider.getContainerTypeDescriptionProperties(); + ServiceRegistration<ContainerTypeDescription> ctdSR = bundleContext.registerService(ContainerTypeDescription.class, ctd, ctdProps); + Namespace ns = dProvider.createNamespace(); + ServiceRegistration<Namespace> nsSR = null; + if (ns != null) + nsSR = bundleContext.registerService(Namespace.class, ns, dProvider.getNamespaceProperties()); if (ctdSR != null) svcRefToDSDPRegMap.put(reference, new RSDPRegistrations(ctdSR, nsSR)); } diff --git a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider/IRemoteServiceDistributionProvider.java b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider/IRemoteServiceDistributionProvider.java index 78360f5e9..58ffeb23c 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider/IRemoteServiceDistributionProvider.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider/IRemoteServiceDistributionProvider.java @@ -1,9 +1,8 @@ package org.eclipse.ecf.remoteservice.provider; +import java.util.Dictionary; import org.eclipse.ecf.core.ContainerTypeDescription; import org.eclipse.ecf.core.identity.Namespace; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; /** * @since 8.7 @@ -14,18 +13,12 @@ import org.osgi.framework.ServiceRegistration; */ public interface IRemoteServiceDistributionProvider { - /** - * Register the appropriate ContainerTypeDescription instance given the bundle context. - * @param context the BundleContext that will register the ContainerTypeDescription. Will not be <code>null</code>. - * @return ServiceRegistration for the registered ContainerTypeDescription. - */ - ServiceRegistration<ContainerTypeDescription> registerContainerTypeDescription(BundleContext context); + ContainerTypeDescription createContainerTypeDescription(); - /** - * Register the appropriate Namespace instance given the bundle context. - * @param context the BundleContext that will register the Namespace. Will not be <code>null</code>. - * @return ServiceRegistration for the registered Namespace. - */ - ServiceRegistration<Namespace> registerNamespace(BundleContext context); + Dictionary<String, ?> getContainerTypeDescriptionProperties(); + + Namespace createNamespace(); + + Dictionary<String, ?> getNamespaceProperties(); } diff --git a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider/RemoteServiceDistributionProvider.java b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider/RemoteServiceDistributionProvider.java index a1d7ae096..a5008d90e 100644 --- a/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider/RemoteServiceDistributionProvider.java +++ b/framework/bundles/org.eclipse.ecf.remoteservice/src/org/eclipse/ecf/remoteservice/provider/RemoteServiceDistributionProvider.java @@ -3,8 +3,6 @@ package org.eclipse.ecf.remoteservice.provider; import java.util.Dictionary; import org.eclipse.ecf.core.ContainerTypeDescription; import org.eclipse.ecf.core.identity.Namespace; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; /** * Basic implementation of IRemoteServiceDistributionProvider. Intended to be subclassed by distribution @@ -14,26 +12,17 @@ import org.osgi.framework.ServiceRegistration; */ public abstract class RemoteServiceDistributionProvider implements IRemoteServiceDistributionProvider { - public ServiceRegistration<ContainerTypeDescription> registerContainerTypeDescription(BundleContext context) { - return context.registerService(ContainerTypeDescription.class, getContainerTypeDescription(), getContainerTypeDescriptionProperties()); - } - - protected abstract ContainerTypeDescription getContainerTypeDescription(); + public abstract ContainerTypeDescription createContainerTypeDescription(); - protected Dictionary<String, ?> getContainerTypeDescriptionProperties() { + public Dictionary<String, ?> getContainerTypeDescriptionProperties() { return null; } - public ServiceRegistration<Namespace> registerNamespace(BundleContext context) { - Namespace ns = getNamespace(); - return (ns == null) ? null : context.registerService(Namespace.class, ns, getNamespaceProperties()); - } - - protected Namespace getNamespace() { + public Namespace createNamespace() { return null; } - protected Dictionary<String, ?> getNamespaceProperties() { + public Dictionary<String, ?> getNamespaceProperties() { return null; } } |