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: JonasEjbRelation.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 jonas-ejb-relation
033: *
034: * @author JOnAS team
035: */
036:
037: public class JonasEjbRelation extends AbsElement {
038:
039: /**
040: * ejb-relation-name
041: */
042: private String ejbRelationName = null;
043:
044: /**
045: * jdbc-table-name
046: */
047: private String jdbcTableName = null;
048:
049: /**
050: * jonas-ejb-relationship-role
051: */
052: private JLinkedList jonasEjbRelationshipRoleList = null;
053:
054: /**
055: * Constructor
056: */
057: public JonasEjbRelation() {
058: super ();
059: jonasEjbRelationshipRoleList = new JLinkedList(
060: "jonas-ejb-relationship-role");
061: }
062:
063: /**
064: * Gets the ejb-relation-name
065: * @return the ejb-relation-name
066: */
067: public String getEjbRelationName() {
068: return ejbRelationName;
069: }
070:
071: /**
072: * Set the ejb-relation-name
073: * @param ejbRelationName ejbRelationName
074: */
075: public void setEjbRelationName(String ejbRelationName) {
076: this .ejbRelationName = ejbRelationName;
077: }
078:
079: /**
080: * Gets the jdbc-table-name
081: * @return the jdbc-table-name
082: */
083: public String getJdbcTableName() {
084: return jdbcTableName;
085: }
086:
087: /**
088: * Set the jdbc-table-name
089: * @param jdbcTableName jdbcTableName
090: */
091: public void setJdbcTableName(String jdbcTableName) {
092: this .jdbcTableName = jdbcTableName;
093: }
094:
095: /**
096: * Gets the jonas-ejb-relationship-role
097: * @return the jonas-ejb-relationship-role
098: */
099: public JLinkedList getJonasEjbRelationshipRoleList() {
100: return jonasEjbRelationshipRoleList;
101: }
102:
103: /**
104: * Set the jonas-ejb-relationship-role
105: * @param jonasEjbRelationshipRoleList jonasEjbRelationshipRole
106: */
107: public void setJonasEjbRelationshipRoleList(
108: JLinkedList jonasEjbRelationshipRoleList) {
109: this .jonasEjbRelationshipRoleList = jonasEjbRelationshipRoleList;
110: }
111:
112: /**
113: * Add a new jonas-ejb-relationship-role element to this object
114: * @param jonasEjbRelationshipRole the jonasEjbRelationshipRoleobject
115: */
116: public void addJonasEjbRelationshipRole(
117: JonasEjbRelationshipRole jonasEjbRelationshipRole) {
118: jonasEjbRelationshipRoleList.add(jonasEjbRelationshipRole);
119: }
120:
121: /**
122: * Represents this element by it's XML description.
123: * @param indent use this indent for prexifing XML representation.
124: * @return the XML description of this object.
125: */
126: public String toXML(int indent) {
127: StringBuffer sb = new StringBuffer();
128: sb.append(indent(indent));
129: sb.append("<jonas-ejb-relation>\n");
130:
131: indent += 2;
132:
133: // ejb-relation-name
134: sb.append(xmlElement(ejbRelationName, "ejb-relation-name",
135: indent));
136: // jdbc-table-name
137: sb.append(xmlElement(jdbcTableName, "jdbc-table-name", indent));
138: // jonas-ejb-relationship-role
139: sb.append(jonasEjbRelationshipRoleList.toXML(indent));
140: indent -= 2;
141: sb.append(indent(indent));
142: sb.append("</jonas-ejb-relation>\n");
143:
144: return sb.toString();
145: }
146: }
|