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: ApplyLoggersConfirmAction.java 9680 2006-10-06 12:08:33Z danesa $
23: * --------------------------------------------------------------------------
24: */
25:
26: package org.objectweb.jonas.webapp.jonasadmin.logging;
27:
28: import java.io.IOException;
29:
30: import javax.management.ObjectName;
31: import javax.servlet.ServletException;
32: import javax.servlet.http.HttpServletRequest;
33: import javax.servlet.http.HttpServletResponse;
34:
35: import org.apache.struts.action.ActionForm;
36: import org.apache.struts.action.ActionForward;
37: import org.apache.struts.action.ActionMapping;
38: import org.objectweb.jonas.jmx.CatalinaObjectName;
39: import org.objectweb.jonas.jmx.JonasManagementRepr;
40: import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou;
41: import org.objectweb.jonas.webapp.jonasadmin.common.ItemsForm;
42:
43: /**
44: * @author Michel-Ange ANTON
45: */
46: public class ApplyLoggersConfirmAction extends BaseLoggerAction {
47:
48: /**
49: * Signature for the remove operation.
50: */
51: private String removeType[] = { "java.lang.String", // Object name
52: };
53:
54: // --------------------------------------------------------- Public Methods
55:
56: public ActionForward executeAction(ActionMapping p_Mapping,
57: ActionForm p_Form, HttpServletRequest p_Request,
58: HttpServletResponse p_Response) throws IOException,
59: ServletException {
60:
61: // Form used
62: ItemsForm oForm = (ItemsForm) p_Form;
63:
64: // Current server
65: String serverName = m_WhereAreYou.getCurrentJonasServerName();
66:
67: // Actions
68: try {
69: String[] values = new String[1];
70: String operation = "removeValve";
71: // Look up the Catalina MBeanFactory
72: ObjectName onFactory = CatalinaObjectName.catalinaFactory();
73: // Remove connectors
74: for (int i = 0; i < oForm.getSelectedItemsList().size(); i++) {
75: LoggerItem o = (LoggerItem) oForm
76: .getSelectedItemsList().get(i);
77: values[0] = o.getObjectName();
78: JonasManagementRepr.invoke(onFactory, operation,
79: values, removeType, serverName);
80: }
81: // refresh tree
82: refreshTree(p_Request);
83: } catch (Throwable t) {
84: addGlobalError(t);
85: saveErrors(p_Request, m_Errors);
86: return (p_Mapping.findForward("Global Error"));
87: }
88:
89: // Forward to the connector display page or the list if create
90: return p_Mapping.findForward("ActionListLoggers");
91: }
92: }
|