1 27 package org.objectweb.jonas_ejb.deployment.xml; 28 29 import java.util.ArrayList ; 30 import java.util.StringTokenizer ; 31 32 import org.objectweb.jonas_lib.deployment.xml.AbsDescriptionElement; 33 import org.objectweb.jonas_lib.deployment.xml.DescriptionGroupXml; 34 import org.objectweb.jonas_lib.deployment.xml.TopLevelElement; 35 36 41 42 public class EjbJar extends AbsDescriptionElement 43 implements TopLevelElement, DescriptionGroupXml { 44 45 46 49 private static final int VERSION_INDEX = 3; 50 51 54 private EnterpriseBeans enterpriseBeans = null; 55 56 59 private Relationships relationships = null; 60 61 64 private AssemblyDescriptor assemblyDescriptor = null; 65 66 69 private String ejbClientJar = null; 70 71 74 private String publicId = null; 75 76 81 private String version = null; 82 83 86 public EjbJar() { 87 super(); 88 } 89 90 94 public String getPublicId() { 95 return publicId; 96 } 97 98 102 public void setPublicId(String pid) { 103 publicId = pid; 104 } 105 106 107 111 public String getVersion() { 112 if (version != null) { 113 return version; 114 } 115 if (publicId == null) { 116 version = "2.1"; 118 } else { 119 ArrayList al = new ArrayList (); 120 StringTokenizer st = new StringTokenizer (publicId , "//"); 122 while (st.hasMoreTokens()) { 123 al.add(st.nextToken().trim()); 124 } 125 String spec = (String ) al.get(2); 126 al.clear(); 127 st = new StringTokenizer (spec , " "); 128 while (st.hasMoreTokens()) { 129 al.add(st.nextToken().trim()); 130 } 131 version = (String ) al.get(VERSION_INDEX); 132 } 133 return version; 134 135 } 136 137 142 public void setVersion(String ver) { 143 version = ver; 144 } 145 146 150 public EnterpriseBeans getEnterpriseBeans() { 151 return enterpriseBeans; 152 } 153 154 158 public void setEnterpriseBeans(EnterpriseBeans enterpriseBeans) { 159 this.enterpriseBeans = enterpriseBeans; 160 } 161 162 166 public Relationships getRelationships() { 167 return relationships; 168 } 169 170 174 public void setRelationships(Relationships relationships) { 175 this.relationships = relationships; 176 } 177 178 182 public AssemblyDescriptor getAssemblyDescriptor() { 183 return assemblyDescriptor; 184 } 185 186 190 public void setAssemblyDescriptor(AssemblyDescriptor assemblyDescriptor) { 191 this.assemblyDescriptor = assemblyDescriptor; 192 } 193 194 198 public String getEjbClientJar() { 199 return ejbClientJar; 200 } 201 202 206 public void setEjbClientJar(String ejbClientJar) { 207 this.ejbClientJar = ejbClientJar; 208 } 209 210 215 public String toXML(int indent) { 216 StringBuffer sb = new StringBuffer (); 217 sb.append(indent(indent)); 218 sb.append("<ejb-jar>\n"); 219 220 indent += 2; 221 222 sb.append(xmlElement(getDescription(), "description", indent)); 224 sb.append(xmlElement(getDisplayName(), "display-name", indent)); 226 sb.append(xmlElement(getIcon().getSmallIcon(), "small-icon", indent)); 228 sb.append(xmlElement(getIcon().getLargeIcon(), "large-icon", indent)); 230 if (enterpriseBeans != null) { 232 sb.append(enterpriseBeans.toXML(indent)); 233 } 234 if (relationships != null) { 236 sb.append(relationships.toXML(indent)); 237 } 238 if (assemblyDescriptor != null) { 240 sb.append(assemblyDescriptor.toXML(indent)); 241 } 242 sb.append(xmlElement(ejbClientJar, "ejb-client-jar", indent)); 244 indent -= 2; 245 sb.append(indent(indent)); 246 sb.append("</ejb-jar>\n"); 247 248 return sb.toString(); 249 } 250 } 251 | Popular Tags |