Menu

Tree [r47] /
 History

HTTPS access


File Date Author Commit
 bin 2012-10-27 mohdejaz [r46] + Refactored whole project
 docs 2011-04-19 mohdejaz [r1] This is first version ...
 lib 2011-04-19 mohdejaz [r1] This is first version ...
 nbproject 2012-10-27 mohdejaz [r46] + Refactored whole project
 src 2012-10-27 mohdejaz [r47] Cosmetic change
 test 2011-04-19 mohdejaz [r1] This is first version ...
 README.TXT 2012-10-27 mohdejaz [r46] + Refactored whole project
 build.xml 2012-10-27 mohdejaz [r46] + Refactored whole project
 manifest.mf 2011-04-19 mohdejaz [r1] This is first version ...

Read Me

This is a configuration reader utility.

Store your configuration in a file and then read them using ConfigReader class.

Helps you write rich property expressions involving arithmetic and logical operators.

A sample configuration looks like this ...

# ------------------------------------------------------------------------------
# Number of milliseconds in a minute
MIN2MIL = 1000 * 60

# Extract value from System Properties
env = $$('env')

jdbc.timeout = MIN2MIL * IF(env == 'DEV'  ? 50 : IF(env == 'QA' ? 30 : 10 ) )
										
jdbc.user = IF(env == "DEV" ?  'user.dev' : IF(env == 'QA' ? 'user.qa' : 'user.prd'))
# ------------------------------------------------------------------------------

Now read it as follows ...

InputStream inp = getClass().getResourceAsStream("/ejaz/utils/smartprops/admin/a.cfg");
ConfigReader pr = new ConfigReader(inp);

System.out.println(pr.toProperties());