KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_ejb > deployment > xml > Entity


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: Entity.java,v 1.11 2004/05/19 21:18:56 ehardesty Exp $
25  * --------------------------------------------------------------------------
26  */

27 package org.objectweb.jonas_ejb.deployment.xml;
28
29 import org.objectweb.jonas_lib.deployment.xml.JLinkedList;
30 /**
31  * This class defines the implementation of the element entity
32  *
33  * @author JOnAS team
34  */

35
36 public class Entity extends CommonEjb {
37
38
39
40     /**
41      * persistence-type
42      */

43     private String JavaDoc persistenceType = null;
44
45     /**
46      * prim-key-class
47      */

48     private String JavaDoc primKeyClass = null;
49
50     /**
51      * reentrant
52      */

53     private String JavaDoc reentrant = null;
54
55     /**
56      * cmp-version
57      */

58     private String JavaDoc cmpVersion = null;
59
60     /**
61      * abstract-schema-name
62      */

63     private String JavaDoc abstractSchemaName = null;
64
65     /**
66      * cmp-field
67      */

68     private JLinkedList cmpFieldList = null;
69
70     /**
71      * primkey-field
72      */

73     private String JavaDoc primkeyField = null;
74
75     /**
76      * query
77      */

78     private JLinkedList queryList = null;
79
80
81     /**
82      * Constructor
83      */

84     public Entity() {
85         super();
86         cmpFieldList = new JLinkedList("cmp-field");
87         queryList = new JLinkedList("query");
88     }
89
90     /**
91      * Gets the persistence-type
92      * @return the persistence-type
93      */

94     public String JavaDoc getPersistenceType() {
95         return persistenceType;
96     }
97
98     /**
99      * Set the persistence-type
100      * @param persistenceType persistenceType
101      */

102     public void setPersistenceType(String JavaDoc persistenceType) {
103         this.persistenceType = persistenceType;
104     }
105
106     /**
107      * Gets the prim-key-class
108      * @return the prim-key-class
109      */

110     public String JavaDoc getPrimKeyClass() {
111         return primKeyClass;
112     }
113
114     /**
115      * Set the prim-key-class
116      * @param primKeyClass primKeyClass
117      */

118     public void setPrimKeyClass(String JavaDoc primKeyClass) {
119         this.primKeyClass = primKeyClass;
120     }
121
122     /**
123      * Gets the reentrant
124      * @return the reentrant
125      */

126     public String JavaDoc getReentrant() {
127         return reentrant;
128     }
129
130     /**
131      * Set the reentrant
132      * @param reentrant reentrant
133      */

134     public void setReentrant(String JavaDoc reentrant) {
135         this.reentrant = reentrant;
136     }
137
138     /**
139      * Gets the cmp-version
140      * @return the cmp-version
141      */

142     public String JavaDoc getCmpVersion() {
143         return cmpVersion;
144     }
145
146     /**
147      * Set the cmp-version
148      * @param cmpVersion cmpVersion
149      */

150     public void setCmpVersion(String JavaDoc cmpVersion) {
151         this.cmpVersion = cmpVersion;
152     }
153
154     /**
155      * Gets the abstract-schema-name
156      * @return the abstract-schema-name
157      */

158     public String JavaDoc getAbstractSchemaName() {
159         return abstractSchemaName;
160     }
161
162     /**
163      * Set the abstract-schema-name
164      * @param abstractSchemaName abstractSchemaName
165      */

166     public void setAbstractSchemaName(String JavaDoc abstractSchemaName) {
167         this.abstractSchemaName = abstractSchemaName;
168     }
169
170     /**
171      * Gets the cmp-field
172      * @return the cmp-field
173      */

174     public JLinkedList getCmpFieldList() {
175         return cmpFieldList;
176     }
177
178     /**
179      * Set the cmp-field
180      * @param cmpFieldList cmpField
181      */

182     public void setCmpFieldList(JLinkedList cmpFieldList) {
183         this.cmpFieldList = cmpFieldList;
184     }
185
186     /**
187      * Add a new cmp-field element to this object
188      * @param cmpField the cmpFieldobject
189      */

190     public void addCmpField(CmpField cmpField) {
191         cmpFieldList.add(cmpField);
192     }
193
194     /**
195      * Gets the primkey-field
196      * @return the primkey-field
197      */

198     public String JavaDoc getPrimkeyField() {
199         return primkeyField;
200     }
201
202     /**
203      * Set the primkey-field
204      * @param primkeyField primkeyField
205      */

206     public void setPrimkeyField(String JavaDoc primkeyField) {
207         this.primkeyField = primkeyField;
208     }
209
210
211     /**
212      * Gets the query
213      * @return the query
214      */

215     public JLinkedList getQueryList() {
216         return queryList;
217     }
218
219     /**
220      * Set the query
221      * @param queryList query
222      */

223     public void setQueryList(JLinkedList queryList) {
224         this.queryList = queryList;
225     }
226
227     /**
228      * Add a new query element to this object
229      * @param query the queryobject
230      */

231     public void addQuery(Query query) {
232         queryList.add(query);
233     }
234
235     /**
236      * Represents this element by it's XML description.
237      * @param indent use this indent for prexifing XML representation.
238      * @return the XML description of this object.
239      */

240     public String JavaDoc toXML(int indent) {
241         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
242         sb.append(indent(indent));
243         sb.append("<entity>\n");
244
245         indent += 2;
246
247         // description
248
sb.append(xmlElement(getDescription(), "description", indent));
249         // display-name
250
sb.append(xmlElement(getDisplayName(), "display-name", indent));
251         // small-icon
252
sb.append(xmlElement(getIcon().getSmallIcon(), "small-icon", indent));
253         // large-icon
254
sb.append(xmlElement(getIcon().getLargeIcon(), "large-icon", indent));
255         // ejb-name
256
sb.append(xmlElement(getEjbName(), "ejb-name", indent));
257         // home
258
sb.append(xmlElement(getHome(), "home", indent));
259         // remote
260
sb.append(xmlElement(getRemote(), "remote", indent));
261         // local-home
262
sb.append(xmlElement(getLocalHome(), "local-home", indent));
263         // local
264
sb.append(xmlElement(getLocal(), "local", indent));
265         // ejb-class
266
sb.append(xmlElement(getEjbClass(), "ejb-class", indent));
267         // persistence-type
268
sb.append(xmlElement(persistenceType, "persistence-type", indent));
269         // prim-key-class
270
sb.append(xmlElement(primKeyClass, "prim-key-class", indent));
271         // reentrant
272
sb.append(xmlElement(reentrant, "reentrant", indent));
273         // cmp-version
274
sb.append(xmlElement(cmpVersion, "cmp-version", indent));
275         // abstract-schema-name
276
sb.append(xmlElement(abstractSchemaName, "abstract-schema-name", indent));
277         // cmp-field
278
sb.append(cmpFieldList.toXML(indent));
279         // primkey-field
280
sb.append(xmlElement(primkeyField, "primkey-field", indent));
281         // env-entry
282
sb.append(getEnvEntryList().toXML(indent));
283         // ejb-ref
284
sb.append(getEjbRefList().toXML(indent));
285         // ejb-local-ref
286
sb.append(getEjbLocalRefList().toXML(indent));
287         // service-ref
288
sb.append(getServiceRefList().toXML(indent));
289         // resource-ref
290
sb.append(getResourceRefList().toXML(indent));
291         // resource-env-ref
292
sb.append(getResourceEnvRefList().toXML(indent));
293         // message-destination-ref
294
sb.append(getMessageDestinationRefList().toXML(indent));
295         // security-role-ref
296
sb.append(getSecurityRoleRefList().toXML(indent));
297         // security-identity
298
if (getSecurityIdentity() != null) {
299             sb.append(getSecurityIdentity().toXML(indent));
300         }
301         // query
302
sb.append(queryList.toXML(indent));
303         indent -= 2;
304         sb.append(indent(indent));
305         sb.append("</entity>\n");
306
307         return sb.toString();
308     }
309 }
310
Popular Tags