File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Linux / UNIX and the fly likes Linux and users Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Linux and users" Watch "Linux and users" New topic
Author

Linux and users

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hello
I have a web application (java) running on a websphere server on a linux machine.
This application writes pdf files on a windows2000 machine, thanks to samba.
but the problem is:
when a user A has opened the pdf file, and another user B want to open it, the application must display a message telling the user B that user A has already opened the file.
Before my application ran on a server in windows2000, so the application uses netapi32.dll (thanks to coroutine API for java) to determine which user open the file.
But now, how can I do? Is there a linux way to see which windows user has opened the file in the samba share? Is ther a way to use netapi32.dll in linux? (wine?)
thanks for your help
[ June 23, 2003: Message edited by: Michael Ernest ]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16065
    
  21

A little more info, please.
Windows locks files based on their names. It has a fairly unfriendly way of doing so, which is why you have to reboot whenever certain executables/DLLs are updated. Linux/Unix looks at files based on inodes, which allows you to actually delete a file while someone else it writing to it without disaster (though it's not a habit I encourage).
Normally, PDF's are read and would be sharable. Only if you're talking about a user updating the PDF would I normally consider locking it. MS-WORD docs are different. A WORD doc can be opened read-only, but it requires a deliberate effort.
Anyway, I haven't looked at that kind of problem, so I can't give a definite solution. I recommend that you check the Samba docs, since it's Samba's job to emulate the networked Windows filesystem, and I think I may recall seeing something about such issues there.
Unix often uses the concept of a lockfile. This is simply a zero-length file whose mere presence is enough to indicate that a resource is locked. It's possible that Samba might even use this as part of whatever file-locking scheme they might be using. Unfortunately, lockfiles have to be explicitly created and destroyed, so if Samba intercepted an SMB file open/close operation, it could take that action as part of its network support functions, but a simple Unix/Linux file open/close can't.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Linux and users