1 23 24 29 30 package com.sun.enterprise.tools.common.dd; 31 32 import org.w3c.dom.*; 33 import org.netbeans.modules.schema2beans.*; 34 import java.beans.*; 35 import java.util.*; 36 37 39 public class SecurityRoleMapping extends com.sun.enterprise.tools.common.dd.SunBaseBean 40 { 41 42 static Vector comparators = new Vector(); 43 44 static public final String ROLE_NAME = "RoleName"; static public final String PRINCIPAL_NAME = "PrincipalName"; static public final String GROUP_NAME = "GroupName"; 48 public SecurityRoleMapping() { 49 this(Common.USE_DEFAULT_VALUES); 50 } 51 52 public SecurityRoleMapping(int options) 53 { 54 super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0)); 55 this.createProperty("role-name", ROLE_NAME, 58 Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, 59 String .class); 60 this.createProperty("principal-name", PRINCIPAL_NAME, Common.SEQUENCE_OR | 62 Common.TYPE_1_N | Common.TYPE_STRING | Common.TYPE_KEY, 63 String .class); 64 this.createProperty("group-name", GROUP_NAME, Common.SEQUENCE_OR | 66 Common.TYPE_1_N | Common.TYPE_STRING | Common.TYPE_KEY, 67 String .class); 68 this.initialize(options); 69 } 70 71 void initialize(int options) 73 { 74 75 } 76 77 public void setRoleName(String value) { 79 this.setValue(ROLE_NAME, value); 80 } 81 82 public String getRoleName() { 84 return (String )this.getValue(ROLE_NAME); 85 } 86 87 public void setPrincipalName(int index, String value) { 89 this.setValue(PRINCIPAL_NAME, index, value); 90 } 91 92 public String getPrincipalName(int index) { 94 return (String )this.getValue(PRINCIPAL_NAME, index); 95 } 96 97 public void setPrincipalName(String [] value) { 99 this.setValue(PRINCIPAL_NAME, value); 100 } 101 102 public String [] getPrincipalName() { 104 return (String [])this.getValues(PRINCIPAL_NAME); 105 } 106 107 public int sizePrincipalName() { 109 return this.size(PRINCIPAL_NAME); 110 } 111 112 public int addPrincipalName(String value) { 114 return this.addValue(PRINCIPAL_NAME, value); 115 } 116 117 public int removePrincipalName(String value) { 122 return this.removeValue(PRINCIPAL_NAME, value); 123 } 124 125 public void setGroupName(int index, String value) { 127 this.setValue(GROUP_NAME, index, value); 128 } 129 130 public String getGroupName(int index) { 132 return (String )this.getValue(GROUP_NAME, index); 133 } 134 135 public void setGroupName(String [] value) { 137 this.setValue(GROUP_NAME, value); 138 } 139 140 public String [] getGroupName() { 142 return (String [])this.getValues(GROUP_NAME); 143 } 144 145 public int sizeGroupName() { 147 return this.size(GROUP_NAME); 148 } 149 150 public int addGroupName(String value) { 152 return this.addValue(GROUP_NAME, value); 153 } 154 155 public int removeGroupName(String value) { 160 return this.removeValue(GROUP_NAME, value); 161 } 162 163 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 165 comparators.add(c); 166 } 167 168 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 170 comparators.remove(c); 171 } 172 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 173 boolean restrictionFailure = false; 174 if (getRoleName() == null) { 176 throw new org.netbeans.modules.schema2beans.ValidateException("getRoleName() == null", "roleName", this); } 178 for (int _index = 0; _index < sizePrincipalName(); ++_index) { 180 String element = getPrincipalName(_index); 181 if (element != null) { 182 } 183 } 184 int orCount = 0; 185 if (sizePrincipalName() > 0) { 186 ++orCount; 187 } 188 for (int _index = 0; _index < sizeGroupName(); ++_index) { 190 String element = getGroupName(_index); 191 if (element != null) { 192 } 193 } 194 if (sizeGroupName() > 0) { 195 ++orCount; 196 } 197 if (orCount != 1) { 198 throw new org.netbeans.modules.schema2beans.ValidateException("orCount ("+orCount+") != 1", "mutually exclusive properties", this); } 200 } 201 202 public void dump(StringBuffer str, String indent){ 204 String s; 205 Object o; 206 org.netbeans.modules.schema2beans.BaseBean n; 207 str.append(indent); 208 str.append("RoleName"); str.append(indent+"\t"); str.append("<"); s = this.getRoleName(); 212 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(ROLE_NAME, 0, str, indent); 215 216 str.append(indent); 217 str.append("PrincipalName["+this.sizePrincipalName()+"]"); for(int i=0; i<this.sizePrincipalName(); i++) 219 { 220 str.append(indent+"\t"); 221 str.append("#"+i+":"); 222 str.append(indent+"\t"); str.append("<"); s = this.getPrincipalName(i); 225 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(PRINCIPAL_NAME, i, str, indent); 228 } 229 230 str.append(indent); 231 str.append("GroupName["+this.sizeGroupName()+"]"); for(int i=0; i<this.sizeGroupName(); i++) 233 { 234 str.append(indent+"\t"); 235 str.append("#"+i+":"); 236 str.append(indent+"\t"); str.append("<"); s = this.getGroupName(i); 239 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(GROUP_NAME, i, str, indent); 242 } 243 244 } 245 public String dumpBeanNode(){ 246 StringBuffer str = new StringBuffer (); 247 str.append("SecurityRoleMapping\n"); this.dump(str, "\n "); return str.toString(); 250 }} 251 252 254 255 528 | Popular Tags |