mcardle 2005/12/23 02:22:30 CET
Modified files:
core/src/java/org/jahia/services/esi
EsiInvalidationEventListener.java
Log:
* refactoring
Revision Changes Path
1.13 +25 -19
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.12&r2=1.13&f=h
Index: EsiInvalidationEventListener.java
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/java/org/jahia/services/esi/EsiInvalidationEventListener.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- EsiInvalidationEventListener.java 23 Dec 2005 00:50:55 -0000 1.12
+++ EsiInvalidationEventListener.java 23 Dec 2005 01:22:29 -0000 1.13
@@ -8,6 +8,7 @@
import org.jahia.data.events.JahiaEventListener;
import org.jahia.data.fields.JahiaField;
import org.jahia.data.fields.LoadFlags;
+import org.jahia.data.JahiaData;
import org.jahia.exceptions.JahiaException;
import org.jahia.params.ProcessingContext;
import org.jahia.registries.ServicesRegistry;
@@ -485,33 +486,38 @@
}
public void templateUpdated( JahiaEvent je ) {
- if (je==null) return;
- //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());
+ clearEntireCache(je, "templateUpdated");
}
+
public void rightsSet( JahiaEvent je) {
- if (je==null) return;
- //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());
+ clearEntireCache(je, "templateUpdated");
}
+
public void pageAdded( JahiaEvent je ) {
- if (je==null) return;
- //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());
+ clearEntireCache(je, "templateUpdated");
}
public void fileManagerAclChanged (JahiaEvent theEvent) {
- if (theEvent==null) return;
- // /TODO: make this more selective !
+ clearEntireCache(theEvent, "templateUpdated");
+ }
+
+ private void clearEntireCache(JahiaEvent je, String eventFct) {
+ if (je==null) return;
+ //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());
+ try {
+ JahiaData jd = je.getJahiaData();
+ if (jd==null) return;
+ ProcessingContext pc = jd.getProcessingContext();
+ if (pc==null) return;
+ SettingsBean sb = pc.settings();
+ if (sb==null) return;
+ EsiSOAPInvalidation.emptyEsiServerCache(sb);
+ logger.warn(eventFct+" event detected so Clearing the whole ESI
server cache (temporary fix)");
+ }
+ catch (Exception ex) {
+ logger.info("couldn't complete cache clearing operation due to
"+ex);
+ }
}
}