Author: dpillot
Date: Thu Jun 28 17:07:38 2007
New Revision: 17823

URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D17823&repname=
=3Djahia
Log:
reactivate groovy script

Modified:
    branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/WEB-INF/var/scripts/groovy=
/events/EventListener.groovy

Modified: branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/WEB-INF/var/scripts/=
groovy/events/EventListener.groovy
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/branches/JAHIA-5-0-SP=
-BRANCH/core/src/webapp/WEB-INF/var/scripts/groovy/events/EventListener.gro=
ovy&rev=3D17823&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/WEB-INF/var/scripts/groovy=
/events/EventListener.groovy (original)
+++ branches/JAHIA-5-0-SP-BRANCH/core/src/webapp/WEB-INF/var/scripts/groovy=
/events/EventListener.groovy Thu Jun 28 17:07:38 2007
@@ -1,28 +1,35 @@
-
-
-import org.jahia.services.events.GroovyEventListener
-// register comma separated list of events we want trap
-GroovyEventListener.registerEvents("dummyEventWeWontHandle");
-
-// The following code was deactivate because it was a performance problem =
when adding containers.
-
 /*
-// todo We need to cleanup the import, because the event listener implemen=
tation checks all dependencies
-// on each event, and for the moment this generates over 15'000 dependency=
 checks !
+WARNING: please optmize all package's import declarations you write here
+since the Groovy engine need to check the modification date of these depen=
dencies.
+this constraint could be a huge pitfall for global performance.
+So avoid all import with * and limit drastically all useless import declar=
ations
+
+In developpement mode, the dependencies are checked anytime, except in the=
 case of frequent call
+to the script, the dependecies check are not made. This is controled by th=
e static field enabledPerformanceMode in
+the groovyEventListener.(true by default)
+
+In production, the script and dependencies are compiled and checked the fi=
rst time
+and each time the script is modified the script is updated , but all subse=
quent calls
+use the cached version.
+*/
 import org.jahia.services.containers.ContentContainer
-import org.jahia.services.fields.*
-import org.jahia.services.pages.*
-import org.jahia.params.*
-import org.jahia.data.containers.*
-import org.jahia.data.JahiaData
-import org.jahia.content.*
-import org.jahia.utils.*
-import org.jahia.registries.*
-import org.jahia.services.mail.*
+import org.jahia.services.events.GroovyEventListener
 import org.apache.log4j.Logger
+import org.jahia.data.JahiaData
+import org.jahia.registries.ServicesRegistry
+import org.jahia.services.mail.MailService
+import org.jahia.registries.JahiaContainerDefinitionsRegistry
+import org.jahia.data.containers.JahiaContainerList
+import org.jahia.data.containers.JahiaContainerDefinition
+import org.jahia.data.containers.JahiaContainer
+import org.jahia.utils.TextHtml
+
+
+
 =

 // register comma separated list of events we want trap
-GroovyEventListener.registerEvents("fake_event");// desactivated by default
+GroovyEventListener.registerEvents("contentObjectCreated");
+
 =

 if(eventName.equals("contentObjectCreated")) {
 logger =3D Logger.getLogger(getClass())
@@ -30,10 +37,9 @@
 =

 if(jahiaEvent.getObject() instanceof ContentContainer) {
 logger.debug("Entering in groovy Eventlistener")
-    //get the pid
+       //get the pid
        pid=3DjahiaEvent.getParams().getPageID()
-
-    if(pid=3D=3D-1) return;
+       if(pid=3D=3D-1) return;
 =

        //construct the jdata
        jData =3D new JahiaData(jahiaEvent.getParams(),true)
@@ -44,14 +50,17 @@
                logger.debug(subscribers.size())
        } else {
                //logger.debug("no subscribers to push")
+               //exiting
                return
        }
+
                //got the mail service
                mailService =3D ServicesRegistry.getInstance ().getMailService 
();
                // get recipients
                sb =3Dnew StringBuffer();
                subscriberEnum =3D subscribers.getContainers();
 =

+
                container =3D (ContentContainer) jahiaEvent.getObject()
                
mydef=3DJahiaContainerDefinitionsRegistry.getInstance().getDefinition(co=
ntainer.getDefinitionID(jahiaEvent.getParams().getEntryLoadRequest()))
 =

@@ -63,7 +72,7 @@
                url=3D 
"http://localhost:8080"+jahiaEvent.getParams().composePageUrl(pid)
 =

 =

-               if (defname.equals("entries")) {
+               if (defname.equals("blogEntries")) {
                                logger.debug("some changes in blogs on page 
"+pid)
                                while (subscriberEnum.hasMoreElements()) {
                                        subscriber =3D (JahiaContainer) 
subscriberEnum.nextElement();
@@ -92,5 +101,4 @@
 =

                        }
        }
-}
-*/
\ No newline at end of file
+}
\ No newline at end of file

_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list

Reply via email to