Java Doc for PolicyContext.java in  » EJB-Server-JBoss-4.2.1 » j2ee » javax » security » jacc » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » EJB Server JBoss 4.2.1 » j2ee » javax.security.jacc 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.security.jacc.PolicyContext

PolicyContext
final public class PolicyContext (Code)
This utility class is used by containers to communicate policy context identifiers and other policy relevant context to Policy providers. Policy providers use the policy context identifier to select the subset of policy to apply in access decisions. The value of a policy context identifier is a String and each thread has an independently established policy context identifier. A container will establish the thread-scoped value of a policy context identifier by calling the static setContextID method. The value of a thread-scoped policy context identifier is available (to Policy) by calling the static getContextID method. This class is also used by Policy providers to request additional thread-scoped policy relevant context objects from the calling container. Containers register container-specific PolicyContext handlers using the static registerHandler method. Handler registration is scoped to the class, such that the same handler registrations are active in all thread contexts. Containers may use the static method setHandlerData to establish a thread-scoped parameter that will be passed to handlers when they are activated by Policy providers. The static getContext method is used to activate a handler and obtain the corresponding context object. The static accessor functions provided by this class allow per-thread policy context values to be established and communicated independent of a common reference to a particular PolicyContext instance. The PolicyContext class may encapsulate static ThreadLocal instance variables to represent the policy context identifier and handler data values. The Application server must bundle or install the PolicyContext class, and the containers of the application server must prevent the methods of the PolicyContext class from being called from calling contexts that are not authorized to call these methods. With the exception of the getContextID and GetHandlerKeys methods, containers must restrict and afford access to the methods of the PolicyContext class to calling contexts trusted by the container to perform container access decisions. The PolicyContext class may satisfy this requirement (on behalf of its container) by rejecting calls made from an AccessControlContext that has not been granted the "setPolicy" SecurityPermission, and by ensuring that Policy providers used to perform container access decisions are granted the "setPolicy" permission.
See Also:    http://java.sun.com/j2ee/1.4/docs/api/
author:
   Scott.Stark@jboss.org
author:
   Ron Monzillo, Gary Ellison (javadoc)
version:
   $Revision: 57196 $




Method Summary
public static  ObjectgetContext(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.
public static  StringgetContextID()
     This method returns the value of the policy context identifier associated with the thread on which the accessor is called. the possibly null policy context identifier established for thethread.
public static  SetgetHandlerKeys()
     This method may be used to obtain the keys that identify the container specific context handlers registered by the container.
public static  voidregisterHandler(String key, PolicyContextHandler handler, boolean replace)
     Authorization protected method used to register a container specific PolicyContext handler.
public static  voidsetContextID(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
Parameters:
  contextID - - a String that represents the value of the policycontext identifier to be assigned to the PolicyContext for the callingthread.
public static  voidsetHandlerData(Object data)
     Authorization protected method that may be used to associate a thread-scoped handler data object with the PolicyContext.



Method Detail
getContext
public static Object getContext(String key) throws PolicyContextException(Code)
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. When this method activates a handler, it passes to the handler the context object key and the handler data associated with the calling thread.
Parameters:
  key - - a non-null String that identifies the PolicyContextHandler toactivate as well as the context object to be acquired from the handler. the container and handler specific object containing the desiredcontext. A null value is returned if the corresponding handler has beenregistered, and the value of the corresponding context is null.
throws:
  IllegalArgumentException - - if a PolicyContextHandler has not beenregistered for the key or the registered handler no longer supports the key.
throws:
  SecurityException - - if the caller does not have theSecurityPermission("getPolicy") permission.
throws:
  PolicyContextException - - if an operation by this method on theidentified PolicyContextHandler causes it to throw a checked exceptionthat is not accounted for in the signature of this method.



getContextID
public static String getContextID()(Code)
This method returns the value of the policy context identifier associated with the thread on which the accessor is called. the possibly null policy context identifier established for thethread. This method must return the default policy context identifier,null, if the policy context identifier of the thread has not been set viasetContext to another value.



getHandlerKeys
public static Set getHandlerKeys()(Code)
This method may be used to obtain the keys that identify the container specific context handlers registered by the container. A Set, the elements of which, are the String key values thatidentify the handlers that have been registered and therefore may beactivated on the PolicyContext



registerHandler
public static void registerHandler(String key, PolicyContextHandler handler, boolean replace) throws PolicyContextException(Code)
Authorization protected method used to register a container specific PolicyContext handler. A handler may be registered to handle multiple keys, but at any time, at most one handler may be registered for a key.
Parameters:
  key - - a case-sensitive, non-null String that identifies the contextobject handled by the handler.
Parameters:
  handler - - an non-null object that implements the PolicyContextHandlerinterface.
Parameters:
  replace - - this boolean value defines the behavior of this methodif, when it is called, a PolicyContextHandler has already been registeredto handle the same key. In that case, and if the value of this argument istrue, the existing handler is replaced with the argument handler. If thevalue of this parameter is false the existing registration is preservedand an exception is thrown.
throws:
  IllegalArgumentException - - if the value of either of the handleror key arguments is null, or the value of the replace argument is falseand a handler with the same key as the argument handler is alreadyregistered.
throws:
  SecurityException - - if the caller does not have theSecurityPermission("setPolicy") permission.
throws:
  PolicyContextException - - if an operation by this method on theargument PolicyContextHandler causes it to throw a checked exception thatis not accounted for in the signature of this method.



setContextID
public static void setContextID(String contextID)(Code)
Authorization protected method used to modify the value of the policy context identifier associated with the thread on which this method is called
Parameters:
  contextID - - a String that represents the value of the policycontext identifier to be assigned to the PolicyContext for the callingthread. The value null is a legitimate value for this parameter.
throws:
  SecurityException - - if the caller does not have theSecurityPermission("setPolicy") permission.



setHandlerData
public static void setHandlerData(Object data)(Code)
Authorization protected method that may be used to associate a thread-scoped handler data object with the PolicyContext. The handler data object will be made available to handlers, where it can serve to supply or bind the handler to invocation scoped state within the container.
Parameters:
  data - - a container-specific object that will be associated with thecalling 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 thesetHandlerData has not been called on the thread.
throws:
  SecurityException - - if the caller does not have theSecurityPermission("setPolicy") permission.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.