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: ApplyEjbSessionConfigurationAction.java 6043 2005-01-04 14:38:19Z danesa $
23: * --------------------------------------------------------------------------
24: */package org.objectweb.jonas.webapp.jonasadmin.service.ejb;
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.webapp.jonasadmin.JonasBaseAction;
37:
38: /**
39: * @author Vivek Lakshmanan
40: * Handles update of session time out information for session beans.
41: */
42: public class ApplyEjbSessionConfigurationAction extends JonasBaseAction {
43: /**
44: * Principal method
45: * @param pMapping action mapping
46: * @param pForm used form
47: * @param pRequest request parameters
48: * @param pResponse response parameters
49: * @return action forward
50: * @throws IOException action failed because a IOException
51: * @throws ServletException a ServletException occured
52: */
53: public ActionForward executeAction(ActionMapping pMapping,
54: ActionForm pForm, HttpServletRequest pRequest,
55: HttpServletResponse pResponse) throws IOException,
56: ServletException {
57:
58: // Form used
59: EjbSessionForm oForm = (EjbSessionForm) pForm;
60: // Object name used
61: String currentObjectName = oForm.getObjectName();
62: try {
63: ObjectName oObjectName = null;
64: if (currentObjectName != null) {
65: oObjectName = ObjectName.getInstance(currentObjectName);
66: String timeOut = oForm.getSessionTimeOut();
67: setIntegerAttribute(oObjectName, "sessionTimeOut",
68: timeOut);
69: }
70: if (oForm.getType().equals("StatelessSessionBean")) {
71: // Forward to stateless action
72: pRequest.setAttribute("select", currentObjectName);
73: return (pMapping.findForward("ActionEditEjbSbl"));
74: } else {
75: // Forward to stateful action
76: pRequest.setAttribute("select", currentObjectName);
77: return (pMapping.findForward("ActionEditEjbSbf"));
78: }
79: } catch (Throwable t) {
80: addGlobalError(t);
81: saveErrors(pRequest, m_Errors);
82: return (pMapping.findForward("Global Error"));
83: }
84:
85: }
86:
87: }
|