KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_rar > deployment > xml > ConnectionDefinition


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  *
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or 1any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20  * USA
21  *
22  * Initial developer: Eric Hardesty
23  * --------------------------------------------------------------------------
24  * $Id: ConnectionDefinition.java,v 1.1 2003/11/11 20:03:28 ehardesty Exp $
25  * --------------------------------------------------------------------------
26  */

27 package org.objectweb.jonas_rar.deployment.xml;
28
29 import org.objectweb.jonas_lib.deployment.xml.AbsElement;
30 import org.objectweb.jonas_lib.deployment.xml.JLinkedList;
31 /**
32  * This class defines the implementation of the element connection-definition
33  *
34  * @author Eric Hardesty
35  */

36
37 public class ConnectionDefinition extends AbsElement {
38
39     /**
40      * id
41      */

42     private String JavaDoc id = null;
43
44     /**
45      * managedconnectionfactory-class
46      */

47     private String JavaDoc managedconnectionfactoryClass = null;
48
49     /**
50      * config-property
51      */

52     private JLinkedList configPropertyList = null;
53
54     /**
55      * connectionfactory-interface
56      */

57     private String JavaDoc connectionfactoryInterface = null;
58
59     /**
60      * connectionfactory-impl-class
61      */

62     private String JavaDoc connectionfactoryImplClass = null;
63
64     /**
65      * connection-interface
66      */

67     private String JavaDoc connectionInterface = null;
68
69     /**
70      * connection-impl-class
71      */

72     private String JavaDoc connectionImplClass = null;
73
74
75     /**
76      * Constructor
77      */

78     public ConnectionDefinition() {
79         super();
80         configPropertyList = new JLinkedList("config-property");
81     }
82
83     /**
84      * Gets the id
85      * @return the id
86      */

87     public String JavaDoc getId() {
88         return id;
89     }
90
91     /**
92      * Set the id
93      * @param id id object
94      */

95     public void setId(String JavaDoc id) {
96         this.id = id;
97     }
98
99     /**
100      * Gets the managedconnectionfactory-class
101      * @return the managedconnectionfactory-class
102      */

103     public String JavaDoc getManagedconnectionfactoryClass() {
104         return managedconnectionfactoryClass;
105     }
106
107     /**
108      * Set the managedconnectionfactory-class
109      * @param managedconnectionfactoryClass managedconnectionfactoryClass
110      */

111     public void setManagedconnectionfactoryClass(String JavaDoc 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 JavaDoc getConnectionfactoryInterface() {
144         return connectionfactoryInterface;
145     }
146
147     /**
148      * Set the connectionfactory-interface
149      * @param connectionfactoryInterface connectionfactoryInterface
150      */

151     public void setConnectionfactoryInterface(String JavaDoc connectionfactoryInterface) {
152         this.connectionfactoryInterface = connectionfactoryInterface;
153     }
154
155     /**
156      * Gets the connectionfactory-impl-class
157      * @return the connectionfactory-impl-class
158      */

159     public String JavaDoc getConnectionfactoryImplClass() {
160         return connectionfactoryImplClass;
161     }
162
163     /**
164      * Set the connectionfactory-impl-class
165      * @param connectionfactoryImplClass connectionfactoryImplClass
166      */

167     public void setConnectionfactoryImplClass(String JavaDoc connectionfactoryImplClass) {
168         this.connectionfactoryImplClass = connectionfactoryImplClass;
169     }
170
171     /**
172      * Gets the connection-interface
173      * @return the connection-interface
174      */

175     public String JavaDoc getConnectionInterface() {
176         return connectionInterface;
177     }
178
179     /**
180      * Set the connection-interface
181      * @param connectionInterface connectionInterface
182      */

183     public void setConnectionInterface(String JavaDoc connectionInterface) {
184         this.connectionInterface = connectionInterface;
185     }
186
187     /**
188      * Gets the connection-impl-class
189      * @return the connection-impl-class
190      */

191     public String JavaDoc getConnectionImplClass() {
192         return connectionImplClass;
193     }
194
195     /**
196      * Set the connection-impl-class
197      * @param connectionImplClass connectionImplClass
198      */

199     public void setConnectionImplClass(String JavaDoc connectionImplClass) {
200         this.connectionImplClass = connectionImplClass;
201     }
202
203
204     /**
205      * Represents this element by it's XML description.
206      * @param indent use this indent for prefixing XML representation.
207      * @return the XML description of this object.
208      */

209     public String JavaDoc toXML(int indent) {
210         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
211         sb.append(indent(indent));
212         sb.append("<connection-definition");
213         sb.append(xmlAttribute(id, "id"));
214         sb.append(">\n");
215
216         indent += 2;
217
218         // managedconnectionfactory-class
219
sb.append(xmlElement(managedconnectionfactoryClass, "managedconnectionfactory-class", indent));
220         // config-property
221
sb.append(configPropertyList.toXML(indent));
222         // connectionfactory-interface
223
sb.append(xmlElement(connectionfactoryInterface, "connectionfactory-interface", indent));
224         // connectionfactory-impl-class
225
sb.append(xmlElement(connectionfactoryImplClass, "connectionfactory-impl-class", indent));
226         // connection-interface
227
sb.append(xmlElement(connectionInterface, "connection-interface", indent));
228         // connection-impl-class
229
sb.append(xmlElement(connectionImplClass, "connection-impl-class", indent));
230         indent -= 2;
231         sb.append(indent(indent));
232         sb.append("</connection-definition>\n");
233
234         return sb.toString();
235     }
236 }
237
Popular Tags