001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 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: EditJmxServerAction.java 9680 2006-10-06 12:08:33Z danesa $
023: * --------------------------------------------------------------------------
024: */package org.objectweb.jonas.webapp.jonasadmin.jonasserver;
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.jmx.JonasManagementRepr;
037: import org.objectweb.jonas.jmx.JonasObjectName;
038: import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction;
039:
040: /**
041: * @author Michel-Ange ANTON
042: */
043:
044: public class EditJmxServerAction extends JonasBaseAction {
045:
046: // --------------------------------------------------------- Public Methods
047: /**
048: * Execute action for JMX service management
049: * @param pMapping mapping info
050: * @param pForm form object
051: * @param pRequest HTTP request
052: * @param pResponse HTTP response
053: *
054: * @return An <code>ActionForward</code> instance or <code>null</code>
055: *
056: * @exception IOException if an input/output error occurs
057: * @exception ServletException if a servlet exception occurs
058: */
059: public ActionForward executeAction(ActionMapping pMapping,
060: ActionForm pForm, HttpServletRequest pRequest,
061: HttpServletResponse pResponse) throws IOException,
062: ServletException {
063: // Force the node selected in tree
064: m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER),
065: true);
066: String serverName = m_WhereAreYou.getCurrentJonasServerName();
067: // Form used
068: JmxServerForm oForm = (JmxServerForm) pForm;
069: try {
070: // Object name used
071: ObjectName oObjectName = JonasObjectName.jmxService();
072: // Copy scalar properties
073: oForm.setMBeanServerId(getStringAttribute(oObjectName,
074: "MBeanServerId"));
075: oForm.setSpecificationName(getStringAttribute(oObjectName,
076: "SpecificationName"));
077: oForm.setSpecificationVersion(getStringAttribute(
078: oObjectName, "SpecificationVersion"));
079: oForm.setSpecificationVendor(getStringAttribute(
080: oObjectName, "SpecificationVendor"));
081: oForm.setImplementationName(getStringAttribute(oObjectName,
082: "ImplementationName"));
083: oForm.setImplementationVersion(getStringAttribute(
084: oObjectName, "ImplementationVersion"));
085: oForm.setImplementationVendor(getStringAttribute(
086: oObjectName, "ImplementationVendor"));
087: if (JonasManagementRepr.isRegistered(JonasObjectName
088: .webContainerService(), serverName)) {
089: oForm.setPresentServletContainer(true);
090:
091: } else {
092: oForm.setPresentServletContainer(false);
093: }
094: } catch (Throwable t) {
095: addGlobalError(t);
096: saveErrors(pRequest, m_Errors);
097: return (pMapping.findForward("Global Error"));
098: }
099:
100: // Forward to the jsp.
101: return (pMapping.findForward("JmxServer"));
102: }
103:
104: }
|