KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > webapp > jonasadmin > service > container > WarForm


1 /*
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * 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: WarForm.java,v 1.7 2004/03/19 14:31:49 sauthieg Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.webapp.jonasadmin.service.container;
27
28 import java.util.ArrayList JavaDoc;
29 import java.util.Collections JavaDoc;
30
31 import javax.servlet.http.HttpServletRequest JavaDoc;
32
33 import org.apache.struts.action.ActionErrors;
34 import org.apache.struts.action.ActionForm;
35 import org.apache.struts.action.ActionMapping;
36 import org.objectweb.jonas.webapp.jonasadmin.JonasAdminJmx;
37
38 /**
39  * @author Michel-Ange ANTON
40  */

41 public class WarForm extends ActionForm {
42
43 // --------------------------------------------------------- Properties variables
44

45     private String JavaDoc path = null;
46     private String JavaDoc filename = null;
47     private String JavaDoc contextRoot = null;
48     private String JavaDoc hostName = null;
49     private String JavaDoc warFile = null;
50     private String JavaDoc warPath = null;
51     private boolean java2DelegationModel = false;
52     private boolean inEarCase = false;
53     private String JavaDoc earPath = null;
54     private String JavaDoc xmlContent = null;
55     private String JavaDoc jonasXmlContent = null;
56     private String JavaDoc[] servletsName = null;
57     private ArrayList JavaDoc listServlets = new ArrayList JavaDoc();
58     private String JavaDoc earFilename = null;
59
60 // --------------------------------------------------------- Public Methods
61

62     /**
63      * Reset all properties to their default values.
64      *
65      * @param mapping The mapping used to select this instance
66      * @param request The servlet request we are processing
67      */

68
69     public void reset(ActionMapping mapping, HttpServletRequest JavaDoc request) {
70         path = null;
71         filename = null;
72
73         contextRoot = null;
74         hostName = null;
75         warPath = null;
76         java2DelegationModel = false;
77         inEarCase = false;
78         earPath = null;
79         earFilename = null;
80         xmlContent = null;
81         jonasXmlContent = null;
82         servletsName = null;
83         listServlets = new ArrayList JavaDoc();
84     }
85
86     /**
87      * Validate the properties that have been set from this HTTP request,
88      * and return an <code>ActionErrors</code> object that encapsulates any
89      * validation errors that have been found. If no errors are found, return
90      * <code>null</code> or an <code>ActionErrors</code> object with no
91      * recorded error messages.
92      *
93      * @param mapping The mapping used to select this instance
94      * @param request The servlet request we are processing
95      * @return List of errors
96      */

97     public ActionErrors validate(ActionMapping mapping, HttpServletRequest JavaDoc request) {
98         ActionErrors oErrors = new ActionErrors();
99         return oErrors;
100     }
101
102 // --------------------------------------------------------- Properties Methods
103

104     public String JavaDoc getPath() {
105         return path;
106     }
107
108     public void setPath(String JavaDoc path) {
109         this.path = path;
110     }
111
112     public String JavaDoc getFilename() {
113         return filename;
114     }
115
116     public void setFilename(String JavaDoc filename) {
117         this.filename = filename;
118     }
119
120     public String JavaDoc getHostName() {
121         return hostName;
122     }
123
124     public void setHostName(String JavaDoc hostName) {
125         this.hostName = hostName;
126     }
127
128     public String JavaDoc getWarPath() {
129         return warPath;
130     }
131
132     public void setWarPath(java.net.URL JavaDoc p_WarUrl) {
133         this.warPath = null;
134         if (p_WarUrl != null) {
135             this.warPath = p_WarUrl.getPath();
136         }
137     }
138
139     public boolean getInEarCase() {
140         return inEarCase;
141     }
142
143     public void setInEarCase(boolean inEarCase) {
144         this.inEarCase = inEarCase;
145     }
146
147     public String JavaDoc getContextRoot() {
148         return contextRoot;
149     }
150
151     public void setContextRoot(String JavaDoc contextRoot) {
152         this.contextRoot = contextRoot;
153     }
154
155     public boolean getJava2DelegationModel() {
156         return java2DelegationModel;
157     }
158
159     public void setJava2DelegationModel(boolean java2DelegationModel) {
160         this.java2DelegationModel = java2DelegationModel;
161     }
162
163     public String JavaDoc getXmlContent() {
164         return xmlContent;
165     }
166
167     public void setXmlContent(String JavaDoc xmlContent) {
168         this.xmlContent = xmlContent;
169     }
170
171     public String JavaDoc getJonasXmlContent() {
172         return jonasXmlContent;
173     }
174
175     public void setJonasXmlContent(String JavaDoc jonasXmlContent) {
176         this.jonasXmlContent = jonasXmlContent;
177     }
178
179     public String JavaDoc[] getServletsName() {
180         return servletsName;
181     }
182
183     public void setServletsName(String JavaDoc[] servletsName) {
184         this.servletsName = servletsName;
185         // Fill list
186
listServlets = new ArrayList JavaDoc();
187         for (int i = 0; i < this.servletsName.length; i++) {
188             listServlets.add(this.servletsName[i]);
189         }
190         Collections.sort(listServlets);
191     }
192
193     public ArrayList JavaDoc getListServlets() {
194         return listServlets;
195     }
196
197     public String JavaDoc getEarPath() {
198         return earPath;
199     }
200
201     public void setEarPath(java.net.URL JavaDoc p_EarUrl) {
202         earPath = null;
203         earFilename = null;
204         if (p_EarUrl != null) {
205             earPath = p_EarUrl.getPath();
206             earFilename = JonasAdminJmx.extractFilename(earPath);
207         }
208     }
209
210     public String JavaDoc getEarFilename() {
211         return earFilename;
212     }
213
214 }
Popular Tags