Hi sanat,
To create a login or a logout listener under ALLINONE 1.6.6, you could follow these steps :
0)Install Maven build tool. We will use it in this example to package the listener project. Otherwise, it is optional and you could use another build tool.
1)Create a folder named signinListenerAIO1.6.6 in your personal workspace.
2)Write a listener java class which extends the "org.exoplatform.services.listener.Listener<ConversationRegistry, ConversationState>" and override this method:
public void onEvent(Event<ConversationRegistry, ConversationState> event) throws Exception;
The body of this method will contain the treatment to be executed once the user login or logout.
Place this class under signinListenerAIO1.6.6\src\main\java\org\exoplatform\samples\listener.
3)Write a configuration file named configuration.xml like this :
<?xml version="1.0" encoding="ISO-8859-1"?>
<configuration>
<external-component-plugins>
<target-component>org.exoplatform.services.listener.ListenerService</target-component>
<component-plugin>
<!-- The name of the the target event for the login listener, it must be exo.core.security.ConversationRegistry.unregister for the logout listener -->
<name>exo.core.security.ConversationRegistry.register</name>
<set-method>addListener</set-method>
<!-- The full qualified name of your custom login or logout Listener -->
<type>org.exoplatform.samples.listener.SignInListener</type>
</component-plugin>
</external-component-plugins>
</configuration>
Place this file under signinListenerAIO1.6.6\src\main\java\conf\portal.
4)Write a maven pom.xml to package the listener as a jar (see attached files) and place it under signinListenerAIO1.6.6 folder.
5)Open a dos console, change your working directory to signinListenerAIO1.6.6 and type "mvn clean install".
6)Copy the jar file exo.samples.signinlistener-1.0-SNAPSHOT.jar from the signinListenerAIO1.6.6\target to tomcatAIO1.6.6\lib.
7)Now run the server and login successfully. You must see a message in your console indicating the execution of your listener.
The attached file signinListenerAIO1.6.6.rar contains the example folder.
To run this example in another version of ALLINONE, WCM 2.X you have only to change your pom.xml.
The following links can be useful:
http://wiki.exoplatform.org/xwiki/bin/view/Kernel/Understanding%20the%20ListenerService
http://wiki.exoplatform.org/xwiki/bin/view/Products%20Tech%20Overview/org%20exoplatform%20services%20listener%20ListenerService
http://svn.exoplatform.org/projects/ks/trunk/eXoApplication/forum/service/src/main/java/org/exoplatform/forum/service/AuthenticationLogoutListener.java
http://svn.exoplatform.org/projects/ks/trunk/eXoApplication/forum/service/src/main/java/org/exoplatform/forum/service/AuthenticationLoginListener.java
Best regards.