001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999-2004 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: EditTopAction.java 9680 2006-10-06 12:08:33Z danesa $
023: * --------------------------------------------------------------------------
024: */package org.objectweb.jonas.webapp.jonasadmin;
025:
026: import java.io.IOException;
027: import java.util.ArrayList;
028:
029: import javax.servlet.ServletException;
030: import javax.servlet.http.HttpServletRequest;
031: import javax.servlet.http.HttpServletResponse;
032:
033: import org.apache.struts.Globals;
034: import org.apache.struts.action.ActionErrors;
035: import org.apache.struts.action.ActionForm;
036: import org.apache.struts.action.ActionForward;
037: import org.apache.struts.action.ActionMapping;
038: import org.objectweb.jonas.common.Log;
039: import org.objectweb.jonas.jmx.JonasManagementRepr;
040: import org.objectweb.util.monolog.api.BasicLevel;
041: import org.objectweb.util.monolog.api.Logger;
042:
043: /**
044: * Test <code>Action</code> that handles events from the tree control test
045: * page.
046: * @author Michel-Ange Anton (initial developer)<br>
047: * @author Florent Benoit (changes for struts 1.2.2)
048: */
049:
050: public class EditTopAction extends JonasBaseAction {
051:
052: // --------------------------------------------------------- Public Methods
053:
054: /**
055: * Process the specified HTTP request, and create the corresponding HTTP
056: * response (or forward to another web component that will create it).
057: * Return an <code>ActionForward</code> instance describing where and how
058: * control should be forwarded, or <code>null</code> if the response has
059: * already been completed.
060: *
061: * @param mapping The ActionMapping used to select this instance
062: * @param actionForm The optional ActionForm bean for this request (if any)
063: * @param request The HTTP request we are processing
064: * @param response The HTTP response we are creating
065: *
066: * @exception IOException if an input/output error occurs
067: * @exception ServletException if a servlet exception occurs
068: */
069: public ActionForward executeAction(ActionMapping mapping,
070: ActionForm form, HttpServletRequest request,
071: HttpServletResponse response) throws IOException,
072: ServletException {
073:
074: // Test if force to reload all the frames
075: ActionErrors oActionErrors = (ActionErrors) request
076: .getAttribute(Globals.ERROR_KEY);
077: if (oActionErrors != null) {
078: request
079: .setAttribute("errorServerSelect",
080: new Boolean(true));
081: } else {
082: String sFirstCall = request.getParameter("firstCall");
083: if (sFirstCall == null) {
084: request.setAttribute("reloadAll", new Boolean(true));
085: }
086: }
087:
088: // Form used
089: TopForm topFm = new TopForm();
090: request.setAttribute("topForm", topFm);
091: try {
092: String serverName = m_WhereAreYou
093: .getCurrentJonasServerName();
094: topFm.setServerSelect(serverName);
095: } catch (Throwable t) {
096: String message = "Problem when accessing to JOnAS ! : "
097: + t.getMessage();
098: //getServlet().log(message, t);
099: Logger logger = Log.getLogger(Log.JONAS_ADMIN_PREFIX);
100: if (logger.isLoggable(BasicLevel.DEBUG)) {
101: logger.log(BasicLevel.DEBUG, message);
102: }
103: response.sendError(HttpServletResponse.SC_BAD_REQUEST,
104: message);
105: return (null);
106: }
107:
108: // Forward to the jsp.
109: return (mapping.findForward("Top"));
110: }
111:
112: }
|