1 26 27 package org.objectweb.jonas_web.deployment.xml; 28 29 import org.objectweb.jonas_lib.deployment.xml.AbsElement; 30 import org.objectweb.jonas_lib.deployment.xml.JLinkedList; 31 import org.objectweb.jonas_lib.deployment.xml.RunAs; 32 import org.objectweb.jonas_lib.deployment.xml.SecurityRoleRef; 33 34 41 public class Servlet extends AbsElement { 42 43 46 private String servletName = null; 47 48 51 private String servletClass = null; 52 53 56 private String jspFile = null; 57 58 61 private JLinkedList securityRoleRefList = null; 62 63 66 private RunAs runAs = null; 67 68 69 72 public Servlet() { 73 super(); 74 securityRoleRefList = new JLinkedList("security-role-ref"); 75 } 76 77 79 80 84 public void setServletName(String servletName) { 85 this.servletName = servletName; 86 } 87 88 89 93 public void setServletClass(String servletClass) { 94 this.servletClass = servletClass; 95 } 96 97 101 public void setJspFile(String jspFile) { 102 this.jspFile = jspFile; 103 } 104 105 109 public void addSecurityRoleRef(SecurityRoleRef securityRoleRef) { 110 securityRoleRefList.add(securityRoleRef); 111 } 112 113 117 public void setSecurityRoleRefList(JLinkedList securityRoleRefList) { 118 this.securityRoleRefList = securityRoleRefList; 119 } 120 121 125 public void setRunAs(RunAs runAs) { 126 this.runAs = runAs; 127 } 128 129 131 134 public String getServletName() { 135 return servletName; 136 } 137 138 141 public String getServletClass() { 142 return servletClass; 143 } 144 145 148 public String getJspFile() { 149 return jspFile; 150 } 151 152 156 public JLinkedList getSecurityRoleRefList() { 157 return securityRoleRefList; 158 } 159 160 161 165 public RunAs getRunAs() { 166 return runAs; 167 } 168 169 174 public String toXML(int indent) { 175 StringBuffer sb = new StringBuffer (); 176 sb.append(indent(indent)); 177 sb.append("<servlet>\n"); 178 179 indent += 2; 180 181 sb.append(xmlElement(servletName, "servlet-name", indent)); 183 184 sb.append(xmlElement(servletClass, "servlet-class", indent)); 186 sb.append(xmlElement(jspFile, "jsp-file", indent)); 187 188 if (runAs != null) { 190 sb.append(runAs.toXML(indent)); 191 } 192 193 if (securityRoleRefList != null) { 195 sb.append(securityRoleRefList.toXML(indent)); 196 } 197 198 indent -= 2; 199 sb.append(indent(indent)); 200 sb.append("</servlet>\n"); 201 202 return sb.toString(); 203 } 204 } 205 | Popular Tags |