Tracking/logging changes made to property file

S

Sumukh

Hi all,
We have written swing based application to edit property files(plain
text) of our application. We want to keep track of changes made to this
property file.
For e.g. if someone changes some property value from the file, then old
value of the property should be logged somewhere.

I m not sure about how to check which property was changed and then how
to store its old value.

One way is to create backup of the property file and then compare backup
and original while saving the file. But I couldn't find any API to
compare the files using java.

Please suggest what can be done to achieve this ?

Thanks in anticipation

Sumukh
 
U

Ulf_N

Sumukh skrev:
Hi all,
We have written swing based application to edit property files(plain
text) of our application. We want to keep track of changes made to this
property file.
For e.g. if someone changes some property value from the file, then old
value of the property should be logged somewhere.

I m not sure about how to check which property was changed and then how
to store its old value.

One way is to create backup of the property file and then compare backup
and original while saving the file. But I couldn't find any API to
compare the files using java.

Please suggest what can be done to achieve this ?

Thanks in anticipation

Sumukh

Couldn't you use cvs? (https://www.cvshome.org/)
/ulf
 
S

Steve Bosman

Sumukh said:
Hi all,
We have written swing based application to edit property files(plain
text) of our application. We want to keep track of changes made to this
property file.
For e.g. if someone changes some property value from the file, then old
value of the property should be logged somewhere.

I m not sure about how to check which property was changed and then how
to store its old value.

One way is to create backup of the property file and then compare backup
and original while saving the file. But I couldn't find any API to
compare the files using java.

Please suggest what can be done to achieve this ?

You could use jLibDiff http://jlibdiff.sourceforge.net/ which will
compare two files.

If you are talking about standard java properties files storing key
value pairs, and you don't really care about sequence order changes, a
hash map based solution would probably work as well. Load original into
a map and cycle through the modified properties file comparing values,
for very large files this is inefficient but on a stand alone app on a
modern PC you can probably get away with it.
 
S

Sumukh

Hi ,
Thanks for the reply.
CVS is usually used while developing the software.
Here I have fully developed,running application.
I just want to keep track of changes, made to property file.

Thanks

Sumukh
 
U

Ulf_N

Sumukh skrev:
Hi ,
Thanks for the reply.
CVS is usually used while developing the software.
Here I have fully developed,running application.
I just want to keep track of changes, made to property file.

Thanks

Sumukh

There should be some interfaces available. (Don't netbeans have a Java
interface?) Maybe overkill in your case though..
/ulf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top