Java Doc for PropertyDatabase.java in  » Test-Coverage » GroboUtils » net » sourceforge » groboutils » util » io » v1 » 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 » Test Coverage » GroboUtils » net.sourceforge.groboutils.util.io.v1 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   net.sourceforge.groboutils.util.io.v1.PropertyDatabase

PropertyDatabase
public class PropertyDatabase (Code)
A database of property files. Internally, it uses a ResourceBundle, so that locale specific properties can be used. The format is for the application defined property files to be defined as "read-only", and for a user defined property file to be the readable/writeable properties (i.e. modifications or additions or removals of the default properties). User settings override the read-only settings. The user property file is not localized, and is stored at $home/.app-name/user.properties (or the filename may be specified).

By default, the properties are loaded from the Resource streams, although this can be changed.

Before using this class, you must initialize the user property file by either PropertyDatabase.setApplicationName(String) or PropertyDatabase.setUserPropertyFile(String) .

The stored data is only of type String, and multiple identical key entries are not possible - only the first one is allowed.
author:
   Matt Albrecht groboclown@users.sourceforge.net
since:
   January 7, 2001
version:
   $Date: 2003/02/10 22:52:45 $




Constructor Summary
public  PropertyDatabase()
    
public  PropertyDatabase(Locale l)
     Specify the Locale to load the properties from.

Method Summary
public  voidaddResourceBundle(String resourceName)
     Adds a resource bundle of the given name to the database, from the specified locale.
protected  voidautoSave()
    
public  FilegetApplicationDirectory()
     Returns the directory where the user properties are stored for the current application, or null if there is no application set.
public  booleangetBooleanValue(String key)
     Convenience function to convert a property to a boolean value.
public  bytegetByteValue(String key)
     Convenience function to convert a property to a byte value.
public  chargetCharValue(String key)
     Convenience function to convert a property to a char value.
public  doublegetDoubleValue(String key)
     Convenience function to convert a property to a double value.
public  floatgetFloatValue(String key)
     Convenience function to convert a property to a float value.
public  intgetIntValue(String key)
     Convenience function to convert a property to an int value.
public  longgetLongValue(String key)
     Convenience function to convert a property to a long value.
public  shortgetShortValue(String key)
     Convenience function to convert a property to a short value.
public  StringgetValue(String key)
     Retrieves the value associated with the given key.
public  booleanisAutosaveOn()
     Retrieves the auto-save setting.
protected  voidloadUserProperties()
    
public  StringremoveValue(String key)
     Removes a value from the properties.
public  voidsaveUserProperties()
     Saves the current user properties.
public  voidsetApplicationName(String name)
     Set the application name and thus the corresponding directory that will store the user properties.
public  voidsetAutosaveOn(boolean yes)
     Sets the current autosave setting.
public  voidsetBooleanValue(String key, boolean value)
     Convenience function to convert a boolean value to a String property.
public  voidsetByteValue(String key, byte value)
     Convenience function to convert a byte value to a String property.
public  voidsetCharValue(String key, char value)
     Convenience function to convert a char value to a String property.
public  voidsetDoubleValue(String key, double value)
     Convenience function to convert a byte value to a String property.
public  voidsetFloatValue(String key, float value)
     Convenience function to convert a float value to a String property.
public  voidsetIntValue(String key, int value)
     Convenience function to convert an int value to a String property.
public  voidsetLongValue(String key, long value)
     Convenience function to convert a long value to a String property.
public  voidsetShortValue(String key, short value)
     Convenience function to convert a short value to a String property.
public  voidsetTrace(PrintWriter tracer)
     Sets the trace stream.
public  voidsetUserPropertyFile(String name)
     Set the user property file name exactly.
public  voidsetValue(String key, String value)
     Sets the given value to the user properties.
public  StringsetValueToDefault(String key)
     Resets the user property to the resource bundle's default value.
Parameters:
  key - the key to be reset.


Constructor Detail
PropertyDatabase
public PropertyDatabase()(Code)
Default Constructor



PropertyDatabase
public PropertyDatabase(Locale l)(Code)
Specify the Locale to load the properties from.




Method Detail
addResourceBundle
public void addResourceBundle(String resourceName)(Code)
Adds a resource bundle of the given name to the database, from the specified locale. Note that if a user property already exists with a given key, then the user property overrides the resource property.



autoSave
protected void autoSave()(Code)



getApplicationDirectory
public File getApplicationDirectory()(Code)
Returns the directory where the user properties are stored for the current application, or null if there is no application set.



getBooleanValue
public boolean getBooleanValue(String key)(Code)
Convenience function to convert a property to a boolean value. the given key converted to a boolean, or falseif there was a parse error.



getByteValue
public byte getByteValue(String key)(Code)
Convenience function to convert a property to a byte value. the given key converted to a byte, or Byte.MIN_VALUEif there was a parse error.



getCharValue
public char getCharValue(String key)(Code)
Convenience function to convert a property to a char value. the given key converted to a char, or Character.MIN_VALUEif there was a parse error.



getDoubleValue
public double getDoubleValue(String key)(Code)
Convenience function to convert a property to a double value. the given key converted to a double, or Double.MIN_VALUEif there was a parse error.



getFloatValue
public float getFloatValue(String key)(Code)
Convenience function to convert a property to a float value. the given key converted to a float, or Float.MIN_VALUEif there was a parse error.



getIntValue
public int getIntValue(String key)(Code)
Convenience function to convert a property to an int value. the given key converted to an integer, or Integer.MIN_VALUEif there was a parse error.



getLongValue
public long getLongValue(String key)(Code)
Convenience function to convert a property to a long value. the given key converted to a long, or Long.MIN_VALUEif there was a parse error.



getShortValue
public short getShortValue(String key)(Code)
Convenience function to convert a property to a short value. the given key converted to a short, or Short.MIN_VALUEif there was a parse error.



getValue
public String getValue(String key)(Code)
Retrieves the value associated with the given key.
Parameters:
  key - the key to pull the value out of



isAutosaveOn
public boolean isAutosaveOn()(Code)
Retrieves the auto-save setting.



loadUserProperties
protected void loadUserProperties() throws IOException(Code)



removeValue
public String removeValue(String key)(Code)
Removes a value from the properties. If the property is defined by a resource, then the user list must specify that it is removed.
Parameters:
  key - the key to remove the value the key was assigned to, or null if nothingwas removed.



saveUserProperties
public void saveUserProperties() throws IOException(Code)
Saves the current user properties.



setApplicationName
public void setApplicationName(String name) throws IOException(Code)
Set the application name and thus the corresponding directory that will store the user properties. The user properties are located at $home/.app-name/user.properties. If the user property file is already set, then an IllegalStateException is thrown.
Parameters:
  name - name of the application.



setAutosaveOn
public void setAutosaveOn(boolean yes)(Code)
Sets the current autosave setting.



setBooleanValue
public void setBooleanValue(String key, boolean value)(Code)
Convenience function to convert a boolean value to a String property.



setByteValue
public void setByteValue(String key, byte value)(Code)
Convenience function to convert a byte value to a String property.



setCharValue
public void setCharValue(String key, char value)(Code)
Convenience function to convert a char value to a String property.



setDoubleValue
public void setDoubleValue(String key, double value)(Code)
Convenience function to convert a byte value to a String property.



setFloatValue
public void setFloatValue(String key, float value)(Code)
Convenience function to convert a float value to a String property.



setIntValue
public void setIntValue(String key, int value)(Code)
Convenience function to convert an int value to a String property.



setLongValue
public void setLongValue(String key, long value)(Code)
Convenience function to convert a long value to a String property.



setShortValue
public void setShortValue(String key, short value)(Code)
Convenience function to convert a short value to a String property.



setTrace
public void setTrace(PrintWriter tracer)(Code)
Sets the trace stream. If you set this to non-null, then warnings, such as ResourceBundles containing duplicate keys, will be reported to the stream. Errors will still be thrown as exceptions. Autosave will send any exceptions to this trace.



setUserPropertyFile
public void setUserPropertyFile(String name) throws IOException(Code)
Set the user property file name exactly. If the user property file is already set, then an IllegalStateException is thrown.



setValue
public void setValue(String key, String value)(Code)
Sets the given value to the user properties.
Parameters:
  key - the key to assign the value to
Parameters:
  value - the value to be assigned to the key



setValueToDefault
public String setValueToDefault(String key)(Code)
Resets the user property to the resource bundle's default value.
Parameters:
  key - the key to be reset. the default value for the key.



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.