001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 2005 Bull S.A.
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 8697 2006-06-29 07:53:05Z pelletib $
024: * --------------------------------------------------------------------------
025: */package org.objectweb.jonas_domain.xml;
026:
027: import org.objectweb.jonas_lib.deployment.xml.AbsElement;
028:
029: /**
030: * JOnAS instance
031: * @author danesa
032: *
033: */
034: public class Server extends AbsElement {
035:
036: /**
037: * Version UID
038: */
039: private static final long serialVersionUID = 3775047449169303947L;
040:
041: /**
042: * Instance name
043: */
044: private String name = null;
045:
046: /**
047: * description
048: */
049: private String description = null;
050:
051: /**
052: * URL
053: */
054: private Location location = null;
055:
056: /**
057: * Cluster Daemon
058: */
059: private String clusterDaemon = null;
060:
061: // TO DO
062: // Add state element
063:
064: /**
065: * Constructor
066: */
067: public Server() {
068: super ();
069: }
070:
071: /**
072: * @return Returns the location.
073: */
074: public Location getLocation() {
075: return location;
076: }
077:
078: /**
079: * @param location The location to set.
080: */
081: public void setLocation(Location location) {
082: this .location = location;
083: }
084:
085: /**
086: * @param location The location to set.
087: */
088: public void addLocation(Location location) {
089: this .location = location;
090: }
091:
092: /**
093: * @return Returns the name.
094: */
095: public String getName() {
096: return name;
097: }
098:
099: /**
100: * @param name The name to set.
101: */
102: public void setName(String name) {
103: this .name = name;
104: }
105:
106: /**
107: * @return Returns the description.
108: */
109: public String getDescription() {
110: return description;
111: }
112:
113: /**
114: * @param description The description to set.
115: */
116: public void setDescription(String description) {
117: this .description = description;
118: }
119:
120: /**
121: * Represents this element by it's XML description.
122: * @param indent use this indent for prexifing XML representation.
123: * @return the XML description of this object.
124: */
125: public String toXML(int indent) {
126: StringBuffer sb = new StringBuffer();
127: sb.append(indent(indent));
128: sb.append("<server>\n");
129:
130: indent += 2;
131:
132: // name
133: if (name != null) {
134: sb.append(xmlElement(name, "name", indent));
135: }
136: // description
137: if (getDescription() != null) {
138: sb.append(xmlElement(getDescription(), "description",
139: indent));
140: }
141: // location
142: if (location != null) {
143: sb.append(location.toXML(indent));
144: }
145:
146: // cluster-daemon
147: if (clusterDaemon != null) {
148: sb.append(xmlElement(clusterDaemon, "cluster-daemon",
149: indent));
150: }
151:
152: indent -= 2;
153: sb.append(indent(indent));
154: sb.append("</server>\n");
155:
156: return sb.toString();
157: }
158:
159: /**
160: *
161: * @return the cluster daemon name
162: */
163: public String getClusterDaemon() {
164: return clusterDaemon;
165: }
166:
167: /**
168: * Set the cluster daemon name
169: * @param clusterDaemon name
170: */
171: public void setClusterDaemon(String clusterDaemon) {
172: this.clusterDaemon = clusterDaemon;
173: }
174: }
|