Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] How could I setup DistributedEventAdmin using DS ?

Hi Cristiano,


On 8/10/2011 5:57 AM, Cristiano Gavião wrote:
On 09/08/11 12:00, Scott Lewis wrote:
Hi Christiano,
Hi Scott,
On 8/9/2011 5:46 AM, Cristiano Gavião wrote:
Hi guys,

Could someone point me how could I setup DistributedEventAdmin using DS ?

No example currently exists. Since some of the DistributedEventAdmin setup currently requires java code it would involve some combination of DS markup and java code.

So let me dig into this :)
I'm creating a example based on hello... If you wanted I could sent you after I've done the challenge... but I need some directions here...

I know now that I can't use DistributedEventAdmin as DS component because it doesn't have a default constructor...

Reading event example, I conclude that I need to get a reference to IContainerManager, get the ID of the container, then get the IContainer, adapt it to ISharedObjectContainer and then add the DistributedEventAdmin object on it. Am I right?

Yes...that's essentially right. It might be better to create the container rather than 'get the ID of the container', but still what you have outlined is fine.



I could get the reference of IContainerManager using DS, but containerManager.getAllContainers() shows me any container... and I don't know how to create the ID of container either...

Well, like I said it might be better to create the container (and it's ID). OTOH, it's also possible to create (and optionally connect) the container outside the scope of the service component, and then just retrieve the container from the container factory.



So I couldn't figure out a way to get a reference to IContainer in the activate method of HelloComponent... could you give a tip how do that?

You can create a container with the containerFactory (accessible via the IContainerManager)...e.g.

IContainer newContainer = containerManager.getContainerFactory().createContainer('ecf.generic.server');

and/or create and connect a

For another purpose, I have done this previously...i.e. used a ds service component to expose the EventAdmin service, and have the component's activation result in the creation of a container, the addition of a DistributedEventAdmin instance to that container...that's then used by the service component to send/post events.

Just FYI....I'm going to be away from Internet access for a couple of days...so although I'm happy to discuss further, it will be next week.

Scott




Back to the top