01: /**
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 2005 Bull S.A.
04: * Contact: jonas-team@objectweb.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19: * USA
20: */package org.objectweb.jonas.webapp.jonasadmin.joramplatform;
21:
22: import java.util.Set;
23:
24: import javax.management.InstanceNotFoundException;
25: import javax.management.ObjectName;
26: import javax.servlet.http.HttpServletRequest;
27: import javax.servlet.http.HttpServletResponse;
28:
29: import org.apache.struts.action.ActionForm;
30: import org.apache.struts.action.ActionForward;
31: import org.apache.struts.action.ActionMapping;
32: import org.objectweb.jonas.jmx.JonasManagementRepr;
33: import org.objectweb.jonas.jmx.JoramObjectName;
34: import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou;
35:
36: /**
37: * @author Adriana Danes
38: */
39:
40: public class EditJoramResourceAdapterAction extends EditJoramBaseAction {
41:
42: // --------------------------------------------------------- Public Methods
43:
44: public ActionForward executeAction(ActionMapping pMapping,
45: ActionForm pForm, HttpServletRequest pRequest,
46: HttpServletResponse pResponse) {
47:
48: // Current JOnAS server
49: String jonasServerName = m_WhereAreYou
50: .getCurrentJonasServerName();
51:
52: // Force the node selected in tree
53: m_WhereAreYou.selectNameNode(getTreeBranchName(DEPTH_DOMAIN)
54: + WhereAreYou.NODE_SEPARATOR + "joramplatform", true);
55:
56: // Form used
57: JoramAdapterForm oForm = (JoramAdapterForm) pForm;
58: try {
59: // Object name used
60: Set adapterOns = JonasManagementRepr.queryNames(
61: JoramObjectName.joramAdapter(), jonasServerName);
62: if (adapterOns.isEmpty()) {
63: throw new InstanceNotFoundException();
64: }
65: ObjectName joramAdapterON = (ObjectName) adapterOns
66: .iterator().next();
67: oForm.setCollocatedServer(getBooleanAttribute(
68: joramAdapterON, "CollocatedServer"));
69: oForm.setConfigDir(getStringAttribute(joramAdapterON,
70: "PlatformConfigDir"));
71: oForm.setAdminFile(getStringAttribute(joramAdapterON,
72: "AdminFileXML"));
73: oForm.setPersistentServer(getBooleanAttribute(
74: joramAdapterON, "PersistentPlatform"));
75: oForm.setServerIdTxt(toStringShortAttribute(joramAdapterON,
76: "ServerId"));
77: oForm.setServerName(getStringAttribute(joramAdapterON,
78: "ServerName"));
79: oForm.setHostName(getStringAttribute(joramAdapterON,
80: "HostName"));
81: oForm.setServerPortTxt(toStringIntegerAttribute(
82: joramAdapterON, "ServerPort"));
83: oForm.setCnxPendingTimerTxt(toStringIntegerAttribute(
84: joramAdapterON, "CnxPendingTimer"));
85: oForm.setConnectingTimerTxt(toStringIntegerAttribute(
86: joramAdapterON, "ConnectingTimer"));
87: oForm.setTxPendingTimerTxt(toStringIntegerAttribute(
88: joramAdapterON, "TxPendingTimer"));
89: } catch (Throwable t) {
90: return (treatError(t, pMapping, pRequest));
91: }
92:
93: // Forward to the jsp.
94: return (pMapping.findForward("JoramAdapter"));
95: }
96:
97: }
|