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: Relationships.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 relationships
033: *
034: * @author JOnAS team
035: */
036:
037: public class Relationships extends AbsElement {
038:
039: /**
040: * description
041: */
042: private String description = null;
043:
044: /**
045: * ejb-relation
046: */
047: private JLinkedList ejbRelationList = null;
048:
049: /**
050: * Constructor
051: */
052: public Relationships() {
053: super ();
054: ejbRelationList = new JLinkedList("ejb-relation");
055: }
056:
057: /**
058: * Gets the description
059: * @return the description
060: */
061: public String getDescription() {
062: return description;
063: }
064:
065: /**
066: * Set the description
067: * @param description description
068: */
069: public void setDescription(String description) {
070: this .description = description;
071: }
072:
073: /**
074: * Gets the ejb-relation
075: * @return the ejb-relation
076: */
077: public JLinkedList getEjbRelationList() {
078: return ejbRelationList;
079: }
080:
081: /**
082: * Set the ejb-relation
083: * @param ejbRelationList ejbRelation
084: */
085: public void setEjbRelationList(JLinkedList ejbRelationList) {
086: this .ejbRelationList = ejbRelationList;
087: }
088:
089: /**
090: * Add a new ejb-relation element to this object
091: * @param ejbRelation the ejbRelationobject
092: */
093: public void addEjbRelation(EjbRelation ejbRelation) {
094: ejbRelationList.add(ejbRelation);
095: }
096:
097: /**
098: * Represents this element by it's XML description.
099: * @param indent use this indent for prexifing XML representation.
100: * @return the XML description of this object.
101: */
102: public String toXML(int indent) {
103: StringBuffer sb = new StringBuffer();
104: sb.append(indent(indent));
105: sb.append("<relationships>\n");
106:
107: indent += 2;
108:
109: // description
110: sb.append(xmlElement(description, "description", indent));
111: // ejb-relation
112: sb.append(ejbRelationList.toXML(indent));
113: indent -= 2;
114: sb.append(indent(indent));
115: sb.append("</relationships>\n");
116:
117: return sb.toString();
118: }
119: }
|