public class LoaderSplitPolicyProvider extends Policy implements DynamicPolicy
LoaderSplitPolicyProvider instance wraps two
 underlying policy providers:
 null class loader, and
 refresh(), which applies to both policies).
 Policy.ParametersUNSUPPORTED_EMPTY_COLLECTION| Constructor and Description | 
|---|
| LoaderSplitPolicyProvider(ClassLoader loader,
                         Policy loaderPolicy,
                         Policy defaultPolicy)Creates a new  LoaderSplitPolicyProviderinstance which
 delegates toloaderPolicyany permission query/grant
 operations involving protection domains or classes with the given class
 loader, any child class loader of the given class loader, or thenullclass loader; all other operations are delegated todefaultPolicy(with the exception ofrefresh,
 which applies to both policies). | 
| Modifier and Type | Method and Description | 
|---|---|
| Permission[] | getGrants(Class cl,
         Principal[] principals)If both underlying policy providers support dynamic grants, delegates to
 the  getGrantsmethod of the underlying policy associated
 with the loader of the given class (the loader-specific policy if the
 class loader isnull, the same as or a child of the loader
 specified in the constructor for this instance, or the default loader
 otherwise). | 
| PermissionCollection | getPermissions(CodeSource source)Delegates to the corresponding  getPermissionsmethod of the
 underlying default policy. | 
| PermissionCollection | getPermissions(ProtectionDomain domain)If the given protection domain is the protection domain of this class,
 then a newly-created  PermissionCollectioncontainingAllPermissionis returned. | 
| void | grant(Class cl,
     Principal[] principals,
     Permission[] permissions)If both underlying policy providers support dynamic grants, delegates to
 the  grantmethod of the underlying policy associated with
 the loader of the given class (the loader-specific policy if the class
 loader isnull, the same as or a child of the loader
 specified in the constructor for this instance, or the default loader
 otherwise). | 
| boolean | grantSupported()Returns  trueif both of the underlying policy providers
 implementDynamicPolicyand returntruefrom calls
 tograntSupported; returnsfalseotherwise. | 
| boolean | implies(ProtectionDomain domain,
       Permission permission)If the given protection domain is the protection domain of this class,
 then  trueis returned. | 
| void | refresh()Invokes  refreshon both the loader-specific and default
 underlying policy providers. | 
getInstance, getInstance, getInstance, getParameters, getPolicy, getProvider, getType, setPolicypublic LoaderSplitPolicyProvider(ClassLoader loader, Policy loaderPolicy, Policy defaultPolicy)
LoaderSplitPolicyProvider instance which
 delegates to loaderPolicy any permission query/grant
 operations involving protection domains or classes with the given class
 loader, any child class loader of the given class loader, or the
 null class loader; all other operations are delegated to
 defaultPolicy (with the exception of refresh,
 which applies to both policies).loader - class loader for which associated permission query/grant
                operations should be forwarded to loaderPolicyloaderPolicy - class loader-specific security policy providerdefaultPolicy - default security policy providerNullPointerException - if loader,
                loaderPolicy or defaultPolicy is
                nullpublic PermissionCollection getPermissions(CodeSource source)
getPermissions method of the
 underlying default policy.getPermissions in class Policysource - code source for which to look up permissionspublic PermissionCollection getPermissions(ProtectionDomain domain)
PermissionCollection containing AllPermission is returned.  If not, delegates to the corresponding
 getPermissions method of the underlying policy associated
 with the loader of the given class (the loader-specific policy if the
 class loader is null, the same as or a child of the loader
 specified in the constructor for this instance, or the default loader
 otherwise).getPermissions in class Policydomain - protection domain for which to look up permissionspublic boolean implies(ProtectionDomain domain, Permission permission)
true is returned.  If not, delegates to the
 implies method of the underlying policy associated with the
 loader of the given class (the loader-specific policy if the class
 loader is null, the same as or a child of the loader
 specified in the constructor for this instance, or the default loader
 otherwise).public void refresh()
refresh on both the loader-specific and default
 underlying policy providers.public boolean grantSupported()
true if both of the underlying policy providers
 implement DynamicPolicy and return true from calls
 to grantSupported; returns false otherwise.grantSupported in interface DynamicPolicytrue if policy supports dynamic permission grants
                under current context, false otherwisepublic void grant(Class cl, Principal[] principals, Permission[] permissions)
grant method of the underlying policy associated with
 the loader of the given class (the loader-specific policy if the class
 loader is null, the same as or a child of the loader
 specified in the constructor for this instance, or the default loader
 otherwise).  If at least one of the underlying policy providers does not
 support dynamic grants, throws an
 UnsupportedOperationException.grant in interface DynamicPolicycl - class to grant permissions to the class loader of, or
                null if granting across all class loadersprincipals - if non-null, minimum set of principals
                to which grants applypermissions - if non-null, permissions to grantUnsupportedOperationException - if policy does not support
          dynamic grants, or if cl is non-null
          and belongs to a protection domain with a null
          class loader other than the system domainSecurityException - if a security manager is installed and the
          calling context does not have sufficient permissions to grant
          the given permissionsNullPointerException - if any element of the principals or
          permissions arrays is nullpublic Permission[] getGrants(Class cl, Principal[] principals)
getGrants method of the underlying policy associated
 with the loader of the given class (the loader-specific policy if the
 class loader is null, the same as or a child of the loader
 specified in the constructor for this instance, or the default loader
 otherwise).  If at least one of the underlying policy providers does not
 support dynamic grants, throws an
 UnsupportedOperationException.getGrants in interface DynamicPolicycl - class to query the permissions dynamically granted to the
          class loader of, or null if querying permissions
          granted across all class loadersprincipals - if non-null, principals to query
                dynamic grants forUnsupportedOperationException - if policy does not support
          dynamic grants, or if cl is non-null
          and belongs to a protection domain with a null
          class loader other than the system domainNullPointerException - if any element of the principals array is
          nullCopyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.