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: * --------------------------------------------------------------------------
22: * $Id: ApplyTemplateCreateResourceAdapterAction.java 8645 2006-06-16 13:16:16Z pasmith $
23: * --------------------------------------------------------------------------
24: */package org.objectweb.jonas.webapp.jonasadmin.resourceadapter;
25:
26: import java.io.File;
27: import java.io.IOException;
28:
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.common.JProp;
37: import org.objectweb.jonas.webapp.jonasadmin.deploy.BaseDeployAction;
38:
39: /**
40: * This action is called when the user picks which type of Resource Archive to create.
41: *
42: * @author Patrick Smith
43: */
44: public class ApplyTemplateCreateResourceAdapterAction extends
45: BaseDeployAction {
46:
47: /**
48: * The location of the base JOnAS Directory.
49: */
50: private String jonasBase = JProp.getJonasBase();
51:
52: /**
53: * The file separator to use for file paths.
54: */
55: private String fileSeparator = File.separator;
56:
57: /**
58: * The name of the directory that stores the rars.
59: */
60: private String rarDir = "rars";
61:
62: // --------------------------------------------------------- Public Methods
63:
64: /**
65: * The action to use when the Struts action is executed.
66: * Directs the user to either template depending on which was selected.
67: * @param p_Mapping The ActionMapping for the action.
68: * @param p_Form The form used in this action.
69: * @param p_Request HTTP Request for the action.
70: * @param p_Response The HTTP Response.
71: * @throws IOException, ServletException if the there is a problem with the
72: * template files, creation of the RARs, or a servlet error.
73: * @return A forward to the next Struts page.
74: */
75: public ActionForward executeAction(ActionMapping p_Mapping,
76: ActionForm p_Form, HttpServletRequest p_Request,
77: HttpServletResponse p_Response) throws IOException,
78: ServletException {
79:
80: // Form used
81: CreateResourceAdapterForm oForm = (CreateResourceAdapterForm) p_Form;
82: m_Session.setAttribute("createResourceAdapterForm", oForm);
83: if (oForm.getTemplate().equals("Other")) {
84: oForm.setTemplate("Other");
85: return (p_Mapping
86: .findForward("Create Other Resource Adapter"));
87: } else {
88: oForm.setTemplate("JDBC");
89: return (p_Mapping
90: .findForward("Create JDBC Resource Adapter"));
91: }
92: }
93:
94: // --------------------------------------------------------- Protected Methods
95:
96: }
|