1 26 27 package org.objectweb.jonas_web.deployment.xml; 28 29 import org.objectweb.jonas_lib.deployment.xml.AbsEnvironmentElement; 30 import org.objectweb.jonas_lib.deployment.xml.JLinkedList; 31 import org.objectweb.jonas_lib.deployment.xml.JndiEnvRefsGroupXml; 32 import org.objectweb.jonas_lib.deployment.xml.SecurityRole; 33 import org.objectweb.jonas_lib.deployment.xml.TopLevelElement; 34 35 39 public class WebApp extends AbsEnvironmentElement implements TopLevelElement, JndiEnvRefsGroupXml { 40 41 44 private JLinkedList servletList = null; 45 46 49 private JLinkedList servletMappingList = null; 50 51 54 private JLinkedList securityConstraintList = null; 55 56 59 private JLinkedList securityRoleList = null; 60 61 64 private int jspConfigNumber = 0; 65 66 69 private int loginConfigNumber = 0; 70 71 74 private int sessionConfigNumber = 0; 75 76 79 public WebApp() { 80 super(); 81 servletList = new JLinkedList("servlet"); 82 servletMappingList = new JLinkedList("servlet-mapping"); 83 securityConstraintList = new JLinkedList("security-constraint"); 84 securityRoleList = new JLinkedList("security-role"); 85 } 86 87 91 public void addServlet(Servlet servlet) { 92 servletList.add(servlet); 93 } 94 95 99 public void addServletMapping(ServletMapping servletMapping) { 100 servletMappingList.add(servletMapping); 101 } 102 103 107 public void setSecurityRoleList(JLinkedList securityRoleList) { 108 this.securityRoleList = securityRoleList; 109 } 110 111 115 public void addSecurityRole(SecurityRole securityRole) { 116 securityRoleList.add(securityRole); 117 } 118 119 123 public void setSecurityConstraintList(JLinkedList securityConstraintList) { 124 this.securityConstraintList = securityConstraintList; 125 } 126 127 131 public void addSecurityConstraint(SecurityConstraint securityConstraint) { 132 securityConstraintList.add(securityConstraint); 133 } 134 135 137 141 public JLinkedList getSecurityConstraintList() { 142 return securityConstraintList; 143 } 144 145 149 public JLinkedList getSecurityRoleList() { 150 return securityRoleList; 151 } 152 153 156 public JLinkedList getServletList() { 157 return servletList; 158 } 159 160 163 public JLinkedList getServletMappingList() { 164 return servletMappingList; 165 } 166 167 170 public void newJspConfig() { 171 jspConfigNumber++; 172 } 173 174 177 public void newLoginConfig() { 178 loginConfigNumber++; 179 } 180 181 184 public void newSessionConfig() { 185 sessionConfigNumber++; 186 } 187 188 193 public String toXML(int indent) { 194 StringBuffer sb = new StringBuffer (); 195 sb.append(indent(indent)); 196 sb.append("<web-app>\n"); 197 198 indent += 2; 199 200 sb.append(xmlElement(getDisplayName(), "display-name", indent)); 202 203 sb.append(servletList.toXML(indent)); 205 206 sb.append(servletMappingList.toXML(indent)); 208 209 sb.append(securityConstraintList.toXML(indent)); 211 212 sb.append(securityRoleList.toXML(indent)); 214 215 sb.append(getResourceEnvRefList().toXML(indent)); 217 218 sb.append(getResourceRefList().toXML(indent)); 220 221 sb.append(getEnvEntryList().toXML(indent)); 223 224 sb.append(getEjbRefList().toXML(indent)); 226 227 sb.append(getEjbLocalRefList().toXML(indent)); 229 230 sb.append(getServiceRefList().toXML(indent)); 232 233 sb.append(getMessageDestinationRefList().toXML(indent)); 235 indent -= 2; 236 sb.append(indent(indent)); 237 sb.append("</web-app>"); 238 239 return sb.toString(); 240 } 241 242 245 public int getJspConfigNumber() { 246 return jspConfigNumber; 247 } 248 249 252 public int getLoginConfigNumber() { 253 return loginConfigNumber; 254 } 255 256 259 public int getSessionConfigNumber() { 260 return sessionConfigNumber; 261 } 262 } | Popular Tags |