01: /*
02: * Copyright (c) 2005 Your Corporation. All Rights Reserved.
03: */
04: package com.technoetic.xplanner.actions.admin;
05:
06: import java.util.Map;
07:
08: import com.technoetic.xplanner.security.auth.Authorizer;
09: import com.technoetic.xplanner.security.auth.SystemAuthorizer;
10: import com.technoetic.xplanner.util.LogUtil;
11: import org.apache.log4j.Logger;
12: import org.apache.struts.action.Action;
13: import org.apache.struts.action.ActionForward;
14: import org.apache.struts.action.ActionMapping;
15: import org.apache.struts.action.ActionForm;
16:
17: import javax.servlet.http.HttpServletRequest;
18: import javax.servlet.http.HttpServletResponse;
19:
20: public class InvalidateCacheAction extends Action {
21: private static final Logger log = LogUtil.getLogger();
22: private Authorizer authorizer;
23: private Map cacheMap;
24:
25: public void setCacheMap(Map cacheMap) {
26: this .cacheMap = cacheMap;
27: }
28:
29: public ActionForward execute(ActionMapping mapping,
30: ActionForm form, HttpServletRequest request,
31: HttpServletResponse response) throws Exception {
32: cacheMap.clear();
33: if (SystemAuthorizer.get() != authorizer) {
34: log
35: .error("Configuration problem: there are 2 Authorizers in the system!");
36: }
37: log.info("cache cleared");
38: return null;
39: }
40:
41: public void setAuthorizer(Authorizer authorizer) {
42: this.authorizer = authorizer;
43: }
44: }
|