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: JonasConnector.java 7467 2005-10-04 12:53:14Z sauthieg $
025: * --------------------------------------------------------------------------
026: */package org.objectweb.jonas_rar.deployment.xml;
027:
028: import javax.mail.Header;
029:
030: import org.objectweb.jonas_lib.deployment.xml.AbsElement;
031: import org.objectweb.jonas_lib.deployment.xml.JLinkedList;
032: import org.objectweb.jonas_lib.deployment.xml.TopLevelElement;
033:
034: import org.objectweb.jonas_rar.deployment.api.JonasConnectorSchemas;
035:
036: /**
037: * This class defines the implementation of the element jonas-resource
038: *
039: * @author Florent Benoit
040: */
041:
042: public class JonasConnector extends AbsElement implements
043: TopLevelElement {
044:
045: /**
046: * jndi-name
047: */
048: private String jndiName = null;
049:
050: /**
051: * rarlink
052: */
053: private String rarlink = null;
054:
055: /**
056: * native-lib
057: */
058: private String nativeLib = null;
059:
060: /**
061: * log-enabled
062: */
063: private String logEnabled = null;
064:
065: /**
066: * log-topic
067: */
068: private String logTopic = null;
069:
070: /**
071: * pool-params
072: */
073: private PoolParams poolParams = null;
074:
075: /**
076: * jdbc-conn-params
077: */
078: private JdbcConnParams jdbcConnParams = null;
079:
080: /**
081: * tm-params
082: */
083: private TmParams tmParams = null;
084:
085: /**
086: * jonas-config-property
087: */
088: private JLinkedList jonasConfigPropertyList = null;
089:
090: /**
091: * jonas-connection-definition
092: */
093: private JLinkedList jonasConnectionDefinitionList = null;
094:
095: /**
096: * jonas-activationspec
097: */
098: private JLinkedList jonasActivationspecList = null;
099:
100: /**
101: * jonas-adminobject
102: */
103: private JLinkedList jonasAdminobjectList = null;
104:
105: /**
106: * jonas-security-mapping
107: */
108: private JonasSecurityMapping jonasSecurityMapping = null;
109:
110: /**
111: * jonas-connector element XML header
112: */
113: public static final String JONAS_RA_ROOT_ELEMENT = "<?xml version=\"1.0\"?>"
114: + "<jonas-connector xmlns=\"http://www.objectweb.org/jonas/ns\"\n"
115: + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
116: + " xsi:schemaLocation=\"http://www.objectweb.org/jonas/ns\n"
117: + " http://www.objectweb.org/jonas/ns/"
118: + JonasConnectorSchemas.getLastSchema() + "\">\n";
119:
120: /**
121: * Constructor
122: */
123: public JonasConnector() {
124: super ();
125: jonasConfigPropertyList = new JLinkedList(
126: "jonas-config-property");
127: jonasConnectionDefinitionList = new JLinkedList(
128: "jonas-connection-definition");
129: jonasActivationspecList = new JLinkedList(
130: "jonas-activationspec");
131: jonasAdminobjectList = new JLinkedList("jonas-adminobject");
132: }
133:
134: /**
135: * Gets the jndiname
136: * @return the jndiname
137: */
138: public String getJndiName() {
139: return jndiName;
140: }
141:
142: /**
143: * Set the jndi-name
144: * @param jndiName jndi-name
145: */
146: public void setJndiName(String jndiName) {
147: this .jndiName = jndiName;
148: }
149:
150: /**
151: * Gets the rarlink
152: * @return the rarlink
153: */
154: public String getRarlink() {
155: return rarlink;
156: }
157:
158: /**
159: * Set the rarlink
160: * @param rarlink rarlink
161: */
162: public void setRarlink(String rarlink) {
163: this .rarlink = rarlink;
164: }
165:
166: /**
167: * Gets the native-lib
168: * @return the native-lib
169: */
170: public String getNativeLib() {
171: return nativeLib;
172: }
173:
174: /**
175: * Set the native-lib
176: * @param nativeLib nativeLib
177: */
178: public void setNativeLib(String nativeLib) {
179: this .nativeLib = nativeLib;
180: }
181:
182: /**
183: * Gets the log-enabled
184: * @return the log-enabled
185: */
186: public String getLogEnabled() {
187: return logEnabled;
188: }
189:
190: /**
191: * Set the log-enabled
192: * @param logEnabled logEnabled
193: */
194: public void setLogEnabled(String logEnabled) {
195: this .logEnabled = logEnabled;
196: }
197:
198: /**
199: * Gets the log-topic
200: * @return the log-topic
201: */
202: public String getLogTopic() {
203: return logTopic;
204: }
205:
206: /**
207: * Set the log-topic
208: * @param logTopic logTopic
209: */
210: public void setLogTopic(String logTopic) {
211: this .logTopic = logTopic;
212: }
213:
214: /**
215: * Gets the pool-params
216: * @return the pool-params
217: */
218: public PoolParams getPoolParams() {
219: return poolParams;
220: }
221:
222: /**
223: * Set the pool-params
224: * @param poolParams poolParams
225: */
226: public void setPoolParams(PoolParams poolParams) {
227: this .poolParams = poolParams;
228: }
229:
230: /**
231: * Gets the jdbc-conn-params
232: * @return the jdbc-conn-params
233: */
234: public JdbcConnParams getJdbcConnParams() {
235: return jdbcConnParams;
236: }
237:
238: /**
239: * Set the jdbc-conn-params
240: * @param jdbcConnParams jdbcConnParams
241: */
242: public void setJdbcConnParams(JdbcConnParams jdbcConnParams) {
243: this .jdbcConnParams = jdbcConnParams;
244: }
245:
246: /**
247: * Gets the jonas-config-property
248: * @return the jonas-config-property
249: */
250: public JLinkedList getJonasConfigPropertyList() {
251: return jonasConfigPropertyList;
252: }
253:
254: /**
255: * Set the jonas-config-property
256: * @param jonasConfigPropertyList jonasConfigProperty
257: */
258: public void setJonasConfigPropertyList(
259: JLinkedList jonasConfigPropertyList) {
260: this .jonasConfigPropertyList = jonasConfigPropertyList;
261: }
262:
263: /**
264: * Add a new jonas-config-property element to this object
265: * @param jonasConfigProperty the jonasConfigPropertyobject
266: */
267: public void addJonasConfigProperty(
268: JonasConfigProperty jonasConfigProperty) {
269: jonasConfigPropertyList.add(jonasConfigProperty);
270: }
271:
272: /**
273: * Gets the jonas-connection-definition
274: * @return the jonas-connection-definition
275: */
276: public JLinkedList getJonasConnectionDefinitionList() {
277: return jonasConnectionDefinitionList;
278: }
279:
280: /**
281: * Set the jonas-connection-definition-property
282: * @param jonasConnectionDefinitionList jonasConnectionDefinition list
283: */
284: public void setJonasConnectionDefinitionList(
285: JLinkedList jonasConnectionDefinitionList) {
286: this .jonasConnectionDefinitionList = jonasConnectionDefinitionList;
287: }
288:
289: /**
290: * Add a new jonas-connection-definition-property element to this object
291: * @param jonasConnectionDefinition the jonasConnectionDefinition object
292: */
293: public void addJonasConnectionDefinition(
294: JonasConnectionDefinition jonasConnectionDefinition) {
295: jonasConnectionDefinitionList.add(jonasConnectionDefinition);
296: }
297:
298: /**
299: * Gets the jonas-activationspec
300: * @return the jonas-activationspec
301: */
302: public JLinkedList getJonasActivationspecList() {
303: return jonasActivationspecList;
304: }
305:
306: /**
307: * Set the jonas-activationspec-property
308: * @param jonasActivationspecList jonas-activationspec-property list
309: */
310: public void setJonasActivationspecList(
311: JLinkedList jonasActivationspecList) {
312: this .jonasActivationspecList = jonasActivationspecList;
313: }
314:
315: /**
316: * Add a new jonas-activationspec-property element to this object
317: * @param jonasActivationspec the jonasActivationspec object
318: */
319: public void addJonasActivationspec(
320: JonasActivationspec jonasActivationspec) {
321: jonasActivationspecList.add(jonasActivationspec);
322: }
323:
324: /**
325: * Gets the jonas-adminobject
326: * @return the jonas-adminobject
327: */
328: public JLinkedList getJonasAdminobjectList() {
329: return jonasAdminobjectList;
330: }
331:
332: /**
333: * Set the jonas-adminobject-property
334: * @param jonasAdminobjectList jonas-adminobject-property list
335: */
336: public void setJonasAdminobjectList(JLinkedList jonasAdminobjectList) {
337: this .jonasAdminobjectList = jonasAdminobjectList;
338: }
339:
340: /**
341: * Add a new jonas-adminobject-property element to this object
342: * @param jonasAdminobject the jonasAdminobject object
343: */
344: public void addJonasAdminobject(JonasAdminobject jonasAdminobject) {
345: jonasAdminobjectList.add(jonasAdminobject);
346: }
347:
348: /**
349: * Gets the jonas-security-mapping
350: * @return the jonasSecurityMapping
351: */
352: public JonasSecurityMapping getJonasSecurityMapping() {
353: return jonasSecurityMapping;
354: }
355:
356: /**
357: * Set the jonas-security-mapping
358: * @param jonasSecurityMapping jonasSecurityMapping
359: */
360: public void setJonasSecurityMapping(
361: JonasSecurityMapping jonasSecurityMapping) {
362: this .jonasSecurityMapping = jonasSecurityMapping;
363: }
364:
365: /**
366: * Gets the tm-params
367: * @return the tm-params
368: */
369: public TmParams getTmParams() {
370: return tmParams;
371: }
372:
373: /**
374: * Set the tm-params
375: * @param tmParams tmParams
376: */
377: public void setTmParams(TmParams tmParams) {
378: this .tmParams = tmParams;
379: }
380:
381: /**
382: * Represents this element by it's XML description.
383: * @param indent use this indent for prefixing XML representation.
384: * @return the XML description of this object.
385: */
386: public String toXML(int indent) {
387: StringBuffer sb = new StringBuffer();
388: sb.append(indent(indent));
389: sb.append(JONAS_RA_ROOT_ELEMENT);
390:
391: indent += 2;
392:
393: // jndiname
394: sb.append(xmlElement(jndiName, "jndi-name", indent));
395: // rarlink
396: sb.append(xmlElement(rarlink, "rarlink", indent));
397: // native-lib
398: sb.append(xmlElement(nativeLib, "native-lib", indent));
399: // log-enabled
400: sb.append(xmlElement(logEnabled, "log-enabled", indent));
401: // log-topic
402: sb.append(xmlElement(logTopic, "log-topic", indent));
403: // pool-params
404: if (poolParams != null) {
405: sb.append(poolParams.toXML(indent));
406: }
407: // jdbc-conn-params
408: if (jdbcConnParams != null) {
409: sb.append(jdbcConnParams.toXML(indent));
410: }
411: // tm-params
412: if (tmParams != null) {
413: sb.append(tmParams.toXML(indent));
414: }
415: // jonas-config-property
416: if (jonasConfigPropertyList != null) {
417: sb.append(jonasConfigPropertyList.toXML(indent));
418: }
419: // jonas-connection-definition
420: if (jonasConnectionDefinitionList != null) {
421: sb.append(jonasConnectionDefinitionList.toXML(indent));
422: }
423: // jonas-activationspec
424: if (jonasActivationspecList != null) {
425: sb.append(jonasActivationspecList.toXML(indent));
426: }
427: // jonas-adminobject
428: if (jonasAdminobjectList != null) {
429: sb.append(jonasAdminobjectList.toXML(indent));
430: }
431: // jonas-security-mapping
432: if (jonasSecurityMapping != null) {
433: sb.append(jonasSecurityMapping.toXML(indent));
434: }
435: indent -= 2;
436: sb.append(indent(indent));
437: sb.append("</jonas-connector>\n");
438:
439: return sb.toString();
440: }
441: }
|