00001
00026 package org.objectweb.jonas.webapp.jonasadmin.deploy;
00027
00028 import java.io.IOException;
00029 import java.util.ArrayList;
00030
00031 import javax.servlet.ServletException;
00032 import javax.servlet.http.HttpServletRequest;
00033 import javax.servlet.http.HttpServletResponse;
00034
00035 import org.apache.struts.action.ActionError;
00036 import org.apache.struts.action.ActionForm;
00037 import org.apache.struts.action.ActionForward;
00038 import org.apache.struts.action.ActionMapping;
00039 import org.objectweb.jonas.webapp.jonasadmin.Jlists;
00040
00044 public class ApplyDeployAction extends BaseDeployAction {
00045
00046
00047
00050 public ActionForward executeAction(ActionMapping p_Mapping, ActionForm p_Form
00051 , HttpServletRequest p_Request, HttpServletResponse p_Response)
00052 throws IOException, ServletException {
00053
00054 String sForward = "Deploy Confirm";
00055
00056
00057 DeployForm oForm = (DeployForm) p_Form;
00058 try {
00059 oForm.setListDeploy(Jlists.getArrayList(oForm.getDeploy(), Jlists.SEPARATOR));
00060 oForm.setListUndeploy(Jlists.getArrayList(oForm.getUndeploy(), Jlists.SEPARATOR));
00061
00062 ArrayList alAdd = new ArrayList(oForm.getListDeploy());
00063 alAdd.removeAll(oForm.getListDeployed());
00064 oForm.setListAdd(alAdd);
00065
00066 ArrayList alRemove = new ArrayList(oForm.getListUndeploy());
00067 alRemove.retainAll(oForm.getListDeployed());
00068 oForm.setListRemove(alRemove);
00069
00070 oForm.setConfirm(((alAdd.size() > 0) || (alRemove.size() > 0)));
00071 if (!oForm.isConfirm()) {
00072 m_Errors.add("error.deploy.noselect", new ActionError("error.deploy.noselect"));
00073 saveErrors(p_Request, m_Errors);
00074 sForward = getForwardEdit();
00075 }
00076 } catch (Throwable t) {
00077 addGlobalError(t);
00078 saveErrors(p_Request, m_Errors);
00079 return (p_Mapping.findForward("Global Error"));
00080 }
00081
00082 return (p_Mapping.findForward(sForward));
00083 }
00084 }