1 19 20 package com.sslexplorer.vfs.actions; 21 22 import java.util.Collection ; 23 24 import javax.servlet.http.HttpServletRequest ; 25 import javax.servlet.http.HttpServletResponse ; 26 27 import org.apache.struts.action.ActionForm; 28 import org.apache.struts.action.ActionForward; 29 import org.apache.struts.action.ActionMapping; 30 31 import com.sslexplorer.policyframework.Permission; 32 import com.sslexplorer.policyframework.PolicyConstants; 33 import com.sslexplorer.security.SessionInfo; 34 import com.sslexplorer.table.actions.AbstractPagerAction; 35 import com.sslexplorer.vfs.VFSFileLock; 36 import com.sslexplorer.vfs.VFSLockManager; 37 import com.sslexplorer.vfs.forms.ShowVfsLocksForm; 38 39 42 public final class ShowVfsLocksDispatchAction extends AbstractPagerAction { 43 44 47 public ShowVfsLocksDispatchAction() { 48 super(PolicyConstants.STATUS_TYPE_RESOURCE_TYPE, new Permission[] { PolicyConstants.PERM_VIEW }); 49 } 50 51 54 public int getNavigationContext(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { 55 return SessionInfo.MANAGEMENT_CONSOLE_CONTEXT; 56 } 57 58 61 public ActionForward filter(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) 62 throws Exception { 63 return unspecified(mapping, form, request, response); 64 } 65 66 69 public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) 70 throws Exception { 71 ShowVfsLocksForm locksForm = (ShowVfsLocksForm) form; 72 Collection <VFSFileLock> currentLocks = VFSLockManager.getInstance().getCurrentLocks(); 73 locksForm.initialize(request.getSession(), currentLocks); 74 return mapping.findForward("display"); 75 } 76 77 85 public ActionForward unlockFile(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) 86 throws Exception { 87 String handle = request.getParameter("selectedResource"); 88 VFSLockManager.getInstance().unlock(handle); 89 return unspecified(mapping, form, request, response); 90 } 91 } | Popular Tags |