public ITimeManager Start(string[] args, GlobalConfigDetails _globalConfig) { globalConfig = _globalConfig; PerfTimer hptStartup = new PerfTimer(); hptStartup.Start(); #region Configuration section log.Info("Reading configuration for Time Manager service."); log.Info("Reading configuration done"); #endregion log.Info("Starting BITS Time Manager service"); this.CanStop = true; this.CanShutdown = true; TimeManager.InstanceOf(globalConfig).Start(); hptStartup.Stop(); log.InfoFormat("BITS Time Manager has started in {0} seconds.", hptStartup.Duration); return TimeManager.InstanceOf(); }
public ServerInfo(GlobalConfigDetails config) { BitsServer = config.BitsServer != null ? config.BitsServer : ""; CentralConfigServer = config.CentralConfigServer != null ? config.CentralConfigServer : ""; CentralConfigConnection = config.CentralConfigConnection != null ? config.CentralConfigConnection : ""; GenevaFileServer = config.GenevaFileServer != null ? config.GenevaFileServer : ""; GenevaSoapUrl = config.GenevaSoapUrl != null ? config.GenevaSoapUrl : ""; IfSuppressEmail = config.SuppressEmail; ReportsServer = config.ReportsServer != null ? config.ReportsServer : ""; RunInstance = config.RunInstance != null ? config.RunInstance : ""; StaarsServer = config.StaarsServer != null ? config.StaarsServer : ""; }
public static DataMonitorManager InstanceOf(GlobalConfigDetails globalConfig) { if (_instance == null) { lock (s_lock) { if (_instance == null) { return _instance = new DataMonitorManager(globalConfig); } } } return _instance; }
public static TimeManager InstanceOf(GlobalConfigDetails globalConfig) { if (_instance == null) { lock (s_lock) { if (_instance == null) { _instance = new TimeManager(); _instance.globalConfig = globalConfig; RefreshNamedSchedules(); EnableNamedScheduleReload(); } } } return _instance; }
public IDataMonitorManager Start(string[] args, GlobalConfigDetails _globalConfig) { globalConfig = _globalConfig; PerfTimer hptStartup = new PerfTimer(); hptStartup.Start(); log.Info("Starting BITS Time Manager service"); this.CanStop = true; this.CanShutdown = true; DataMonitorManager.InstanceOf(globalConfig).Start(); hptStartup.Stop(); log.InfoFormat("BITS Time Manager has started in {0} seconds.", hptStartup.Duration); return DataMonitorManager.InstanceOf(); }
public IFlatFileLoader Start(string[] args, GlobalConfigDetails _globalConfig) { globalConfig = _globalConfig; FlatFileLoader.InstanceOf().GlobalConfig = _globalConfig; log.Info("Starting BITS File Manager service"); PerfTimer hptStartup = new PerfTimer(); hptStartup.Start(); this.CanStop = true; this.CanShutdown = true; FlatFileLoader.InstanceOf().Start(); hptStartup.Stop(); log.InfoFormat("BITS File Manager service has started in {0} seconds.", hptStartup.Duration); return (IFlatFileLoader)FlatFileLoader.InstanceOf(); }
public static DateTime GetNextBusDate ( GlobalConfigDetails globalConfig, string runAsInstance, DateTime RunDate ) { return GetTargetBusDate(globalConfig, runAsInstance, RunDate ,1); }
public static DateTime GetPreviousBusDate(GlobalConfigDetails globalConfig, string runAsInstance) { return GetTargetBusDate(globalConfig, runAsInstance, DateTime.Today, -1); #region OldImplementation was calling not existing usp_GetPrevUSBusinessDate //DbConnectionDetail dbConnDetail = null; //DateTime prevDate = DateTime.MinValue; //if (globalConfig.ConnectionSettings.Connections != null) //{ // if (runAsInstance.Equals("PROD")) // dbConnDetail = (DbConnectionDetail)globalConfig.ConnectionSettings.Connections[globalConfig.DbReference_PROD]; // else // dbConnDetail = (DbConnectionDetail)globalConfig.ConnectionSettings.Connections[globalConfig.DbReference_QA]; // if (dbConnDetail != null) // { // DatabaseUtils.Connect(dbConnDetail.DefaultConnectString); // if (DatabaseUtils.TestConnection()) // { // System.Data.SqlClient.SqlParameter[] parameters = { // new System.Data.SqlClient.SqlParameter("@RunDate", SqlDbType.DateTime), // }; // parameters[0].Value = DateTime.Now; // parameters[0].Direction = ParameterDirection.Output; // DataSet ds = DatabaseUtils.ExecuteStoredProc("[usp_GetPrevUSBusinessDate]", parameters, "Table0"); // if (parameters[0].Value != null && parameters[0].Value != DBNull.Value) // prevDate = (DateTime)parameters[0].Value; // } // } //} //return prevDate; #endregion }
//public Job(Job oJob, bool isNew) //{ // key = isNew ? DateTime.Now : oJob.key; // jobName = oJob.jobName; // dependencyTraversalMode = oJob.dependencyTraversalMode; // config = oJob.config; // arrModules = oJob.arrModules; // modules = oJob.modules; // dependencies = oJob.dependencies; // limiter = oJob.limiter; // jobStats = new JobStats(this); // jobDetails = oJob.jobDetails; // jobState = new State(oJob.JobState); // jobState.CurrentJobCode = key; // jobState.CurrentJobHash = KeyHash; // jobState.JobName = jobName; //} public Job(string _jobName, string _dependencyTraversalMode, JobDetails _jobDetails, GlobalConfigDetails _config) { config = _config; jobName = _jobName; jobStats = new JobStats(this); jobState = new State(_jobName); jobDetails = _jobDetails; dependencyTraversalMode = _dependencyTraversalMode; }
public Job(Job oJob) { key = oJob.key; jobName = oJob.jobName; dependencyTraversalMode = oJob.dependencyTraversalMode; jobStats = new JobStats(this); jobDetails = oJob.jobDetails; jobState = new State(oJob.JobState); config = oJob.config; arrModules = oJob.arrModules; modules = oJob.modules; dependencies = oJob.dependencies; limiter = oJob.limiter; }
public static ITimeManager StartTimeManagerService(GlobalConfigDetails globalConfig) { ITimeManager tManager = timeManagerService.Start(null, globalConfig); return tManager; }
private DataMonitorManager(GlobalConfigDetails globalConfig) { _globalConfig = globalConfig; _dmDictionary = new Dictionary<string, DataMonitor>(); _dmDetailsDictionary= new Dictionary<string, DataMonitorDetails>(); }
public ConfigHelper(GlobalConfigDetails globalConfig) { BuildRepositories(globalConfig); }
/// <summary> /// Replaces meta tags in filename with the appropriate data /// </summary> /// <param name="RunID"></param> /// <returns></returns> /// /// /// public static void BuildConfigMetatags(GlobalConfigDetails globalConfig) { XDocument tags; environmentMetatagsDictionary = new Dictionary<string, string>(); runtimeMetatagsDictionary = new Dictionary<string, string>(); if (File.Exists(GlobalConfig.AppRoot + "\\BItsShellMetatagData.xml")) { //load tags from file try { tags = XDocument.Load(GlobalConfig.AppRoot + "\\BItsShellMetatagData.xml"); } catch (Exception ex) { log.Error("Could not find file with Metattags"); throw new Exception("Could not find file with Metatags", ex); } //build runtime dictionaries try { var res = from metatag in tags.Descendants("Metatag") where metatag.Element("TagScope").Value == "Environment" select metatag; foreach (XElement resItem in res) { switch (resItem.Element("TagScope").Value) { case "Environment": environmentMetatagsDictionary[resItem.Element("Tag").Value] = resItem.Element("TagValue").Value; break; case "Runtime": runtimeMetatagsDictionary[resItem.Element("Tag").Value] = resItem.Element("TagValue").Value; break; default: break; } } } catch (Exception ex) { log.Error("Could not create Metatatgs dictionary out of Metatags file " + ex.Message); throw new Exception("Could not create Netatatgs dictionary out of Metatags file", ex); } } else { log.Warn("No Metatag file provided"); } //add to runtime dictionaries from app.config environmentMetatagsDictionary["*ROOT*"] = globalConfig.AppRoot; }
private static DataTable GetGoldDatesFromDb(GlobalConfigDetails globalConfig) { DataSet ds = new DataSet(); DbConnectionDetail dbConnDetail = null; try { if (globalConfig.ConnectionSettings.Connections != null) { string existingConnectionString = DatabaseUtils.DBConnection.ConnectionString; dbConnDetail = (DbConnectionDetail)globalConfig.ConnectionSettings.Connections[globalConfig.GoldDateConnection]; DatabaseUtils.Connect(dbConnDetail.DefaultConnectString); ds = DatabaseUtils.ExecuteStoredProc("usp_GetGoldDates", new IDataParameter[] { }, "GoldDates"); //safety to return it back after using DatabaseUtils if(String.IsNullOrEmpty(existingConnectionString)==false) DatabaseUtils.Connect(existingConnectionString); } } catch (Exception e) { log.WarnFormat(e.ToString()); } return ds.Tables["GoldDates"]; }
private static DateTime GetGoldDate(GlobalConfigDetails globalConfig, string dateType) { switch (dateType) { case "*GOLD_PSDATE*": return (DateTime)GetGoldDatesFromDb(globalConfig).Rows[0]["PeriodStartDate"]; case "*GOLD_PEDATE*": return (DateTime)GetGoldDatesFromDb(globalConfig).Rows[0]["PeriodEndDate"]; case "*GOLD_KDATE*": return (DateTime)GetGoldDatesFromDb(globalConfig).Rows[0]["KnowledgeDate"]; case "*GOLD_PKDATE*": return (DateTime)GetGoldDatesFromDb(globalConfig).Rows[0]["PriorKnowledgeDate"]; } return DateTime.MinValue; }
private static DateTime GetNextBusDate ( GlobalConfigDetails globalConfig, string runAsInstance ) { return GetTargetBusDate(globalConfig, runAsInstance, DateTime.Today,1); }
private static DateTime GetPreviousBusDate(GlobalConfigDetails globalConfig, string runAsInstance, DateTime RunDate) { return GetTargetBusDate(globalConfig, runAsInstance, RunDate, -1); }
public static DateTime GetTargetBusDate ( GlobalConfigDetails globalConfig, string runAsInstance, DateTime RunDate, int DayOffset ) { DbConnectionDetail dbConnDetail = null; DateTime nextDate = DateTime.MinValue; //safety to return it back after using DatabaseUtils string globalDbUtilsConnectionString = DatabaseUtils.DBConnection.ConnectionString; if (globalConfig.ConnectionSettings.Connections != null) { dbConnDetail = (DbConnectionDetail)globalConfig.ConnectionSettings.Connections[globalConfig.CentralConfigConnection]; if (dbConnDetail != null) { lock (DatabaseUtils.Sync_lock) { DatabaseUtils.Connect(dbConnDetail.DefaultConnectString); if (DatabaseUtils.TestConnection()) { System.Data.SqlClient.SqlParameter[] parameters = { new System.Data.SqlClient.SqlParameter("@RunDate", RunDate), new System.Data.SqlClient.SqlParameter("@Offset", DayOffset), }; parameters[0].Direction = ParameterDirection.InputOutput; DataSet ds = DatabaseUtils.ExecuteStoredProc("[usp_GetTargetUSBusinessDate]", parameters, "Table0"); if (parameters[0].Value != null && parameters[0].Value != DBNull.Value) nextDate = (DateTime) parameters[0].Value; } } } if (globalDbUtilsConnectionString.Equals(String.Empty)) DatabaseUtils.DBConnection.ConnectionString = globalDbUtilsConnectionString; else DatabaseUtils.Connect(globalDbUtilsConnectionString); } return nextDate; }
private ExecutionEngine() { nbConfig = ConfigUtils.NbConfig; globalConfig = ConfigUtils.GlobalConfig; Repository.SetFactory(new LocalRepositoryFactory()); Repository.SetContext(new ContextUser()); ResetMdaProxy(); InitializeJobQueueThread(); InitializetJobStatusThread(); }
private static bool GetCentralConfig(ref GlobalConfigDetails globalConfig) { string connectionString = ""; if (!CentralConfig.IsInitialized) { try { if (globalConfig.CentralConfigConnection.Equals(String.Empty) || globalConfig.CentralConfigConnection.Contains("*")) throw new ApplicationException("Central Config reference cannot be blank or a metatag. Please fix configuration and restart service."); if (globalConfig.ConnectionSettings.Connections[globalConfig.CentralConfigConnection] != null) connectionString = ((DbConnectionDetail)globalConfig.ConnectionSettings.Connections[globalConfig.CentralConfigConnection]).DefaultConnectString; else //VJ Deprecated??? CentralConfig.FetchConnectionString("BitsConfig"); //TO DO - verify and check that connect string is in central config throw new ApplicationException("CentralConfig DB connection is not loaded from centralConfigDBConnString configuration parameter value"); log.InfoFormat("Connecting to Central Config on {0} using \"{1}\"", globalConfig.CentralConfigConnection, connectionString); // If we are creating the configuration component from within this application // we will inherit the application hierarchy, so first we must create the hierarchy. CentralConfig.InitializeApp(connectionString, CentralConfig.Global, CentralConfig.MakeAppLevel("BITS_SHELL")); globalConfig.Hierarchy = CentralConfig.CreateCustomHierarchy("global", CentralConfig.MakeAppLevel("BITS_JOB_SPEC"), CentralConfig.MakeUserLevel( Environment.UserName).ToLower()); globalConfig.Hierarchy.Levels.Add(CentralConfig.MakeInstanceLevel(globalConfig.RunInstance)); globalConfig.Hierarchy.Levels.Add(CentralConfig.MakeAppGroupLevel("DB_CONNECTIONS")); globalConfig.ResolveDataBaseConnections(); globalConfig.Hierarchy.Levels.Add(CentralConfig.MakeAppLevel("BITS_SHARED_SCHEDULE")); globalConfig.Hierarchy.Levels.Add(CentralConfig.MakeAppLevel("BITS_JOB_SPEC")); globalConfig.Hierarchy.Levels.Add(CentralConfig.MakeAppGroupLevel("FOLDER_OVERRIDE")); globalConfig.Hierarchy.Levels.Add(CentralConfig.MakeAppGroupLevel("METATAGS")); globalConfig.Hierarchy.Levels.Add(CentralConfig.MakeAppGroupLevel("METATAGS\\Environment")); globalConfig.Hierarchy.Levels.Add(CentralConfig.MakeAppGroupLevel("METATAGS\\Runtime")); //globalConfig.Hierarchy[] .Levels.Add(CentralConfig.MakeAppGroupLevel("METATAGS\\Runtime")); MetaTagReplacer.LoadEnvironmentProperties(ref globalConfig.GlobalParameters); globalConfig.ResolveEnvironmentFields(); globalConfig.GlobalParameters["*ROOT*"] = globalConfig.AppRoot; log.InfoFormat("*ROOT* = {0}", (string)globalConfig.GlobalParameters["*ROOT*"]); globalConfig.GlobalParameters["*RUN_INSTANCE*"] = globalConfig.RunInstance; log.InfoFormat("*RUN_INSTANCE* = {0}", (string)globalConfig.GlobalParameters["*RUN_INSTANCE*"]); log.InfoFormat("Connected to Central Config on {0}", globalConfig.CentralConfigConnection); log.InfoFormat("User: {0} Role: {1}", globalConfig, ConfigUtils.GlobalConfig.UserRole); } catch (Exception ex) { log.ErrorFormat("Failed to connect to Central Config on {0} using \"{1}\"", globalConfig.CentralConfigConnection, connectionString); log.Error(ex); return false; } } return true; }
public static IFlatFileLoader StartFileManagerService(GlobalConfigDetails globalConfig) { IFlatFileLoader ffLoader = fileManagerService.Start(null, globalConfig); return ffLoader; }
private void BuildRepositories(GlobalConfigDetails globalConfig) { Bam.Framework.Service.Persistence.Repository.SetFactory(new LocalRepositoryFactory()); #region fill Fh1-Sql repository NameValueCollection config = null; config = (NameValueCollection)ConfigurationManager.GetSection("SqlPersistence.Repository"); if (config != null) _repositories["SqlPersistence"] = FillRepositoryInfo(config, "SqlPersistence"); #endregion #region fill Brain repository config = null; config = (NameValueCollection)ConfigurationManager.GetSection("BrainPersistenceBamRef.Repository"); if (config != null) _repositories["BrainPersistenceBamRef"] = FillRepositoryInfo(config, "BrainPersistenceBamRef"); config = (NameValueCollection)ConfigurationManager.GetSection("BrainPersistenceBamExt.Repository"); if (config != null) _repositories["BrainPersistenceBamExt"] = FillRepositoryInfo(config, "BrainPersistenceBamExt"); #endregion #region fill Geneva repository if (globalConfig != null) { switch (globalConfig.DefaultPersistenceRepository) { case "GenevaPersistencePROD": config = (NameValueCollection)ConfigurationManager.GetSection("GenevaPersistencePROD.Repository"); break; case "GenevaPersistenceQA": config = (NameValueCollection)ConfigurationManager.GetSection("GenevaPersistenceQA.Repository"); break; case "GenevaPersistenceDR": config = (NameValueCollection)ConfigurationManager.GetSection("GenevaPersistenceDR.Repository"); break; } if (config != null) _repositories["GenevaPersistence"] = FillRepositoryInfo(config, "GenevaPersistence"); } #endregion #region fill Dashboard repository if (globalConfig != null) { config = (NameValueCollection)ConfigurationManager.GetSection("Dashboard.Repository"); if (config != null) _repositories["Dashboard"] = FillRepositoryInfo(config, "Dashboard"); } #endregion #region fill Reference repository if (globalConfig != null) { config = (NameValueCollection)ConfigurationManager.GetSection("ReferenceRepository.Repository"); if (config != null) _repositories["ReferenceRepository"] = FillRepositoryInfo(config, "ReferenceRepository"); } #endregion #region fill in MDA repository if (globalConfig != null) { config = (NameValueCollection)ConfigurationManager.GetSection("MDA.Repository"); if (config != null) _repositories["MDA"] = FillRepositoryInfo(config, "MDA"); } #endregion #region fill in MDA repository if (globalConfig != null) { config = (NameValueCollection)ConfigurationManager.GetSection("BossRepository.Repository"); if (config != null) _repositories["BossRepository"] = FillRepositoryInfo(config, "BossRepository"); } #endregion }