Java Doc for PolicyUtils.java in  » Apache-Harmony-Java-SE » org-package » org » apache » harmony » security » fortress » 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 » Apache Harmony Java SE » org package » org.apache.harmony.security.fortress 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.harmony.security.fortress.PolicyUtils

PolicyUtils
public class PolicyUtils (Code)
This class consist of a number of static methods, which provide a common functionality for various policy and configuration providers.

Inner Class :public static class URLLoader implements PrivilegedExceptionAction<InputStream>
Inner Class :public static class SystemKit implements PrivilegedAction<Properties>
Inner Class :public static class SystemPropertyAccessor implements PrivilegedAction<String>
Inner Class :public static class SecurityPropertyAccessor implements PrivilegedAction<String>
Inner Class :public static class ProviderLoader implements PrivilegedAction<T>
Inner Class :public static class ExpansionFailedException extends Exception
Inner Class :public static interface GeneralExpansionHandler

Field Summary
final public static  StringFALSE
     Negative value of switching properties.
final public static  StringPOLICY_ALLOW_DYNAMIC
     A key to security properties, deciding whether usage of dynamic policy location via system properties is allowed.
final public static  StringPOLICY_EXPAND
     A key to security properties, deciding whether expansion of system properties is allowed (in security properties values, policy files, etc).
final public static  StringTRUE
     Positive value of switching properties.


Method Summary
public static  booleancanExpandProperties()
     Returns false if current security settings disable to perform properties expansion, true otherwise.
public static  Stringexpand(String str, Properties properties)
     Substitutes all entries like ${some.key}, found in specified string, for specified values. If some key is unknown, throws ExpansionFailedException.
public static  StringexpandGeneral(String str, GeneralExpansionHandler handler)
     Substitutes all entries like ${{protocol:data}}, found in specified string, for values resolved by passed handler.
public static  StringexpandURL(String str, Properties properties)
     Handy shortcut for expand(str, properties).replace(File.separatorChar, '/').
public static  URIfilePathToURI(String path)
     Converts a file path to URI without accessing file system (like {File#toURI()} does).
Parameters:
  path - -file path.
public static  URL[]getPolicyURLs(Properties system, String systemUrlKey, String securityUrlPrefix)
     Obtains a list of locations for a policy or configuration provider. The search algorithm is as follows:
  1. Look in security properties for keys of form prefix + n, where n is an integer and prefix is a passed parameter.
public static  PermissioninstantiatePermission(Class targetType, String targetName, String targetActions)
     Tries to find a suitable constructor and instantiate a new Permission with specified parameters.
public static  booleanmatchSubset(Object[] what, Object[] where)
     Checks whether the objects from what array are all presented in where array.
public static  URLnormalizeURL(URL codebase)
     Normalizes URLs to standard ones, eliminating pathname symbols.
Parameters:
  codebase - -the original URL.
public static  PermissionCollectiontoPermissionCollection(Collection<Permission> perms)
     Converts common-purpose collection of Permissions to PermissionCollection.

Field Detail
FALSE
final public static String FALSE(Code)
Negative value of switching properties.



POLICY_ALLOW_DYNAMIC
final public static String POLICY_ALLOW_DYNAMIC(Code)
A key to security properties, deciding whether usage of dynamic policy location via system properties is allowed.
See Also:   PolicyUtils.getPolicyURLs(Properties,String,String)



POLICY_EXPAND
final public static String POLICY_EXPAND(Code)
A key to security properties, deciding whether expansion of system properties is allowed (in security properties values, policy files, etc).
See Also:   PolicyUtils.expand(String,Properties)
See Also:   



TRUE
final public static String TRUE(Code)
Positive value of switching properties.





Method Detail
canExpandProperties
public static boolean canExpandProperties()(Code)
Returns false if current security settings disable to perform properties expansion, true otherwise.
See Also:   PolicyUtils.expand(String,Properties)
See Also:   



expand
public static String expand(String str, Properties properties) throws ExpansionFailedException(Code)
Substitutes all entries like ${some.key}, found in specified string, for specified values. If some key is unknown, throws ExpansionFailedException.
Parameters:
  str - the string to be expanded
Parameters:
  properties - available key-value mappings expanded string
throws:
  ExpansionFailedException -



expandGeneral
public static String expandGeneral(String str, GeneralExpansionHandler handler) throws ExpansionFailedException(Code)
Substitutes all entries like ${{protocol:data}}, found in specified string, for values resolved by passed handler. The data part may be empty, and in this case expression may have simplified form, as ${{protocol}}. If some entry cannot be resolved, throws ExpansionFailedException;
Parameters:
  str - the string to be expanded
Parameters:
  handler - the handler to resolve data denoted by protocol expanded string
throws:
  ExpansionFailedException -



expandURL
public static String expandURL(String str, Properties properties) throws ExpansionFailedException(Code)
Handy shortcut for expand(str, properties).replace(File.separatorChar, '/').
See Also:   PolicyUtils.expand(String,Properties)



filePathToURI
public static URI filePathToURI(String path) throws URISyntaxException(Code)
Converts a file path to URI without accessing file system (like {File#toURI()} does).
Parameters:
  path - -file path. - the resulting URI.



getPolicyURLs
public static URL[] getPolicyURLs(Properties system, String systemUrlKey, String securityUrlPrefix)(Code)
Obtains a list of locations for a policy or configuration provider. The search algorithm is as follows:
  1. Look in security properties for keys of form prefix + n, where n is an integer and prefix is a passed parameter. Sequence starts with n=1, and keeps incrementing n until next key is not found.
    For each obtained key, try to construct an URL instance. On success, add the URL to the list; otherwise ignore it.
  2. If security settings do not prohibit (through PolicyUtils.POLICY_ALLOW_DYNAMIC the "policy.allowSystemProperty" property ) to use additional policy location, read the system property under the passed key parameter. If property exists, it may designate a file or an absolute URL. Thus, first check if there is a file with that name, and if so, convert the pathname to URL. Otherwise, try to instantiate an URL directly. If succeeded, append the URL to the list
  3. If the additional location from the step above was specified to the system via "==" (i.e. starts with '='), discard all URLs above and use this only URL.
Note: all property values (both security and system) related to URLs are subject to PolicyUtils.expand(String,Properties) property expansion , regardless of the "policy.expandProperties" security setting.
Parameters:
  system - system properties
Parameters:
  systemUrlKey - key to additional policy location
Parameters:
  securityUrlPrefix - prefix to numbered locations in security properties array of URLs to provider's configuration files, may be empty.



instantiatePermission
public static Permission instantiatePermission(Class targetType, String targetName, String targetActions) throws Exception(Code)
Tries to find a suitable constructor and instantiate a new Permission with specified parameters.
Parameters:
  targetType - class of expected Permission instance
Parameters:
  targetName - name of expected Permission instance
Parameters:
  targetActions - actions of expected Permission instance a new Permission instance
throws:
  IllegalArgumentException - if no suitable constructor found
throws:
  Exception - any exception thrown by Constructor.newInstance()



matchSubset
public static boolean matchSubset(Object[] what, Object[] where)(Code)
Checks whether the objects from what array are all presented in where array.
Parameters:
  what - first array, may be null
Parameters:
  where - second array, may be null true if the first array is nullor if each and every object (ignoring null values) from the first array has a twin in the second array; false otherwise



normalizeURL
public static URL normalizeURL(URL codebase)(Code)
Normalizes URLs to standard ones, eliminating pathname symbols.
Parameters:
  codebase - -the original URL. - the normalized URL.



toPermissionCollection
public static PermissionCollection toPermissionCollection(Collection<Permission> perms)(Code)
Converts common-purpose collection of Permissions to PermissionCollection.
Parameters:
  perms - a collection containing arbitrary permissions, may be null mutable heterogeneous PermissionCollection containing all Permissions from the specified collection



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.