This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[Urgent]Accessing properties file

 
Sukh sri
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a requirment where we need to access the properties file from various J2EE modules like war , rar , ejb-jar . These modules can modify the properies file. And the modification should be availbale to other modules ....

What will be the good option.
 
Sukh sri
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why there were no replies .... is there something missing from the details...

... we came through different approaches like

Using properties file , resource bundle etc .. but , our requirement is that the properties file should be writable
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sorry, but you have to be kidding to expect an answer in 30 minutes: PatienceIsAVirtue. You might also usefully read EaseUp and the other tips we have on getting the most out of the Saloon: HowToAskQuestionsOnJavaRanch.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An updated properties file is usually available after the application has been redeployed or the server restarted. Consider writing to a database instead.
 
Sukh sri
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Roger ,

thanks for your reply . But , the information that will go into the property file is about "ports" which does not look good to put them in the database. And also , this config file is to be shared between rar and war files .
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see why port data cannot be written to a DB.
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sukh sri:
But , the information that will go into the property file is about "ports" which does not look good to put them in the database.


In addition to what Roger mentioned, property files are in most cases changed during deployment and not dynamically. I second with what Roger mentioned about using database for storing/sharing this information. However, if you are still reluctant in doing this, you can think of having a single common service which will be used by these war,rar etc... to modify/access the properties. Doing this will ensure that the common service is aware of any changes to the properties and will be able to return this changed property.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic