Java Doc for JFig.java in  » Development » jfig » org » igfay » jfig » 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 » Development » jfig » org.igfay.jfig 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.igfay.jfig.JFig

JFig
public class JFig implements JFigIF(Code)
The JFig package provides very simple, flexible and powerful functionality for managing one or more configurations in a java environment.

It allows for a combination of a hierarchy of configuration files, substitution variables and property variables. Methods are provided to get values stored in a configuration dictionary with a variety of types (String, array, integer, float, boolean, etc) and default values.

Usage:
To get an instance of the JFig singleton, use: JFig. getInstance();

There are a number of helper methods to retrieve configuration values. The most common is:
String value = JFig. getInstance().getValue ("aSection","aKey","aDefaultValue");

See the javadocs for additional helper methods to retrieve values as different java types and with different exception handling.
author:
   bconrad





Method Summary
public  voidaddConfigEventListener(JFigListener listener)
     Add JFig listeners to list so they can be notified when there is a significant change in the configuration.
protected  voidfireConfigUpdateEvent()
     Notify registered listeners when configuration is updated.
protected  MapgetAllConfigFiles()
     Returns the list of all config files that have been processed.
public  String[]getArrayValue(String section, String key)
     Convenience method for getting values as array.
public  String[]getArrayValue(String section, String key, String notFoundValue)
     Convenience method for getting values as array with default value.
public  booleangetBooleanValue(String section, String key, String notFoundValue)
    
public  JFigDictionarygetConfigDictionary()
     return the ConfigurationDictionary Made public so we can access this from a jsp and show the configuration via html.
protected  StringgetConfigFileName()
    
protected  ListgetConfigListeners()
    
protected  JFigLocatorIFgetConfigLocator()
    
public  MapgetEntriesStartingWith(String section, String key)
     Return a map of all values starting with "key" in the scetcion.
public  floatgetFloatValue(String section, String key, String notFoundValue)
    
public static synchronized  JFigIFgetInstance()
    
public static synchronized  JFigIFgetInstance(int dummy)
     Return the config singleton.
public static synchronized  JFigIFgetInstance(int dummy, JFigLocatorIF locator)
     Return the config singleton passing a JFigLocator.
public static synchronized  JFigIFgetInstance(JFigLocatorIF jfigLocator)
    
public  intgetIntegerValue(String section, String key)
    
public  intgetIntegerValue(String section, String key, String notFoundValue)
    
protected  JFigParsergetParser()
    
public  MapgetSection(String section)
    
public  PropertiesgetSectionAsProperties(String section)
    
public  PropertiesgetSectionAsProperties(String section, Properties properties)
     Return a section populated in a supplied Properties object.
public  StringgetValue(String section, String key, String defaultValue)
     Return the value for this section and key.
public  StringgetValue(String section, String key)
     Call configParser to get the value for a key in a given section.
public  ListgetValuesStartingWith(String section, String key)
     Return a list of all values starting with "key" in the section.
public static  JFigIFinitialize()
    
public static  JFigIFinitialize(JFigLocator locator)
     Initialize configuration.
protected  booleanisXML()
     Is the configuration file in XML format or ini format.
public static  voidmain(String[] args)
    
public  voidprint()
     Print the values in the JFig dictionary.
public  voidprintConfigurationDictionary()
     Print the values in the JFig dictionary.
protected  voidprocessConfig()
    
public  voidreprocessConfiguration()
    
public  voidreprocessConfiguration(JFigLocator locator)
    
protected  voidsetAllConfigFiles(HashMap map)
    
protected  voidsetConfigDictionary(JFigDictionary configDictionary)
     Sets the configDictionary.
public  voidsetConfigurationValue(String sectionName, String keyString, String valueString)
     Set a configuration value.
public static  voidsetInstance(JFigIF jfig)
    



Method Detail
addConfigEventListener
public void addConfigEventListener(JFigListener listener)(Code)
Add JFig listeners to list so they can be notified when there is a significant change in the configuration.
Parameters:
  listener - The feature to be added to the ConfigEventListenerattribute



fireConfigUpdateEvent
protected void fireConfigUpdateEvent()(Code)
Notify registered listeners when configuration is updated.



getAllConfigFiles
protected Map getAllConfigFiles()(Code)
Returns the list of all config files that have been processed. Used to prevent processing the same file multiple times esp in case of circular includes. List



getArrayValue
public String[] getArrayValue(String section, String key) throws JFigException(Code)
Convenience method for getting values as array. The value is tokenized depending on the first token found in the following order: comma, semicolon, colon, space



getArrayValue
public String[] getArrayValue(String section, String key, String notFoundValue)(Code)
Convenience method for getting values as array with default value.



getBooleanValue
public boolean getBooleanValue(String section, String key, String notFoundValue)(Code)
Convenience method for getting values as boolean



getConfigDictionary
public JFigDictionary getConfigDictionary()(Code)
return the ConfigurationDictionary Made public so we can access this from a jsp and show the configuration via html.



getConfigFileName
protected String getConfigFileName()(Code)



getConfigListeners
protected List getConfigListeners()(Code)
Lazily initialize and return listeners



getConfigLocator
protected JFigLocatorIF getConfigLocator()(Code)



getEntriesStartingWith
public Map getEntriesStartingWith(String section, String key)(Code)
Return a map of all values starting with "key" in the scetcion. If section xxx contains x.1=a, x.2=b, and x.3=c, getValuesStartingWith("xxx", "x.") returns a map containing x.1,a x.2,b and x.3,c.
Parameters:
  section -
Parameters:
  key -
Parameters:
  defaultValue - List



getFloatValue
public float getFloatValue(String section, String key, String notFoundValue) throws JFigException(Code)
Convenience method for getting values as float
Parameters:
  section - Description of Parameter
Parameters:
  key - Description of Parameter
Parameters:
  notFoundValue - Description of Parameter The FloatValue value
exception:
  JFigException - Description of Exception



getInstance
public static synchronized JFigIF getInstance()(Code)
Return the config singleton



getInstance
public static synchronized JFigIF getInstance(int dummy) throws JFigException(Code)
Return the config singleton. If the configuration file is not found, throw an exception.



getInstance
public static synchronized JFigIF getInstance(int dummy, JFigLocatorIF locator) throws JFigException(Code)
Return the config singleton passing a JFigLocator. If the configuration file is not found, throw an exception.



getInstance
public static synchronized JFigIF getInstance(JFigLocatorIF jfigLocator)(Code)
Return the config singleton passing a JFigLocator



getIntegerValue
public int getIntegerValue(String section, String key) throws JFigException(Code)
Convenience method for getting values as int



getIntegerValue
public int getIntegerValue(String section, String key, String notFoundValue)(Code)
Convenience method for getting values as int, with default value



getParser
protected JFigParser getParser()(Code)
Return the JFig parser



getSection
public Map getSection(String section)(Code)
Return an entire section as a Map



getSectionAsProperties
public Properties getSectionAsProperties(String section)(Code)
Return a section as a Properties object



getSectionAsProperties
public Properties getSectionAsProperties(String section, Properties properties)(Code)
Return a section populated in a supplied Properties object.



getValue
public String getValue(String section, String key, String defaultValue)(Code)
Return the value for this section and key. If none found, return the default value.
Parameters:
  section - Description of Parameter
Parameters:
  key - Description of Parameter
Parameters:
  defaultValue - Description of Parameter The Value value



getValue
public String getValue(String section, String key) throws JFigException(Code)
Call configParser to get the value for a key in a given section.



getValuesStartingWith
public List getValuesStartingWith(String section, String key)(Code)
Return a list of all values starting with "key" in the section. If section xxx contains x.1, x.2, and x.3, getValuesStartingWith("xxx", "x.") returns a list containing x.1, x.2, and x.3.
Parameters:
  section -
Parameters:
  key -
Parameters:
  defaultValue - List



initialize
public static JFigIF initialize() throws JFigException(Code)
Initialize configuration



initialize
public static JFigIF initialize(JFigLocator locator) throws JFigException(Code)
Initialize configuration. It is recommended that JFig is explicitly initialized by this method. The alternative is to let getInstance() lazily initialize. The difference is that this will throw a JFigException if there is a problem in the initialization process while getInstance() will not.



isXML
protected boolean isXML()(Code)
Is the configuration file in XML format or ini format. boolean



main
public static void main(String[] args)(Code)



print
public void print()(Code)
Print the values in the JFig dictionary.



printConfigurationDictionary
public void printConfigurationDictionary()(Code)
Print the values in the JFig dictionary.



processConfig
protected void processConfig() throws JFigException(Code)
Call parser to process required config



reprocessConfiguration
public void reprocessConfiguration() throws JFigException(Code)
Reprocess the configuration creating a new config dictionary



reprocessConfiguration
public void reprocessConfiguration(JFigLocator locator) throws JFigException(Code)
Reprocess the configuration with the specified JFigLocator, creating a new config dictionary



setAllConfigFiles
protected void setAllConfigFiles(HashMap map)(Code)



setConfigDictionary
protected void setConfigDictionary(JFigDictionary configDictionary)(Code)
Sets the configDictionary.
Parameters:
  configDictionary -



setConfigurationValue
public void setConfigurationValue(String sectionName, String keyString, String valueString)(Code)
Set a configuration value. Most values are set during initial parsing so this is rarely used.



setInstance
public static void setInstance(JFigIF jfig)(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.