Java Doc for UtilProperties.java in  » ERP-CRM-Financial » SourceTap-CRM » org » ofbiz » base » 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 » ERP CRM Financial » SourceTap CRM » org.ofbiz.base.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.ofbiz.base.util.UtilProperties

UtilProperties
public class UtilProperties (Code)
Generic Property Accessor with Cache - Utilities for working with properties files
author:
   David E. Jones
version:
   $Revision: 1.9 $
since:
   1.0


Field Summary
public static  UtilCachebundleLocaleCache
    
final public static  Stringmodule
    
public static  UtilCacheresourceCache
     An instance of the generic cache for storing the FlexibleProperties corresponding to each properties file keyed by a String for the resource location.
public static  UtilCacheurlCache
    


Method Summary
protected static  ResourceBundlegetBaseResourceBundle(String resource, Locale locale)
    
public static  StringgetMessage(String resource, String name, Locale locale)
     Returns the value of the specified property name from the specified resource/properties file corresponding to the given locale.
public static  StringgetMessage(String resource, String name, Object[] arguments, Locale locale)
    
public static  StringgetMessage(String resource, String name, List arguments, Locale locale)
    
public static  StringgetMessage(String resource, String name, Map context, Locale locale)
    
public static  PropertiesgetProperties(String resource)
    
public static  PropertiesgetProperties(URL url)
    
public static  PropertiesgetProperties(String resource, Locale locale)
     Returns the specified resource/properties file NOTE: This is NOT fully implemented yet to fulfill all of the requirements for i18n messages.
public static  doublegetPropertyNumber(String resource, String name)
    
public static  doublegetPropertyNumber(URL url, String name)
    
public static  StringgetPropertyValue(String resource, String name, String defaultValue)
     Returns the value of the specified property name from the specified resource/properties file.
public static  StringgetPropertyValue(String resource, String name)
    
public static  StringgetPropertyValue(URL url, String name, String defaultValue)
     Returns the value of the specified property name from the specified resource/properties file.
public static  StringgetPropertyValue(URL url, String name)
    
public static  ResourceBundlegetResourceBundle(String resource, Locale locale)
    
public static  MapgetResourceBundleMap(String resource, Locale locale)
    
public static  StringgetSplitPropertyValue(URL url, String name)
     Returns the value of a split property name from the specified resource/properties file Rather than specifying the property name the value of a name.X property is specified which will correspond to a value.X property whose value will be returned.
public static  booleanpropertyValueEquals(String resource, String name, String compareString)
    
public static  booleanpropertyValueEquals(URL url, String name, String compareString)
    
public static  booleanpropertyValueEqualsIgnoreCase(String resource, String name, String compareString)
    
public static  booleanpropertyValueEqualsIgnoreCase(URL url, String name, String compareString)
    
protected static  MapresourceBundleToMap(ResourceBundle bundle)
    

Field Detail
bundleLocaleCache
public static UtilCache bundleLocaleCache(Code)
An instance of the generic cache for storing the ResourceBundle corresponding to each properties file keyed by a String for the resource location and the locale



module
final public static String module(Code)



resourceCache
public static UtilCache resourceCache(Code)
An instance of the generic cache for storing the FlexibleProperties corresponding to each properties file keyed by a String for the resource location. This will be used for both non-locale and locale keyed FexibleProperties instances.



urlCache
public static UtilCache urlCache(Code)
An instance of the generic cache for storing the FlexibleProperties corresponding to each properties file keyed by a URL object





Method Detail
getBaseResourceBundle
protected static ResourceBundle getBaseResourceBundle(String resource, Locale locale)(Code)



getMessage
public static String getMessage(String resource, String name, Locale locale)(Code)
Returns the value of the specified property name from the specified resource/properties file corresponding to the given locale.

Two reasons why we do not use the FlexibleProperties class for this:
  • Doesn't support flexible locale based naming: try fname_locale (5 letter), then fname_locale (2 letter lang only), then fname
  • Does not support parent properties/bundles so that if the fname_locale5 file doesn't have it then fname_locale2 is tried, then the fname bundle

Parameters:
  resource - The name of the resource - can be a file, class, or URL
Parameters:
  name - The name of the property in the properties file
Parameters:
  locale - The locale that the given resource will correspond to The value of the property in the properties file



getMessage
public static String getMessage(String resource, String name, Object[] arguments, Locale locale)(Code)
Returns the value of the specified property name from the specified resource/properties file corresponding to the given locale and replacing argument place holders with the given arguments using the MessageFormat class
Parameters:
  resource - The name of the resource - can be a file, class, or URL
Parameters:
  name - The name of the property in the properties file
Parameters:
  locale - The locale that the given resource will correspond to
Parameters:
  arguments - An array of Objects to insert into the message argument place holders The value of the property in the properties file



getMessage
public static String getMessage(String resource, String name, List arguments, Locale locale)(Code)
Returns the value of the specified property name from the specified resource/properties file corresponding to the given locale and replacing argument place holders with the given arguments using the MessageFormat class
Parameters:
  resource - The name of the resource - can be a file, class, or URL
Parameters:
  name - The name of the property in the properties file
Parameters:
  locale - The locale that the given resource will correspond to
Parameters:
  arguments - A List of Objects to insert into the message argument place holders The value of the property in the properties file



getMessage
public static String getMessage(String resource, String name, Map context, Locale locale)(Code)
Returns the value of the specified property name from the specified resource/properties file corresponding to the given locale and replacing argument place holders with the given arguments using the FlexibleStringExpander class
Parameters:
  resource - The name of the resource - can be a file, class, or URL
Parameters:
  name - The name of the property in the properties file
Parameters:
  locale - The locale that the given resource will correspond to
Parameters:
  context - A Map of Objects to insert into the message place holders using the ${} syntax of the FlexibleStringExpander The value of the property in the properties file



getProperties
public static Properties getProperties(String resource)(Code)
Returns the specified resource/properties file
Parameters:
  resource - The name of the resource - can be a file, class, or URL The properties file



getProperties
public static Properties getProperties(URL url)(Code)
Returns the specified resource/properties file
Parameters:
  resource - The name of the resource - can be a file, class, or URL The properties file



getProperties
public static Properties getProperties(String resource, Locale locale)(Code)
Returns the specified resource/properties file NOTE: This is NOT fully implemented yet to fulfill all of the requirements for i18n messages. Do NOT use. To be used in an i18n context this still needs to be extended quite a bit. The behavior needed is that for each getMessage the most specific locale (with fname_en_US for instance) is searched first, then the next less specific (fname_en for instance), then without the locale if it is still not found (plain fname for example, not that these examples would have .properties appended to them). This would be accomplished by returning the following structure: 1. Get "fname" FlexibleProperties object 2. Get the "fname_en" FlexibleProperties object and if the "fname" one is not null, set it as the default/parent of the "fname_en" object 3. Get the "fname_en_US" FlexibleProperties object and if the "fname_en" one is not null, set it as the default/parent of the "fname_en_US" object; if the "fname_en" one is null, but the "fname" one is not, set the "fname" object as the default/parent of the "fname_en_US" object Then return the fname_en_US object if not null, else the fname_en, else the fname. To make this all more fun, the default locale should be the parent of the "fname" object in this example so that there is an even higher chance of finding something for each request. For efficiency all of these should be cached indendependently so the same instance can be shared, speeding up loading time/efficiency. All of this should work with the setDefaultProperties method of the FlexibleProperties class, but it should be tested and updated as necessary. It's a bit tricky, so chances are it won't work as desired...
Parameters:
  resource - The name of the resource - can be a file, class, or URL
Parameters:
  locale - The locale that the given resource will correspond to The Properties class



getPropertyNumber
public static double getPropertyNumber(String resource, String name)(Code)



getPropertyNumber
public static double getPropertyNumber(URL url, String name)(Code)



getPropertyValue
public static String getPropertyValue(String resource, String name, String defaultValue)(Code)
Returns the value of the specified property name from the specified resource/properties file. If the specified property name or properties file is not found, the defaultValue is returned.
Parameters:
  resource - The name of the resource - if the properties file is 'webevent.properties', the resource name is 'webevent'
Parameters:
  name - The name of the property in the properties file
Parameters:
  defaultValue - The value to return if the property is not found The value of the property in the properties file, or if not found then the defaultValue



getPropertyValue
public static String getPropertyValue(String resource, String name)(Code)
Returns the value of the specified property name from the specified resource/properties file
Parameters:
  resource - The name of the resource - can be a file, class, or URL
Parameters:
  name - The name of the property in the properties file The value of the property in the properties file



getPropertyValue
public static String getPropertyValue(URL url, String name, String defaultValue)(Code)
Returns the value of the specified property name from the specified resource/properties file. If the specified property name or properties file is not found, the defaultValue is returned.
Parameters:
  url - URL object specifying the location of the resource
Parameters:
  name - The name of the property in the properties file
Parameters:
  defaultValue - The value to return if the property is not found The value of the property in the properties file, or if not found then the defaultValue



getPropertyValue
public static String getPropertyValue(URL url, String name)(Code)
Returns the value of the specified property name from the specified resource/properties file
Parameters:
  url - URL object specifying the location of the resource
Parameters:
  name - The name of the property in the properties file The value of the property in the properties file



getResourceBundle
public static ResourceBundle getResourceBundle(String resource, Locale locale)(Code)
Returns the specified resource/properties file as a ResourceBundle
Parameters:
  resource - The name of the resource - can be a file, class, or URL
Parameters:
  locale - The locale that the given resource will correspond to The ResourceBundle



getResourceBundleMap
public static Map getResourceBundleMap(String resource, Locale locale)(Code)
Returns the specified resource/properties file as a Map with the original ResourceBundle in the Map under the key _RESOURCE_BUNDLE_
Parameters:
  resource - The name of the resource - can be a file, class, or URL
Parameters:
  locale - The locale that the given resource will correspond to Map containing all entries in The ResourceBundle



getSplitPropertyValue
public static String getSplitPropertyValue(URL url, String name)(Code)
Returns the value of a split property name from the specified resource/properties file Rather than specifying the property name the value of a name.X property is specified which will correspond to a value.X property whose value will be returned. X is a number from 1 to whatever and all values are checked until a name.X for a certain X is not found.
Parameters:
  url - URL object specifying the location of the resource
Parameters:
  name - The name of the split property in the properties file The value of the split property from the properties file



propertyValueEquals
public static boolean propertyValueEquals(String resource, String name, String compareString)(Code)
Compares the specified property to the compareString, returns true if they are the same, false otherwise
Parameters:
  resource - The name of the resource - if the properties file is 'webevent.properties', the resource name is 'webevent'
Parameters:
  name - The name of the property in the properties file
Parameters:
  compareString - The String to compare the property value to True if the strings are the same, false otherwise



propertyValueEquals
public static boolean propertyValueEquals(URL url, String name, String compareString)(Code)
Compares the specified property to the compareString, returns true if they are the same, false otherwise
Parameters:
  url - URL object specifying the location of the resource
Parameters:
  name - The name of the property in the properties file
Parameters:
  compareString - The String to compare the property value to True if the strings are the same, false otherwise



propertyValueEqualsIgnoreCase
public static boolean propertyValueEqualsIgnoreCase(String resource, String name, String compareString)(Code)
Compares Ignoring Case the specified property to the compareString, returns true if they are the same, false otherwise
Parameters:
  resource - The name of the resource - if the properties file is 'webevent.properties', the resource name is 'webevent'
Parameters:
  name - The name of the property in the properties file
Parameters:
  compareString - The String to compare the property value to True if the strings are the same, false otherwise



propertyValueEqualsIgnoreCase
public static boolean propertyValueEqualsIgnoreCase(URL url, String name, String compareString)(Code)
Compares Ignoring Case the specified property to the compareString, returns true if they are the same, false otherwise
Parameters:
  url - URL object specifying the location of the resource
Parameters:
  name - The name of the property in the properties file
Parameters:
  compareString - The String to compare the property value to True if the strings are the same, false otherwise



resourceBundleToMap
protected static Map resourceBundleToMap(ResourceBundle bundle)(Code)



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.