001: /*
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: DomainDeployForm.java 9712 2006-10-10 13:42:20Z danesa $
023: * --------------------------------------------------------------------------
024: */
025:
026: package org.objectweb.jonas.webapp.jonasadmin.deploy;
027:
028: import java.util.ArrayList;
029: import java.util.Map;
030: import java.util.TreeMap;
031:
032: import javax.servlet.http.HttpServletRequest;
033:
034: import org.apache.struts.action.ActionErrors;
035: import org.apache.struts.action.ActionForm;
036: import org.apache.struts.action.ActionMapping;
037:
038: /**
039: * @author Patrick Smith
040: * Greg Lapouchnian
041: */
042:
043: public class DomainDeployForm extends ActionForm {
044:
045: // --------------------------------------------------------- Constants
046:
047: public static final String DEPLOY = "deploy";
048: public static final String UPLOAD = "upload";
049: public static final String UPLOADDEPLOY = "uploadDeploy";
050: public static final String UNDEPLOY = "undeploy";
051:
052: // --------------------------------------------------------- Properties variables
053: /**
054: * all the apps available for deployment
055: */
056: private ArrayList listDeployable = new ArrayList();
057: /**
058: * possible targets in the domain (contain corresponding ONs)
059: */
060: private ArrayList listTargets = new ArrayList();
061: /**
062: * possible target names in the domain
063: */
064: private ArrayList listTargetNames = new ArrayList();
065: /**
066: * the apps that were selected by the user to be deployed
067: */
068: private ArrayList listDeploy = new ArrayList();
069: /**
070: * the targets selected by the user
071: */
072: private ArrayList listTargetsSelected = new ArrayList();
073: /**
074: * the names selected by the user
075: */
076: private ArrayList listTargetSelectedNames = new ArrayList();
077:
078: // store the progress report to provide the user with feedback
079: private Map reports = new TreeMap();
080:
081: private String deploy = null;
082:
083: // which deployment option was selected by the user
084: private String selectedOption = null;
085: // should applications with the same name be replaced during upload
086: private boolean replaceOnTarget = false;
087: // should applications be installed in the autoload directory
088: private boolean autoload = false;
089: // apps to deploy
090: private String[] deploySelected = new String[0];
091: /**
092: * all the targets selected by the apply
093: */
094: private String[] targetSelected = new String[0];
095:
096: // has the user confirmed the deployment?
097: private boolean confirm = false;
098: // is there a deployment operation in progress?
099: private boolean deploymentInProgress = false;
100: // is there a deployment completed?
101: private boolean deploymentCompleted = false;
102:
103: // the action to take
104: private String selectedAction = null;
105: // replace on target option
106: private boolean replacementOption = false;
107:
108: // Has an exception occured during this operation.
109: private boolean exception = false;
110:
111: // Is the archive type selected configurable.
112: private boolean isConfigurable;
113:
114: // --------------------------------------------------------- Public Methods
115:
116: /**
117: * Reset all properties to their default values.
118: *
119: * @param mapping The mapping used to select this instance
120: * @param request The servlet request we are processing
121: */
122:
123: public void reset(ActionMapping mapping, HttpServletRequest request) {
124: deploySelected = new String[0];
125: targetSelected = new String[0];
126: setSelectedOption(DEPLOY);
127: replaceOnTarget = false;
128: exception = false;
129: }
130:
131: /**
132: * Validate the properties that have been set from this HTTP request,
133: * and return an <code>ActionErrors</code> object that encapsulates any
134: * validation errors that have been found. If no errors are found, return
135: * <code>null</code> or an <code>ActionErrors</code> object with no
136: * recorded error messages.
137: *
138: * @param mapping The mapping used to select this instance
139: * @param request The servlet request we are processing
140: */
141: public ActionErrors validate(ActionMapping mapping,
142: HttpServletRequest request) {
143: ActionErrors oErrors = new ActionErrors();
144: return oErrors;
145: }
146:
147: public String toString() {
148: StringBuffer sb = new StringBuffer();
149: sb.append(" listDeployable = ").append(listDeployable).append(
150: "\n");
151: sb.append(" listServers = ").append(listTargets).append("\n");
152: sb.append(" listDeploy = ").append(listDeploy).append("\n");
153: sb.append(" listTargetsSelected = ")
154: .append(listTargetsSelected).append("\n");
155: sb.append(" reports = ").append(reports).append("\n");
156: sb.append(" deploySelected = [");
157: for (int i = 0; i < deploySelected.length; i++) {
158: if (i > 0) {
159: sb.append(", ");
160: }
161: sb.append(deploySelected[i]);
162: }
163: sb.append("]\n");
164: sb.append(" serverSelected = [");
165: for (int i = 0; i < targetSelected.length; i++) {
166: if (i > 0) {
167: sb.append(", ");
168: }
169: sb.append(targetSelected[i]);
170: }
171: sb.append("]\n");
172: sb.append(" deploy = ").append(deploy).append("\n");
173: sb.append(" progress = ").append(deploymentInProgress).append(
174: "\n");
175: sb.append(" selectedOption = ").append(selectedOption).append(
176: "\n");
177: sb.append(" replaceOnTarget = ").append(replaceOnTarget)
178: .append("\n");
179: sb.append(" selectedAction = ").append(selectedAction).append(
180: "\n");
181: sb.append(" replacementOption = ").append(replacementOption)
182: .append("\n");
183:
184: return sb.toString();
185: }
186:
187: // --------------------------------------------------------- Properties Methods
188:
189: public ArrayList getListTargets() {
190: return listTargets;
191: }
192:
193: public void setListTargets(ArrayList listTargets) {
194: this .listTargets = listTargets;
195: }
196:
197: public ArrayList getListTargetNames() {
198: return listTargetNames;
199: }
200:
201: public void setListTargetNames(ArrayList listTargetNames) {
202: this .listTargetNames = listTargetNames;
203: }
204:
205: public Map getReports() {
206: return reports;
207: }
208:
209: public void setReports(Map reports) {
210: this .reports = reports;
211: }
212:
213: public ArrayList getListTargetsSelected() {
214: return listTargetsSelected;
215: }
216:
217: public void setListTargetsSelected(ArrayList listTargetsSelected) {
218: this .listTargetsSelected = listTargetsSelected;
219: }
220:
221: public ArrayList getListTargetSelectedNames() {
222: return listTargetSelectedNames;
223: }
224:
225: public void setListTargetSelectedNames(
226: ArrayList listTargetSelectedNames) {
227: this .listTargetSelectedNames = listTargetSelectedNames;
228: }
229:
230: public ArrayList getListDeployable() {
231: return listDeployable;
232: }
233:
234: public void setListDeployable(ArrayList listDeployable) {
235: this .listDeployable = listDeployable;
236: }
237:
238: public String[] getDeploySelected() {
239: return deploySelected;
240: }
241:
242: public void setDeploySelected(String[] deploySelected) {
243: this .deploySelected = deploySelected;
244: }
245:
246: public String[] getTargetSelected() {
247: return targetSelected;
248: }
249:
250: public void setTargetSelected(String[] serverSelected) {
251: this .targetSelected = serverSelected;
252: }
253:
254: public ArrayList getListDeploy() {
255: return listDeploy;
256: }
257:
258: public void setListDeploy(ArrayList listDeploy) {
259: this .listDeploy = listDeploy;
260: }
261:
262: public String getDeploy() {
263: return deploy;
264: }
265:
266: public void setDeploy(String deploy) {
267: this .deploy = deploy;
268: }
269:
270: public boolean isConfirm() {
271: return confirm;
272: }
273:
274: public void setConfirm(boolean confirm) {
275: this .confirm = confirm;
276: }
277:
278: public boolean getDeploymentInProgress() {
279: return deploymentInProgress;
280: }
281:
282: public void setDeploymentInProgress(boolean deploymentInProgress) {
283: this .deploymentInProgress = deploymentInProgress;
284: }
285:
286: public String getSelectedOption() {
287: return this .selectedOption;
288: }
289:
290: public void setSelectedOption(String selectedOption) {
291: this .selectedOption = selectedOption;
292: }
293:
294: public String getSelectedAction() {
295: return this .selectedAction;
296: }
297:
298: public void setSelectedAction(String selectedAction) {
299: this .selectedAction = selectedAction;
300: }
301:
302: public boolean getReplaceOnTarget() {
303: return replaceOnTarget;
304: }
305:
306: public void setReplaceOnTarget(boolean replaceChecked) {
307: this .replaceOnTarget = replaceChecked;
308: }
309:
310: public boolean getReplacementOption() {
311: return replacementOption;
312: }
313:
314: public void setReplacementOption(boolean replacementOption) {
315: this .replacementOption = replacementOption;
316: }
317:
318: public boolean getException() {
319: return exception;
320: }
321:
322: public void setException(boolean exception) {
323: this .exception = exception;
324: }
325:
326: /**
327: * Return if the current deployment type is configurable.
328: * @return if the current deployment type is configurable.
329: */
330: public boolean getIsConfigurable() {
331: return this .isConfigurable;
332: }
333:
334: /**
335: * Sets if the current deployment type is configurable.
336: * @param isDomain if current deployment type is configurable.
337: */
338: public void setIsConfigurable(boolean isConfigurable) {
339: this .isConfigurable = isConfigurable;
340: }
341:
342: public boolean isDeploymentCompleted() {
343: return deploymentCompleted;
344: }
345:
346: public void setDeploymentCompleted(boolean deploymentCompleted) {
347: this .deploymentCompleted = deploymentCompleted;
348: }
349:
350: public boolean isAutoload() {
351: return autoload;
352: }
353:
354: public void setAutoload(boolean autoload) {
355: this.autoload = autoload;
356: }
357:
358: }
|