public static RFMonitoredFile ReadFromConfig(RFEnum fileKey, IRFUserConfig config, Func <string, string> nameTransform = null, bool throwIfFail = true) { try { var m = new RFMonitoredFile { FileKey = fileKey, FileNameWildcard = config.GetString(CONFIG_SECTION, fileKey, false, "FileNameWildcard"), FileNameRegex = config.GetString(CONFIG_SECTION, fileKey, false, "FileNameRegex"), GetSubDirectory = config.GetString(CONFIG_SECTION, fileKey, false, "GetSubDirectory") ?? config.GetString(CONFIG_SECTION, fileKey, false, "SubDirectory"), PutSubDirectory = config.GetString(CONFIG_SECTION, fileKey, false, "PutSubDirectory"), NameTransform = nameTransform, Recursive = config.GetBool(CONFIG_SECTION, fileKey, false, false, "RecursiveSearch"), RemoveExpired = config.GetBool(CONFIG_SECTION, fileKey, false, false, "RemoveExpired"), LatestOnly = config.GetBool(CONFIG_SECTION, fileKey, false, false, "LatestOnly"), ContentPasswords = config.GetString(CONFIG_SECTION, fileKey, false, "ContentPasswords"), }; if (string.IsNullOrWhiteSpace(m.FileNameWildcard) && string.IsNullOrWhiteSpace(m.FileNameRegex) && throwIfFail) { throw new RFSystemException(typeof(RFMonitoredFile), "Invalid monitored file {0} configuration: missing file name.", fileKey.ToString()); } return(m); } catch (Exception) { if (throwIfFail) { throw; } } return(null); }
public override List <RFFileAvailableEvent> CheckSite(List <RFMonitoredFile> monitoredFiles) { var availableFiles = new List <RFFileAvailableEvent>(); using (var activity = new RFInputFilesActivity(mContext)) { foreach (var monitoredFile in monitoredFiles) { foreach (var file in activity.GetInputFilesList(new List <RFEnum> { monitoredFile.FileKey })) { availableFiles.Add(new RFFileAvailableEvent { FileAttributes = new RFFileTrackedAttributes { FileName = file.Attributes.FileName, FileSize = file.Attributes.FileSize, FullPath = file.UniqueKey, ModifiedDate = file.UpdateTime.UtcDateTime }, FileKey = RFEnum.FromString(file.FileKey), SourceSite = SiteKey }); } } } return(availableFiles); }
public static RFLocalMirrorSite ReadFromConfig(RFEnum siteKey, IRFUserConfig userConfig, string connectionString) { return(new RFLocalMirrorSite(siteKey, userConfig, userConfig.GetString(CONFIG_SECTION, siteKey, true, "RootDirectory"), connectionString) { SiteKey = siteKey, PreserveModifiedDate = userConfig.GetBool(CONFIG_SECTION, siteKey, false, true, "PreserveModifiedDate"), CacheDirectoryList = true }); }
public static RFKeyVaultKey Create(RFKeyDomain domain, RFEnum _enum) { return(domain.Associate(new RFKeyVaultKey { Plane = RFPlane.User, Enum = _enum, StoreType = RFStoreType.Document, GraphInstance = null }) as RFKeyVaultKey); }
public static RFCatalogKey Create(RFKeyDomain domain, RFEnum fileKey, string uniqueKey) { return(domain.Associate(new RFFileKey { FileKey = fileKey, UniqueKey = uniqueKey, StoreType = RFStoreType.Document, Plane = RFPlane.User })); }
public static RFCatalogKey Create(RFKeyDomain domain, RFEnum reportCode, RFGraphInstance instance) { return(domain.Associate(new RFRawReportKey { Plane = RFPlane.User, ReportCode = reportCode, StoreType = RFStoreType.Document, GraphInstance = instance })); }
public static RFDataSetKey Create(RFKeyDomain domain, RFEnum dataSetCode, RFGraphInstance instance, params string[] path) { return(domain.Associate(new RFDataSetKey { Plane = RFPlane.User, DataSetCode = dataSetCode, StoreType = RFStoreType.Document, Path = path != null ? String.Join("/", path) : null, GraphInstance = instance }) as RFDataSetKey); }
protected RFAttributionActivity(IRFProcessingContext context, Func <RFDate, RFGraphInstance> getInstanceFunc, Func <RFEnum, RFCatalogKey> keyCreatorFunc, RFEnum latestEnum, RFEnum templateEnum, string userName) : base(context, userName) { mGetInstanceFunc = getInstanceFunc; mKeyCreatorFunc = keyCreatorFunc; mLatestEnum = latestEnum; mTemplateEnum = templateEnum; }
public static RFFTPFileSite ReadFromConfig(RFEnum siteKey, IRFUserConfig userConfig) { return(new RFFTPFileSite(siteKey, userConfig) { SiteKey = siteKey, SiteType = (RFFTPSiteType)Enum.Parse(typeof(RFFTPSiteType), userConfig.GetString(CONFIG_SECTION, siteKey, true, "SiteType"), true), Hostname = userConfig.GetString(CONFIG_SECTION, siteKey, true, "Hostname"), Port = userConfig.GetInt(CONFIG_SECTION, siteKey, false, null, "Port"), Username = userConfig.GetString(CONFIG_SECTION, siteKey, true, "Username"), Password = userConfig.GetString(CONFIG_SECTION, siteKey, false, "Password"), ConnectionKeyPath = userConfig.GetString(CONFIG_SECTION, siteKey, false, "ConnectionKeyPath"), ConnectionKeyPassword = userConfig.GetString(CONFIG_SECTION, siteKey, false, "ConnectionKeyPassword"), RootDirectory = userConfig.GetString(CONFIG_SECTION, siteKey, false, "RootDirectory") }); }
protected RFFileSite(RFEnum siteKey, string configSection, IRFUserConfig userConfig) { SiteKey = siteKey; Enabled = true; MaxAge = null; if (userConfig != null) { MaxAge = userConfig.GetDecimal(configSection, siteKey, false, null, "MaxAge"); Enabled = userConfig.GetBool(configSection, siteKey, false, true, "Enabled"); PGPSuffixes = userConfig.GetString(configSection, siteKey, false, "PGPSuffixes"); PGPKeyPath = userConfig.GetString(configSection, siteKey, false, "PGPKeyPath"); PGPKeyPassword = userConfig.GetString(configSection, siteKey, false, "PGPKeyPassword"); WriteCooldown = userConfig.GetInt(configSection, siteKey, false, null, "WriteCooldown"); ScanArchives = userConfig.GetBool(configSection, siteKey, false, false, "ScanArchives"); ArchivePath = userConfig.GetString(configSection, siteKey, false, "ArchivePath"); UseTemporaryName = userConfig.GetBool(configSection, siteKey, false, false, "UseTemporaryName"); } }
public RFFTPFileSite(RFEnum siteKey, IRFUserConfig userConfig) : base(siteKey, CONFIG_SECTION, userConfig) { }
public static string GetRootDirectory(RFEnum siteKey, IRFUserConfig userConfig) { return(userConfig.GetString(CONFIG_SECTION, siteKey, true, "RootDirectory")); }
public RFLocalMirrorSite(RFEnum siteKey, IRFUserConfig userConfig, string rootDirectory, string connectionString) : base(siteKey, userConfig, rootDirectory) { SiteKey = siteKey; RootDirectory = rootDirectory; _connectionString = connectionString; }
protected RFCatalogKey AttributionKey(RFDate valueDate, RFEnum key) { return(mKeyCreatorFunc(key).CreateForInstance(mGetInstanceFunc(valueDate))); }
public RFLocalFileSite(RFEnum siteKey, IRFUserConfig userConfig, string rootDirectory) : base(siteKey, CONFIG_SECTION, userConfig) { SiteKey = siteKey; RootDirectory = rootDirectory; }
public ActionResult SubmitFile( string fileKey, HttpPostedFileBase fileData, RFDate?valueDate, string returnUrl = null, string instance = null) { try { if (fileData == null && Request.Files != null && Request.Files.Count > 0) { fileData = Request.Files[0]; } var uniqueKey = String.Format("{0}_web", DateTime.Now.ToString("yyyyMMdd_HHmmss")); if (fileData == null || fileData.FileName == null || fileData.InputStream == null) { throw new RFSystemException(this, "No file submitted."); } var fileName = Path.GetFileName(fileData.FileName); var newFileEntry = RFDocument.Create( RFFileKey.Create( EngineConfig.KeyDomain, RFEnum.FromString(fileKey), uniqueKey), new RFFile { Attributes = new RFFileTrackedAttributes { FileName = fileName, FullPath = fileData.FileName, FileSize = fileData.ContentLength, ModifiedDate = DateTime.Now }, Data = RFStreamHelpers.ReadBytes(fileData.InputStream), FileKey = RFEnum.FromString(fileKey), ValueDate = valueDate, UniqueKey = uniqueKey }); // the file will have graph instance attached if (instance.NotBlank() && valueDate.HasValue) { newFileEntry.Key.GraphInstance = new RFGraphInstance { Name = instance, ValueDate = valueDate.Value }; } using (var rfService = new RFServiceClient()) { RFProcessingTrackerHandle trackerKey = null; trackerKey = rfService.RFService.SubmitAndProcess(new List <RFCatalogEntryDTO> { new RFCatalogEntryDTO(newFileEntry) }, new RFUserLogEntry { Action = "Upload File", Description = String.Format("Uploaded file {0} for processing", fileName), IsUserAction = true, IsWarning = false, Processor = null, ValueDate = valueDate.HasValue ? valueDate.Value : RFDate.NullDate, Username = Username }); //lock (sSync) { AddModelToCache(uniqueKey, new ProcessingModel { Tracker = trackerKey, ProcessingKey = uniqueKey, FileKey = fileKey, FileName = fileName, FileSize = fileData.ContentLength, ReturnUrl = returnUrl }); } return(RedirectToAction("ProcessingStatus", new { processKey = uniqueKey })); } } catch (Exception ex) { Log.Exception(this, "SubmitFile", ex); return(Error("InputFiles", "System", null, "Error submitting file: {0}", ex.Message)); } }
public RFSecureActivity(IRFProcessingContext context, string userName, RFKeyDomain keyDomain, RFEnum vaultEnum) : base(context, userName.ToLower().Trim()) { _vaultKey = RFKeyVaultKey.Create(keyDomain, vaultEnum); }
public RFMirrorActivity(IRFProcessingContext context, string userName) : base(context, userName) { _dc = new RFFrameworkDataContext(RFSettings.GetAppSetting("RFFramework.DataContext")); _mirrorRoot = RFLocalMirrorSite.GetRootDirectory(RFEnum.FromString("Mirror"), context.UserConfig); }