<file-monitor-process>

Purpose/Function

Extension to <stream-monitor-process> which allows one to attach a monitor which checks for the appearance and/or update of files. Like the stream monitors, the file monitor is automatically started and stopped with the start and termination of the process.

Attributes

NAME

TYPE

DEFAULT VALUE

DESCRIPTION

dumpEnvironment

boolean

false

print the environment to a file before executing (for debugging purposes)

executionDir

java.lang.String

user.dir system property

execute in this directory

inFile

java.lang.String

null

redirect stdin to process from this file

inheritEnvironment

boolean

true

run process in parent's environment

Elements

TAG

TYPE

COUNT

DESCRIPTION

<command-line>

java.lang.String

0:1

command to execute

<environment>

java.util.List

0:1

list of environment variable definitions (name=value); if inheritEnvironment is true, these are added to the parent environment; if not, they constitute the new environment

<err-monitor>

ncsa.tools.ogrescript.process.types.StreamMonitor

0:1

attach this monitor to the error stream

<out-monitor>

ncsa.tools.ogrescript.process.types.StreamMonitor

0:1

attach this monitor to the output stream

<file-monitor>

ncsa.tools.ogrescript.process.types.FileMonitor

0:1

attach this monitor to the process which is producing/updating files

ReturnValues

None.

NOTES

For further explanation of triggers and triggered actions on streams, see under StreamMonitorTrigger and StreamSegmentTriggeredAction; similarly for triggers and triggered actions on files, under FileMonitorTrigger and FileMetadataTriggeredAction.

Examples

<ogrescript>
...
   <file-monitor-process execution-dir="${runtime.dir}">
   	<command-line>${runtime.dir}/testprocess.sh</command-line>
   	<out-monitor>
   		<trigger>
   		   <filter pattern=".*"/>
   			<actions>
   				<stream-progress-action topic="TROLL"/>
   			</actions>
   		</trigger>
   	</out-monitor>
   	<file-monitor>
   	   <pattern base="file:${runtime.dir}">
   	   	<exclude>target</exclude>
   	   </pattern>
   	   <new-file-queued-trigger>
   	 	<filter pattern=".*.txt"/>
   	 	<actions>
   	 		<file-progress-action topic="TROLL"/>
   	 		<file-copy-action targetDir="file:${runtime.dir}/target"/>
   	 	</actions>
   	   </new-file-queued-trigger>
   	</file-monitor>
   </file-monitor-process>
...
</ogrescript>
  • No labels