1 23 package com.sun.enterprise.deployment; 24 25 import com.sun.enterprise.deployment.web.SecurityRole; 26 import com.sun.enterprise.deployment.web.AuthorizationConstraint; 27 28 import java.util.Enumeration ; 29 import java.util.Vector ; 30 import java.util.HashSet ; 31 import java.util.Set ; 32 33 39 40 public class AuthorizationConstraintImpl extends Descriptor implements 41 AuthorizationConstraint { 42 private Set securityRoles; 43 44 48 public AuthorizationConstraintImpl() { 49 } 50 51 54 public AuthorizationConstraintImpl(AuthorizationConstraintImpl other) { 55 this.securityRoles = new HashSet (other.getSecurityRoleSet()); 56 } 57 58 61 private Set getSecurityRoleSet() { 62 if (this.securityRoles == null) { 63 this.securityRoles = new HashSet (); 64 } 65 return this.securityRoles; 66 } 67 68 73 public Enumeration getSecurityRoles() { 74 if (this.securityRoles == null) { 75 this.securityRoles = new HashSet (); 76 } 77 return (new Vector (this.getSecurityRoleSet())).elements(); 78 } 79 80 84 public void addSecurityRole(SecurityRole securityRole) { 85 this.getSecurityRoleSet().add(securityRole); 86 } 87 88 92 public void addSecurityRole(String roleName) { 93 SecurityRoleDescriptor sr = new SecurityRoleDescriptor(); 94 sr.setName(roleName); 95 addSecurityRole(sr); 96 } 97 98 102 public void removeSecurityRole(SecurityRole securityRole) { 103 this.getSecurityRoleSet().remove(securityRole); 104 } 105 106 109 public void print(StringBuffer toStringBuffer) { 110 toStringBuffer.append("AuthorizationConstraint "); 111 super.print(toStringBuffer); 112 toStringBuffer.append(" securityRoles ").append(this.securityRoles); 113 } 114 115 } 116 | Popular Tags |