diff options
author | slewis | 2013-05-13 22:56:33 +0000 |
---|---|---|
committer | slewis | 2013-05-13 22:56:33 +0000 |
commit | 610e8ac564f3a2dd2a56482310a3e2e7d626c9ea (patch) | |
tree | 5b37b8a98d1ad2167d562ab611fdd47db312d27e /compendium/bundles/org.eclipse.ecf.osgi.services.distribution | |
parent | 96770fc1427a7756a1a9fbcd274d9ac3c3b9b77a (diff) | |
download | org.eclipse.ecf-610e8ac564f3a2dd2a56482310a3e2e7d626c9ea.tar.gz org.eclipse.ecf-610e8ac564f3a2dd2a56482310a3e2e7d626c9ea.tar.xz org.eclipse.ecf-610e8ac564f3a2dd2a56482310a3e2e7d626c9ea.zip |
Implementation for enhancement
https://bugs.eclipse.org/bugs/show_bug.cgi?id=407952
Diffstat (limited to 'compendium/bundles/org.eclipse.ecf.osgi.services.distribution')
4 files changed, 28 insertions, 24 deletions
diff --git a/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/OSGI-INF/eventhookcomponent.xml b/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/OSGI-INF/eventhookcomponent.xml index 0e2cf8934..96108ea8d 100644 --- a/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/OSGI-INF/eventhookcomponent.xml +++ b/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/OSGI-INF/eventhookcomponent.xml @@ -2,8 +2,8 @@ <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="activate" immediate="false" name="org.eclipse.ecf.osgi.services.distribution.basictopologymanager"> <implementation class="org.eclipse.ecf.internal.osgi.services.distribution.BasicTopologyManagerComponent"/> <service> - <provide interface="org.osgi.framework.hooks.service.EventHook"/> <provide interface="org.osgi.service.remoteserviceadmin.RemoteServiceAdminListener"/> + <provide interface="org.osgi.framework.hooks.service.EventListenerHook"/> </service> <reference bind="bindEndpointListener" cardinality="1..n" interface="org.osgi.service.remoteserviceadmin.EndpointListener" name="EndpointListener" policy="static" unbind="unbindEndpointListener"/> <property name="event.topics" type="String" value="org/osgi/service/remoteserviceadmin/*"/> diff --git a/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/internal/osgi/services/distribution/Activator.java b/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/internal/osgi/services/distribution/Activator.java index 6ac92dd0f..760de2d71 100644 --- a/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/internal/osgi/services/distribution/Activator.java +++ b/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/internal/osgi/services/distribution/Activator.java @@ -19,7 +19,7 @@ import org.osgi.framework.BundleContext; import org.osgi.framework.Filter; import org.osgi.framework.ServiceReference; import org.osgi.framework.ServiceRegistration; -import org.osgi.framework.hooks.service.EventHook; +import org.osgi.framework.hooks.service.EventListenerHook; import org.osgi.service.log.LogService; import org.osgi.service.remoteserviceadmin.EndpointListener; import org.osgi.service.remoteserviceadmin.RemoteServiceAdminListener; @@ -62,7 +62,7 @@ public class Activator implements BundleActivator { private BasicTopologyManagerImpl basicTopologyManagerImpl; private ServiceRegistration endpointListenerReg; private BasicTopologyManagerComponent basicTopologyManagerComp; - private ServiceRegistration eventHookRegistration; + private ServiceRegistration eventListenerHookRegistration; private ServiceRegistration eventAdminListenerRegistration; public static Activator getDefault() { @@ -162,12 +162,13 @@ public class Activator implements BundleActivator { return; // If this property is set we assume DS is being used. // The following code is to make sure that we don't do any more if - // EventHook has already been registered for us by DS - // Create serviceFilter for EventHook classname - String serviceName = EventHook.class.getName(); + // EventListenerHook has already been registered for us by DS + // Create serviceFilter for EventListenerHook classname + String serviceName = EventListenerHook.class.getName(); Filter serviceFilter = context .createFilter("(objectclass=" + serviceName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ - // if this bundle has already registered EventHook service via ds, then + // if this bundle has already registered EventListenerHook service via + // ds, then // we're done ServiceReference[] refs = context.getBundle().getRegisteredServices(); if (refs != null) { @@ -185,9 +186,9 @@ public class Activator implements BundleActivator { eventAdminListenerRegistration = this.context.registerService( RemoteServiceAdminListener.class, basicTopologyManagerComp, null); - // register the basic topology manager as EventHook service - eventHookRegistration = this.context.registerService(EventHook.class, - basicTopologyManagerComp, null); + // register the basic topology manager as EventListenerHook service + eventListenerHookRegistration = this.context.registerService( + EventListenerHook.class, basicTopologyManagerComp, null); // export any previously registered remote services by calling activate basicTopologyManagerComp.activate(); } @@ -199,9 +200,9 @@ public class Activator implements BundleActivator { * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) */ public void stop(BundleContext ctxt) throws Exception { - if (eventHookRegistration != null) { - eventHookRegistration.unregister(); - eventHookRegistration = null; + if (eventListenerHookRegistration != null) { + eventListenerHookRegistration.unregister(); + eventListenerHookRegistration = null; } if (basicTopologyManagerComp != null) { basicTopologyManagerComp diff --git a/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/internal/osgi/services/distribution/BasicTopologyManagerComponent.java b/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/internal/osgi/services/distribution/BasicTopologyManagerComponent.java index fe1dc571a..dce7a6928 100644 --- a/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/internal/osgi/services/distribution/BasicTopologyManagerComponent.java +++ b/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/internal/osgi/services/distribution/BasicTopologyManagerComponent.java @@ -1,13 +1,13 @@ package org.eclipse.ecf.internal.osgi.services.distribution; -import java.util.Collection; +import java.util.Map; import org.osgi.framework.ServiceEvent; -import org.osgi.framework.hooks.service.EventHook; +import org.osgi.framework.hooks.service.EventListenerHook; import org.osgi.service.remoteserviceadmin.EndpointListener; import org.osgi.service.remoteserviceadmin.RemoteServiceAdminEvent; import org.osgi.service.remoteserviceadmin.RemoteServiceAdminListener; -public class BasicTopologyManagerComponent implements EventHook, +public class BasicTopologyManagerComponent implements EventListenerHook, RemoteServiceAdminListener { private boolean exportRegisteredSvcs = new Boolean( @@ -39,14 +39,14 @@ public class BasicTopologyManagerComponent implements EventHook, exportRegisteredSvcsClassname, exportRegisteredSvcsFilter); } - // EventHook impl - public void event(ServiceEvent event, Collection contexts) { - basicTopologyManagerImpl.event(event, contexts); - } - // RemoteServiceAdminListener impl public void remoteAdminEvent(RemoteServiceAdminEvent event) { basicTopologyManagerImpl.handleRemoteAdminEvent(event); } + // EventListenerHook impl + public void event(ServiceEvent event, Map listeners) { + basicTopologyManagerImpl.event(event, listeners); + } + } diff --git a/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/internal/osgi/services/distribution/BasicTopologyManagerImpl.java b/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/internal/osgi/services/distribution/BasicTopologyManagerImpl.java index e0c8ebebc..926302aa8 100644 --- a/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/internal/osgi/services/distribution/BasicTopologyManagerImpl.java +++ b/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/internal/osgi/services/distribution/BasicTopologyManagerImpl.java @@ -1,6 +1,6 @@ package org.eclipse.ecf.internal.osgi.services.distribution; -import java.util.Collection; +import java.util.Map; import org.eclipse.ecf.osgi.services.remoteserviceadmin.AbstractTopologyManager; import org.osgi.framework.BundleContext; import org.osgi.framework.InvalidSyntaxException; @@ -58,6 +58,7 @@ public class BasicTopologyManagerImpl extends AbstractTopologyManager implements } } + // EndpointListener impl /* * (non-Javadoc) * @@ -85,10 +86,12 @@ public class BasicTopologyManagerImpl extends AbstractTopologyManager implements handleEndpointRemoved(endpoint, matchedFilter); } - void event(ServiceEvent event, Collection contexts) { - handleEvent(event, contexts); + // EventListenerHook impl + void event(ServiceEvent event, Map listeners) { + handleEvent(event, listeners); } + // RemoteServiceAdminListener impl void handleRemoteAdminEvent(RemoteServiceAdminEvent event) { handleRemoteServiceAdminEvent(event); } |