mcardle     2005/12/23 01:47:37 CET

  Modified files:
    core/src/java/org/jahia/services/esi 
                                         EsiInvalidationEventListener.java 
  Log:
  * temporary fix to flush all the ESI cache when templateUpdated, rightsSet, 
pageAdded and fileManagerAclChanged events are fired.
  
  Revision  Changes    Path
  1.11      +65 -36    
jahia/core/src/java/org/jahia/services/esi/EsiInvalidationEventListener.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/services/esi/EsiInvalidationEventListener.java.diff?r1=1.10&r2=1.11&f=h
  
  
  
  Index: EsiInvalidationEventListener.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/services/esi/EsiInvalidationEventListener.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- EsiInvalidationEventListener.java 7 Dec 2005 16:56:20 -0000       1.10
  +++ EsiInvalidationEventListener.java 23 Dec 2005 00:47:37 -0000      1.11
  @@ -204,8 +204,8 @@
                       if (parentCtnList.getParentEntryID()!=0) { 
//parentCtnList is enclosed inside a valid ctn
                           //invalidate ctn containing uninitialized 
parentCtnList containing created ctn (!?)
                           
esiService.ctnRequiresInvalidation(parentCtnList.getParentEntryID());
  -                         if (logger.isDebugEnabled())
  -                             logger.debug("[esi] :  Triggering invalidation 
of the PARENT Container [" + parentCtnList.getParentEntryID() + "] of 
ContainerList ["+jahiaContainer.getListID()+"]");
  +                        if (logger.isDebugEnabled())
  +                            logger.debug("[esi] :  Triggering invalidation 
of the PARENT Container [" + parentCtnList.getParentEntryID() + "] of 
ContainerList ["+jahiaContainer.getListID()+"]");
                       }
                       else { //this is a uninitialized standalone (top level) 
parentCtnList
                           if 
(!esiService.isCtnListAlreadyReferenced(parentCtnList.getID())) { //TODO: get 
rid of this if message below is never outputted
  @@ -337,7 +337,7 @@
                                   (ContentContainerList) (((ContentContainer) 
curContentObject)
                                           
.getParent(processingContext.getEntryLoadRequest()));
                           if (parentContainerList != null) {
  -                         //TODO: extract a method out of following section 
since it is reused (wait till debugging is finished)
  +                            //TODO: extract a method out of following 
section since it is reused (wait till debugging is finished)
                               logger.debug("[esi] :  info: PARENT 
ContentContainerList [" + parentContainerList.getID() + "] for ContentContainer 
ID[" + objID + "].");
                               logger.debug("[esi] :  info: PARENT 
ContentContainerList [" + parentContainerList.getID() + "] has Parent Container 
ID[" + parentContainerList.getParentContainerID() + "]");
   
  @@ -347,7 +347,7 @@
                                       //invalidate ctn containing 
uninitialized ctnList containing created ctn (!?)
                                       
esiService.ctnRequiresInvalidation(parentContainerList.getParentContainerID());
                                       if (logger.isDebugEnabled())
  -                                            logger.debug("[esi] :  
Triggering invalidation of the PARENT Container [" + 
parentContainerList.getParentContainerID() + "] of ContainerList 
["+parentContainerList.getID()+"]");
  +                                        logger.debug("[esi] :  Triggering 
invalidation of the PARENT Container [" + 
parentContainerList.getParentContainerID() + "] of ContainerList 
["+parentContainerList.getID()+"]");
                                   }
                                   else { //this is a uninitialized standalone 
(top level) ctnList
                                       if 
(!esiService.isCtnListAlreadyReferenced(parentContainerList.getID())) { //TODO: 
get rid of this if message below is never outputted
  @@ -368,7 +368,7 @@
                                       try{
                                           
invalidateCtnListID0(parentContainerList);
                                       } catch (JahiaException ex) {
  -                                            logger.error("Error invalidating 
parentContainerList ["+parentContainerList.getID()+"] during 
invalidateCtnListID0 "+ex);
  +                                        logger.error("Error invalidating 
parentContainerList ["+parentContainerList.getID()+"] during 
invalidateCtnListID0 "+ex);
                                       }
                                   }
                                   else {
  @@ -406,40 +406,40 @@
                       logger.debug("[esi] :  info: ContentContainerList [" + 
contentCtnList.getID() + "]");
                       logger.debug("[esi] :  info: ContentContainerList [" + 
contentCtnList.getID() + "] has Parent Container ID[" + 
contentCtnList.getParentContainerID() + "]");
   
  -                            if ( contentCtnList.getID()==0 ) { 
//uninitialized ctnList?
  +                    if ( contentCtnList.getID()==0 ) { //uninitialized 
ctnList?
   
  -                                if 
(contentCtnList.getParentContainerID()!=0) { //ctnList is enclosed inside a 
valid ctn
  -                                    //invalidate ctn containing 
uninitialized ctnList containing created ctn (!?)
  -                                    
esiService.ctnRequiresInvalidation(contentCtnList.getParentContainerID());
  -                                    if (logger.isDebugEnabled())
  -                                            logger.debug("[esi] :  
Triggering invalidation of the PARENT Container [" + 
contentCtnList.getParentContainerID() + "] of ContainerList 
["+contentCtnList.getID()+"]");
  -                                }
  -                                else { //this is a uninitialized standalone 
(top level) ctnList
  -                                    if 
(!esiService.isCtnListAlreadyReferenced(contentCtnList.getID())) { //TODO: get 
rid of this if message below is never outputted
  -                                        try{
  -                                            
invalidateCtnListID0(contentCtnList);
  -                                        } catch (JahiaException ex) {
  -                                            logger.error("Error invalidating 
contentCtnList ["+contentCtnList.getID()+"] during invalidateCtnListID0 "+ex);
  -                                        }
  -                                    }
  -                                    else
  -                                        logger.error("[esi] : 
ContentContainerList [" + contentCtnList.getID() + "] IS referenced but 
SHOUDLN'T.");
  +                        if (contentCtnList.getParentContainerID()!=0) { 
//ctnList is enclosed inside a valid ctn
  +                            //invalidate ctn containing uninitialized 
ctnList containing created ctn (!?)
  +                            
esiService.ctnRequiresInvalidation(contentCtnList.getParentContainerID());
  +                            if (logger.isDebugEnabled())
  +                                logger.debug("[esi] :  Triggering 
invalidation of the PARENT Container [" + contentCtnList.getParentContainerID() 
+ "] of ContainerList ["+contentCtnList.getID()+"]");
  +                        }
  +                        else { //this is a uninitialized standalone (top 
level) ctnList
  +                            if 
(!esiService.isCtnListAlreadyReferenced(contentCtnList.getID())) { //TODO: get 
rid of this if message below is never outputted
  +                                try{
  +                                    invalidateCtnListID0(contentCtnList);
  +                                } catch (JahiaException ex) {
  +                                    logger.error("Error invalidating 
contentCtnList ["+contentCtnList.getID()+"] during invalidateCtnListID0 "+ex);
                                   }
                               }
  -                            else { //initialized ctnList
  -                                if 
(!esiService.isCtnListAlreadyReferenced(contentCtnList.getID())) {
  -                                    //this is actually a new initialized 
ctnList which hasn't yet been referenced
  -                                    try{
  -                                        invalidateCtnListID0(contentCtnList);
  -                                    } catch (JahiaException ex) {
  -                                            logger.error("Error invalidating 
contentCtnList ["+contentCtnList.getID()+"] during invalidateCtnListID0 "+ex);
  -                                    }
  -                                }
  -                                else {
  -                                    
esiService.ctnListRequiresInvalidation(contentCtnList.getID());
  -                                    if (logger.isDebugEnabled())
  -                                        logger.debug("[esi] :  Invalidating 
ContentContainerList [" + contentCtnList.getID() + "] ");
  -                                }
  +                            else
  +                                logger.error("[esi] : ContentContainerList 
[" + contentCtnList.getID() + "] IS referenced but SHOUDLN'T.");
  +                        }
  +                    }
  +                    else { //initialized ctnList
  +                        if 
(!esiService.isCtnListAlreadyReferenced(contentCtnList.getID())) {
  +                            //this is actually a new initialized ctnList 
which hasn't yet been referenced
  +                            try{
  +                                invalidateCtnListID0(contentCtnList);
  +                            } catch (JahiaException ex) {
  +                                logger.error("Error invalidating 
contentCtnList ["+contentCtnList.getID()+"] during invalidateCtnListID0 "+ex);
  +                            }
  +                        }
  +                        else {
  +                            
esiService.ctnListRequiresInvalidation(contentCtnList.getID());
  +                            if (logger.isDebugEnabled())
  +                                logger.debug("[esi] :  Invalidating 
ContentContainerList [" + contentCtnList.getID() + "] ");
  +                        }
                       }
                   }
                   else  {
  @@ -483,6 +483,33 @@
           logger.debug("[esi] :  Triggering invalidation of CntListID0 [" + 
ctnListPageID +"_"+ ctnListName + "] which is a standalone ctnList");
   
       }
  +
  +    public void templateUpdated( JahiaEvent je ) {
  +        //TODO: make this more selective !
  +        //Clear the ESI server cache
  +        logger.warn("templateUpdated event detected so Clearing the whole 
ESI server cache (temporary fix)");
  +        
EsiSOAPInvalidation.emptyEsiServerCache(je.getJahiaData().getProcessingContext().settings());
  +    }
  +    public void rightsSet( JahiaEvent je) {
  +        //TODO: make this more selective !
  +        //Clear the ESI server cache
  +        logger.warn("rightsSet event detected so Clearing the whole ESI 
server cache (temporary fix)");
  +        
EsiSOAPInvalidation.emptyEsiServerCache(je.getJahiaData().getProcessingContext().settings());
  +    }
  +    public void pageAdded( JahiaEvent je ) {
  +        //TODO: make this more selective !
  +        //Clear the ESI server cache
  +        logger.warn("pageAdded event detected so Clearing the whole ESI 
server cache (temporary fix)");
  +        
EsiSOAPInvalidation.emptyEsiServerCache(je.getJahiaData().getProcessingContext().settings());
  +    }
  +
  +    public void fileManagerAclChanged (JahiaEvent theEvent) {
  +        //TODO: make this more selective !
  +        //Clear the ESI server cache
  +        logger.warn("fileManagerAclChanged event detected so Clearing the 
whole ESI server cache (temporary fix)");
  +        
EsiSOAPInvalidation.emptyEsiServerCache(theEvent.getJahiaData().getProcessingContext().settings());
  +    }
  +
   }
   
   /* -------------------------------- TODO EVENTS 
------------------------------------------------ */
  @@ -490,3 +517,5 @@
   //TODO: Add support for the following events:
   // public void objectChanged( WorkflowEvent je ) { return; }
   
  +
  +
  

Reply via email to