1 25 26 package org.objectweb.jonas.webapp.jonasadmin.deploy; 27 28 import java.io.IOException ; 29 import java.util.ArrayList ; 30 import java.util.HashMap ; 31 import java.util.Map ; 32 import java.util.TreeMap ; 33 34 import javax.management.ObjectName ; 35 import javax.servlet.ServletException ; 36 import javax.servlet.http.HttpServletRequest ; 37 import javax.servlet.http.HttpServletResponse ; 38 39 import org.apache.struts.action.ActionForm; 40 import org.apache.struts.action.ActionForward; 41 import org.apache.struts.action.ActionMapping; 42 import org.apache.struts.action.ActionMessage; 43 44 48 public class ApplyDomainDeployAction extends BaseDeployAction { 49 50 52 54 public ActionForward executeAction(ActionMapping p_Mapping, 55 ActionForm p_Form, HttpServletRequest p_Request, 56 HttpServletResponse p_Response) throws IOException , 57 ServletException { 58 59 String sForward = "Domain Deploy Confirm"; 60 61 DomainDeployForm oForm = (DomainDeployForm) p_Form; 63 oForm.setDeploymentInProgress(false); 64 oForm.setDeploymentComplete(false); 65 66 try { 67 68 ArrayList appList = new ArrayList (); 71 ArrayList serverList = new ArrayList (); 72 ArrayList serverNamesList = new ArrayList (); 73 74 for (int i = 0; i < oForm.getServerSelected().length; i++) { 75 serverList.add(oForm.getServerSelected()[i]); 76 serverNamesList.add(ObjectName.getInstance(oForm.getServerSelected()[i]).getKeyProperty("name")); 77 } 78 for (int i = 0; i < oForm.getDeploySelected().length; i++) { 79 appList.add(oForm.getDeploySelected()[i]); 80 } 81 82 oForm.setListDeploy(appList); 83 oForm.setListTargetServers(serverList); 84 oForm.setListTargetServerNames(serverNamesList); 85 86 oForm.setSelectedAction(oForm.getSelectedOption()); 89 oForm.setReplacementOption(oForm.getReplaceOnTarget()); 90 91 Map blankReport = new TreeMap (); 94 Map initialStatus = new HashMap (); 95 initialStatus.put("In Progress...", "true"); 96 for (int i = 0; i < appList.size(); i++) { 97 HashMap appReport = new HashMap (); 98 for (int j = 0; j < serverList.size(); j++) { 99 appReport.put(ObjectName.getInstance( 100 (String ) serverList.get(j)).getKeyProperty("name"), 101 initialStatus); 102 } 103 blankReport.put(appList.get(i), appReport); 104 } 105 oForm.setReports(blankReport); 106 107 oForm.setConfirm(oForm.getDeploySelected().length > 0 110 && oForm.getServerSelected().length > 0); 111 112 if (!oForm.isConfirm()) { 113 m_Errors.add("error.domain.deploy.noselect", 114 new ActionMessage("error.domain.deploy.noselect")); 115 saveErrors(p_Request, m_Errors); 116 sForward = getForwardEdit(); 117 } 118 119 } catch (Throwable t) { 120 addGlobalError(t); 121 saveErrors(p_Request, m_Errors); 122 return (p_Mapping.findForward("Global Error")); 123 } 124 125 return (p_Mapping.findForward(sForward)); 127 } 128 } 129 | Popular Tags |