java.security
Class AccessControlContext

java.lang.Object
  |
  +--java.security.AccessControlContext

public final class AccessControlContext
extends Object

Untamed:


Field Summary
private  DomainCombiner combiner
           
private  ProtectionDomain[] context
           
private static sun.security.util.Debug debug
           
private static boolean debugInit
           
private  boolean isPrivileged
           
private  AccessControlContext privilegedContext
           
 
Constructor Summary
  AccessControlContext(AccessControlContext acc, DomainCombiner combiner)
          Enabled: Create a new AccessControlContext with the given AccessControlContext and DomainCombiner.
  AccessControlContext(ProtectionDomain[] context)
          Enabled: Create an AccessControlContext with the given set of ProtectionDomains.
(package private) AccessControlContext(ProtectionDomain[] context, boolean isPrivileged)
          package private constructor for AccessController.getContext()
private AccessControlContext(ProtectionDomain[] context, DomainCombiner combiner)
           
 
Method Summary
 void checkPermission(Permission perm)
          Enabled: Determines whether the access request indicated by the specified permission should be allowed or denied, based on the security policy currently in effect, and the context in this object.
private  boolean containsAllPDs(AccessControlContext that)
           
 boolean equals(Object obj)
          Suppressed: Checks two AccessControlContext objects for equality.
(package private) static sun.security.util.Debug getDebug()
           
 DomainCombiner getDomainCombiner()
          Enabled: Get the DomainCombiner associated with this AccessControlContext.
private  AccessControlContext goCombiner(ProtectionDomain[] current, AccessControlContext assigned)
           
 int hashCode()
          Suppressed: Returns the hash code value for this context.
(package private)  boolean isPrivileged()
          Returns true if this context is privileged.
(package private)  AccessControlContext optimize()
          Take the stack-based context (this) and combine it with the privileged or inherited context, if need be.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

private ProtectionDomain[] context

isPrivileged

private boolean isPrivileged

privilegedContext

private AccessControlContext privilegedContext

combiner

private DomainCombiner combiner

debugInit

private static boolean debugInit

debug

private static sun.security.util.Debug debug
Constructor Detail

AccessControlContext

public AccessControlContext(ProtectionDomain[] context)
Enabled: Create an AccessControlContext with the given set of ProtectionDomains. Context must not be null. Duplicate domains will be removed from the context.

Parameters:
context - the ProtectionDomains associated with this context.

AccessControlContext

public AccessControlContext(AccessControlContext acc,
                            DomainCombiner combiner)
Enabled: Create a new AccessControlContext with the given AccessControlContext and DomainCombiner. This constructor associates the provided DomainCombiner with the provided AccessControlContext.

Parameters:
acc - the AccessControlContext associated with the provided DomainCombiner.

combiner - the DomainCombiner to be associated with the provided AccessControlContext.

AccessControlContext

private AccessControlContext(ProtectionDomain[] context,
                             DomainCombiner combiner)

AccessControlContext

AccessControlContext(ProtectionDomain[] context,
                     boolean isPrivileged)
package private constructor for AccessController.getContext()

Method Detail

getDebug

static sun.security.util.Debug getDebug()

isPrivileged

boolean isPrivileged()
Returns true if this context is privileged.


getDomainCombiner

public DomainCombiner getDomainCombiner()
Enabled: Get the DomainCombiner associated with this AccessControlContext.

Returns:
the DomainCombiner associated with this AccessControlContext, or null if there is none.

checkPermission

public void checkPermission(Permission perm)
                     throws AccessControlException
Enabled: Determines whether the access request indicated by the specified permission should be allowed or denied, based on the security policy currently in effect, and the context in this object.

This method quietly returns if the access request is permitted, or throws a suitable AccessControlException otherwise.

Parameters:
perm - the requested permission.
AccessControlException

optimize

AccessControlContext optimize()
Take the stack-based context (this) and combine it with the privileged or inherited context, if need be.


goCombiner

private AccessControlContext goCombiner(ProtectionDomain[] current,
                                        AccessControlContext assigned)

equals

public boolean equals(Object obj)
Suppressed: Checks two AccessControlContext objects for equality. Checks that obj is an AccessControlContext and has the same set of ProtectionDomains as this context.

Overrides:
equals in class Object
Parameters:
obj - the object we are testing for equality with this object.
Returns:
true if obj is an AccessControlContext, and has the same set of ProtectionDomains as this context, false otherwise.
See Also:
Object.hashCode(), java.util.Hashtable

containsAllPDs

private boolean containsAllPDs(AccessControlContext that)

hashCode

public int hashCode()
Suppressed: Returns the hash code value for this context. The hash code is computed by exclusive or-ing the hash code of all the protection domains in the context together.

Overrides:
hashCode in class Object
Returns:
a hash code value for this context.
See Also:
java.lang.Object#equals(java.lang.Object), java.util.Hashtable


comments?