0

I'm working on a Win32 based document management system that employs an automatic check in/check out model. The model it currently uses for tracking documents in use (monitoring the processes of the applications that open the documents) is not particularly robust so I'm researching alternatives.

Check outs are easy as the DocMgt application is responsible for launching the other application (Word, Adobe, Notepad etc) and passing it the document.

It's the automatic check-in requirement that is more difficult. When the user closes the document in Word/Adobe/Notepad ideally the DocMgt system would be automatically notified so it can perform an automatic check in of the updated document.

To complicate things further the document is likely to be stored on a network drive not a local drive.

Anyone got any tips on API calls, techniques or architectures to support this sort of functionality?

I'm not expecting a magic 3 line solution, the research I've done so far leads me to believe that this is far from a trivial problem and will require some significant work to implement. I'm interested in all suggestions whether they're for a full or part solution.

LachlanG
  • 4,047
  • 1
  • 23
  • 35
  • 4
    There's no generic way to do this reliably. – Jonathan Potter Jan 24 '18 at 07:23
  • Since the DocMgt app is launching the editor app, it can monitor when the editor process terminates, then check in the document file. – Remy Lebeau Jan 24 '18 at 08:47
  • 2
    @RemyLebeau what if the editor app is already open, and launching it simply makes it open a new tab? – Jonathan Potter Jan 24 '18 at 08:54
  • Remy and Jonathon, between the two of you you've described the current architecture and its primary deficiency. – LachlanG Jan 24 '18 at 09:38
  • In addition to what others have said: you probably need a specific "addin" for each editor application that detects when the user saves or closes a document and does the respective "checkin" operation. I think, this is what MS office apps do when opening documents from Sharepoint. – Christian.K Jan 24 '18 at 10:29
  • 1
    Note that many apps (e.g. Notepad, Paint) close the file as soon as they finish loading it. When you save, they open it again. – Raymond Chen Jan 25 '18 at 06:52

1 Answers1

1

What you describe is a common task. It is perfectly doable, though not without its share of hassle. Here I assume that the files are closed on the computer where your code can run (even if the files are stored on the mounted network share).

There exist two approaches to controlling the files when they are used: the filter and the virtual filesystem.

The filter sits in the middle, between the process and the filesystem (any filesystem, either local, network or fully virtual) and intercepts file requests that go to this filesystem. Here it is required that the filter code is run on the computer, via which the requests are passed (this requirement seems to be met in your scenario).

The virtual filesystem is an endpoint for the requests that come from the applications. When you implement the virtual filesystem, you handle all requests, so you always fully control the lifetime of the files. As the filesystem is virtual, you are free to keep the files anywhere including the real disk (local or network) or even in the cloud.

The benefit of the filter approach is that you can control individual files that reside on the real disks, while the virtual filesystem can be mounted only to the new drive letter or into the empty directory on the NTFS drive, which is not always fisible. At the same time, sitting in the middle, the filter is to some extent more restricted at what it can do, and the files can be altered while the filter is not running. Finally, filters are more complicated and potentially error prone, as they sit in the middle and must play nice with other filters and with endpoints.

I don't have specific recommendations, but if the separate drive letter is an option, I would recommend the virtual filesystem.

Our company developed (and continues to maintain for the new owner) two products, CBFS Filter and CBFS Connect, which let you create a filter and a virtual filesystem respectively, all in the user mode. Those products are used in many software titles, including some Document Management Systems (which is close to what you do). You will find both products on their website.

Eugene Mayevski 'Callback
  • 45,135
  • 8
  • 71
  • 121