KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > webapp > admin > host > AddHostAction


1 /*
2  * Copyright 2001-2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.webapp.admin.host;
18
19 import java.io.IOException JavaDoc;
20 import java.util.Locale JavaDoc;
21 import java.util.ArrayList JavaDoc;
22 import javax.servlet.ServletException JavaDoc;
23 import javax.servlet.http.HttpServletRequest JavaDoc;
24 import javax.servlet.http.HttpServletResponse JavaDoc;
25 import javax.servlet.http.HttpSession JavaDoc;
26 import org.apache.struts.action.Action;
27 import org.apache.struts.action.ActionErrors;
28 import org.apache.struts.action.ActionForm;
29 import org.apache.struts.action.ActionForward;
30 import org.apache.struts.action.ActionMapping;
31 import org.apache.struts.util.MessageResources;
32 import org.apache.webapp.admin.LabelValueBean;
33 import org.apache.webapp.admin.Lists;
34
35 /**
36  * The <code>Action</code> that sets up <em>Add Host</em> transactions.
37  *
38  * @author Manveen Kaur
39  * @version $Revision: 1.11 $ $Date: 2004/10/18 06:37:53 $
40  */

41
42 public class AddHostAction extends Action {
43
44     // --------------------------------------------------------- Public Methods
45

46     /**
47      * Process the specified HTTP request, and create the corresponding HTTP
48      * response (or forward to another web component that will create it).
49      * Return an <code>ActionForward</code> instance describing where and how
50      * control should be forwarded, or <code>null</code> if the response has
51      * already been completed.
52      *
53      * @param mapping The ActionMapping used to select this instance
54      * @param actionForm The optional ActionForm bean for this request (if any)
55      * @param request The HTTP request we are processing
56      * @param response The HTTP response we are creating
57      *
58      * @exception IOException if an input/output error occurs
59      * @exception ServletException if a servlet exception occurs
60      */

61     public ActionForward execute(ActionMapping mapping,
62     ActionForm form,
63     HttpServletRequest JavaDoc request,
64     HttpServletResponse JavaDoc response)
65     throws IOException JavaDoc, ServletException JavaDoc {
66
67         // Acquire the resources that we need
68
HttpSession JavaDoc session = request.getSession();
69         Locale JavaDoc locale = getLocale(request);
70         MessageResources resources = getResources(request);
71
72         // the service Name is needed to retrieve the engine mBean to
73
// which the new host mBean will be added.
74
String JavaDoc serviceName = request.getParameter("select");
75
76         // Fill in the form values for display and editing
77
HostForm hostFm = new HostForm();
78         session.setAttribute("hostForm", hostFm);
79         hostFm.setAdminAction("Create");
80         hostFm.setObjectName("");
81         hostFm.setHostName("");
82         hostFm.setServiceName(serviceName);
83         hostFm.setAppBase("");
84         hostFm.setAutoDeploy("true");
85         hostFm.setDeployXML("true");
86         hostFm.setDeployOnStartup("true");
87         hostFm.setUnpackWARs("true");
88         hostFm.setXmlNamespaceAware("false");
89         hostFm.setXmlValidation("false");
90         hostFm.setBooleanVals(Lists.getBooleanValues());
91
92         // Forward to the host display page
93
return (mapping.findForward("Host"));
94
95     }
96
97
98 }
99
Popular Tags