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: ConnectionDefinition.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:
031: /**
032: * This class defines the implementation of the element connection-definition
033: *
034: * @author Eric Hardesty
035: */
036:
037: public class ConnectionDefinition extends AbsElement {
038:
039: /**
040: * id
041: */
042: private String id = null;
043:
044: /**
045: * managedconnectionfactory-class
046: */
047: private String managedconnectionfactoryClass = null;
048:
049: /**
050: * config-property
051: */
052: private JLinkedList configPropertyList = null;
053:
054: /**
055: * connectionfactory-interface
056: */
057: private String connectionfactoryInterface = null;
058:
059: /**
060: * connectionfactory-impl-class
061: */
062: private String connectionfactoryImplClass = null;
063:
064: /**
065: * connection-interface
066: */
067: private String connectionInterface = null;
068:
069: /**
070: * connection-impl-class
071: */
072: private String connectionImplClass = null;
073:
074: /**
075: * Constructor
076: */
077: public ConnectionDefinition() {
078: super ();
079: configPropertyList = new JLinkedList("config-property");
080: }
081:
082: /**
083: * Gets the id
084: * @return the id
085: */
086: public String getId() {
087: return id;
088: }
089:
090: /**
091: * Set the id
092: * @param id id object
093: */
094: public void setId(String id) {
095: this .id = id;
096: }
097:
098: /**
099: * Gets the managedconnectionfactory-class
100: * @return the managedconnectionfactory-class
101: */
102: public String getManagedconnectionfactoryClass() {
103: return managedconnectionfactoryClass;
104: }
105:
106: /**
107: * Set the managedconnectionfactory-class
108: * @param managedconnectionfactoryClass managedconnectionfactoryClass
109: */
110: public void setManagedconnectionfactoryClass(
111: String managedconnectionfactoryClass) {
112: this .managedconnectionfactoryClass = managedconnectionfactoryClass;
113: }
114:
115: /**
116: * Gets the config-property
117: * @return the config-property
118: */
119: public JLinkedList getConfigPropertyList() {
120: return configPropertyList;
121: }
122:
123: /**
124: * Set the config-property
125: * @param configPropertyList configProperty
126: */
127: public void setConfigPropertyList(JLinkedList configPropertyList) {
128: this .configPropertyList = configPropertyList;
129: }
130:
131: /**
132: * Add a new config-property element to this object
133: * @param configProperty the configPropertyobject
134: */
135: public void addConfigProperty(ConfigProperty configProperty) {
136: configPropertyList.add(configProperty);
137: }
138:
139: /**
140: * Gets the connectionfactory-interface
141: * @return the connectionfactory-interface
142: */
143: public String getConnectionfactoryInterface() {
144: return connectionfactoryInterface;
145: }
146:
147: /**
148: * Set the connectionfactory-interface
149: * @param connectionfactoryInterface connectionfactoryInterface
150: */
151: public void setConnectionfactoryInterface(
152: String connectionfactoryInterface) {
153: this .connectionfactoryInterface = connectionfactoryInterface;
154: }
155:
156: /**
157: * Gets the connectionfactory-impl-class
158: * @return the connectionfactory-impl-class
159: */
160: public String getConnectionfactoryImplClass() {
161: return connectionfactoryImplClass;
162: }
163:
164: /**
165: * Set the connectionfactory-impl-class
166: * @param connectionfactoryImplClass connectionfactoryImplClass
167: */
168: public void setConnectionfactoryImplClass(
169: String connectionfactoryImplClass) {
170: this .connectionfactoryImplClass = connectionfactoryImplClass;
171: }
172:
173: /**
174: * Gets the connection-interface
175: * @return the connection-interface
176: */
177: public String getConnectionInterface() {
178: return connectionInterface;
179: }
180:
181: /**
182: * Set the connection-interface
183: * @param connectionInterface connectionInterface
184: */
185: public void setConnectionInterface(String connectionInterface) {
186: this .connectionInterface = connectionInterface;
187: }
188:
189: /**
190: * Gets the connection-impl-class
191: * @return the connection-impl-class
192: */
193: public String getConnectionImplClass() {
194: return connectionImplClass;
195: }
196:
197: /**
198: * Set the connection-impl-class
199: * @param connectionImplClass connectionImplClass
200: */
201: public void setConnectionImplClass(String connectionImplClass) {
202: this .connectionImplClass = connectionImplClass;
203: }
204:
205: /**
206: * Represents this element by it's XML description.
207: * @param indent use this indent for prefixing XML representation.
208: * @return the XML description of this object.
209: */
210: public String toXML(int indent) {
211: StringBuffer sb = new StringBuffer();
212: sb.append(indent(indent));
213: sb.append("<connection-definition");
214: sb.append(xmlAttribute(id, "id"));
215: sb.append(">\n");
216:
217: indent += 2;
218:
219: // managedconnectionfactory-class
220: sb.append(xmlElement(managedconnectionfactoryClass,
221: "managedconnectionfactory-class", indent));
222: // config-property
223: sb.append(configPropertyList.toXML(indent));
224: // connectionfactory-interface
225: sb.append(xmlElement(connectionfactoryInterface,
226: "connectionfactory-interface", indent));
227: // connectionfactory-impl-class
228: sb.append(xmlElement(connectionfactoryImplClass,
229: "connectionfactory-impl-class", indent));
230: // connection-interface
231: sb.append(xmlElement(connectionInterface,
232: "connection-interface", indent));
233: // connection-impl-class
234: sb.append(xmlElement(connectionImplClass,
235: "connection-impl-class", indent));
236: indent -= 2;
237: sb.append(indent(indent));
238: sb.append("</connection-definition>\n");
239:
240: return sb.toString();
241: }
242: }
|