KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > webapp > jonasadmin > deploy > DomainDeployForm


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: DomainDeployForm.java,v 1.1 2005/07/25 21:03:54 pasmith Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.webapp.jonasadmin.deploy;
27
28 import java.util.ArrayList JavaDoc;
29 import java.util.HashMap JavaDoc;
30 import java.util.Map JavaDoc;
31 import java.util.TreeMap JavaDoc;
32
33 import javax.servlet.http.HttpServletRequest JavaDoc;
34
35 import org.apache.struts.action.ActionErrors;
36 import org.apache.struts.action.ActionForm;
37 import org.apache.struts.action.ActionMapping;
38
39 /**
40  * @author Patrick Smith
41  * Greg Lapouchnian
42  */

43
44 public class DomainDeployForm extends ActionForm {
45
46 // --------------------------------------------------------- Constants
47

48     public static final String JavaDoc DEPLOY = "deploy";
49     public static final String JavaDoc UPLOAD = "upload";
50     public static final String JavaDoc UPLOADDEPLOY = "uploadDeploy";
51
52 // --------------------------------------------------------- Properties variables
53

54
55     // all the apps available for deployment
56
private ArrayList JavaDoc listDeployable = new ArrayList JavaDoc();
57     // all the servers in the domain
58
private ArrayList JavaDoc listServers = new ArrayList JavaDoc();
59     // the actual names of the servers in the domain
60
private ArrayList JavaDoc listServerNames = new ArrayList JavaDoc();
61
62     // the apps that were selected by the user to be deployed
63
private ArrayList JavaDoc listDeploy = new ArrayList JavaDoc();
64     // the target servers selected by the user
65
private ArrayList JavaDoc listTargetServers = new ArrayList JavaDoc();
66     // the names of the servers selected by the user
67
private ArrayList JavaDoc listTargetServerNames = new ArrayList JavaDoc();
68
69     // store the progress report to provide the user with feedback
70
private Map JavaDoc reports = new TreeMap JavaDoc();
71
72     private String JavaDoc deploy = null;
73
74     // which deployment option was selected by the user
75
private String JavaDoc selectedOption = null;
76     // should applications with the same name be replaced during upload
77
private boolean replaceOnTarget = false;
78     // apps to deploy
79
private String JavaDoc[] deploySelected = new String JavaDoc[0];
80     // target servers
81
private String JavaDoc[] serverSelected = new String JavaDoc[0];
82     
83     // has the user confirmed the deployment?
84
private boolean confirm = false;
85     // has the deployment finished?
86
private boolean deploymentComplete = false;
87     // is there a deployment operation in progress?
88
private boolean deploymentInProgress = false;
89
90     // the action to take
91
private String JavaDoc selectedAction = null;
92     // replace on target option
93
private boolean replacementOption = false;
94     
95     // Has an exception occured during this operation.
96
private boolean exception = false;
97
98 // --------------------------------------------------------- Public Methods
99

100     /**
101      * Reset all properties to their default values.
102      *
103      * @param mapping The mapping used to select this instance
104      * @param request The servlet request we are processing
105      */

106
107     public void reset(ActionMapping mapping, HttpServletRequest JavaDoc request) {
108         deploySelected = new String JavaDoc[0];
109         serverSelected = new String JavaDoc[0];
110         setSelectedOption(DEPLOY);
111         replaceOnTarget = false;
112         exception = false;
113     }
114
115     /**
116      * Validate the properties that have been set from this HTTP request,
117      * and return an <code>ActionErrors</code> object that encapsulates any
118      * validation errors that have been found. If no errors are found, return
119      * <code>null</code> or an <code>ActionErrors</code> object with no
120      * recorded error messages.
121      *
122      * @param mapping The mapping used to select this instance
123      * @param request The servlet request we are processing
124      */

125     public ActionErrors validate(ActionMapping mapping, HttpServletRequest JavaDoc request) {
126         ActionErrors oErrors = new ActionErrors();
127         return oErrors;
128     }
129
130     public String JavaDoc toString() {
131         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
132         sb.append(" listDeployable = ").append(listDeployable).append("\n");
133         sb.append(" listServers = ").append(listServers).append("\n");
134         sb.append(" listDeploy = ").append(listDeploy).append("\n");
135         sb.append(" listTargetServers = ").append(listTargetServers).append("\n");
136         sb.append(" reports = ").append(reports).append("\n");
137         sb.append(" deploySelected = [");
138         for (int i = 0; i < deploySelected.length; i++) {
139             if (i > 0) {
140                 sb.append(", ");
141             }
142             sb.append(deploySelected[i]);
143         }
144         sb.append("]\n");
145         sb.append(" serverSelected = [");
146         for (int i = 0; i < serverSelected.length; i++) {
147             if (i > 0) {
148                 sb.append(", ");
149             }
150             sb.append(serverSelected[i]);
151         }
152         sb.append("]\n");
153         sb.append(" deploy = ").append(deploy).append("\n");
154         sb.append(" complete = ").append(deploymentComplete).append("\n");
155         sb.append(" progress = ").append(deploymentInProgress).append("\n");
156         sb.append(" selectedOption = ").append(selectedOption).append("\n");
157         sb.append(" replaceOnTarget = ").append(replaceOnTarget).append("\n");
158         sb.append(" selectedAction = ").append(selectedAction).append("\n");
159         sb.append(" replacementOption = ").append(replacementOption).append("\n");
160
161         return sb.toString();
162     }
163
164 // --------------------------------------------------------- Properties Methods
165

166     public ArrayList JavaDoc getListServers() {
167         return listServers;
168     }
169
170     public void setListServers(ArrayList JavaDoc listServers) {
171         this.listServers = listServers;
172     }
173     
174     public ArrayList JavaDoc getListServerNames() {
175         return listServerNames;
176     }
177
178     public void setListServerNames(ArrayList JavaDoc listServerNames) {
179         this.listServerNames = listServerNames;
180     }
181     
182     public Map JavaDoc getReports() {
183         return reports;
184     }
185
186     public void setReports(Map JavaDoc reports) {
187         this.reports = reports;
188     }
189
190     public ArrayList JavaDoc getListTargetServers() {
191         return listTargetServers;
192     }
193
194     public void setListTargetServers(ArrayList JavaDoc listTargetServers) {
195         this.listTargetServers = listTargetServers;
196     }
197     
198     public ArrayList JavaDoc getListTargetServerNames() {
199         return listTargetServerNames;
200     }
201
202     public void setListTargetServerNames(ArrayList JavaDoc listTargetServerNames) {
203         this.listTargetServerNames = listTargetServerNames;
204     }
205     
206     public ArrayList JavaDoc getListDeployable() {
207         return listDeployable;
208     }
209
210     public void setListDeployable(ArrayList JavaDoc listDeployable) {
211         this.listDeployable = listDeployable;
212     }
213
214     public String JavaDoc[] getDeploySelected() {
215         return deploySelected;
216     }
217
218     public void setDeploySelected(String JavaDoc[] deploySelected) {
219         this.deploySelected = deploySelected;
220     }
221     
222     public String JavaDoc[] getServerSelected() {
223         return serverSelected;
224     }
225     
226     public void setServerSelected(String JavaDoc[] serverSelected) {
227         this.serverSelected = serverSelected;
228     }
229
230     public ArrayList JavaDoc getListDeploy() {
231         return listDeploy;
232     }
233
234     public void setListDeploy(ArrayList JavaDoc listDeploy) {
235         this.listDeploy = listDeploy;
236     }
237
238     public String JavaDoc getDeploy() {
239         return deploy;
240     }
241
242     public void setDeploy(String JavaDoc deploy) {
243         this.deploy = deploy;
244     }
245
246     public boolean isConfirm() {
247         return confirm;
248     }
249
250     public void setConfirm(boolean confirm) {
251         this.confirm = confirm;
252     }
253     
254     public boolean getDeploymentInProgress() {
255         return deploymentInProgress;
256     }
257
258     public void setDeploymentInProgress(boolean deploymentInProgress) {
259         this.deploymentInProgress = deploymentInProgress;
260     }
261     
262     public boolean getDeploymentComplete() {
263         return deploymentComplete;
264     }
265     
266     public void setDeploymentComplete(boolean deploymentComplete) {
267         this.deploymentComplete = deploymentComplete;
268     }
269     
270     public String JavaDoc getSelectedOption() {
271         return this.selectedOption;
272     }
273     
274     public void setSelectedOption(String JavaDoc selectedOption) {
275         this.selectedOption = selectedOption;
276     }
277     
278     public String JavaDoc getSelectedAction() {
279         return this.selectedAction;
280     }
281     
282     public void setSelectedAction(String JavaDoc selectedAction) {
283         this.selectedAction = selectedAction;
284     }
285     
286     public boolean getReplaceOnTarget() {
287         return replaceOnTarget;
288     }
289     
290     public void setReplaceOnTarget(boolean replaceChecked) {
291         this.replaceOnTarget = replaceChecked;
292     }
293     
294     public boolean getReplacementOption() {
295         return replacementOption;
296     }
297     
298     public void setReplacementOption(boolean replacementOption) {
299         this.replacementOption = replacementOption;
300     }
301     
302     public boolean getException() {
303         return exception;
304     }
305     
306     public void setException(boolean exception) {
307         this.exception = exception;
308     }
309 }
310
Popular Tags