00001
00027 package org.objectweb.jonas_ejb.deployment.xml;
00028
00029 import org.objectweb.jonas_lib.deployment.xml.AbsElement;
00030 import org.objectweb.jonas_lib.deployment.xml.JLinkedList;
00037 public class MethodPermission extends AbsElement {
00038
00042 private String description = null;
00043
00047 private JLinkedList roleNameList = null;
00048
00052 private boolean unchecked = false;
00053
00057 private JLinkedList methodList = null;
00058
00059
00063 public MethodPermission() {
00064 super();
00065 roleNameList = new JLinkedList("role-name");
00066 methodList = new JLinkedList("method");
00067 }
00068
00073 public String getDescription() {
00074 return description;
00075 }
00076
00081 public void setDescription(String description) {
00082 this.description = description;
00083 }
00084
00089 public JLinkedList getRoleNameList() {
00090 return roleNameList;
00091 }
00092
00097 public void setRoleNameList(JLinkedList roleNameList) {
00098 this.roleNameList = roleNameList;
00099 }
00100
00105 public void addRoleName(String roleName) {
00106 roleNameList.add(roleName);
00107 }
00108
00113 public boolean isUnchecked() {
00114 return unchecked;
00115 }
00116
00120 public void setUnchecked() {
00121 this.unchecked = true;
00122 }
00123
00128 public JLinkedList getMethodList() {
00129 return methodList;
00130 }
00131
00136 public void setMethodList(JLinkedList methodList) {
00137 this.methodList = methodList;
00138 }
00139
00144 public void addMethod(Method method) {
00145 methodList.add(method);
00146 }
00147
00153 public String toXML(int indent) {
00154 StringBuffer sb = new StringBuffer();
00155 sb.append(indent(indent));
00156 sb.append("<method-permission>\n");
00157
00158 indent += 2;
00159
00160
00161 sb.append(xmlElement(description, "description", indent));
00162
00163 sb.append(roleNameList.toXML(indent));
00164
00165 if (unchecked) {
00166 sb.append(indent(indent));
00167 sb.append("<unchecked></unchecked>\n");
00168 }
00169
00170 sb.append(methodList.toXML(indent));
00171 indent -= 2;
00172 sb.append(indent(indent));
00173 sb.append("</method-permission>\n");
00174
00175 return sb.toString();
00176 }
00177 }