Tharindu Madushanka wrote: > 1. Create a LoginListener class that implements EventListener > can I use the package org.xwiki.observation.event to add this class ?
I don't think you need to create this class yet. Better leave it for when you will start working on the chat module. All you need to do for this task is to send the events, not receive them. When you will need to write the listener, it won't be in the org.xwiki.observation.event package, but in your own package (something like org.xwiki.chat.events.UserLoginListener). > 2. I do not need to create any DefaultObservationManager instance. > components.xml file is defined with DefaultObservationManager > implementation. > I get reference to it by calling (Step 5) when ever nececary > ObservationManager om = (ObservationManager) > Utils.getComponent(ObservationManager.class); Step 2 depends on step 1, ignore it for the moment. But as Asiri said, you will probably get this as an automatic dependency injection, and not using the component manager. > 3. Define class UserLoginEvent similar to DocumentSaveEvent > in package org.xwiki.observation.event > *[TODO]* Yes. > 4. Need to find the place where I call the addListener() of > ObservationManager with parameters - object of UserLoginEvent and > reference to login listener. I think when user initiated login I need to > add the listener. I looked at LoginAction class, but could not figure > out a way. This also depends on step 1. Ignore it for the moment. If you will write your listener as a component, there is a special interface that components can implement, Initializable, which adds an initialize() method which will be called when the component is created and all its dependencies are in place. > 6. Need to find when to call notify() of DefaultObjectManager instance > when user successfully logged in A first idea is xwiki-core/com.xpn.xwiki.web.LoginSubmitAction. This will be refined later, since users that have cookies use a different mechanism. But LoginSubmitAction is a pretty good initial approximation. > 7. Implement notify() in LoginListener Ignore. > I think I need to get familiar with com.xpn.xwiki.web package to learn > how to do steps 4 and 6. If anyone could point me some points to look > for it would be really helpful. Only steps 3 and 6 should be implemented now. -- Sergiu Dumitriu http://purl.org/net/sergiu/ _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

