001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 2003-2005 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: NewServerForm.java 9455 2006-08-24 12:34:22Z danesa $
023: * --------------------------------------------------------------------------
024: */package org.objectweb.jonas.webapp.jonasadmin.domain;
025:
026: import javax.servlet.http.HttpServletRequest;
027:
028: import org.apache.struts.action.ActionErrors;
029: import org.apache.struts.action.ActionForm;
030: import org.apache.struts.action.ActionMapping;
031: import org.apache.struts.action.ActionMessage;
032:
033: /**
034: * @author Adriana Danes
035: */
036:
037: public final class NewServerForm extends ActionForm {
038:
039: // ----------------------------------------------------- Properties Variables
040:
041: private boolean isCluster = false;
042: // Used when a new server is to be add to the domain
043: private String serverName = null;
044: private String serverURL = null;
045: private String serverCld = null;
046: // Used when a new server is to be add to a cluster
047: private String[] serverNames = null;
048: private String[] selectedItems = new String[0];
049:
050: // --------------------------------------------------------- Public Methods
051:
052: public void reset(ActionMapping mapping, HttpServletRequest request) {
053: super .reset(mapping, request);
054: }
055:
056: public ActionErrors validate(ActionMapping mapping,
057: HttpServletRequest request) {
058: ActionErrors oErrors = new ActionErrors();
059: if (!isCluster) {
060: if ((serverName == null) || (serverName.length() < 1)) {
061: oErrors.add("serverName", new ActionMessage(
062: "error.logger.domain.servername.required"));
063: }
064: if ((serverURL == null) || (serverURL.length() < 1)) {
065: oErrors.add("serverURL", new ActionMessage(
066: "error.logger.domain.serverurl.required"));
067: }
068: }
069: return oErrors;
070: }
071:
072: // ------------------------------------------------------------- Properties Methods
073:
074: /**
075: * @return Returns the serverName.
076: */
077: public String getServerName() {
078: return serverName;
079: }
080:
081: /**
082: * @param serverName The serverName to set.
083: */
084: public void setServerName(String serverName) {
085: this .serverName = serverName;
086: }
087:
088: /**
089: * @return Returns the serverURL.
090: */
091: public String getServerURL() {
092: return serverURL;
093: }
094:
095: /**
096: * @param serverURL The serverURL to set.
097: */
098: public void setServerURL(String serverURL) {
099: this .serverURL = serverURL;
100: }
101:
102: /**
103: * @return the name of server's cluster daemon
104: */
105: public String getServerCld() {
106: return serverCld;
107: }
108:
109: /**
110: * @param serverCld The server cluster daemon name to set.
111: */
112: public void setServerCld(String serverCld) {
113: this .serverCld = serverCld;
114: }
115:
116: public boolean isCluster() {
117: return isCluster;
118: }
119:
120: public void setCluster(boolean isCluster) {
121: this .isCluster = isCluster;
122: }
123:
124: public String[] getServerNames() {
125: return serverNames;
126: }
127:
128: public void setServerNames(String[] serverNames) {
129: this .serverNames = serverNames;
130: }
131:
132: public String[] getSelectedItems() {
133: return selectedItems;
134: }
135:
136: public void setSelectedItems(String[] selectedItems) {
137: this.selectedItems = selectedItems;
138: }
139:
140: }
|