public abstract class AbstractPolicy extends Policy
Policy.Parameters| Modifier and Type | Field and Description |
|---|---|
protected Permission |
ALL_PERMISSION |
protected Comparator<Permission> |
comparator |
protected Permission |
umbrella |
UNSUPPORTED_EMPTY_COLLECTION| Modifier | Constructor and Description |
|---|---|
protected |
AbstractPolicy() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkCallerHasGrants(Collection<PermissionGrant> grants)
This method checks that the PermissionGrant's are authorised to be
granted by it's caller, if it Fails, it will throw a SecurityException
or AccessControlException.
|
protected void |
checkNullElements(Object[] array)
Checks array for null elements
|
protected PermissionCollection |
convert(NavigableSet<Permission> permissions,
int initialCapacity,
float loadFactor,
int concurrencyLevel,
int unresolvedCapacity)
Creates an optimised PermissionCollection, firstly all permissions should
be sorted using
PermissionComparator, this ensures that any
SocketPermission will be ordered to avoid reverse DNS calls if possible. |
protected void |
expandUmbrella(PermissionCollection pc)
River-26 Mark Brouwer suggested making UmbrellaPermission's expandable
from Dynamic Grants.
|
protected PermissionGrant |
extractGrantFromPolicy(Policy p,
ProtectionDomain domain) |
protected void |
processGrants(Collection<PermissionGrant> grant,
Class permClass,
boolean stopIfAll,
NavigableSet<Permission> setToAddPerms)
Adds Permission objects contained in PermissionGrant's to a NavigableSet
that is sorted using a PermissionComparator.
|
getInstance, getInstance, getInstance, getParameters, getPermissions, getPermissions, getPolicy, getProvider, getType, implies, refresh, setPolicyprotected final Permission umbrella
protected final Permission ALL_PERMISSION
protected final Comparator<Permission> comparator
protected final void checkCallerHasGrants(Collection<PermissionGrant> grants) throws SecurityException
grants - to checkSecurityExceptionprotected final void checkNullElements(Object[] array) throws NullPointerException
array - to check for null elements.NullPointerException - if array contains null elements or array is null.protected final PermissionCollection convert(NavigableSet<Permission> permissions, int initialCapacity, float loadFactor, int concurrencyLevel, int unresolvedCapacity) throws IllegalArgumentException
PermissionComparator, this ensures that any
SocketPermission will be ordered to avoid reverse DNS calls if possible.
Other parameters enable the underlying ConcurrentHashMap
to be optimised, these parameters use identical names.permissions - to be optimizedinitialCapacity - see ConcurrentHashMaploadFactor - see ConcurrentHashMapconcurrencyLevel - see ConcurrentHashMapunresolvedCapacity - Capacity of Map used to store
UnresolvedPermission instancesIllegalArgumentException - if the initial capacity is
negative or the load factor or concurrencyLevel are
nonpositive.protected final void expandUmbrella(PermissionCollection pc)
pc - PermissionCollection containing UmbrellaPermission's to be
expanded.protected final void processGrants(Collection<PermissionGrant> grant, Class permClass, boolean stopIfAll, NavigableSet<Permission> setToAddPerms)
grant - array of PermissionGrants.permClass - optionally only add Permission objects that use this
class or UnresolvedPermission.stopIfAll - if true returns immediately when AllPermission is
found.setToAddPerms - Permission objects extracted from grant will be
added to this set.protected PermissionGrant extractGrantFromPolicy(Policy p, ProtectionDomain domain)
Copyright © 2016–2018 The Apache Software Foundation. All rights reserved.