• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Linux and users

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Saloon Keeper
Posts: 28133
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
No matter how many women are assigned to the project, a pregnancy takes nine months. Much longer than this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic