KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_lib > deployment > xml > AbsJonasParam


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  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or 1any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * Initial developer: Florent BENOIT
22  * --------------------------------------------------------------------------
23  * $Id: AbsJonasParam.java,v 1.2 2004/07/01 15:35:10 sauthieg Exp $
24  * --------------------------------------------------------------------------
25  */

26
27 package org.objectweb.jonas_lib.deployment.xml;
28
29 /**
30  * This class defines the implementation of the element jonas-param
31  * @author Guillaume Sauthier
32  */

33 public abstract class AbsJonasParam extends AbsElement {
34
35     /**
36      * Name of this parameter
37      */

38     private String JavaDoc paramName = null;
39
40     /**
41      * Value of this parameter
42      */

43     private String JavaDoc paramValue = null;
44
45     /**
46      * Element name
47      */

48     private String JavaDoc elementName = null;
49
50     /**
51      * Construct a JOnASParam with given Element name.
52      * @param ename Element name
53      */

54     protected AbsJonasParam(String JavaDoc ename) {
55         elementName = ename;
56     }
57
58     // Setters
59

60     /**
61      * Sets the name
62      * @param paramName the name to use
63      */

64     public void setParamName(String JavaDoc paramName) {
65         this.paramName = paramName;
66     }
67
68
69     /**
70      * Sets the value
71      * @param paramValue the value
72      */

73     public void setParamValue(String JavaDoc paramValue) {
74         this.paramValue = paramValue;
75     }
76
77     // Getters
78

79
80     /**
81      * @return the name of the parameter
82      */

83     public String JavaDoc getParamName() {
84         return paramName;
85     }
86
87
88     /**
89      * @return the value of the parameter
90      */

91     public String JavaDoc getParamValue() {
92         return paramValue;
93     }
94
95     /**
96      * Represents this element by it's XML description.
97      * @param indent use this indent for prexifing XML representation.
98      * @return the XML description of this object.
99      */

100     public String JavaDoc toXML(int indent) {
101         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
102         sb.append(indent(indent));
103         sb.append("<" + elementName + ">\n");
104
105         indent += 2;
106
107         // name
108
sb.append(xmlElement(paramName, "param-name", indent));
109
110         // value
111
sb.append(xmlElement(paramValue, "param-value", indent));
112
113         indent -= 2;
114         sb.append(indent(indent));
115         sb.append("</" + elementName + ">\n");
116
117         return sb.toString();
118     }
119
120
121
122 }
123
Popular Tags