Revision c53aa229 trunk/Pithos.Core/Agents/FileAgent.cs

b/trunk/Pithos.Core/Agents/FileAgent.cs
14 14

  
15 15
namespace Pithos.Core.Agents
16 16
{
17
    [Export]
17
    [Export,PartCreationPolicy(CreationPolicy.NonShared)]
18 18
    public class FileAgent
19 19
    {
20 20
        Agent<WorkflowState> _agent;
......
27 27
        [Import]
28 28
        public WorkflowAgent WorkflowAgent { get; set; }
29 29

  
30
        public string RootPath { get; private set; }
30
        private AccountInfo AccountInfo { get; set; }
31

  
32
        private string RootPath { get;  set; }
31 33

  
32 34
        private static readonly ILog Log = LogManager.GetLogger("FileAgent");
33 35

  
34
        public void Start(string rootPath)
36
        public void Start(AccountInfo accountInfo,string rootPath)
35 37
        {
38
            if (accountInfo==null)
39
                throw new ArgumentNullException("accountInfo");
36 40
            if (String.IsNullOrWhiteSpace(rootPath))
37 41
                throw new ArgumentNullException("rootPath");
38 42
            if (!Path.IsPathRooted(rootPath))
39 43
                throw new ArgumentException("rootPath must be an absolute path","rootPath");
40 44
            Contract.EndContractBlock();
41 45

  
46
            AccountInfo = accountInfo;
42 47
            RootPath = rootPath;
43 48
            _watcher = new FileSystemWatcher(rootPath);
44 49
            _watcher.IncludeSubdirectories = true;            
......
201 206
            var filePath = e.FullPath;
202 207
            if (Ignore(filePath)) 
203 208
                return;
204
            _agent.Post(new WorkflowState { Path = filePath, FileName = e.Name, TriggeringChange = e.ChangeType });
209
            _agent.Post(new WorkflowState(AccountInfo) { Path = filePath, FileName = e.Name, TriggeringChange = e.ChangeType });
205 210
        }
206 211

  
207 212

  
......
213 218
            if (Ignore(oldFullPath) || Ignore(fullPath))
214 219
                return;
215 220

  
216
            _agent.Post(new WorkflowState
221
            _agent.Post(new WorkflowState(AccountInfo)
217 222
            {
218 223
                OldPath = oldFullPath,
219 224
                OldFileName = e.OldName,

Also available in: Unified diff