• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How build my own Application Setting

 
adi sembiring
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ...., I wanna build ApplicationSetting to my application. the application setting can be stored in a file properties or in a database table. the content of applicatino setting is key and value. ex:




I have design my code bellow:
AppSettings Reader



Application Setting Class



Test



so, my questions are:
1. Give your opinion about my code, is there some thing wrong ?
2. I configure my application setting once, while the application start, I configure the application setting with appropriate reader (DbReader or PropertiesReader), I make it singleton. The problem is, While some user edit the database or file directly to database or file, I can't get the changed. now, I wanna implement like ApplicationSettingChangeListener. so if the data change, i will refresh reconfigure my application setting. do you have suggestion ?
 
Jan Cumps
Bartender
Posts: 2588
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have moved your post to our Java in General forum.
 
Karthik Shiraly
Bartender
Posts: 1208
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Adi:

Hi,

The Apache Commons Configuration framework does all that you want: read from different type of data sources, reload on change, and much more.
If you've no compelling reason to roll out your own implementation, you're probably better off using that.
 
Michael Angstadt
Ranch Hand
Posts: 277
Eclipse IDE Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adi, please PostRealCode next time.
The java.util.Properties class can read Java property files, which is what your settings file seems to be. You don't have to manually parse the file yourself.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic