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: *
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: * Initial developer: Eric Hardesty
023: * --------------------------------------------------------------------------
024: * $Id: JonasAdminobject.java 4397 2004-03-18 06:28:09Z ehardesty $
025: * --------------------------------------------------------------------------
026: */package org.objectweb.jonas_rar.deployment.xml;
027:
028: import org.objectweb.jonas_lib.deployment.xml.AbsElement;
029: import org.objectweb.jonas_lib.deployment.xml.JLinkedList;
030: import org.objectweb.jonas_lib.deployment.xml.TopLevelElement;
031:
032: /**
033: * This class defines the implementation of the element jonas-adminobject
034: *
035: * @author Eric Hardesty
036: */
037:
038: public class JonasAdminobject extends AbsElement implements
039: TopLevelElement {
040:
041: /**
042: * id
043: */
044: private String id = null;
045:
046: /**
047: * description
048: */
049: private JLinkedList descriptionList = null;
050:
051: /**
052: * jndiname
053: */
054: private String jndiName = null;
055:
056: /**
057: * jonas-config-property
058: */
059: private JLinkedList jonasConfigPropertyList = null;
060:
061: /**
062: * Constructor
063: */
064: public JonasAdminobject() {
065: super ();
066: descriptionList = new JLinkedList("description");
067: jonasConfigPropertyList = new JLinkedList(
068: "jonas-config-property");
069: }
070:
071: /**
072: * Gets the id
073: * @return the id
074: */
075: public String getId() {
076: return id;
077: }
078:
079: /**
080: * Set the id
081: * @param id id
082: */
083: public void setId(String id) {
084: this .id = id;
085: }
086:
087: /**
088: * Gets the description
089: * @return the description
090: */
091: public JLinkedList getDescriptionList() {
092: return descriptionList;
093: }
094:
095: /**
096: * Set the description
097: * @param descriptionList description
098: */
099: public void setDescriptionList(JLinkedList descriptionList) {
100: this .descriptionList = descriptionList;
101: }
102:
103: /**
104: * Add a new description element to this object
105: * @param description the description String
106: */
107: public void addDescription(String description) {
108: descriptionList.add(description);
109: }
110:
111: /**
112: * Gets the jndiName
113: * @return the jndiname
114: */
115: public String getJndiName() {
116: return jndiName;
117: }
118:
119: /**
120: * Set the jndiname
121: * @param jndiName jndiname
122: */
123: public void setJndiName(String jndiName) {
124: this .jndiName = jndiName;
125: }
126:
127: /**
128: * Gets the jonas-config-property
129: * @return the jonas-config-property
130: */
131: public JLinkedList getJonasConfigPropertyList() {
132: return jonasConfigPropertyList;
133: }
134:
135: /**
136: * Set the jonas-config-property
137: * @param jonasConfigPropertyList jonasConfigProperty
138: */
139: public void setJonasConfigPropertyList(
140: JLinkedList jonasConfigPropertyList) {
141: this .jonasConfigPropertyList = jonasConfigPropertyList;
142: }
143:
144: /**
145: * Add a new jonas-config-property element to this object
146: * @param jonasConfigProperty the jonasConfigPropertyobject
147: */
148: public void addJonasConfigProperty(
149: JonasConfigProperty jonasConfigProperty) {
150: jonasConfigPropertyList.add(jonasConfigProperty);
151: }
152:
153: /**
154: * Represents this element by it's XML description.
155: * @param indent use this indent for prefixing 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("<jonas-adminobject>\n");
162:
163: indent += 2;
164:
165: // id
166: sb.append(xmlElement(id, "id", indent));
167: // description
168: sb.append(descriptionList.toXML(indent));
169: // jndiname
170: sb.append(xmlElement(jndiName, "jndi-name", indent));
171: // jonas-config-property
172: if (jonasConfigPropertyList != null) {
173: sb.append(jonasConfigPropertyList.toXML(indent));
174: }
175: indent -= 2;
176: sb.append(indent(indent));
177: sb.append("</jonas-adminobject>\n");
178:
179: return sb.toString();
180: }
181: }
|