KickJava   Java API By Example, From Geeks To Geeks.

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


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: EarForm.java,v 1.12 2005/07/08 09:45:06 kemlerp Exp $
23  * --------------------------------------------------------------------------
24  */

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

44 public class EarForm extends ActionForm {
45
46 // --------------------------------------------------------- Properties variables
47

48     /**
49      * Name of the file containing the ear
50      */

51     private String JavaDoc filename = null;
52     /**
53      * Complete path of the file containing the ear
54      */

55     private String JavaDoc earPath = null;
56     /**
57      * The ear's deployement descriptor
58      */

59     private String JavaDoc xmlDeploymentDescriptor = null;
60 // /**
61
// * List of ContainerItems correspondig to the rars contained in the ear.
62
// */
63
// private ArrayList listRars = new ArrayList();
64
/**
65      * List of ModuleItems corresponding to the ejb-jars (EJBModules) contained in the ear.
66      */

67     private ArrayList JavaDoc ejbjars = new ArrayList JavaDoc();
68     /**
69      * List of ModuleItems corresponding to the wars (WebModules) contained in the ear.
70      */

71     private ArrayList JavaDoc wars = new ArrayList JavaDoc();
72     /**
73      * List of ModuleItems corresponding to the rars contained in the ear.
74      */

75     private ArrayList JavaDoc rars = new ArrayList JavaDoc();
76
77 // --------------------------------------------------------- Public Methods
78

79     /**
80      * Reset all properties to their default values.
81      *
82      * @param mapping The mapping used to select this instance
83      * @param request The servlet request we are processing
84      */

85
86     public void reset(ActionMapping mapping, HttpServletRequest JavaDoc request) {
87         filename = null;
88         earPath = null;
89         xmlDeploymentDescriptor = null;
90 // listRars = new ArrayList();
91
ejbjars = new ArrayList JavaDoc();
92         wars = new ArrayList JavaDoc();
93         rars = new ArrayList JavaDoc();
94     }
95
96     /**
97      * Validate the properties that have been set from this HTTP request,
98      * and return an <code>ActionErrors</code> object that encapsulates any
99      * validation errors that have been found. If no errors are found, return
100      * <code>null</code> or an <code>ActionErrors</code> object with no
101      * recorded error messages.
102      *
103      * @param mapping The mapping used to select this instance
104      * @param request The servlet request we are processing
105      * @return the ActionErrors
106      */

107     public ActionErrors validate(ActionMapping mapping, HttpServletRequest JavaDoc request) {
108         ActionErrors oErrors = new ActionErrors();
109         return oErrors;
110     }
111
112 // --------------------------------------------------------- Properties Methods
113
/**
114      * @return the name of the file containing the ear
115      */

116     public String JavaDoc getFilename() {
117         return filename;
118     }
119     /**
120      * @param filename the name of the file containing the ear
121      */

122     public void setFilename(String JavaDoc filename) {
123         this.filename = filename;
124     }
125
126     /**
127      * @return the complete path of the file containing the ear
128      */

129     public String JavaDoc getEarPath() {
130         return earPath;
131     }
132
133     /**
134      * @param pUrl the ear's URL
135      */

136     public void setEarPath(URL JavaDoc pUrl) {
137         this.earPath = null;
138         if (pUrl != null) {
139             this.earPath = pUrl.getPath();
140         }
141     }
142
143 // /**
144
// * @return the list of ContainerItems correspondig to the rars contained in the ear.
145
// */
146
// public ArrayList getListRars() {
147
// return listRars;
148
// }
149
// /**
150
// * Set list of rars given an array of <code>URL</code>s corresponding to each rar.
151
// * Each item of list is a <code>ContainerItem</code> containing 2 attributes:
152
// * - file
153
// * - path
154
// *
155
// * @param pUrl Array of Rar
156
// */
157
// public void setListRars(URL[] pUrl) {
158
// listRars.clear();
159
// if (pUrl != null) {
160
// for (int i = 0; i < pUrl.length; i++) {
161
// listRars.add(new ContainerItem(JonasAdminJmx.extractFilename(pUrl[i].getPath())
162
// , pUrl[i].getPath()));
163
// }
164
// // Sort list
165
// Collections.sort(listRars, new ContainerItemByFile());
166
// }
167
// }
168
/**
169      * @return the ear's deployement descriptor
170      */

171     public String JavaDoc getXmlDeploymentDescriptor() {
172         return xmlDeploymentDescriptor;
173     }
174
175     /**
176      * @param xmlDeploymentDescriptor The ear's deployement descriptor
177      */

178     public void setXmlDeploymentDescriptor(String JavaDoc xmlDeploymentDescriptor) {
179         this.xmlDeploymentDescriptor = xmlDeploymentDescriptor;
180     }
181     /**
182      * @return The list of ModuleItems corresponding to the ejb-jars (EJBModules) contained in the ear.
183      */

184     public ArrayList JavaDoc getEjbjars() {
185         return ejbjars;
186     }
187     /**
188      * @param ejbjars The list of ModuleItems corresponding to the ejb-jars (EJBModules) contained in the ear.
189      */

190     public void setEjbjars(ArrayList JavaDoc ejbjars) {
191         this.ejbjars = ejbjars;
192     }
193     /**
194      * @return The list of ModuleItems corresponding to the wars (WebModules) contained in the ear.
195      */

196     public ArrayList JavaDoc getWars() {
197         return wars;
198     }
199     /**
200      * @param wars The list of ModuleItems corresponding to the wars (WebModules) contained in the ear.
201      */

202     public void setWars(ArrayList JavaDoc wars) {
203         this.wars = wars;
204         Collections.sort(wars, new ModuleItemByName());
205     }
206
207     /**
208      * @return Returns the rars.
209      */

210     public ArrayList JavaDoc getRars() {
211         return rars;
212     }
213
214
215     /**
216      * @param rars The rars to set.
217      */

218     public void setRars(ArrayList JavaDoc rars) {
219         this.rars = rars;
220     }
221
222 }
223
Popular Tags