Methods Summary |
---|
public void | add(java.security.Permission permission)Adds an unresolved permission to this {@code
UnresolvedPermissionCollection}.
if (isReadOnly()) {
throw new SecurityException(Messages.getString("security.15")); //$NON-NLS-1$
}
if (permission == null
|| permission.getClass() != UnresolvedPermission.class) {
throw new IllegalArgumentException(Messages.getString("security.16", //$NON-NLS-1$
permission));
}
synchronized (klasses) {
String klass = permission.getName();
Collection klassMates = (Collection)klasses.get(klass);
if (klassMates == null) {
klassMates = new HashSet();
klasses.put(klass, klassMates);
}
klassMates.add(permission);
}
|
public java.util.Enumeration | elements()
Collection all = new ArrayList();
for (Iterator iter = klasses.values().iterator(); iter.hasNext();) {
all.addAll((Collection)iter.next());
}
return Collections.enumeration(all);
|
boolean | hasUnresolved(java.security.Permission permission)Returns true if this collection contains unresolved permissions
with the same classname as argument permission.
return klasses.containsKey(permission.getClass().getName());
|
public boolean | implies(java.security.Permission permission)Always returns {@code false}.
return false;
|
private void | readObject(java.io.ObjectInputStream in)
ObjectInputStream.GetField fields = in.readFields();
Map permissions = (Map)fields.get("permissions", null); //$NON-NLS-1$
klasses = new HashMap();
synchronized (klasses) {
for (Iterator iter = permissions.keySet().iterator(); iter
.hasNext();) {
String key = (String)iter.next();
Collection values = (Collection)permissions.get(key);
for (Iterator iterator = values.iterator(); iterator.hasNext();) {
UnresolvedPermission element = (UnresolvedPermission)iterator
.next();
if (!element.getName().equals(key)) {
throw new InvalidObjectException(
Messages.getString("security.22")); //$NON-NLS-1$
}
}
klasses.put(key, new HashSet(values));
}
}
|
java.security.PermissionCollection | resolveCollection(java.security.Permission target, java.security.PermissionCollection holder)Resolves all permissions of the same class as the specified target
permission and adds them to the specified collection. If passed
collection is {@code null} and some unresolved permissions were resolved,
an appropriate new collection is instantiated and used. All resolved
permissions are removed from this unresolved collection, and collection
with resolved ones is returned.
String klass = target.getClass().getName();
if (klasses.containsKey(klass)) {
synchronized (klasses) {
Collection klassMates = (Collection)klasses.get(klass);
for (Iterator iter = klassMates.iterator(); iter.hasNext();) {
UnresolvedPermission element = (UnresolvedPermission)iter
.next();
Permission resolved = element.resolve(target.getClass());
if (resolved != null) {
if (holder == null) {
holder = target.newPermissionCollection();
if (holder == null) {
holder = new PermissionsHash();
}
}
holder.add(resolved);
iter.remove();
}
}
if (klassMates.size() == 0) {
klasses.remove(klass);
}
}
}
return holder;
|
private void | writeObject(java.io.ObjectOutputStream out)
Hashtable permissions = new Hashtable();
for (Iterator iter = klasses.keySet().iterator(); iter.hasNext();) {
String key = (String)iter.next();
permissions.put(key, new Vector(((Collection)klasses.get(key))));
}
ObjectOutputStream.PutField fields = out.putFields();
fields.put("permissions", permissions); //$NON-NLS-1$
out.writeFields();
|