Jahia Dev Forum > Jahia 7 - System...

0 (0 Good)
0 (0 Bad)

Jahia 7 - System Event

by  eddyacthergal »  2015/02/11 16:49

Hello,

I need to do some custom logic whenever a module is deployed on a site. I tried to follow the documentation found here: http://www.jahia.com/documentation-and-downloads/developers-techwiki/events-rules-jobs/system-events

However, when I create my own Listener implementing the ApplicationListener<ModuleDeployedOnSiteEvent>, I don't receive any event when deploying a module on a site...

Here is the java code:

public class ResourceSynchronizerListener implements  ApplicationListener<ModuleDeployedOnSiteEvent> {

    private static final Logger logger = org.slf4j.LoggerFactory.getLogger(ResourceSynchronizerListener.class);
    
    @Override
    public void onApplicationEvent(ModuleDeployedOnSiteEvent event) {
        //Custom logic when a module is deployed to a site
        logger.info(event.getTargetSitePath());
    }  
}

And the Spring bean definition

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
    
    <bean id="resourceListener" class="org.jahia.modules.resources.ResourceSynchronizerListener"  />
    
</beans>

Any idea ?

  • Jahia 7 - System Event
    2015/02/11 16:49

    eddyacthergal <p>Hello,</p> <p>I need to do some custom logic whenever a module is deployed on a site. I tried to follow the documentation found here: <a href="http://www.jahia.com/documentation-and-downloads/developers-techwiki/events-rules-jobs/system-events">http://www.jahia.com/documentation-and-downloads/developers-techwiki/events-rules-jobs/system-events</a></p> <p>However, when I create my own Listener implementing the ApplicationListener&lt;ModuleDeployedOnSiteEvent&gt;, I don&#39;t receive any event when deploying a module on a site...</p> <p><em><u>Here is the java code:</u></em></p> <p>public class ResourceSynchronizerListener implements&nbsp; ApplicationListener&lt;ModuleDeployedOnSiteEvent&gt; {</p> <p>&nbsp;&nbsp; &nbsp;private static final Logger logger = org.slf4j.LoggerFactory.getLogger(ResourceSynchronizerListener.class);<br /> &nbsp;&nbsp; &nbsp;<br /> &nbsp;&nbsp; &nbsp;@Override<br /> &nbsp;&nbsp; &nbsp;public void onApplicationEvent(ModuleDeployedOnSiteEvent event) {<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;//Custom logic when a module is deployed to a site<br /> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;logger.info(event.getTargetSitePath());<br /> &nbsp;&nbsp; &nbsp;}&nbsp;&nbsp;<br /> }</p> <p><u><em>And the Spring bean definition</em></u></p> <p>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br /> &lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;<br /> &nbsp;&nbsp;&nbsp; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;<br /> &nbsp;&nbsp;&nbsp; xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd&quot;&gt;<br /> &nbsp;&nbsp; &nbsp;<br /> &nbsp;&nbsp;&nbsp; &lt;bean id=&quot;resourceListener&quot; class=&quot;org.jahia.modules.resources.ResourceSynchronizerListener&quot;&nbsp; /&gt;<br /> &nbsp;&nbsp; &nbsp;<br /> &lt;/beans&gt;</p> <p>Any idea ?</p>

  • Number of messages  1
    Registration date Feb 11, 2015
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page