code: public void onEvent(EventIterator eventIterator)
     {
        // waiting for Event.PROPERTY_ADDED, Event.PROPERTY_REMOVED,
        // Event.PROPERTY_CHANGED
        Session session = null;
        try
        {
           while (eventIterator.hasNext())
           {
              Event event = eventIterator.nextEvent();
              String path = event.getPath();
  
              if (path.endsWith("/jcr:data"))
              {
                 // jcr:data removed 'exo:groovyResourceContainer' then unbind resource
                 if (event.getType() == Event.PROPERTY_REMOVED)
                 {
                    unloadScript(path.substring(0, path.lastIndexOf('/')));
                 }
                 else if (event.getType() == Event.PROPERTY_ADDED || event.getType() == Event.PROPERTY_CHANGED)
                 {
                    if (session == null)
                    {
                       session = repository.getSystemSession(workspaceName);
                    }
  
                    Node node = session.getItem(path).getParent();
                    if (node.getProperty("exo:autoload").getBoolean())
                       loadScript(node);
                 }
              }
           }
        }
        catch (Exception e)
        {
           LOG.error("Process event failed. ", e);
        }
        finally
        {
           if (session != null)
           {
              session.logout();
           }
        }
     }
docs: {@inheritDoc}