public final class PolicyContext extends Object
http://java.sun.com/j2ee/1.4/docs/api/
Modifier and Type | Method and Description |
---|---|
static Object |
getContext(String key)
This method may be used by a Policy provider to activate the
PolicyContextHandler registered to the context object key and cause it to
return the corresponding policy context object from the container.
|
static String |
getContextID()
This method returns the value of the policy context identifier associated
with the thread on which the accessor is called.
|
static Set |
getHandlerKeys()
This method may be used to obtain the keys that identify the container
specific context handlers registered by the container.
|
static void |
registerHandler(String key,
PolicyContextHandler handler,
boolean replace)
Authorization protected method used to register a container specific
PolicyContext handler.
|
static void |
setContextID(String contextID)
Authorization protected method used to modify the value of the policy
context identifier associated with the thread on which this method is
called
|
static void |
setHandlerData(Object data)
Authorization protected method that may be used to associate a
thread-scoped handler data object with the PolicyContext.
|
public static Object getContext(String key) throws PolicyContextException
key
- - a non-null String that identifies the PolicyContextHandler to
activate as well as the context object to be acquired from the handler.IllegalArgumentException
- - if a PolicyContextHandler has not been
registered for the key or the registered handler no longer supports the key.SecurityException
- - if the caller does not have the
SecurityPermission("getPolicy") permission.PolicyContextException
- - if an operation by this method on the
identified PolicyContextHandler causes it to throw a checked exception
that is not accounted for in the signature of this method.public static String getContextID()
public static Set getHandlerKeys()
public static void registerHandler(String key, PolicyContextHandler handler, boolean replace) throws PolicyContextException
key
- - a case-sensitive, non-null String that identifies the context
object handled by the handler.handler
- - an non-null object that implements the PolicyContextHandler
interface.replace
- - this boolean value defines the behavior of this method
if, when it is called, a PolicyContextHandler has already been registered
to handle the same key. In that case, and if the value of this argument is
true, the existing handler is replaced with the argument handler. If the
value of this parameter is false the existing registration is preserved
and an exception is thrown.IllegalArgumentException
- - if the value of either of the handler
or key arguments is null, or the value of the replace argument is false
and a handler with the same key as the argument handler is already
registered.SecurityException
- - if the caller does not have the
SecurityPermission("setPolicy") permission.PolicyContextException
- - if an operation by this method on the
argument PolicyContextHandler causes it to throw a checked exception that
is not accounted for in the signature of this method.public static void setContextID(String contextID)
contextID
- - a String that represents the value of the policy
context identifier to be assigned to the PolicyContext for the calling
thread. The value null is a legitimate value for this parameter.SecurityException
- - if the caller does not have the
SecurityPermission("setPolicy") permission.public static void setHandlerData(Object data)
data
- - a container-specific object that will be associated with the
calling thread and passed to any handler activated by a Policy provider
(on the thread). The value null is a legitimate value for this parameter,
and is the value that will be used in the activation of handlers if the
setHandlerData has not been called on the thread.SecurityException
- - if the caller does not have the
SecurityPermission("setPolicy") permission.Copyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.