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: ClusterDaemon.java 9305 2006-08-02 09:11:31Z pelletib $
024: * --------------------------------------------------------------------------
025: */package org.objectweb.jonas_clusterd.xml;
026:
027: import org.objectweb.jonas_lib.deployment.xml.AbsDescriptionElement;
028: import org.objectweb.jonas_lib.deployment.xml.JLinkedList;
029: import org.objectweb.jonas_lib.deployment.xml.TopLevelElement;
030:
031: /**
032: * This class defines the configuration of the cluster daemon
033: *
034: * @author Benoit Pelletier
035: */
036: public class ClusterDaemon extends AbsDescriptionElement implements
037: TopLevelElement {
038:
039: /**
040: * Version UID
041: */
042: private static final long serialVersionUID = 3212755715938568244L;
043:
044: /**
045: * name
046: */
047: private String name = null;
048:
049: /**
050: * Domain name
051: */
052: private String domainName = null;
053:
054: /**
055: * JOnAS interaction mode : loosely/tighly coupled
056: */
057: private String jonasInteractionMode = null;
058:
059: /**
060: * servers
061: */
062: private JLinkedList serverList = null;
063:
064: /**
065: * Constructor
066: */
067: public ClusterDaemon() {
068: super ();
069: serverList = new JLinkedList("server");
070: }
071:
072: /**
073: * Add a new server element to this object
074: * @param server the Server object
075: */
076: public void addServer(Server server) {
077: serverList.add(server);
078: }
079:
080: /**
081: * @return Returns the serverList.
082: */
083: public JLinkedList getServerList() {
084: return serverList;
085: }
086:
087: /**
088: * @param serverList The serverList to set.
089: */
090: public void setServerList(JLinkedList serverList) {
091: this .serverList = serverList;
092: }
093:
094: /**
095: * Represents this element by it's XML description.
096: * @param indent use this indent for prexifing XML representation.
097: * @return the XML description of this object.
098: */
099: public String toXML(int indent) {
100: StringBuffer sb = new StringBuffer();
101: sb.append(indent(indent));
102: sb
103: .append("<cluster-daemon> "
104: + "xmlns=\"http://www.objectweb.org/jonas/ns\" "
105: + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
106: + "xsi:schemaLocation=\"http://www.objectweb.org/jonas/ns\" "
107: + "http://www.objectweb.org/jonas/ns/jonas-clusterd_4_8.xsd");
108: indent += 2;
109:
110: // name
111: if (getName() != null) {
112: sb.append(xmlElement(getName(), "name", indent));
113: }
114:
115: // domain-name
116: if (getDomainName() != null) {
117: sb
118: .append(xmlElement(getDomainName(), "domain-name",
119: indent));
120: }
121:
122: // jonas-interaction-mode
123: if (getJonasInteractionMode() != null) {
124: sb.append(xmlElement(getJonasInteractionMode(),
125: "jonas-interaction-mode", indent));
126: }
127:
128: // servers
129: sb.append(getServerList().toXML(indent));
130:
131: indent -= 2;
132: sb.append(indent(indent));
133: sb.append("</cluster-daemon>\n");
134:
135: return sb.toString();
136: }
137:
138: /**
139: *
140: * @return the domain name
141: */
142: public String getDomainName() {
143: return domainName;
144: }
145:
146: /**
147: * set the domain name
148: * @param domainName domain name
149: */
150: public void setDomainName(String domainName) {
151: this .domainName = domainName;
152: }
153:
154: /**
155: *
156: * @return the name
157: */
158: public String getName() {
159: return name;
160: }
161:
162: /**
163: * set the name
164: * @param name name
165: */
166: public void setName(String name) {
167: this .name = name;
168: }
169:
170: /**
171: *
172: * @return the interaction mode with JOnAS
173: */
174: public String getJonasInteractionMode() {
175: return jonasInteractionMode;
176: }
177:
178: /**
179: * set the interaction mode with JOnAS
180: * @param jonasInteraction interaction mode
181: */
182: public void setJonasInteractionMode(String jonasInteractionMode) {
183: this.jonasInteractionMode = jonasInteractionMode;
184: }
185:
186: }
|