1 11 12 package org.eclipse.osgi.framework.internal.core; 13 14 import java.security.Permission ; 15 import java.security.PermissionCollection ; 16 import java.util.Enumeration ; 17 import java.util.Hashtable ; 18 19 34 class PermissionsHash extends PermissionCollection { 35 private static final long serialVersionUID = 3258408426341284153L; 36 39 Hashtable perms = new Hashtable (8); 40 41 45 public PermissionsHash() { 46 super(); 47 } 48 49 57 public void add(Permission perm) { 58 if (isReadOnly()) { 59 throw new SecurityException (); 60 } 61 62 perms.put(perm, perm); 63 } 64 65 72 public Enumeration elements() { 73 return perms.keys(); 74 } 75 76 87 public boolean implies(Permission perm) { 88 Permission p = (Permission ) perms.get(perm); 89 90 if ((p != null) && p.implies(perm)) { 91 return true; 92 } 93 94 Enumeration permsEnum = elements(); 95 96 while (permsEnum.hasMoreElements()) { 97 if (((Permission ) permsEnum.nextElement()).implies(perm)) { 98 return true; 99 } 100 } 101 102 return false; 103 } 104 } 105 | Popular Tags |