Rev 1256 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
936 | dev | 1 | package ak.photoalbum.webapp; |
2 | |||
3 | import java.util.List; |
||
4 | import javax.servlet.http.HttpServletRequest; |
||
5 | import javax.servlet.http.HttpServletResponse; |
||
1257 | dev | 6 | import javax.servlet.ServletException; |
936 | dev | 7 | import org.apache.struts.action.Action; |
8 | import org.apache.struts.action.ActionMapping; |
||
9 | import org.apache.struts.action.ActionForm; |
||
10 | import org.apache.struts.action.ActionForward; |
||
11 | import org.apache.log4j.Logger; |
||
1249 | dev | 12 | import ak.photoalbum.logic.Logic; |
936 | dev | 13 | |
1257 | dev | 14 | public final class CacheAction |
936 | dev | 15 | extends Action |
16 | { |
||
1257 | dev | 17 | private static final Logger logger = Logger.getLogger(CacheAction.class); |
936 | dev | 18 | |
19 | public ActionForward execute(ActionMapping mapping, ActionForm form, |
||
20 | HttpServletRequest request, HttpServletResponse response) |
||
21 | throws Exception |
||
22 | { |
||
1257 | dev | 23 | CacheForm theForm = (CacheForm)form; |
24 | String branch = theForm.getBranch(); |
||
25 | String action = theForm.getAction(); |
||
26 | |||
27 | // FIXME: show progress bar |
||
1250 | dev | 28 | |
1257 | dev | 29 | if("build".equals(action)) |
30 | Logic.getLogic().buildCache(branch); |
||
31 | else if("rebuild".equals(action)) |
||
32 | Logic.getLogic().rebuildCache(branch); |
||
33 | else if("reload".equals(action)) |
||
34 | Logic.getLogic().reloadCache(branch); |
||
35 | else if("delete".equals(action)) |
||
36 | Logic.getLogic().deleteCache(branch); |
||
37 | else |
||
38 | throw new ServletException("unknown action"); |
||
936 | dev | 39 | |
40 | return mapping.findForward("success"); |
||
41 | } |
||
42 | } |