--- "Saverance, Kenyon Scott" <[EMAIL PROTECTED]> wrote:

> I want to monitor a filesys directory for the presence of a file and, once
> extant, continue on the pipeline. I'm thinking the top of the pipeline
> should be a generator or xpl that can:
> * return filesys directory structure/file info

You can do this with the undocumented Directory Scanner processor. See attached
an example showing how to call this processor.

> For now, I'm thinking I'll skip the regexp part and create an XPL that:
> * takes an explicit file name
> * passes to oxf:url-generator
> * handles the error of *not* finding the file by inserting a task into
> oxf:scheduler to recall in a specified number of secs

You cannot use the oxf:url-generator for this as it will throw an exception if
the file is not found, and you have no way of catching the exception in XPL at
this point. So you should instead use the directory scanner for this.

> Beyond this, anyone have any recommendations on Java classes that I could
> wrap in a custom processor to handle the tasks I described above?

If polling is acceptable: java.io.File.exists() and Thread.sleep(). Otherwise
in general people call a native library for this (e.g. FileWatcherXX.dll of
IntelliJ), so I assume there is no pure Java way do to this, but I might be
wrong :).

Alex
<p:processor name="oxf:directory-scanner">
    <p:input name="config">
        <config>
            <base-directory>C:\test</base-directory>
            <include>*</include>
            <case-sensitive>false</case-sensitive>
        </config>
    </p:input>
    <p:output name="data" id="directories"/>
</p:processor>

Reply via email to