2.5.2. Registering your listeners

Warning

You are looking at documentation for an older release. Not what you want? See the current release documentation.

Registering the listeners is then achieved by using the ExoContainer plugin mechanism. See Service configuration for beginners for more information.

To effectively register organization service's listeners, you simply need to use the addListenerPlugin set-method.

So, the easiest way to register your listeners is to pack them into a .jar and create a configuration file into it under mylisteners.jar!/conf/portal/configuration.xml.


<?xml version="1.0" encoding="ISO-8859-1"?>
<configuration>
 <external-component-plugins>
  <target-component>org.exoplatform.services.organization.OrganizationService</target-component>
   <component-plugin>
    <name>myuserplugin</name>
    <set-method>addListenerPlugin</set-method>
    <type>org.example.MyUserListener</type>
    <description></description>      
   </component-plugin>
   <component-plugin>
    <name>mygroupplugin</name>
    <set-method>addListenerPlugin</set-method>
    <type>org.example.MyGroupListener</type>
    <description></description>      
   </component-plugin>
   <component-plugin>
    <name>mymembershipplugin</name>
    <set-method>addListenerPlugin</set-method>
    <type>org.example.MyMembershipListener</type>
    <description></description>      
   </component-plugin>
  </external-component-plugins>
<configuration>

Now, simply deploy the .jar under $PLATFORM_TOMCAT_HOME/lib and your listeners are ready.

Note

Be aware that you need to set proper RuntimePermission to add or remove listeners. To do that, you need to grant the following permission: permission java.lang.RuntimePermission "manageListeners".

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus