001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: *
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or 1any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this library; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
020: * USA
021: *
022: * Initial developer: JOnAS team
023: * --------------------------------------------------------------------------
024: * $Id: EnterpriseBeans.java 4716 2004-05-10 11:45:44Z sauthieg $
025: * --------------------------------------------------------------------------
026: */package org.objectweb.jonas_ejb.deployment.xml;
027:
028: import org.objectweb.jonas_lib.deployment.xml.AbsElement;
029: import org.objectweb.jonas_lib.deployment.xml.JLinkedList;
030:
031: /**
032: * This class defines the implementation of the element enterprise-beans
033: *
034: * @author JOnAS team
035: */
036:
037: public class EnterpriseBeans extends AbsElement {
038:
039: /**
040: * session
041: */
042: private JLinkedList sessionList = null;
043:
044: /**
045: * entity
046: */
047: private JLinkedList entityList = null;
048:
049: /**
050: * message-driven
051: */
052: private JLinkedList messageDrivenList = null;
053:
054: /**
055: * Constructor
056: */
057: public EnterpriseBeans() {
058: super ();
059: sessionList = new JLinkedList("session");
060: entityList = new JLinkedList("entity");
061: messageDrivenList = new JLinkedList("message-driven");
062: }
063:
064: /**
065: * Gets the session
066: * @return the session
067: */
068: public JLinkedList getSessionList() {
069: return sessionList;
070: }
071:
072: /**
073: * Set the session
074: * @param sessionList session
075: */
076: public void setSessionList(JLinkedList sessionList) {
077: this .sessionList = sessionList;
078: }
079:
080: /**
081: * Add a new session element to this object
082: * @param session the sessionobject
083: */
084: public void addSession(Session session) {
085: sessionList.add(session);
086: }
087:
088: /**
089: * Gets the entity
090: * @return the entity
091: */
092: public JLinkedList getEntityList() {
093: return entityList;
094: }
095:
096: /**
097: * Set the entity
098: * @param entityList entity
099: */
100: public void setEntityList(JLinkedList entityList) {
101: this .entityList = entityList;
102: }
103:
104: /**
105: * Add a new entity element to this object
106: * @param entity the entityobject
107: */
108: public void addEntity(Entity entity) {
109: entityList.add(entity);
110: }
111:
112: /**
113: * Gets the message-driven
114: * @return the message-driven
115: */
116: public JLinkedList getMessageDrivenList() {
117: return messageDrivenList;
118: }
119:
120: /**
121: * Set the message-driven
122: * @param messageDrivenList messageDriven
123: */
124: public void setMessageDrivenList(JLinkedList messageDrivenList) {
125: this .messageDrivenList = messageDrivenList;
126: }
127:
128: /**
129: * Add a new message-driven element to this object
130: * @param messageDriven the messageDrivenobject
131: */
132: public void addMessageDriven(MessageDriven messageDriven) {
133: messageDrivenList.add(messageDriven);
134: }
135:
136: /**
137: * Represents this element by it's XML description.
138: * @param indent use this indent for prexifing XML representation.
139: * @return the XML description of this object.
140: */
141: public String toXML(int indent) {
142: StringBuffer sb = new StringBuffer();
143: sb.append(indent(indent));
144: sb.append("<enterprise-beans>\n");
145:
146: indent += 2;
147:
148: // session
149: sb.append(sessionList.toXML(indent));
150: // entity
151: sb.append(entityList.toXML(indent));
152: // message-driven
153: sb.append(messageDrivenList.toXML(indent));
154: indent -= 2;
155: sb.append(indent(indent));
156: sb.append("</enterprise-beans>\n");
157:
158: return sb.toString();
159: }
160: }
|