2

In my Java project I need to add versioning control to the files(Like SVN), maintain different versions to the same named files in same folder. Please help me how to do this in java programming. Eg: in my project,i maintained a folder which have set of images which are uploaded by user.but user can upload same named image n number of times.to overcome this overhead i planned to maintain versioning to each image which are same (same named).

5
  • Is this for managing the Java source code for your project, or do you want to have something like SVN in the finished program to manage user data? Commented Nov 24, 2011 at 5:55
  • 2
    Please elaborate it a bit more. you want to implement something like SVN or want to use ? Commented Nov 24, 2011 at 5:55
  • Using svn for java projects is exactly the same as for other types, svn doesn't know or care what it's controlling. I even have a repo for random files. Commented Nov 24, 2011 at 6:03
  • in my project,i maintained a folder which have set of images which are uploaded by user.but user can upload same named image n number of times.to overcome this overhead i planned to maintain versioning to each image which are same (same named). Commented Nov 24, 2011 at 6:08
  • maybe just use eclipse.org/jgit Commented Nov 24, 2011 at 6:16

2 Answers 2

3

Source control code is not the way to do this. Rename the files to a uuid as they get uploaded and build a map of original filename->uuid filename with timestamps that you can then lookup or expire as needed.

Sign up to request clarification or add additional context in comments.

2 Comments

I decided to work with SVNKit svnkit.com/documentation.html please tell me how to int-egret this to my project image folder(to maintain version to image) please suggest me ...Thanks
I know I'm being finicky but you can't ask for advice, ignore the advice and go another way and then ask for more help with what you decided to do.
0

I agree with awm. Version control is not for binary files. However, if you insist to do it like that, SVN has an API that you can use. You can access it directly from your code to commit code, update code, etc.

Here's a place to start: http://svnkit.com/

Go checkout out the SVNClientManager under "Subversion Client and IDE Integrations
Subversion clients and IDE integrations"

Good look.

(of course, I haven't used SVN in ages... I 'git' joy from a much better tool... :-))

2 Comments

Thanks for response I agree with your answer,but SVNkit is useful to retrieve and edit soon from svn repository information.but i am not using any svn in my project. My requirement is in my project,i maintained a folder which have set of images which are uploaded by user.but user can upload same named image n number of times.to overcome this overhead i planned to maintain versioning to each image which are same (same named). please advice me right solution
I understand... in that case there are two ideas that comes to mind. The first is to post-pend System.currentTimeMillis() to every file. This is trivially easy to do and will give you tracking on when the file was uploaded. For example: cat-in-a-box.jpg becomes cat-in-a-box.jpg.237467823647. I've used this before and it works great. The second idea, is to use today's date, and add a counter at the end and use that, i.e. 20111126-1, 20111126-2, 20111126-3, etc.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.