01: /**
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 2006 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: * $Id: $
22: * --------------------------------------------------------------------------
23: */package org.objectweb.jonas.webapp.jonasadmin.joramplatform;
24:
25: import java.io.IOException;
26:
27: import javax.management.ObjectName;
28: import javax.servlet.ServletException;
29: import javax.servlet.http.HttpServletRequest;
30: import javax.servlet.http.HttpServletResponse;
31:
32: import org.apache.struts.action.ActionForm;
33: import org.apache.struts.action.ActionForward;
34: import org.apache.struts.action.ActionMapping;
35: import org.objectweb.jonas.jmx.J2eeObjectName;
36: import org.objectweb.jonas.jmx.JonasManagementRepr;
37: import org.objectweb.jonas.jmx.JoramObjectName;
38:
39: /**
40: * @author Adriana danes
41: */
42:
43: public class ExportRepository extends EditJoramBaseAction {
44:
45: /**
46: * Process the specified HTTP request, and create the corresponding HTTP
47: * response (or forward to another web component that will create it).
48: * Return an <code>ActionForward</code> instance describing where and how
49: * control should be forwarded, or <code>null</code> if the response has
50: * already been completed.
51: *
52: * @param p_Mapping The ActionMapping used to select this instance
53: * @param p_Form The optional ActionForm bean for this request (if any)
54: * @param p_Request The HTTP request we are processing
55: * @param p_Response The HTTP response we are creating
56: *
57: * @return An <code>ActionForward</code> instance or <code>null</code>
58: *
59: * @exception IOException if an input/output error occurs
60: * @exception ServletException if a servlet exception occurs
61: */
62: public ActionForward executeAction(ActionMapping p_Mapping,
63: ActionForm p_Form, HttpServletRequest p_Request,
64: HttpServletResponse p_Response) throws IOException,
65: ServletException {
66:
67: // Current JOnAS server
68: String jonasServerName = m_WhereAreYou
69: .getCurrentJonasServerName();
70:
71: try {
72: // Object name used
73: ObjectName joramPlatformOn = JoramObjectName.joramAdmin();
74: // call method
75: String[] params = new String[1];
76: params[0] = getPathToExportRepository();
77: String[] signature = { "java.lang.String" };
78: JonasManagementRepr.invoke(joramPlatformOn,
79: "exportRepositoryToFile", params, signature,
80: jonasServerName);
81: } catch (Throwable t) {
82: addGlobalError(t);
83: saveErrors(p_Request, m_Errors);
84: return (p_Mapping.findForward("Global Error"));
85: }
86:
87: // Forward to the jsp.
88: return (p_Mapping.findForward("JoramPlatform"));
89: }
90:
91: }
|