diff options
Diffstat (limited to 'compendium')
5 files changed, 31 insertions, 2 deletions
diff --git a/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/META-INF/MANIFEST.MF b/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/META-INF/MANIFEST.MF index b759db01b..e62512352 100644 --- a/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/META-INF/MANIFEST.MF +++ b/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/META-INF/MANIFEST.MF @@ -10,6 +10,7 @@ Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1, Import-Package: org.eclipse.ecf.core.util, org.osgi.framework;version="1.3.0", org.osgi.framework.hooks.service;version="1.0.0", + org.osgi.service.event;version="1.3.0", org.osgi.service.log;version="1.3.0", org.osgi.service.remoteserviceadmin;version="1.0", org.osgi.util.tracker 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 348301167..6ff7e5d2c 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 @@ -3,6 +3,8 @@ <implementation class="org.eclipse.ecf.internal.osgi.services.distribution.BasicTopologyManagerComponent"/> <service> <provide interface="org.osgi.framework.hooks.service.EventHook"/> + <provide interface="org.osgi.service.event.EventHandler"/> </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/*"/> </scr:component> 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 83535b505..f81a485ab 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 @@ -20,6 +20,8 @@ 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.service.event.EventConstants; +import org.osgi.service.event.EventHandler; import org.osgi.service.log.LogService; import org.osgi.service.remoteserviceadmin.EndpointListener; import org.osgi.util.tracker.ServiceTracker; @@ -62,6 +64,7 @@ public class Activator implements BundleActivator { private ServiceRegistration endpointListenerReg; private BasicTopologyManagerComponent basicTopologyManagerComp; private ServiceRegistration eventHookRegistration; + private ServiceRegistration eventHandlerRegistration; public static Activator getDefault() { return plugin; @@ -179,6 +182,13 @@ public class Activator implements BundleActivator { basicTopologyManagerComp = new BasicTopologyManagerComponent(); // bind the topology manager to it basicTopologyManagerComp.bindEndpointListener(basicTopologyManagerImpl); + // Register EventHandler for rsa + Properties eventHandlerProps = new Properties(); + String[] rsaTopics = new String[] { "org/osgi/service/remoteserviceadmin/*" }; //$NON-NLS-1$ + eventHandlerProps.put(EventConstants.EVENT_TOPIC, rsaTopics); + eventHandlerRegistration = this.context.registerService( + EventHandler.class, basicTopologyManagerComp, + (Dictionary) eventHandlerProps); // register the basic topology manager as EventHook service eventHookRegistration = this.context.registerService(EventHook.class, basicTopologyManagerComp, null); @@ -206,6 +216,10 @@ public class Activator implements BundleActivator { endpointListenerReg.unregister(); endpointListenerReg = null; } + if (eventHandlerRegistration != null) { + eventHandlerRegistration.unregister(); + eventHandlerRegistration = null; + } if (basicTopologyManagerImpl != null) { basicTopologyManagerImpl.close(); basicTopologyManagerImpl = null; 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 7b4e7e9d7..d2fbe2bd2 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 @@ -3,9 +3,11 @@ package org.eclipse.ecf.internal.osgi.services.distribution; import java.util.Collection; import org.osgi.framework.ServiceEvent; import org.osgi.framework.hooks.service.EventHook; +import org.osgi.service.event.Event; +import org.osgi.service.event.EventHandler; import org.osgi.service.remoteserviceadmin.EndpointListener; -public class BasicTopologyManagerComponent implements EventHook { +public class BasicTopologyManagerComponent implements EventHook, EventHandler { private boolean exportRegisteredSvcs = new Boolean( System.getProperty( @@ -40,4 +42,8 @@ public class BasicTopologyManagerComponent implements EventHook { basicTopologyManagerImpl.event(event, contexts); } + public void handleEvent(Event event) { + basicTopologyManagerImpl.handleEvent(event); + } + } 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 89c78345d..83aef85d1 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 @@ -6,10 +6,12 @@ import org.osgi.framework.BundleContext; import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.ServiceEvent; import org.osgi.framework.ServiceReference; +import org.osgi.service.event.Event; +import org.osgi.service.event.EventHandler; import org.osgi.service.remoteserviceadmin.EndpointListener; public class BasicTopologyManagerImpl extends AbstractTopologyManager implements - EndpointListener { + EndpointListener, EventHandler { BasicTopologyManagerImpl(BundleContext context) { super(context); @@ -88,4 +90,8 @@ public class BasicTopologyManagerImpl extends AbstractTopologyManager implements handleEvent(event, contexts); } + public void handleEvent(Event event) { + handleRSAEvent(event); + } + } |