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: EditJmsServiceAction.java 9829 2006-11-10 09:55:29Z danesa $
023: * --------------------------------------------------------------------------
024: */
025:
026: package org.objectweb.jonas.webapp.jonasadmin.service.jms;
027:
028: import java.io.IOException;
029:
030: import javax.management.ObjectName;
031: import javax.servlet.ServletException;
032: import javax.servlet.http.HttpServletRequest;
033: import javax.servlet.http.HttpServletResponse;
034:
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.jmx.JonasManagementRepr;
039: import org.objectweb.jonas.jmx.JonasObjectName;
040: import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction;
041: import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou;
042:
043: /**
044: * Principal action for JMS service management. Allows to get the configuration
045: * attributes of the MOM implementing the jms service.
046: * @author Adriana Danes
047: */
048: public class EditJmsServiceAction extends JonasBaseAction {
049:
050: public static final String JORAM = "org.objectweb.jonas_jms.JmsAdminForJoram";
051:
052: public ActionForward executeAction(ActionMapping p_Mapping,
053: ActionForm p_Form, HttpServletRequest p_Request,
054: HttpServletResponse p_Response) throws IOException,
055: ServletException {
056:
057: // Force the node selected in tree
058: m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_SERVER)
059: + WhereAreYou.NODE_SEPARATOR + "services"
060: + WhereAreYou.NODE_SEPARATOR + "jms", true);
061:
062: // Form used
063: JmsServiceForm oForm = (JmsServiceForm) p_Form;
064: try {
065: // Object name used
066: ObjectName oObjectName = JonasObjectName.jmsService();
067: String momName = (String) getStringAttribute(oObjectName,
068: "Mom");
069: if (momName.equals(JORAM)) {
070: momName = m_Resources.getMessage("tab.mom.joram");
071: }
072: oForm.setMomName(momName);
073:
074: String location;
075: String currentServer = m_WhereAreYou
076: .getCurrentJonasServerName();
077: Boolean momLocal = (Boolean) JonasManagementRepr.invoke(
078: oObjectName, "isMomLocal", null, null,
079: currentServer);
080: if (momLocal.booleanValue()) {
081: // Collacated MOM
082: location = m_Resources.getMessage("tab.mom.collocated");
083: oForm.setMomLocation(location);
084: } else {
085: // Distant MOM
086: location = m_Resources.getMessage("tab.mom.distant");
087: oForm.setMomLocation(location);
088: }
089:
090: String momUrl = (String) getStringAttribute(oObjectName,
091: "Url");
092: oForm.setMomUrl(momUrl);
093: } catch (Throwable t) {
094: addGlobalError(t);
095: saveErrors(p_Request, m_Errors);
096: return (p_Mapping.findForward("Global Error"));
097: }
098:
099: // Forward to the jsp.
100: return (p_Mapping.findForward("Jms Service"));
101: }
102: }
|