public IFile CopyToWorkingDirectory(Guid processId, string filePath) { if (!_fileStorage.Exists(filePath)) { throw new FileNotFoundException($"File at path '{filePath}' not found."); } _logger.LogInfo("Waiting on file to be ready..."); _fileStorage.WaitForFileReady(filePath, _settings.DropFileReadyTimeout); _logger.LogInfo("File ready."); var file = _fileStorage.GetFile(filePath); ValidateIntegrationFile(file); var workingFileInfo = GetWorkingFileInfo(file, processId); _logger.LogInfo($"Copying dropped file at '{file}' to '{workingFileInfo}'..."); string workingFilePath = _fileStorage.CopyFile(file.FullPath, workingFileInfo.FullPath); _logger.LogInfo("Copying complete."); if (_settings.DeleteFromDropDirectory) { _logger.LogInfo($"Deleting dropped file at '{filePath}'..."); _fileStorage.Delete(filePath); _logger.LogInfo($"Dropped file deleted."); } return(_fileStorage.GetFile(workingFilePath)); }
public string Execute(string filePath) { Guard.IsNotNull(filePath, nameof(filePath)); ProcessWorkingDirectoryContext processDirectoryContext = null; try { _logger.LogInfo("******** Process Started ********"); _logger.LogInfo($"File Path: {filePath}"); _logger.LogInfo($"Process ID: {Id}"); processDirectoryContext = _processSetup.SetupProcessDirectory(Id, filePath); _logger.LogInfo("**** Beginning Executables processing. ****"); _processExecutor.Execute(Id, processDirectoryContext.ProcessDirectory); _logger.LogInfo("**** Executables processing completed successfully. ****"); } catch (Exception ex) { _logger.LogInfo("** FAILURE **"); _logger.LogInfo($"Process Error: {ex.Message}"); _logger.LogError(ex); } finally { try { // TODO //_finalizer.OnComplete(success, processDirectoryContext?.WorkingDirectory); _logger.LogInfo("******** Process Complete ********"); } catch (Exception ex) { _logger.LogError(ex); } } return(_logger.ToString()); }
public void Archive(Guid processId, string filePath) { if (!_settings.Archive) { return; } _logger.LogInfo("Archiving integration..."); var archiveFile = GetArchiveFile(filePath, processId); _logger.LogInfo($"Copying '{filePath}' to '{archiveFile.FullPath}'..."); _fileStorage.CopyFile(filePath, archiveFile.FullPath); _logger.LogInfo("Copying complete."); _logger.LogInfo($"Integration files archived to '{archiveFile.FullPath}'."); CleanUpArchive(archiveFile.Directory, _settings.ArchiveLimit); }