1 25 26 package org.objectweb.jonas.webapp.jonasadmin.deploy; 27 28 import java.util.ArrayList ; 29 import java.util.Iterator ; 30 import java.util.List ; 31 32 import javax.servlet.ServletException ; 33 import javax.servlet.http.HttpServletRequest ; 34 import javax.servlet.http.HttpServletResponse ; 35 36 import org.apache.struts.action.ActionForm; 37 import org.apache.struts.action.ActionForward; 38 import org.apache.struts.action.ActionMapping; 39 import org.apache.struts.action.ActionMessage; 40 41 45 46 public class ApplyRemoveConfirmAction extends BaseDeployAction { 47 48 57 public ActionForward executeAction(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, 58 HttpServletResponse response) throws ServletException { 59 60 String sForward = "Remove Confirm"; 61 62 RemoveForm removeForm = (RemoveForm) actionForm; 64 List updatedRemovedList = new ArrayList (removeForm.getListToBeRemoved()); 65 for (Iterator it = removeForm.getListToBeRemoved().iterator(); it.hasNext();) { 67 String fileName = (String ) it.next(); 68 try { 69 boolean b = removeFile(fileName); 70 if (b) { 71 updatedRemovedList.remove(fileName); 72 removeForm.getListRemoved().add(fileName); 73 } else { 74 m_Errors.add("error.remove", new ActionMessage("error.remove", "File '" + fileName + "' has not be removed.")); 75 saveErrors(request, m_Errors); 76 } 77 } catch (Exception e) { 78 m_Errors.add("error.remove", new ActionMessage("error.remove", fileName, e.getMessage())); 79 saveErrors(request, m_Errors); 80 } 81 } 82 removeForm.setListToBeRemoved(updatedRemovedList); 84 85 removeForm.setConfirm(false); 87 try { 89 refreshTree(request); 90 } catch (Exception e) { 91 addGlobalError(e); 92 saveErrors(request, m_Errors); 93 return (actionMapping.findForward("Global Error")); 94 } 95 96 return (actionMapping.findForward(sForward)); 98 } 99 } 100 | Popular Tags |