Subversion Repositories general

Rev

Rev 1257 | Blame | Compare with Previous | Last modification | View Log | RSS feed

package ak.photoalbum.webapp;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.log4j.Logger;
import ak.photoalbum.logic.Logic;

public final class CacheAction
  extends Action
{
  public ActionForward execute(ActionMapping mapping, ActionForm form,
     HttpServletRequest request, HttpServletResponse response)
    throws Exception
  {
    CacheForm theForm = (CacheForm)form;
    String    branch  = theForm.getBranch();
    String    action  = theForm.getAction();
    
    // FIXME: show progress bar

    if("build".equals(action))
      Logic.getLogic().buildCache(branch);
    else if("rebuild".equals(action))
      Logic.getLogic().rebuildCache(branch);
    else if("reload".equals(action))
      Logic.getLogic().reloadCache(branch);
    else if("delete".equals(action))
      Logic.getLogic().deleteCache(branch);
    else
      throw new ServletException("unknown action");

    return mapping.findForward("success");
  }
}