1 7 8 package org.openejb.alt.config.ejb11; 9 10 14 import java.io.IOException ; 15 import java.io.Reader ; 16 import java.io.Serializable ; 17 import java.io.Writer ; 18 import java.util.Enumeration ; 19 import java.util.Vector ; 20 import org.exolab.castor.xml.MarshalException; 21 import org.exolab.castor.xml.Marshaller; 22 import org.exolab.castor.xml.Unmarshaller; 23 import org.exolab.castor.xml.ValidationException; 24 import org.xml.sax.ContentHandler ; 25 26 31 public class MethodPermission implements java.io.Serializable { 32 33 34 38 41 private java.lang.String _id; 42 43 46 private java.lang.String _description; 47 48 51 private java.util.Vector _roleNameList; 52 53 56 private java.util.Vector _methodList; 57 58 59 63 public MethodPermission() { 64 super(); 65 _roleNameList = new Vector (); 66 _methodList = new Vector (); 67 } 69 70 74 79 public void addMethod(org.openejb.alt.config.ejb11.Method vMethod) 80 throws java.lang.IndexOutOfBoundsException 81 { 82 _methodList.addElement(vMethod); 83 } 85 91 public void addMethod(int index, org.openejb.alt.config.ejb11.Method vMethod) 92 throws java.lang.IndexOutOfBoundsException 93 { 94 _methodList.insertElementAt(vMethod, index); 95 } 97 102 public void addRoleName(java.lang.String vRoleName) 103 throws java.lang.IndexOutOfBoundsException 104 { 105 _roleNameList.addElement(vRoleName); 106 } 108 114 public void addRoleName(int index, java.lang.String vRoleName) 115 throws java.lang.IndexOutOfBoundsException 116 { 117 _roleNameList.insertElementAt(vRoleName, index); 118 } 120 123 public java.util.Enumeration enumerateMethod() 124 { 125 return _methodList.elements(); 126 } 128 131 public java.util.Enumeration enumerateRoleName() 132 { 133 return _roleNameList.elements(); 134 } 136 141 public java.lang.String getDescription() 142 { 143 return this._description; 144 } 146 151 public java.lang.String getId() 152 { 153 return this._id; 154 } 156 161 public org.openejb.alt.config.ejb11.Method getMethod(int index) 162 throws java.lang.IndexOutOfBoundsException 163 { 164 if ((index < 0) || (index > _methodList.size())) { 166 throw new IndexOutOfBoundsException (); 167 } 168 169 return (org.openejb.alt.config.ejb11.Method) _methodList.elementAt(index); 170 } 172 175 public org.openejb.alt.config.ejb11.Method[] getMethod() 176 { 177 int size = _methodList.size(); 178 org.openejb.alt.config.ejb11.Method[] mArray = new org.openejb.alt.config.ejb11.Method[size]; 179 for (int index = 0; index < size; index++) { 180 mArray[index] = (org.openejb.alt.config.ejb11.Method) _methodList.elementAt(index); 181 } 182 return mArray; 183 } 185 188 public int getMethodCount() 189 { 190 return _methodList.size(); 191 } 193 198 public java.lang.String getRoleName(int index) 199 throws java.lang.IndexOutOfBoundsException 200 { 201 if ((index < 0) || (index > _roleNameList.size())) { 203 throw new IndexOutOfBoundsException (); 204 } 205 206 return (String )_roleNameList.elementAt(index); 207 } 209 212 public java.lang.String [] getRoleName() 213 { 214 int size = _roleNameList.size(); 215 java.lang.String [] mArray = new java.lang.String [size]; 216 for (int index = 0; index < size; index++) { 217 mArray[index] = (String )_roleNameList.elementAt(index); 218 } 219 return mArray; 220 } 222 225 public int getRoleNameCount() 226 { 227 return _roleNameList.size(); 228 } 230 233 public boolean isValid() 234 { 235 try { 236 validate(); 237 } 238 catch (org.exolab.castor.xml.ValidationException vex) { 239 return false; 240 } 241 return true; 242 } 244 249 public void marshal(java.io.Writer out) 250 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException 251 { 252 253 Marshaller.marshal(this, out); 254 } 256 261 public void marshal(org.xml.sax.ContentHandler handler) 262 throws java.io.IOException , org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException 263 { 264 265 Marshaller.marshal(this, handler); 266 } 268 271 public void removeAllMethod() 272 { 273 _methodList.removeAllElements(); 274 } 276 279 public void removeAllRoleName() 280 { 281 _roleNameList.removeAllElements(); 282 } 284 289 public org.openejb.alt.config.ejb11.Method removeMethod(int index) 290 { 291 java.lang.Object obj = _methodList.elementAt(index); 292 _methodList.removeElementAt(index); 293 return (org.openejb.alt.config.ejb11.Method) obj; 294 } 296 301 public java.lang.String removeRoleName(int index) 302 { 303 java.lang.Object obj = _roleNameList.elementAt(index); 304 _roleNameList.removeElementAt(index); 305 return (String )obj; 306 } 308 313 public void setDescription(java.lang.String description) 314 { 315 this._description = description; 316 } 318 323 public void setId(java.lang.String id) 324 { 325 this._id = id; 326 } 328 334 public void setMethod(int index, org.openejb.alt.config.ejb11.Method vMethod) 335 throws java.lang.IndexOutOfBoundsException 336 { 337 if ((index < 0) || (index > _methodList.size())) { 339 throw new IndexOutOfBoundsException (); 340 } 341 _methodList.setElementAt(vMethod, index); 342 } 344 349 public void setMethod(org.openejb.alt.config.ejb11.Method[] methodArray) 350 { 351 _methodList.removeAllElements(); 353 for (int i = 0; i < methodArray.length; i++) { 354 _methodList.addElement(methodArray[i]); 355 } 356 } 358 364 public void setRoleName(int index, java.lang.String vRoleName) 365 throws java.lang.IndexOutOfBoundsException 366 { 367 if ((index < 0) || (index > _roleNameList.size())) { 369 throw new IndexOutOfBoundsException (); 370 } 371 _roleNameList.setElementAt(vRoleName, index); 372 } 374 379 public void setRoleName(java.lang.String [] roleNameArray) 380 { 381 _roleNameList.removeAllElements(); 383 for (int i = 0; i < roleNameArray.length; i++) { 384 _roleNameList.addElement(roleNameArray[i]); 385 } 386 } 388 393 public static java.lang.Object unmarshal(java.io.Reader reader) 394 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException 395 { 396 return (org.openejb.alt.config.ejb11.MethodPermission) Unmarshaller.unmarshal(org.openejb.alt.config.ejb11.MethodPermission.class, reader); 397 } 399 402 public void validate() 403 throws org.exolab.castor.xml.ValidationException 404 { 405 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); 406 validator.validate(this); 407 } 409 } 410 | Popular Tags |