Jan Holesovsky wrote: > Hi, > > Please is it possible to lock a document for access of concurrent instances of > OOo? I mean the scenario when the document is on a NFS share (read/write), > and more users opened it concurrently from their OOo. I'm working on shared > workbook functionality, > http://www.openoffice.org/issues/show_bug.cgi?id=8811, and I need to do > something like (pseudo-code): > > void Save( document ) { > lock( document ); > do { > conflict = merge_recent_changes_with_the_already_saved( document ); > if ( conflict ) { > unlock( document ); > ask_user_to_resolve_the_conflict(); > lock( document ); > } > } while ( conflict ); > perform_save( document ); > unlock( document ); > } > > The lock()/unlock() here would prevent the other OOo instances from changing > the document while one of the instances works. Please, does a functionality > like this already exist in OOo? I would prefer not to reinvent the wheel ;-)
This algorithm looks weird. It seems that you don't want to lock the file before you save it. But then the document can become modified by other applications or even deleted by the user while it is still edited in an OOo instance. This will let OOo crash in many cases. This means that the way OOo opens documents must be changed: first every file must be copied and the copy must be opened. When the file is saved you can try to acquire a lock and proceed as outlined above. After successful save the file must be copied again. IMHO concurrent access without a server managing the access is only of limited use and I'm not sure if the little gain in functionality is worth the effort and the pain you put on users if things don't work as expected. Ciao, Mathias -- Mathias Bauer (mba) - Project Lead OpenOffice.org Writer OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS Please don't reply to "[EMAIL PROTECTED]". I use it for the OOo lists and only rarely read other mails sent to it. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]