001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 2006 Bull S.A.S.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: *
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or 1any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this library; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
020: * USA
021: *
022: * --------------------------------------------------------------------------
023: * $Id: Server.java 8694 2006-06-28 15:19:31Z pelletib $
024: * --------------------------------------------------------------------------
025: */package org.objectweb.jonas_clusterd.xml;
026:
027: import org.objectweb.jonas_lib.deployment.xml.AbsElement;
028:
029: /**
030: *
031: * Server element
032: * @author pelletib
033: */
034: public class Server extends AbsElement {
035:
036: /**
037: * Version UID
038: */
039: private static final long serialVersionUID = -7044912860997997046L;
040:
041: /**
042: * JOnAS instance name
043: */
044: private String name = null;
045:
046: /**
047: * description
048: */
049: private String description = null;
050:
051: /**
052: * JAVA_HOME directory
053: */
054: private String javaHome = null;
055:
056: /**
057: * JONAS_ROOT directory
058: */
059: private String jonasRoot = null;
060:
061: /**
062: * JONAS_BASE directory
063: */
064: private String jonasBase = null;
065:
066: /**
067: * Extra parameters for starting the JVM
068: */
069: private String xprm = null;
070:
071: /**
072: * Automatic boot
073: */
074: private String autoBoot = null;
075:
076: /**
077: * Constructor
078: */
079: public Server() {
080: super ();
081: }
082:
083: /**
084: * @return Returns the name.
085: */
086: public String getName() {
087: return name;
088: }
089:
090: /**
091: * @param name The name to set.
092: */
093: public void setName(String name) {
094: this .name = name;
095: }
096:
097: /**
098: * @return Returns the JAVA_HOME dir.
099: */
100: public String getJavaHome() {
101: return javaHome;
102: }
103:
104: /**
105: * @param javaHome The JAVA_HOME to set.
106: */
107: public void setJavaHome(String javaHome) {
108: this .javaHome = javaHome;
109: }
110:
111: /**
112: * @return Returns the JONAS_ROOT.
113: */
114: public String getJonasRoot() {
115: return jonasRoot;
116: }
117:
118: /**
119: * @param jonasRoot The JONAS_ROOT to set.
120: */
121: public void setJonasRoot(String jonasRoot) {
122: this .jonasRoot = jonasRoot;
123: }
124:
125: /**
126: * @return Returns the JONAS_BASE.
127: */
128: public String getJonasBase() {
129: return jonasBase;
130: }
131:
132: /**
133: * @param jonasBase The JONAS_BASE to set.
134: */
135: public void setJonasBase(String jonasBase) {
136: this .jonasBase = jonasBase;
137: }
138:
139: /**
140: * @return Returns the description.
141: */
142: public String getDescription() {
143: return description;
144: }
145:
146: /**
147: * @param description The description to set.
148: */
149: public void setDescription(String description) {
150: this .description = description;
151: }
152:
153: /**
154: * Represents this element by it's XML description.
155: * @param indent use this indent for prexifing XML representation.
156: * @return the XML description of this object.
157: */
158: public String toXML(int indent) {
159: StringBuffer sb = new StringBuffer();
160: sb.append(indent(indent));
161: sb.append("<server>\n");
162:
163: indent += 2;
164:
165: // name
166: if (name != null) {
167: sb.append(xmlElement(name, "name", indent));
168: }
169: // description
170: if (getDescription() != null) {
171: sb.append(xmlElement(getDescription(), "description",
172: indent));
173: }
174: // javaHome
175: if (getJavaHome() != null) {
176: sb.append(xmlElement(getJavaHome(), "java-home", indent));
177: }
178: // jonasRoot
179: if (getJonasRoot() != null) {
180: sb.append(xmlElement(getJonasRoot(), "jonas-root", indent));
181: }
182: // jonasBase
183: if (getJonasBase() != null) {
184: sb.append(xmlElement(getJonasBase(), "jonas-base", indent));
185: }
186:
187: // xprm
188: if (getXprm() != null) {
189: sb.append(xmlElement(getXprm(), "xprm", indent));
190: }
191:
192: // autoBoot
193: sb.append(xmlElement(new Boolean(isAutoBoot()).toString(),
194: "auto-boot", indent));
195:
196: indent -= 2;
197: sb.append(indent(indent));
198: sb.append("</server>\n");
199:
200: return sb.toString();
201: }
202:
203: /**
204: * Set the auto boot for the server
205: * @param autoBoot true if automatic boot is set
206: */
207: public void setAutoBoot(String autoBoot) {
208: this .autoBoot = autoBoot;
209: }
210:
211: /**
212: * @return true/false
213: */
214: public String getAutoBoot() {
215: return this .autoBoot;
216: }
217:
218: /**
219: *
220: * @return true if the auto boot is set
221: */
222: public boolean isAutoBoot() {
223: return new Boolean(getAutoBoot()).booleanValue();
224: }
225:
226: /**
227: *
228: * @return the extra parameters
229: */
230: public String getXprm() {
231: return xprm;
232: }
233:
234: /**
235: * Set the extra parameters
236: * @param xprm extra parameters
237: */
238: public void setXprm(String xprm) {
239: this.xprm = xprm;
240: }
241: }
|