01: /**
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 1999 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: *
21: * --------------------------------------------------------------------------
22: * $Id: ApplyJtmConfigurationAction.java 9680 2006-10-06 12:08:33Z danesa $
23: * --------------------------------------------------------------------------
24: */package org.objectweb.jonas.webapp.jonasadmin.service.jtm;
25:
26: import java.io.IOException;
27:
28: import javax.management.ObjectName;
29: import javax.servlet.ServletException;
30: import javax.servlet.http.HttpServletRequest;
31: import javax.servlet.http.HttpServletResponse;
32:
33: import org.apache.struts.action.ActionForm;
34: import org.apache.struts.action.ActionForward;
35: import org.apache.struts.action.ActionMapping;
36: import org.objectweb.jonas.jmx.JonasManagementRepr;
37: import org.objectweb.jonas.jmx.J2eeObjectName;
38: import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction;
39:
40: /**
41: * @author Adriana Danes
42: */
43: public class ApplyJtmConfigurationAction extends JonasBaseAction {
44: /**
45: * Principal method
46: * @param pMapping action mapping
47: * @param pForm used form
48: * @param pRequest request parameters
49: * @param pResponse response parameters
50: * @return action forward
51: * @throws IOException action failed because a IOException
52: * @throws ServletException a ServletException occured
53: */
54: public ActionForward executeAction(ActionMapping pMapping,
55: ActionForm pForm, HttpServletRequest pRequest,
56: HttpServletResponse pResponse) throws IOException,
57: ServletException {
58:
59: // Form used
60: JtmServiceForm oForm = (JtmServiceForm) pForm;
61: try {
62: // Object name used
63: String currentDomainName = m_WhereAreYou
64: .getCurrentDomainName();
65: String currentJonasServerName = m_WhereAreYou
66: .getCurrentJonasServerName();
67: String jtaResourceName = "JTAResource";
68: ObjectName jtaResourceObjectName = J2eeObjectName
69: .JTAResource(currentDomainName,
70: currentJonasServerName, jtaResourceName);
71:
72: JonasManagementRepr.setAttribute(jtaResourceObjectName,
73: "timeOut", new Integer(oForm.getTimeOutText()),
74: currentJonasServerName);
75:
76: if (oForm.getAction().equals("save")) {
77: JonasManagementRepr.invoke(jtaResourceObjectName,
78: "saveConfig", null, null,
79: currentJonasServerName);
80: }
81: } catch (Throwable t) {
82: addGlobalError(t);
83: saveErrors(pRequest, m_Errors);
84: return (pMapping.findForward("Global Error"));
85: }
86:
87: // Forward to action
88: return (pMapping.findForward("Jtm Service"));
89: }
90:
91: }
|