Fertiggestellt

DirectoryWatcher

Job Description:

A directory monitoring class. When a certain type of file is created, it is "locked" and read, passed to another class and then deleted.

Please read the attached documents carefully before bidding.

## Deliverables

### DirectoryWatcher

Namespace: [url removed, login to view]

Overview

This is a class that invokes a RuleEngine (re) whenever a file is created in a directory. There may be multiple directories being watched and there may be multiple applications, on different machines, watching the same directories. When a file in a directory changes the file is read and the RulesEngine is invoked.

A call to beginWatching will start the process of watching the directories.

Processing is done in the single thread, as user intervention may be required.

**Details**

An xml configuration file will determine the rules. The configuration file will be located at [url removed, login to view] + "[\\[url removed, login to view]][1]". The class constructor will load it. The structure will be:

<rules>

<ruleset directoryName="...." />

<ruleset directoryName="...." />

....

</rules>

An xml configuration file ([url removed, login to view]) will have 'ruleset' nodes with an attribute of 'directoryName'. The method beginWatching() should read the configuration file and watch every directory referenced for changed files.

When a file has been changed first verify that the extension of the file is CSV then verify that there is no file of the same name with a "lock" extension. Then write a lock file into the directory, catering for race conditions. If successful, the ruleset node matching the directory that has the modified file needs to be found within the xml file i.e. .selectSingleNode("//ruleset[@directoryName='directory']".

An object (re) of type RuleEngine (namespace AgentMangler) is created passing the ruleset to the constructor and the method:

Public void [url removed, login to view](stream csvData)

Is called. When the method completes the file is to be moved to the Done folder (as specified as an attribute on the ruleset) and the lock file removed.

The process method may throw an InvalidEntity error in which case the original file is moved to a designated errors folder (attribute errorFolder) and the lock file removed. An email is then sent out to a predesignated email address.

The To: email address will be an attribute (errorEmail) on the ruleset

The From: email address will be an attribute (email) on the rules.documentElement.

The SMTP server will be an attribute (smtp) on the rules.documentElement.

The subject should be "Error parsing file"

The body should contain the record number (+1) of the toBeProcessed object that failed and the file name.

Simple email code shown below:

[url removed, login to view] message = new [url removed, login to view]();

[url removed, login to view]("[luckyperson@[url removed, login to view]][2]");

[url removed, login to view] = "This is the Subject line";

[url removed, login to view] = new [url removed, login to view]("[From@[url removed, login to view]][3]");

[url removed, login to view] = "This is the message body";

[url removed, login to view] smtp = new [url removed, login to view]("yoursmtphost");

[url removed, login to view](message);

# Scope

The class [url removed, login to view] is required.

Unit tests in [url removed, login to view]

The unit test should verify the functionality of :

* Monitoring a directory

* Finding, and passing, the correct ruleset node

* The full file locking process

* emails

The class Config will be mocked for the unit test

The class RuleEngine will be mocked for the unit test

The mocked objects should be located in a separate file [url removed, login to view]

Fähigkeiten: C# Programmierung, Microsoft, Script Install, Shell Script, Windows Desktop

Über den Kunden:
( 24 Bewertungen ) Australia

Projekt-ID: #3661625

Vergeben an:

meparashar

See private message.

$125 USD in 14 Tagen
(54 Bewertungen)
5.4

4 Freelancer bieten im Durchschnitt $114 für diesen Job

mobiletech1604

See private message.

$120.7 USD in 14 Tagen
(48 Bewertungen)
6.0
supars

See private message.

$85 USD in 14 Tagen
(0 Bewertungen)
0.0
quicksoftso

See private message.

$125.8 USD in 14 Tagen
(2 Bewertungen)
0.0