EjbRelation.java

00001 
00028 package org.objectweb.jonas_ejb.deployment.xml;
00029 
00030 import java.util.Iterator;
00031 import org.objectweb.jonas_lib.deployment.xml.AbsElement;
00032 import org.objectweb.jonas_lib.deployment.xml.JLinkedList;
00033 
00039 public class EjbRelation extends AbsElement {
00040 
00044     private String description = null;
00045 
00049     private String ejbRelationName = null;
00050 
00051 
00055     private JLinkedList ejbRelationshipRoleList = null;
00056 
00057 
00061     public EjbRelation() {
00062         super();
00063         ejbRelationshipRoleList = new JLinkedList("ejb-relationship-role");
00064     }
00065 
00070     public String getDescription() {
00071         return description;
00072     }
00073 
00078     public void setDescription(String description) {
00079         this.description = description;
00080     }
00081 
00086     public String getEjbRelationName() {
00087         return ejbRelationName;
00088     }
00089 
00094     public void setEjbRelationName(String ejbRelationName) {
00095         this.ejbRelationName = ejbRelationName;
00096     }
00097 
00102     public void addEjbRelationshipRole(EjbRelationshipRole ejbRelationshipRole) {
00103         ejbRelationshipRoleList.add(ejbRelationshipRole);
00104     }
00105 
00110     public JLinkedList getEjbRelationshipRoleList() {
00111         return ejbRelationshipRoleList;
00112     }
00113 
00118     public EjbRelationshipRole getEjbRelationshipRole() {
00119         Iterator i = ejbRelationshipRoleList.iterator();
00120         EjbRelationshipRole ejbRelationshipRole1 = (EjbRelationshipRole) i.next();
00121         return ejbRelationshipRole1;
00122     }
00123 
00124 
00129     public EjbRelationshipRole getEjbRelationshipRole2() {
00130         Iterator i = ejbRelationshipRoleList.iterator();
00131         EjbRelationshipRole ejbRelationshipRole2 = (EjbRelationshipRole) i.next();
00132         ejbRelationshipRole2 = (EjbRelationshipRole) i.next();
00133         return ejbRelationshipRole2;
00134     }
00135 
00136 
00137 
00143     public String toXML(int indent) {
00144         StringBuffer sb = new StringBuffer();
00145         sb.append(indent(indent));
00146         sb.append("<ejb-relation>\n");
00147 
00148         indent += 2;
00149 
00150         // description
00151         sb.append(xmlElement(description, "description", indent));
00152         // ejb-relation-name
00153         sb.append(xmlElement(ejbRelationName, "ejb-relation-name", indent));
00154         // ejb-relationship-role
00155         if (ejbRelationshipRoleList != null) {
00156             for (Iterator i = ejbRelationshipRoleList.iterator(); i.hasNext();) {
00157                 sb.append(((EjbRelationshipRole) i.next()).toXML(indent));
00158             }
00159         }
00160 
00161         indent -= 2;
00162         sb.append(indent(indent));
00163         sb.append("</ejb-relation>\n");
00164 
00165         return sb.toString();
00166     }
00167 }

Generated on Tue Feb 15 15:05:47 2005 for JOnAS by  doxygen 1.3.9.1