KickJava   Java API By Example, From Geeks To Geeks.

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


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999-2004 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  * --------------------------------------------------------------------------
23  * $Id: JavaXmlTypeMapping.java,v 1.4 2004/11/19 09:23:00 sauthieg Exp $
24  * --------------------------------------------------------------------------
25  */

26 package org.objectweb.jonas_ws.deployment.xml;
27
28 import org.objectweb.jonas_lib.deployment.xml.AbsElement;
29 import org.objectweb.jonas_lib.deployment.xml.JLinkedList;
30 import org.objectweb.jonas_lib.deployment.xml.Qname;
31
32
33 /**
34  * This class defines the implementation of the element java-xml-type-mapping
35  *
36  * @author JOnAS team
37  */

38
39 public class JavaXmlTypeMapping extends AbsElement {
40
41     /**
42      * java-type
43      */

44     private String JavaDoc javaType = null;
45
46     /**
47      * root-type-qname
48      */

49     private Qname rootTypeQname = null;
50
51     /**
52      * anonymous-type-qname
53      */

54     private Qname anonymousTypeQname = null;
55
56     /**
57      * qname-scope
58      */

59     private String JavaDoc qnameScope = null;
60
61     /**
62      * variable-mapping
63      */

64     private JLinkedList variableMappingList = null;
65
66
67     /**
68      * Constructor
69      */

70     public JavaXmlTypeMapping() {
71         super();
72         variableMappingList = new JLinkedList("variable-mapping");
73     }
74
75     /**
76      * Gets the class-type
77      * @return the class-type
78      */

79     public String JavaDoc getJavaType() {
80         return javaType;
81     }
82
83     /**
84      * Set the java-type
85      * @param javaType javaType
86      */

87     public void setJavaType(String JavaDoc javaType) {
88         this.javaType = javaType;
89     }
90
91     /**
92      * Gets the root-type-qname
93      * @return the root-type-qname
94      */

95     public Qname getRootTypeQname() {
96         return rootTypeQname;
97     }
98
99     /**
100      * Set the root-type-qname
101      * @param rootTypeQname rootTypeQname
102      */

103     public void setRootTypeQname(Qname rootTypeQname) {
104         this.rootTypeQname = rootTypeQname;
105     }
106
107     /**
108      * Gets the qname-scope
109      * @return the qname-scope
110      */

111     public String JavaDoc getQnameScope() {
112         return qnameScope;
113     }
114
115     /**
116      * Set the qname-scope
117      * @param qnameScope qnameScope
118      */

119     public void setQnameScope(String JavaDoc qnameScope) {
120         this.qnameScope = qnameScope;
121     }
122
123     /**
124      * Gets the variable-mapping
125      * @return the variable-mapping
126      */

127     public JLinkedList getVariableMappingList() {
128         return variableMappingList;
129     }
130
131     /**
132      * Set the variable-mapping
133      * @param variableMappingList variableMapping
134      */

135     public void setVariableMappingList(JLinkedList variableMappingList) {
136         this.variableMappingList = variableMappingList;
137     }
138
139     /**
140      * Add a new variable-mapping element to this object
141      * @param variableMapping the variableMappingobject
142      */

143     public void addVariableMapping(VariableMapping variableMapping) {
144         variableMappingList.add(variableMapping);
145     }
146
147     /**
148      * @return Returns the anonymousTypeQname.
149      */

150     public Qname getAnonymousTypeQname() {
151         return anonymousTypeQname;
152     }
153
154     /**
155      * @param anonymousTypeQname The anonymousTypeQname to set.
156      */

157     public void setAnonymousTypeQname(Qname anonymousTypeQname) {
158         this.anonymousTypeQname = anonymousTypeQname;
159     }
160
161     /**
162      * Represents this element by it's XML description.
163      * @param indent use this indent for prexifing XML representation.
164      * @return the XML description of this object.
165      */

166     public String JavaDoc toXML(int indent) {
167         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
168         sb.append(indent(indent));
169         sb.append("<java-xml-type-mapping>\n");
170
171         indent += 2;
172
173         // class-type
174
sb.append(xmlElement(javaType, "java-type", indent));
175         // root-type-qname
176
if (rootTypeQname != null) {
177             sb.append(rootTypeQname.toXML(indent));
178         }
179         // anonymous-type-qname
180
if (anonymousTypeQname != null) {
181             sb.append(anonymousTypeQname.toXML(indent));
182         }
183         // qname-scope
184
sb.append(xmlElement(qnameScope, "qname-scope", indent));
185         // variable-mapping
186
sb.append(variableMappingList.toXML(indent));
187         indent -= 2;
188         sb.append(indent(indent));
189         sb.append("</java-xml-type-mapping>\n");
190
191         return sb.toString();
192     }
193 }
194
Popular Tags