KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_ws > deployment > xml > VariableMapping


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: JOnAS team
23  * --------------------------------------------------------------------------
24  * $Id: VariableMapping.java,v 1.3 2004/05/06 08:53:55 sauthieg Exp $
25  * --------------------------------------------------------------------------
26  */

27 package org.objectweb.jonas_ws.deployment.xml;
28
29 import org.objectweb.jonas_lib.deployment.xml.AbsElement;
30 /**
31  * This class defines the implementation of the element variable-mapping
32  *
33  * @author JOnAS team
34  */

35
36 public class VariableMapping extends AbsElement {
37
38     /**
39      * java-variable-name
40      */

41     private String JavaDoc javaVariableName = null;
42
43     /**
44      * data-member
45      */

46     private boolean dataMember = false;
47
48     /**
49      * xml-element-name
50      */

51     private String JavaDoc xmlElementName = null;
52
53
54     /**
55      * Constructor
56      */

57     public VariableMapping() {
58         super();
59     }
60
61     /**
62      * Gets the java-variable-name
63      * @return the java-variable-name
64      */

65     public String JavaDoc getJavaVariableName() {
66         return javaVariableName;
67     }
68
69     /**
70      * Set the java-variable-name
71      * @param javaVariableName javaVariableName
72      */

73     public void setJavaVariableName(String JavaDoc javaVariableName) {
74         this.javaVariableName = javaVariableName;
75     }
76
77     /**
78      * Gets the data-member
79      * @return true if data-member
80      */

81     public boolean isDataMember() {
82         return dataMember;
83     }
84
85     /**
86      * Set the data-member
87      */

88     public void setDataMember() {
89         this.dataMember = true;
90     }
91
92     /**
93      * Gets the xml-element-name
94      * @return the xml-element-name
95      */

96     public String JavaDoc getXmlElementName() {
97         return xmlElementName;
98     }
99
100     /**
101      * Set the xml-element-name
102      * @param xmlElementName xmlElementName
103      */

104     public void setXmlElementName(String JavaDoc xmlElementName) {
105         this.xmlElementName = xmlElementName;
106     }
107
108     /**
109      * Represents this element by it's XML description.
110      * @param indent use this indent for prexifing XML representation.
111      * @return the XML description of this object.
112      */

113     public String JavaDoc toXML(int indent) {
114         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
115         sb.append(indent(indent));
116         sb.append("<variable-mapping>\n");
117
118         indent += 2;
119
120         // java-variable-name
121
sb.append(xmlElement(javaVariableName, "java-variable-name", indent));
122         // data-member
123
if (dataMember) {
124             sb.append(indent(indent));
125             sb.append("<data-member/>");
126         }
127         // xml-element-name
128
sb.append(xmlElement(xmlElementName, "xml-element-name", indent));
129         indent -= 2;
130         sb.append(indent(indent));
131         sb.append("</variable-mapping>\n");
132
133         return sb.toString();
134     }
135 }
136
Popular Tags