KickJava   Java API By Example, From Geeks To Geeks.

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


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: EnterpriseBeans.java,v 1.8 2004/05/10 11:45:44 sauthieg Exp $
25  * --------------------------------------------------------------------------
26  */

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

36
37 public class EnterpriseBeans extends AbsElement {
38
39     /**
40      * session
41      */

42     private JLinkedList sessionList = null;
43
44     /**
45      * entity
46      */

47     private JLinkedList entityList = null;
48
49     /**
50      * message-driven
51      */

52     private JLinkedList messageDrivenList = null;
53
54
55     /**
56      * Constructor
57      */

58     public EnterpriseBeans() {
59         super();
60         sessionList = new JLinkedList("session");
61         entityList = new JLinkedList("entity");
62         messageDrivenList = new JLinkedList("message-driven");
63     }
64
65     /**
66      * Gets the session
67      * @return the session
68      */

69     public JLinkedList getSessionList() {
70         return sessionList;
71     }
72
73     /**
74      * Set the session
75      * @param sessionList session
76      */

77     public void setSessionList(JLinkedList sessionList) {
78         this.sessionList = sessionList;
79     }
80
81     /**
82      * Add a new session element to this object
83      * @param session the sessionobject
84      */

85     public void addSession(Session session) {
86         sessionList.add(session);
87     }
88
89     /**
90      * Gets the entity
91      * @return the entity
92      */

93     public JLinkedList getEntityList() {
94         return entityList;
95     }
96
97     /**
98      * Set the entity
99      * @param entityList entity
100      */

101     public void setEntityList(JLinkedList entityList) {
102         this.entityList = entityList;
103     }
104
105     /**
106      * Add a new entity element to this object
107      * @param entity the entityobject
108      */

109     public void addEntity(Entity entity) {
110         entityList.add(entity);
111     }
112
113     /**
114      * Gets the message-driven
115      * @return the message-driven
116      */

117     public JLinkedList getMessageDrivenList() {
118         return messageDrivenList;
119     }
120
121     /**
122      * Set the message-driven
123      * @param messageDrivenList messageDriven
124      */

125     public void setMessageDrivenList(JLinkedList messageDrivenList) {
126         this.messageDrivenList = messageDrivenList;
127     }
128
129     /**
130      * Add a new message-driven element to this object
131      * @param messageDriven the messageDrivenobject
132      */

133     public void addMessageDriven(MessageDriven messageDriven) {
134         messageDrivenList.add(messageDriven);
135     }
136
137     /**
138      * Represents this element by it's XML description.
139      * @param indent use this indent for prexifing XML representation.
140      * @return the XML description of this object.
141      */

142     public String JavaDoc toXML(int indent) {
143         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
144         sb.append(indent(indent));
145         sb.append("<enterprise-beans>\n");
146
147         indent += 2;
148
149         // session
150
sb.append(sessionList.toXML(indent));
151         // entity
152
sb.append(entityList.toXML(indent));
153         // message-driven
154
sb.append(messageDrivenList.toXML(indent));
155         indent -= 2;
156         sb.append(indent(indent));
157         sb.append("</enterprise-beans>\n");
158
159         return sb.toString();
160     }
161 }
162
Popular Tags