- All Implemented Interfaces:
- java.lang.Runnable
public class FileObserver
extends java.lang.Object
implements java.lang.Runnable
\page FileObserver
\section rules_com_highqsoft_moma_fileobserver_FileObserver FileObserver
\addindex fileobserver
The FileObserver get notifications when a file is created, deleted or modified.
The configuration of the FileObserver is done in a property file. The configuration
file name must be passed as command line parameter: '-Setup Propertyfilename'
E.g. start the file observer:
java -cp jar\dynamicperformance.jar com.highqsoft.moma.fileobserver.FileObserver -Setup C:\cvs\projects\highqsoft\schema\etc\FileObserver.properties
The FileObserver configuration file supports the following entries:
Hint: All numberic values are in seconds.
It is possible to use variable in the defined values of the property file.
Apache supports three types of variables:
sys This prefix marks a variable to be a system property. Commons Configuration will search for a system property
with the given name and replace the variable by its value. This is a very easy means for accessing the values of
system properties in every configuration implementation.
e.g.: user.file = ${sys:user.home}/settings.xml
const The const prefix indicates that a variable is to be interpreted as a constant member field of a class
(i.e. a field with the static final modifiers). The name of the variable must be of the form
.. The specified class will be loaded and the value of this field will be obtained.
e.g.: action.key = ${const:java.awt.event.KeyEvent.VK_CANCEL}
env Variables can also reference OS-specific environment properties. This is indicated by the env prefix.
e.g.: java.home = ${env:JAVA_HOME}
; The log level. Supported entries: OFF, SEVERE, WARNING, INFO, CONFIG, FINE, ALL, the default is INFOs
FileObserver.Loglevel = FINE
; The name of the file observer log file
FileObserver.LogFile = C:\\Temp\\FileObserver.log
; Delay time for waiting during start of file observer
; After the start, the FileObserver waits the defined delay time before
; starting to scan the directories and import on stable files.
; Default value: 60
FileObserver.DelayTime = 10
; It can happen the FileObserver miss a certain notification so the FileObserver scans the directories also periodically.
; Default value: 3600
FileObserver.ScanFrequence = 3600
; When new file is detected, the file observers waits the given time before executing defined commands
; The FileObserver starts a check on a stable file after a notification of a created file.
; A stable file is a file where the length is not changed within the time period.
; The time period within the file is not changed.
; Default value: 10
FileObserver.StableTime = 10
; One or more directories to observe
FileObserver.Directory = C:\\Temp\\dir1
FileObserver.Directory = C:\\Temp\\dir2
; One or more file patterns as regular expression and the command which should be executed when filename match
; %FILENAME% is the place holder for found file at the observed directories.
FileObserver.FilePattern = .*\.tdms
FileObserver.Command = java -jar jar\\dynamicperformance.jar etc\\Import_TDMS.xml ${FILENAME}
FileObserver.FilePattern = .*\.csv
FileObserver.Command = java -jar jar\\dynamicperformance.jar etc\\Import_CSVS.xml ${FILENAME}
; The directory which should be used for executing commands
FileObserver.WorkingDirectory = C:\\cvs\\projects\\honda\\hrda\\dynamicPerformance\\import
; The directory where the file will be moved in case the command was executed successful
; when the directory is not given the file stays where it is. The directory must exist.
FileObserver.DirectoryOk = C:\\cvs\\projects\\honda\\hrda\\ImportOk
; The directory where the file will be moved in case the command was executed with error.
; when the directory is not given the file stays where it is. The directory must exist.
FileObserver.DirectoryFailed = C:\\cvs\\projects\\honda\\hrda\\ImportFailed
; The summary log file where the command, the result and duration will be reported.
; In case the SummaryLog is not given, no output will be produced.
FileObserver.SummaryLog = C:\\cvs\\projects\\honda\\hrda\\Result.log
The FileObserver starts only one import at the same time, no parallel imports are supported.