[Join-cvs] join1/src/main/org/figure8/join/control/action DeploymentsActions.java, NONE, 1.1 Envir
Brought to you by:
lbroudoux
|
From: Laurent B. <lbr...@us...> - 2008-01-28 00:23:49
|
Update of /cvsroot/join/join1/src/main/org/figure8/join/control/action In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15573/control/action Modified Files: EnvironmentMappingActions.java Added Files: DeploymentsActions.java Log Message: Fix for issue #1821986 : display deployments history Index: EnvironmentMappingActions.java =================================================================== RCS file: /cvsroot/join/join1/src/main/org/figure8/join/control/action/EnvironmentMappingActions.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EnvironmentMappingActions.java 19 Jul 2006 22:42:26 -0000 1.1 --- EnvironmentMappingActions.java 28 Jan 2008 00:23:44 -0000 1.2 *************** *** 1,4 **** /** ! * Copyright 2005-2006 the original author or authors. * * Licensed under the Gnu General Pubic License, Version 2.0 (the --- 1,4 ---- /** ! * Copyright 2005-2008 the original author or authors. * * Licensed under the Gnu General Pubic License, Version 2.0 (the *************** *** 108,112 **** * @throws Exception such as InfraStructureExceptions ... */ ! public ActionForward doExecute(String operation, ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception{ // Trace operation to execute. log.debug("doExecute() called for '" + operation + "' operation"); --- 108,114 ---- * @throws Exception such as InfraStructureExceptions ... */ ! public ActionForward doExecute(String operation, ActionMapping mapping, ActionForm form, ! HttpServletRequest request, HttpServletResponse response) ! throws Exception{ // Trace operation to execute. log.debug("doExecute() called for '" + operation + "' operation"); *************** *** 138,142 **** * @return A forward to the next view to render and display */ ! protected ActionForward showMappingForm(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception{ --- 140,145 ---- * @return A forward to the next view to render and display */ ! protected ActionForward showMappingForm(ActionMapping mapping, ActionForm form, ! HttpServletRequest request, HttpServletResponse response) throws Exception{ *************** *** 173,177 **** * @return A forward to the next view to render and display */ ! protected ActionForward loadMapping(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception{ --- 176,181 ---- * @return A forward to the next view to render and display */ ! protected ActionForward loadMapping(ActionMapping mapping, ActionForm form, ! HttpServletRequest request, HttpServletResponse response) throws Exception{ *************** *** 194,198 **** * @return A forward to the next view to render and display */ ! protected ActionForward createMapping(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception{ --- 198,203 ---- * @return A forward to the next view to render and display */ ! protected ActionForward createMapping(ActionMapping mapping, ActionForm form, ! HttpServletRequest request, HttpServletResponse response) throws Exception{ *************** *** 220,224 **** * @return A forward to the next view to render and display */ ! protected ActionForward closeMapping(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception{ --- 225,230 ---- * @return A forward to the next view to render and display */ ! protected ActionForward closeMapping(ActionMapping mapping, ActionForm form, ! HttpServletRequest request, HttpServletResponse response) throws Exception{ *************** *** 245,249 **** * @return A forward to the next view to render and display */ ! protected ActionForward loadEnvironmentMappings(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception{ --- 251,256 ---- * @return A forward to the next view to render and display */ ! protected ActionForward loadEnvironmentMappings(ActionMapping mapping, ActionForm form, ! HttpServletRequest request, HttpServletResponse response) throws Exception{ *************** *** 265,269 **** else if (mForm.getPhysicalEnvKey() != null){ // Log and get appropriate list. ! log.info("Retrieving the EnvironmentMapping history for physical environment: " + mForm.getPhysicalEnvKey()); PhysicalEnvironment physicalEnv = environmentManager.getPhysicalEnvironment(mForm.getPhysicalEnvKey()); mappings = environmentManager.getEnvironmentMappings(physicalEnv); --- 272,277 ---- else if (mForm.getPhysicalEnvKey() != null){ // Log and get appropriate list. ! log.info("Retrieving the EnvironmentMapping history for physical environment: " ! + mForm.getPhysicalEnvKey()); PhysicalEnvironment physicalEnv = environmentManager.getPhysicalEnvironment(mForm.getPhysicalEnvKey()); mappings = environmentManager.getEnvironmentMappings(physicalEnv); --- NEW FILE: DeploymentsActions.java --- /** * Copyright 2005-2007 the original author or authors. * * Licensed under the Gnu General Pubic License, Version 2.0 (the * "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.opensource.org/licenses/gpl-license.php * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the Gnu General Public License for more details. */ package org.figure8.join.control.action; import org.figure8.join.control.JoinAction; import org.figure8.join.control.form.DeploymentsForm; import org.figure8.join.businessfacades.environment.EnvironmentManager; import org.figure8.join.businessobjects.environment.EnvironmentMapping; import org.figure8.join.businessobjects.environment.LogicalEnvironment; import org.figure8.join.businessobjects.environment.PhysicalEnvironment; import org.figure8.join.util.LogUtil; import org.apache.commons.logging.Log; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.List; /** * This is a Struts action controller for managing Deployments retrieval related operations. * @author <a href="mailto:lau...@fr...">Laurent Broudoux</a> * @version $Revision: 1.1 $ * @struts.action path="/deployments" name="DeploymentsForm" * scope="request" parameter="op" validate="true" * input="/pages/mainpage.jsp?body=/jsp/environment/deploymentshistory.jsp" * @struts.action-forward name="History" path="/jsp/environment/deploymentshistory.jsp" */ public class DeploymentsActions extends JoinAction{ // Static ------------------------------------------------------------------- /** Get a commons logger */ private static final Log log = LogUtil.getLog(DeploymentsActions.class); /** Operation code for retrieving deployments for a logical environment. */ public static final String LOGICALENV_OP = "getByLogical"; /** Operation code for retrieving deployments for a physical environment. */ public static final String PHYSICALENV_OP = "getByPhysical"; /** Operation code for retrieving deployments for an environment mapping. */ public static final String ENVMAPPING_OP = "getByEnvMapping"; /** The request scope for specifying the title of the screen (used by view) */ public static final String TITLE_KEY = "title"; /** * The request scope attribute under which the retrivied deployments * list is stored. */ public static final String DEPLOYMENTS_KEY = "deployments"; // Attributes --------------------------------------------------------------- /** The EnvironmentManager implementation to use */ protected EnvironmentManager environmentManager = null; // Constructors ------------------------------------------------------------- /** Creates a new instance of DeploymentsActions. */ public DeploymentsActions(){ } // Public ------------------------------------------------------------------- /** @param environmentManager The EnvironmentManager implementation to use */ public void setEnvironmentManager(EnvironmentManager environmentManager){ this.environmentManager = environmentManager; } // Implementation of JoinAction --------------------------------------------- /** * @param operation String representing the operation to invoke on Action * @param mapping Mapping between forwards name and path for this action * @param form The form object containing request parameters * @param request The servlet container request wrapper * @param response The servlet container response wrapper * @return A forward to the next view to render and display * @throws Exception such as InfraStructureExceptions ... */ public ActionForward doExecute(String operation, ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception{ // Trace operation to execute. log.debug("doExecute() called for '" + operation + "' operation"); if (form instanceof DeploymentsForm){ // Get deployments form for operations. DeploymentsForm dForm = (DeploymentsForm)form; if (LOGICALENV_OP.equals(operation)){ return getDeploymentsForLogicalEnvironment(mapping, dForm, request, response); } else if (PHYSICALENV_OP.equals(operation)){ return getDeploymentsForPhysicalEnvironment(mapping, dForm, request, response); } else if (ENVMAPPING_OP.equals(operation)){ return getDeploymentsForEnvironmentMapping(mapping, dForm, request, response); } } // This should not happen... return null; } // Protected ---------------------------------------------------------------- /** * Retrieve deployments for a specified logical environment. * @return A forward to the next view to render and display */ protected ActionForward getDeploymentsForLogicalEnvironment(ActionMapping mapping, DeploymentsForm form, HttpServletRequest request, HttpServletResponse response) throws Exception{ // Retrieve deployments from manager. LogicalEnvironment environment = environmentManager.getLogicalEnvironment(form.getLogicalEnvKey()); List deployments = environmentManager.getDeployments(environment); // Store into request attributes before forwarding. request.setAttribute(LogicalEnvironmentActions.ENVIRONMENT_KEY, environment); request.setAttribute(DEPLOYMENTS_KEY, deployments); request.setAttribute(TITLE_KEY, "title.deployments.bylogicalenv"); request.setAttribute("criterion", "logicalenv"); return mapping.findForward("History"); } /** * Retrieve deployments for a specified physical environment. * @return A forward to the next view to render and display */ protected ActionForward getDeploymentsForPhysicalEnvironment(ActionMapping mapping, DeploymentsForm form, HttpServletRequest request, HttpServletResponse response) throws Exception{ // Retrieve deployments from manager. PhysicalEnvironment environment = environmentManager.getPhysicalEnvironment(form.getPhysicalEnvKey()); List deployments = environmentManager.getDeployments(environment); // Store into request attributes before forwarding. request.setAttribute(PhysicalEnvironmentActions.ENVIRONMENT_KEY, environment); request.setAttribute(DEPLOYMENTS_KEY, deployments); request.setAttribute(TITLE_KEY, "title.deployments.byphysicalenv"); request.setAttribute("criterion", "physicalenv"); return mapping.findForward("History"); } /** * Retrieve deployments for a specified environment mapping. * @return A forward to the next view to render and display */ protected ActionForward getDeploymentsForEnvironmentMapping(ActionMapping mapping, DeploymentsForm form, HttpServletRequest request, HttpServletResponse response) throws Exception{ // Retrieve environment mapping from manager. EnvironmentMapping envMapping = environmentManager.getEnvironmentMapping(form.getId()); // Store into request attributes before forwarding. request.setAttribute(EnvironmentMappingActions.MAPPING_KEY, envMapping); request.setAttribute(DEPLOYMENTS_KEY, envMapping.getDeployments()); request.setAttribute(TITLE_KEY, "title.deployments.byenvmapping"); request.setAttribute("criterion", "envmapping"); return mapping.findForward("History"); } } |