Methods Summary |
---|
public void | add(java.security.Permission permission)Adds a permission to this UnresolvedPermissionCollection.
The key for the hash is the unresolved permission's type (class) name.
if (! (permission instanceof UnresolvedPermission))
throw new IllegalArgumentException("invalid permission: "+
permission);
UnresolvedPermission up = (UnresolvedPermission) permission;
List v;
synchronized (this) {
v = (List) perms.get(up.getName());
if (v == null) {
v = new ArrayList();
perms.put(up.getName(), v);
}
}
synchronized (v) {
v.add(up);
}
|
public java.util.Enumeration | elements()Returns an enumeration of all the UnresolvedPermission lists in the
container.
List results = new ArrayList(); // where results are stored
// Get iterator of Map values (which are lists of permissions)
synchronized (this) {
for (Iterator iter = perms.values().iterator(); iter.hasNext();) {
List l = (List) iter.next();
synchronized (l) {
results.addAll(l);
}
}
}
return Collections.enumeration(results);
|
java.util.List | getUnresolvedPermissions(java.security.Permission p)get any unresolved permissions of the same type as p,
and return the List containing them.
synchronized (this) {
return (List) perms.get(p.getClass().getName());
}
|
public boolean | implies(java.security.Permission permission)always returns false for unresolved permissions
return false;
|
private void | readObject(java.io.ObjectInputStream in)
// Don't call defaultReadObject()
// Read in serialized fields
ObjectInputStream.GetField gfields = in.readFields();
// Get permissions
Hashtable permissions = (Hashtable)gfields.get("permissions", null);
perms = new HashMap(permissions.size()*2);
// Convert each entry (Vector) into a List
Set set = permissions.entrySet();
for (Iterator iter = set.iterator(); iter.hasNext(); ) {
Map.Entry e = (Map.Entry)iter.next();
// Convert Vector into ArrayList
Vector vec = (Vector) e.getValue();
List list = new ArrayList(vec.size());
list.addAll(vec);
// Add to Hashtable being serialized
perms.put(e.getKey(), list);
}
|
private void | writeObject(java.io.ObjectOutputStream out)
/*
* Writes the contents of the perms field out as a Hashtable
* in which the values are Vectors for
* serialization compatibility with earlier releases.
*/
// Don't call out.defaultWriteObject()
// Copy perms into a Hashtable
Hashtable permissions = new Hashtable(perms.size()*2);
// Convert each entry (List) into a Vector
synchronized (this) {
Set set = perms.entrySet();
for (Iterator iter = set.iterator(); iter.hasNext(); ) {
Map.Entry e = (Map.Entry)iter.next();
// Convert list into Vector
List list = (List) e.getValue();
Vector vec = new Vector(list.size());
synchronized (list) {
vec.addAll(list);
}
// Add to Hashtable being serialized
permissions.put(e.getKey(), vec);
}
}
// Write out serializable fields
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("permissions", permissions);
out.writeFields();
|