Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[ecf-dev] New topic in forum Eclipse Communications Framework (ECF), called Multiple topics for DistributedEventAdmin, by Robert Onslow

Title: Eclipse Community Forums
Subject: Multiple topics for DistributedEventAdmin Author: Robert Onslow Date: Mon, 11 February 2013 13:37
I have a bundle which has registered a distributedeventadmin for a particular topic:

EventAdmin admin = new DistributedEventAdmin(context);
					
					
IContainer container = manager.getContainerFactory().createContainer("ecf.generic.server");
sharedObjectContainer = (ISharedObjectContainer) container.getAdapter(ISharedObjectContainer.class);
					
ISharedObjectManager manager1 = sharedObjectContainer.getSharedObjectManager();
					
Properties props = new Properties();
props.put(EventConstants.EVENT_TOPIC, "uk_co_xlegal_xbundle3_remote");
					manager1.addSharedObject(IDFactory.getDefault().createStringID("uk.co.xlegal.xbundle3.remote"), (ISharedObject) admin, props);


I have a second bundle, which needs to register another topic for distribution by the DistributedEventManager. I was thinking along the lines of:
//assume these get the registered distributedeventadmin and icontainermanager
admin = (EventAdmin) this.getServiceImplementingClass(EventAdmin.class)
IContainerManager manager = (IContainerManager) this.getServiceImplementingClass(IContainerManager.class
//could be done better, I'm sure
IContainer[] containers = manager.getAllContainers();
IContainer container = (containers.length == 1)? containers[0] : null;
ISharedObjectContainer sharedObjectContainer = (ISharedObjectContainer) ((IAdaptable) container).getAdapter(ISharedObjectContainer.class);
ISharedObjectManager manager1 = sharedObjectContainer.getSharedObjectManager();
		
Properties props = new Properties();
props.put(EventConstants.EVENT_TOPIC, "uk_co_xlegal_liveshow_annotation");
//do I just re-register the distributedeventadmin in the sharedobjectmanager with the additional topic as a property?
manager1.addSharedObject(IDFactory.getDefault().createStringID("uk_co_xlegal_liveshow_annotation"), (ISharedObject) admin, props);
						


Is this the correct way of doing this?

Thanks

Robert
[ Reply ][ Quote ][ View Topic/Message ][ Unsubscribe from this forum ]

Back to the top