Hello everyone,

I'm trying to write a listener. The listener is correctly triggered after
creation. But when I change the listener code, it is not taken into account
by the server. I have to 

restart the server. How to avoid this?

This my code:

{{groovy}}
import org.xwiki.observation.*
import org.xwiki.observation.event.*
import com.xpn.xwiki.web.*
import com.xpn.xwiki.*

class AutoEventListener implements EventListener
{
    def xwiki
    def context

    AutoEventListener(xwiki, context)
    {
        this.xwiki = xwiki
        this.context = context
    }

    String getName()
    {
        return "auto_febi"
    }

    List<Event> getEvents()
    {
        return Arrays.asList(new DocumentSaveEvent())
    }

    void onEvent(Event event, Object source, Object data)

    {
        
    if (source.fullName != "EventListenerAuto") {
          def document = xwiki.getDocument(source.fullName)
                  def var= document.getValue("avisDSI")
         if (var != "-"){
              document.set("nomDSI","coucou")}
           }
        }
     }

    def observation = Utils.getComponent(ObservationManager.class)
    observation.removeListener("auto_febi")
    def listener = new AutoEventListener(xwiki, xcontext)
    observation.addListener(listener)


    
{{/groovy}}


Thank you very much for your future answer, 

Cécile





--
View this message in context: 
http://xwiki.475771.n2.nabble.com/listener-not-reloading-after-modification-tp7582265.html
Sent from the XWiki- Dev mailing list archive at Nabble.com.
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to