|
#1
|
|||
|
|||
|
Hello,
What I would like to do is to manage a transaction for a file upload with file's metadata. The transaction should manage the write of the file on the filesystem and the write of metadata in the database. I did not found many documentation on Internet about Atomic File Transaction and specially none with Spring. I've found 3 source of documentation:
Do you get a idea on how can I start the subject ? Thanks, Cyrille |
|
#2
|
|||
|
|||
|
I'm not sure if is possible, regardless of Spring. It there an OS independent way of doing this? I haven't seen an examples of this but I'll check out the ones you attached.
|
|
#3
|
|||
|
|||
|
Thanks a lot.
I'm a beginner with Java Application and it's a real BIG world where we have to make so many choises ... I would be happy of reading your synthesis. I am astonished that the Java & Spring World has not yet a solution for that common problem. We are often manipulating files and they should be managed in transactions to be safe like for database. Regards, Cyrille |
|
#4
|
|||
|
|||
|
I agree with what your saying, there are lots of frameworks, libraries, technologies etc...... Obviously can you do things like JMS and DB inside a transaction so it would be logical if file access could also participate. There may be something to already provide this, but I've not yet seen it.
|
|
#5
|
|||
|
|||
|
Yes, it's a common problem, as old as file systems, but, it seems, not big enough to warrant a general solution.
It's the database server that implements transactions for the database. The role of the database server for files is taken by the OS, and that's the proper level where transactions should be implemented. Every other solution is, unavoidably, very brittle. Now, considering the number of operating systems and file systems available, some of them implementing transactions, some not - I guess we would need something like "file system driver". I guess you could try raising an issue with Sun.
|
|
#6
|
||||
|
||||
|
The problem with the file systems is that most of them are not transactional and since the JDK has to be generic, the lowest common infrastructure has to be used.
You might want to look at JCR (Java Content Repository) which tries to address this problem along other by offering a unified API for dealing with storage (along with transactional support, a search language and export/import). However, if you don't want to use another API, try adding your own mechanism usually by implementing a double-lock to make sure the transaction has succeeded.
__________________
Costin Leau SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source" http://twitter.com/costinl Please use [ c o d e ] [ / c o d e ] tags |
|
#7
|
|||
|
|||
|
Quote:
Quote:
Quote:
But those I've found (see this thread's first post) seems to do not be integrated with standard Transaction api and could not ba integrated ASIS in Spring. I'm surprised that those File Transaction mechanism has not been yet integrated with Java Transaction Standard and Spring. Regards, Cyrille |
|
#8
|
|||
|
|||
|
If you looked at the comments of the URL you supplied, other people also talked about integration with JTA. I don't think you are on your own here. Might be worth adding a comment to see if anyone did actually do it?
|
|
#9
|
|||
|
|||
|
Quote:
and a Jira new feature to Commons-Transaction |
|
#10
|
||||
|
||||
|
Seems that the article back at O'reilly is quite old... as for commons-tx, I was looking at it a couple of month ago and thinking of adding a bridge between Spring tx infrastructure and theirs but I'm not sure if the project is still active.
There aren't many releases and the last update was done in July.
__________________
Costin Leau SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source" http://twitter.com/costinl Please use [ c o d e ] [ / c o d e ] tags |
![]() |
| Thread Tools | |
| Display Modes | |
|
|