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: Florent BENOIT
023: * --------------------------------------------------------------------------
024: * $Id: Connector.java 3673 2003-11-11 20:03:28Z 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 connector
034: *
035: * @author Florent Benoit
036: */
037:
038: public class Connector extends AbsElement implements TopLevelElement {
039:
040: /**
041: * display-name
042: */
043: private String displayName = null;
044:
045: /**
046: * description
047: */
048: private JLinkedList descriptionList = null;
049:
050: /**
051: * icon
052: */
053: private Icon icon = null;
054:
055: /**
056: * vendor-name
057: */
058: private String vendorName = null;
059:
060: /**
061: * spec-version
062: */
063: private String specVersion = null;
064:
065: /**
066: * eis-type
067: */
068: private String eisType = null;
069:
070: /**
071: * version
072: */
073: private String version = null;
074:
075: /**
076: * resourceadapter-version
077: */
078: private String resourceadapterVersion = null;
079:
080: /**
081: * license
082: */
083: private License license = null;
084:
085: /**
086: * resourceadapter
087: */
088: private Resourceadapter resourceadapter = null;
089:
090: /**
091: * Constructor
092: */
093: public Connector() {
094: super ();
095: descriptionList = new JLinkedList("description");
096: }
097:
098: /**
099: * Gets the display-name
100: * @return the display-name
101: */
102: public String getDisplayName() {
103: return displayName;
104: }
105:
106: /**
107: * Set the display-name
108: * @param displayName displayName
109: */
110: public void setDisplayName(String displayName) {
111: this .displayName = displayName;
112: }
113:
114: /**
115: * Gets the description
116: * @return the description
117: */
118: public JLinkedList getDescriptionList() {
119: return descriptionList;
120: }
121:
122: /**
123: * Set the description
124: * @param descriptionList description
125: */
126: public void setDescriptionList(JLinkedList descriptionList) {
127: this .descriptionList = descriptionList;
128: }
129:
130: /**
131: * Add a new description element to this object
132: * @param description the description String
133: */
134: public void addDescription(String description) {
135: descriptionList.add(description);
136: }
137:
138: /**
139: * Gets the icon
140: * @return the icon
141: */
142: public Icon getIcon() {
143: return icon;
144: }
145:
146: /**
147: * Set the icon
148: * @param icon icon
149: */
150: public void setIcon(Icon icon) {
151: this .icon = icon;
152: }
153:
154: /**
155: * Gets the vendor-name
156: * @return the vendor-name
157: */
158: public String getVendorName() {
159: return vendorName;
160: }
161:
162: /**
163: * Set the vendor-name
164: * @param vendorName vendorName
165: */
166: public void setVendorName(String vendorName) {
167: this .vendorName = vendorName;
168: }
169:
170: /**
171: * Gets the spec-version
172: * @return the spec-version
173: */
174: public String getSpecVersion() {
175: return specVersion;
176: }
177:
178: /**
179: * Set the spec-version
180: * @param specVersion specVersion
181: */
182: public void setSpecVersion(String specVersion) {
183: this .specVersion = specVersion;
184: }
185:
186: /**
187: * Gets the eis-type
188: * @return the eis-type
189: */
190: public String getEisType() {
191: return eisType;
192: }
193:
194: /**
195: * Set the eis-type
196: * @param eisType eisType
197: */
198: public void setEisType(String eisType) {
199: this .eisType = eisType;
200: }
201:
202: /**
203: * Gets the version
204: * @return the version
205: */
206: public String getVersion() {
207: return version;
208: }
209:
210: /**
211: * Set the version
212: * @param version version
213: */
214: public void setVersion(String version) {
215: this .version = version;
216: }
217:
218: /**
219: * Gets the resourceadapter-version
220: * @return the resourceadapter-version
221: */
222: public String getResourceadapterVersion() {
223: return resourceadapterVersion;
224: }
225:
226: /**
227: * Set the resourceadapter-version
228: * @param resourceadapterVersion resourceadapterVersion
229: */
230: public void setResourceadapterVersion(String resourceadapterVersion) {
231: this .resourceadapterVersion = resourceadapterVersion;
232: }
233:
234: /**
235: * Gets the license
236: * @return the license
237: */
238: public License getLicense() {
239: return license;
240: }
241:
242: /**
243: * Set the license
244: * @param license license
245: */
246: public void setLicense(License license) {
247: this .license = license;
248: }
249:
250: /**
251: * Gets the resourceadapter
252: * @return the resourceadapter
253: */
254: public Resourceadapter getResourceadapter() {
255: return resourceadapter;
256: }
257:
258: /**
259: * Set the resourceadapter
260: * @param resourceadapter resourceadapter
261: */
262: public void setResourceadapter(Resourceadapter resourceadapter) {
263: this .resourceadapter = resourceadapter;
264: }
265:
266: /**
267: * Represents this element by it's XML description.
268: * @param indent use this indent for prefixing XML representation.
269: * @return the XML description of this object.
270: */
271: public String toXML(int indent) {
272: StringBuffer sb = new StringBuffer();
273: sb.append(indent(indent));
274: sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
275: sb.append("<connector");
276: sb.append(xmlAttribute(specVersion, "version"));
277: sb.append(">\n");
278:
279: indent += 2;
280:
281: // description
282: sb.append(descriptionList.toXML(indent));
283: // display-name
284: sb.append(xmlElement(displayName, "display-name", indent));
285: // icon
286: if (icon != null) {
287: sb.append(icon.toXML(indent));
288: }
289: // vendor-name
290: sb.append(xmlElement(vendorName, "vendor-name", indent));
291: // eis-type
292: sb.append(xmlElement(eisType, "eis-type", indent));
293: // version
294: sb.append(xmlElement(resourceadapterVersion,
295: "resourceadapter-version", indent));
296: // license
297: if (license != null) {
298: sb.append(license.toXML(indent));
299: }
300: // resourceadapter
301: if (resourceadapter != null) {
302: sb.append(resourceadapter.toXML(indent));
303: }
304: indent -= 2;
305: sb.append(indent(indent));
306: sb.append("</connector>\n");
307:
308: return sb.toString();
309: }
310: }
|