Re: [dev] Writer allows deleting opened file while saving
Ales Kahanek wrote: With such applications we do another approach: we try periodically to get ShareExclusive access to this file. If the request is rejected, we know that the file is still opened and edited. And here is the problem with Writer - when you save the file in Writer, there is a short period of time, when the the exclusive access to the file can be obtained and more, the file can be even DELETED. There is an important point to know: this behaviour can be reproduced when the OO QuickStarter is running (I do not know if this could have any impact on it). What do you think about it? How can I know, when the file opened by Writer was closed? Or better - shouldn´t this behaviour be changed not to release the file access lock? If we overwrite a file we must (at least for a short span of time) release the old one or (to keep the lock) use a more complicated approach that - when things go haywire - can result in crashes and data loss or would need a complete rewrite of our persistence code to avoid that. It's too much to explain it here but believe me, we considered this very carefully. There are so many things that can happen why saving a file, you wouldn't believe it. And Linux/Unix file systems add a lot of complexity that make them incomparable with Windows file systems, so a comparison with Word or Excel doesn't really help. BTW: we changed the behavior a bit for OOo2.0 (but still with a temporary release) and now we have the most robust solution implemented, Even removing a remote file system while a file gets saved to it shouldn't cause OOo to crash or lose data. Relying on the locked state of a file IMHO is a hack (sorry). But there's no need to use such a hack because you can use our API to get the job done. If you placed a listener in every open document you would get notifications when they are closed and then copy the content of the file they have been saved to to your database. Best regards, Mathias -- Mathias Bauer - OpenOffice.org Application Framework Project Lead Please reply to the list only, [EMAIL PROTECTED] is a spam sink. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[dev] Writer allows deleting opened file while saving
Hi, there is a problem with OO Writer when saving document. I would really appreciate any hints: we are developing document management system, the document (files) are stored in a database. When user wants to edit the file, it is extracted from database to disk and then external application is called to open the file. Then user makes changes to this document and closes the application. The key point is to know, when user has finished editing the file and copy it back to database. Mostly we start the external process and periodically check if it is active. If not, we know that editing has finished. This is not possible with OO, as then process is still running when another file is opened in another OO window. The process seems to be the same for all OO windows. With such applications we do another approach: we try periodically to get ShareExclusive access to this file. If the request is rejected, we know that the file is still opened and edited. And here is the problem with Writer - when you save the file in Writer, there is a short period of time, when the the exclusive access to the file can be obtained and more, the file can be even DELETED. There is an important point to know: this behaviour can be reproduced when the OO QuickStarter is running (I do not know if this could have any impact on it). Also when comparing to MS Word or Excel, trying to get exclusive access to the file works fine. Word or Excel does not release the lock from the file until the file is closed. What do you think about it? How can I know, when the file opened by Writer was closed? Or better - shouldnt this behaviour be changed not to release the file access lock? Thank you very much for any hint. If this is wrong group, please, point me to the right place. Ales Kahanek - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]