001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999-2005 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: EditWebAppJettyAction.java 9680 2006-10-06 12:08:33Z danesa $
023: * --------------------------------------------------------------------------
024: */package org.objectweb.jonas.webapp.jonasadmin.service.container;
025:
026: import java.io.IOException;
027:
028: import javax.management.ObjectName;
029: import javax.servlet.ServletException;
030: import javax.servlet.http.HttpServletRequest;
031: import javax.servlet.http.HttpServletResponse;
032:
033: import org.apache.struts.action.ActionForm;
034: import org.apache.struts.action.ActionForward;
035: import org.apache.struts.action.ActionMapping;
036: import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou;
037:
038: /**
039: * @author Michel-Ange ANTON
040: */
041:
042: public class EditWebAppJettyAction extends BaseWebAppAction {
043:
044: // --------------------------------------------------------- Public Methods
045:
046: public ActionForward executeAction(ActionMapping p_Mapping,
047: ActionForm p_Form, HttpServletRequest p_Request,
048: HttpServletResponse p_Response) throws IOException,
049: ServletException {
050:
051: // Current server
052: WhereAreYou oWhere = (WhereAreYou) p_Request.getSession()
053: .getAttribute(WhereAreYou.SESSION_NAME);
054: String sServerName = oWhere.getCurrentJonasServerName();
055:
056: // Initialize form
057: boolean bPopulate = initialize(p_Mapping, p_Request);
058:
059: try {
060: // Force the node selected in tree
061: if (mWebAppForm != null
062: && mWebAppForm.getObjectName() != null) {
063: m_WhereAreYou.selectNameNode(
064: getTreeBranchName(DEPTH_SERVER)
065: + WhereAreYou.NODE_SEPARATOR
066: + "services"
067: + WhereAreYou.NODE_SEPARATOR + "web"
068: + WhereAreYou.NODE_SEPARATOR
069: + mWebAppForm.getObjectName(), true);
070: }
071:
072: // Populate
073: if (bPopulate) {
074: // Populate WebApp
075: populateWebAppJetty(mWebAppForm.getObjectName(),
076: (WebAppJettyForm) mWebAppForm);
077: // Detect War, still use the JOnAS War MBean as we could not transfer
078: // management information we need to the Jetty MBean
079: String pathContext = mWebAppForm.getPathContext();
080: ObjectName on = findJonasMbeanWar(pathContext,
081: sServerName);
082: if (on != null) {
083: // Populate War
084: mWarForm = createWarForm(p_Mapping, p_Request);
085: populateJettyWar(on, mWarForm, sServerName);
086: // here we populated the WarForm very incompletlly,
087: // for example hostName is null
088: }
089: }
090: } catch (Throwable t) {
091: addGlobalError(t);
092: saveErrors(p_Request, m_Errors);
093: return (p_Mapping.findForward("Global Error"));
094: }
095: // Forward to the jsp.
096: return (p_Mapping.findForward("WebApp Jetty"));
097: }
098:
099: // --------------------------------------------------------- Protected Methods
100:
101: }
|