|
GigaSpaces XAP 10.0.1 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.security.Policy com.sun.jini.start.LoaderSplitPolicyProvider
public class LoaderSplitPolicyProvider
Security policy provider which handles permission queries and grants by
delegating to different policy providers depending on the class loader
involved. Each LoaderSplitPolicyProvider
instance wraps two
underlying policy providers:
null
class loader, and
refresh()
, which applies to both policies).
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.security.Policy |
---|
Policy.Parameters |
Field Summary |
---|
Fields inherited from class java.security.Policy |
---|
UNSUPPORTED_EMPTY_COLLECTION |
Constructor Summary | |
---|---|
LoaderSplitPolicyProvider(ClassLoader loader,
Policy loaderPolicy,
Policy defaultPolicy)
Creates a new 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). |
Method Summary | |
---|---|
Permission[] |
getGrants(Class cl,
Principal[] principals)
If both underlying policy providers support dynamic grants, delegates to the 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). |
PermissionCollection |
getPermissions(CodeSource source)
Delegates to the corresponding getPermissions method 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 PermissionCollection containing AllPermission is returned. |
void |
grant(Class cl,
Principal[] principals,
Permission[] permissions)
If both underlying policy providers support dynamic grants, delegates to the 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). |
boolean |
grantSupported()
Returns true if both of the underlying policy providers
implement DynamicPolicy and return true from calls
to grantSupported ; returns false otherwise. |
boolean |
implies(ProtectionDomain domain,
Permission permission)
If the given protection domain is the protection domain of this class, then true is returned. |
void |
refresh()
Invokes refresh on both the loader-specific and default
underlying policy providers. |
Methods inherited from class java.security.Policy |
---|
getInstance, getInstance, getInstance, getParameters, getPolicy, getProvider, getType, setPolicy |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public 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 loaderPolicy
loaderPolicy
- class loader-specific security policy providerdefaultPolicy
- default security policy provider
NullPointerException
- if loader
,
loaderPolicy
or defaultPolicy
is
null
Method Detail |
---|
public PermissionCollection getPermissions(CodeSource source)
getPermissions
method of the
underlying default policy.
getPermissions
in class Policy
source
- code source for which to look up permissions
public 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 Policy
domain
- protection domain for which to look up permissions
public 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).
implies
in class Policy
domain
- protection domain in which to check implicationpermission
- permission to test implication of
true
if permission is implied by permissions of
given protection domain, false
otherwisepublic void refresh()
refresh
on both the loader-specific and default
underlying policy providers.
refresh
in class Policy
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 DynamicPolicy
true
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 DynamicPolicy
cl
- 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 grant
UnsupportedOperationException
- 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 domain
SecurityException
- if a security manager is installed and the
calling context does not have sufficient permissions to grant
the given permissions
NullPointerException
- if any element of the principals or
permissions arrays is null
public 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 DynamicPolicy
cl
- 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 for
UnsupportedOperationException
- 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 domain
NullPointerException
- if any element of the principals array is
null
|
GigaSpaces XAP 10.0.1 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |