Java Doc for PermissionChecker.java in  » IDE-Netbeans » visualweb.api.designer » com » sun » rave » web » ui » util » 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 » IDE Netbeans » visualweb.api.designer » com.sun.rave.web.ui.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.rave.web.ui.util.PermissionChecker

PermissionChecker
public class PermissionChecker (Code)
This class takes a "Permission String" and is cabable of determining if a user passes the permission check. Supported "checks" are:
  • Boolean -- "true" or "false"
The format of the "Permission String" must be an equation that results in a boolean answer. The supported functions/operators are: --
  • $<type>{<key>} -- To read a value according to <type> using <key> (See: com.sun.rave.web.ui.util.VariableResolver ). (null is interpretted as false, non boolean values (besides the string "false") are interpretted to mean true)
  • '(' and ')' can be used to define order of operation
  • '!' may be used to negate a value
  • '|' may be used as a logical OR
  • '&' may be used as a logical AND
  • '=' may be used as a String equals
Operator Precedence (for infix notation) is:
  • () -- Highest
  • !
  • &
  • |
  • =

See Also:   VariableResolver
author:
   Ken Paulsen (ken.paulsen@sun.com)

Inner Class :public static interface Function
Inner Class :protected class StringFunction implements PermissionChecker.Function
Inner Class :protected static class BooleanFunction implements PermissionChecker.Function

Field Summary
final public static  charAND_OPERATOR
    
final public static  charARGUMENT_SEPARATOR
    
final public static  charEQUALS_OPERATOR
    
final public static  StringFALSE
    
final public static  BooleanFunctionFALSE_BOOLEAN_FUNCTION
     This variable represents a "false" BooleanFunction.
final public static  charFUNCTION_MARKER
    
final public static  charLEFT_PAREN
    
final public static  charLESS_THAN_OPERATOR
    
final public static  charMODULUS_OPERATOR
    
final public static  charMORE_THAN_OPERATOR
    
final public static  charNOT_OPERATOR
    
final public static  charOR_OPERATOR
    
final protected static  charPOST_FALSE
    
final protected static  charPOST_FALSE_CAP
    
final protected static  charPOST_TRUE
    
final protected static  charPOST_TRUE_CAP
    
final public static  charRIGHT_PAREN
    
final public static  StringTRUE
    
final public static  BooleanFunctionTRUE_BOOLEAN_FUNCTION
     This variable represents a "true" BooleanFunction.

Constructor Summary
public  PermissionChecker(LayoutElement desc, UIComponent component, String infixStr)
     This is the constructor method that is required to create this object.

Method Summary
protected  char[]generatePostfix(String infixStr)
     This method calculates the postfix representation of the infix equation passed in.
protected static  FunctiongetFunction(String functionName)
     This method is a factory method for constructing a new function based on the function name passed in.
public  StringgetInfix()
     This method returns the infix representation of the equation, in other words: the original String passed in.
public  LayoutElementgetLayoutElement()
    
public  StringgetPostfix()
    
protected  char[]getPostfixArr()
    
public  UIComponentgetUIComponent()
    
public  booleanhasPermission()
     This method is invoked to determine if the equation evaluates to true or false.
public static  booleanisOperator(char ch)
     This method returns true if the given character is a valid operator.
public static  voidmain(String args)
     This is here to provide some test cases.
protected  char[]preProcessString(String source)
     This method replaces all "true" / "false" strings w/ 't'/'f'.
public static  voidregisterFunction(String functionName, Class function)
    

This method allows arbitrary functions to be registered.

public  voidsetInfix(String equation)
     This method sets the equation and forces a re-evaluation of the equation.
protected  voidsetLayoutElement(LayoutElement desc)
    

This method sets the LayoutElement that is associated with the 'if' check being evaluated.

protected  voidsetPostfixArr(char postfix)
    
protected  voidsetUIComponent(UIComponent component)
    

This method sets the LayoutElement that is associated with the 'if' check being evaluated.

protected  intstoreFunction(char arr, int idx)
    

This method looks at the given char array starting at index and continues until an operator (or end of String) is encountered.

public static  StringstripWhiteSpace(String input)
    
public  StringtoString()
     Displays the infix and postfix version of the equation.

Field Detail
AND_OPERATOR
final public static char AND_OPERATOR(Code)



ARGUMENT_SEPARATOR
final public static char ARGUMENT_SEPARATOR(Code)



EQUALS_OPERATOR
final public static char EQUALS_OPERATOR(Code)



FALSE
final public static String FALSE(Code)



FALSE_BOOLEAN_FUNCTION
final public static BooleanFunction FALSE_BOOLEAN_FUNCTION(Code)
This variable represents a "false" BooleanFunction.



FUNCTION_MARKER
final public static char FUNCTION_MARKER(Code)



LEFT_PAREN
final public static char LEFT_PAREN(Code)



LESS_THAN_OPERATOR
final public static char LESS_THAN_OPERATOR(Code)



MODULUS_OPERATOR
final public static char MODULUS_OPERATOR(Code)



MORE_THAN_OPERATOR
final public static char MORE_THAN_OPERATOR(Code)



NOT_OPERATOR
final public static char NOT_OPERATOR(Code)



OR_OPERATOR
final public static char OR_OPERATOR(Code)



POST_FALSE
final protected static char POST_FALSE(Code)



POST_FALSE_CAP
final protected static char POST_FALSE_CAP(Code)



POST_TRUE
final protected static char POST_TRUE(Code)



POST_TRUE_CAP
final protected static char POST_TRUE_CAP(Code)



RIGHT_PAREN
final public static char RIGHT_PAREN(Code)



TRUE
final public static String TRUE(Code)



TRUE_BOOLEAN_FUNCTION
final public static BooleanFunction TRUE_BOOLEAN_FUNCTION(Code)
This variable represents a "true" BooleanFunction.




Constructor Detail
PermissionChecker
public PermissionChecker(LayoutElement desc, UIComponent component, String infixStr)(Code)
This is the constructor method that is required to create this object.




Method Detail
generatePostfix
protected char[] generatePostfix(String infixStr)(Code)
This method calculates the postfix representation of the infix equation passed in. It returns the postfix equation as a char[].
Parameters:
  infixStr - The infix representation of the equation. postfix representation of the equation as a char[] (the f()'sare removed and stored in _functionList).



getFunction
protected static Function getFunction(String functionName)(Code)
This method is a factory method for constructing a new function based on the function name passed in. The function must be registered prior to invoking this method.



getInfix
public String getInfix()(Code)
This method returns the infix representation of the equation, in other words: the original String passed in.



getLayoutElement
public LayoutElement getLayoutElement()(Code)

Retreives the LayoutElement associated with this PermissionChecker (only needed in cases where a expression requires a LayoutElement for evaluation).




getPostfix
public String getPostfix()(Code)



getPostfixArr
protected char[] getPostfixArr()(Code)



getUIComponent
public UIComponent getUIComponent()(Code)

Retreives the LayoutElement associated with this PermissionChecker (only needed in cases where a expression requires a LayoutElement for evaluation).




hasPermission
public boolean hasPermission()(Code)
This method is invoked to determine if the equation evaluates to true or false.



isOperator
public static boolean isOperator(char ch)(Code)
This method returns true if the given character is a valid operator.



main
public static void main(String args)(Code)
This is here to provide some test cases. It only tests the conversion to postfix notation.



preProcessString
protected char[] preProcessString(String source)(Code)
This method replaces all "true" / "false" strings w/ 't'/'f'. It converts the String into a char[]. It replaces all user defined functions w/ 'F' and places a Function in a list per the registered user-defined function. All other strings are converted to an 'F' and a StringFunction is added to the function list.



registerFunction
public static void registerFunction(String functionName, Class function)(Code)

This method allows arbitrary functions to be registered. Function names should only contain letters or numbers, other characters or whitespace may cause problems. No checking is done to ensure this, however.

Functions will be expressed in an equation as follows:

  • function_name(param1,param2)

Function parameters also should only contain alpha-numeric characters.

Functions must implement PermissionChecker.Function interface




setInfix
public void setInfix(String equation)(Code)
This method sets the equation and forces a re-evaluation of the equation. It returns the postfix representation of the equation.
Parameters:
  equation - The infix equation to use



setLayoutElement
protected void setLayoutElement(LayoutElement desc)(Code)

This method sets the LayoutElement that is associated with the 'if' check being evaluated. This is not normally needed, it is only needed if the 'if' check contains an expression which requires a LayoutElement to be properly evaluated.




setPostfixArr
protected void setPostfixArr(char postfix)(Code)



setUIComponent
protected void setUIComponent(UIComponent component)(Code)

This method sets the LayoutElement that is associated with the 'if' check being evaluated. This is not normally needed, it is only needed if the 'if' check contains an expression which requires a LayoutElement to be properly evaluated.




storeFunction
protected int storeFunction(char arr, int idx)(Code)

This method looks at the given char array starting at index and continues until an operator (or end of String) is encountered. It then uses this string to lookup a registered function (if any), it stores that function (with parameters)... or if the function is not found, it registers a "String function" (which always returns true).




stripWhiteSpace
public static String stripWhiteSpace(String input)(Code)
This method removes all whitespace from the given String



toString
public String toString()(Code)
Displays the infix and postfix version of the equation.



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.