public Object GetServerInfo(object arg) { ServerInfo si = new ServerInfo(globalConfig); return si; }
private object GetServers() { Server s = new Server(); lock (s) { foreach (string server in DataService.Config.NbConfigs.Keys) { var si = BrokerConnection.InstanceOf().Request(server, "GetServerInfo", null) as ServerInfo; ServerInfo info = new ServerInfo(); if (si != null) { info = si; } s.Servers.Add(new Server(server, info)); } } return s.Servers; }
public Server (string name, ServerInfo info) { instanceName = name; bitsServer = info.BitsServer; centralConfigServer = info.CentralConfigServer; centralConfigConnection = info.CentralConfigConnection; genevaFileServer = info.GenevaFileServer; genevaSoapUrl = info.GenevaSoapUrl; ifSuppressEmail = info.IfSuppressEmail; reportsServer = info.ReportsServer; runInstance = info.RunInstance; staarsServer = info.StaarsServer; //PropertyChanged += Server_PropertyChanged; //servers.CollectionChanged += Servers_CollectionChanged; }
//public static bool ConnectCentralConfig() //{ // if (String.IsNullOrEmpty(ConfigUtils.GlobalConfig.CentralConfigConnection)) // throw (new ApplicationException("Attempted call to ConnectCentralConfig with null connection string.")); // log.DebugFormat("Trying to connect to central config {0}", ConfigUtils.GlobalConfig.CentralConfigConnection); // if (ConfigUtils.GlobalConfig.ConnectionSettings.Connections == null) // throw (new ApplicationException("Global config connection settings are null")); // if (ConfigUtils.GlobalConfig.ConnectionSettings.Connections.ContainsKey(ConfigUtils.GlobalConfig.CentralConfigConnection) == false) // throw (new ApplicationException("Cannot find connection string for Central Config Server")); // String ccConnectionString = // ((DbConnectionDetail) ConfigUtils.GlobalConfig.ConnectionSettings.Connections[ConfigUtils.GlobalConfig.CentralConfigConnection]). // DefaultConnectString; // if (String.IsNullOrEmpty(ccConnectionString)) // throw (new ApplicationException("Cannot find connection string for Central Config Server")); // log.DebugFormat("Obtained connection string for Central Config server={0}", ConfigUtils.GlobalConfig.CentralConfigConnection); // // If we are creating the configuration component from within this app // // we inherit the application hierarchy, so first we must create the hierarchy. // CentralConfig.InitializeApp(ccConnectionString, true, CentralConfig.Global, CentralConfig.MakeAppLevel("BITS_UI")); // ConfigUtils.GlobalConfig.Hierarchy = CentralConfig.CreateCustomHierarchy("global", // CentralConfig.MakeAppLevel("BITS_JOB_SPEC"), // CentralConfig.MakeUserLevel(Environment.UserName). // ToLower()); // ConfigUtils.GlobalConfig.Hierarchy.Levels.Add(CentralConfig.MakeAppLevel("BITS_JOB_GROUP")); // ConfigUtils.GlobalConfig.Hierarchy.Levels.Add(CentralConfig.MakeAppGroupLevel("METATAGS")); // ConfigUtils.GlobalConfig.Hierarchy.Levels.Add(CentralConfig.MakeAppGroupLevel("METATAGS\\Environment")); // ConfigUtils.GlobalConfig.Hierarchy.Levels.Add(CentralConfig.MakeAppGroupLevel("METATAGS\\RuntimeOnly")); // ConfigUtils.GlobalConfig.Hierarchy.Levels.Add(CentralConfig.MakeAppLevel("ReportServer")); // ConfigUtils.GlobalConfig.Hierarchy.Levels.Add(CentralConfig.MakeAppGroupLevel("DB_CONNECTIONS")); // ConfigUtils.GlobalConfig.ResolveDataBaseConnections(); // //for backward-compatibility // ConfigUtils.GlobalConfig.Hierarchy.Levels.Add(CentralConfig.MakeAppGroupLevel("BITS_JOB_SPEC")); // List<string> jobGroups = (List<string>)ConfigUtils.GlobalConfig.Hierarchy.LevelNames("app\\BITS_JOB_GROUP"); // //for backward-compatibility // if (jobGroups.Count == 0) // jobGroups = (List<string>)ConfigUtils.GlobalConfig.Hierarchy.LevelNames("app\\BITS_JOB_GROUP"); // foreach (string jobGroup in jobGroups) // { // try // { // string to = String.Empty; // ConfigUtils.GlobalConfig.Hierarchy.TryGetValueAtLevel("app\\BITS_JOB_GROUP", jobGroup, out to); // //for backward-compatibility // if (String.IsNullOrEmpty(to)) // ConfigUtils.GlobalConfig.Hierarchy.TryGetValueAtLevel("appgroup\\BITS_JOB_GROUP", jobGroup, out to); // if (to.Equals(String.Empty) == false) // ConfigUtils.GlobalConfig.GuiGroupMapping[jobGroup.ToUpper()] = to; // } // catch (Exception ex) // { // log.Debug(ex); // } // } // try // { // //ConfigUtils.BuildConfigMetatags(ConfigUtils.GlobalConfig); // //ConfigUtils.GlobalConfig.Resolve(); // Entitlements = ConfigUtils.GlobalConfig.Hierarchy.LevelNames2("user\\" + ConfigUtils.GlobalConfig.UserName, "BITS_ENTITLEMENT"); // GetNbConfigs(); // } // catch (Exception ex) // { // log.Debug(ex); // } // //Test entitlement to access specific instance // entitlements = ConfigUtils.GlobalConfig.Hierarchy.LevelNames2("user\\" + ConfigUtils.GlobalConfig.UserName, "BITS_ENTITLEMENT"); // return true; //} public static bool ConnectCentralConfig(ServerInfo si) { if (String.IsNullOrEmpty(si.CentralConfigConnection)) throw (new ApplicationException("Attempted call to ConnectCentralConfig with null connection string.")); log.DebugFormat("Trying to connect to central config {0}", si.CentralConfigConnection); if (ConfigUtils.GlobalConfig.ConnectionSettings.Connections == null) throw (new ApplicationException("Global config connection settings are null")); if (ConfigUtils.GlobalConfig.ConnectionSettings.Connections.ContainsKey(si.CentralConfigConnection) == false) throw (new ApplicationException("Cannot find connection string for Central Config Server")); String ccConnectionString = ((DbConnectionDetail)ConfigUtils.GlobalConfig.ConnectionSettings.Connections[si.CentralConfigConnection]). DefaultConnectString; if (String.IsNullOrEmpty(ccConnectionString)) throw (new ApplicationException("Cannot find connection string for Central Config Server")); log.DebugFormat("Obtained connection string for Central Config server={0}", si.CentralConfigConnection); // If we are creating the configuration component from within this app // we inherit the application hierarchy, so first we must create the hierarchy. CentralConfig.InitializeApp(ccConnectionString, true, CentralConfig.Global, CentralConfig.MakeAppLevel("BITS_UI")); ConfigUtils.GlobalConfig.Hierarchy = CentralConfig.CreateCustomHierarchy("global", CentralConfig.MakeAppLevel("BITS_JOB_SPEC"), CentralConfig.MakeUserLevel(Environment.UserName).ToLower()); ConfigUtils.GlobalConfig.Hierarchy.Levels.Add(CentralConfig.MakeAppLevel("BITS_JOB_GROUP")); ConfigUtils.GlobalConfig.Hierarchy.Levels.Add(CentralConfig.MakeAppGroupLevel("METATAGS")); ConfigUtils.GlobalConfig.Hierarchy.Levels.Add(CentralConfig.MakeAppGroupLevel("METATAGS\\Environment")); ConfigUtils.GlobalConfig.Hierarchy.Levels.Add(CentralConfig.MakeAppGroupLevel("METATAGS\\RuntimeOnly")); ConfigUtils.GlobalConfig.Hierarchy.Levels.Add(CentralConfig.MakeAppLevel("ReportServer")); ConfigUtils.GlobalConfig.Hierarchy.Levels.Add(CentralConfig.MakeAppGroupLevel("DB_CONNECTIONS")); ConfigUtils.GlobalConfig.ResolveDataBaseConnections(); //for backward-compatibility ConfigUtils.GlobalConfig.Hierarchy.Levels.Add(CentralConfig.MakeAppGroupLevel("BITS_JOB_SPEC")); List<string> jobGroups = (List<string>)ConfigUtils.GlobalConfig.Hierarchy.LevelNames("app\\BITS_JOB_GROUP"); //for backward-compatibility if (jobGroups.Count == 0) jobGroups = (List<string>)ConfigUtils.GlobalConfig.Hierarchy.LevelNames("app\\BITS_JOB_GROUP"); foreach (string jobGroup in jobGroups) { try { string to = String.Empty; ConfigUtils.GlobalConfig.Hierarchy.TryGetValueAtLevel("app\\BITS_JOB_GROUP", jobGroup, out to); //for backward-compatibility if (String.IsNullOrEmpty(to)) ConfigUtils.GlobalConfig.Hierarchy.TryGetValueAtLevel("appgroup\\BITS_JOB_GROUP", jobGroup, out to); if (to.Equals(String.Empty) == false) ConfigUtils.GlobalConfig.GuiGroupMapping[jobGroup.ToUpper()] = to; } catch (Exception ex) { log.Debug(ex); } } try { Entitlements = ConfigUtils.GlobalConfig.Hierarchy.LevelNames2("user\\" + ConfigUtils.GlobalConfig.UserName, "BITS_ENTITLEMENT"); GetNbConfigs(); } catch (Exception ex) { log.Debug(ex); } return true; }
private ServerInfo VerifyConnection(string nbInstance) { ServerInfo si = null; try { si = BrokerConnection.Request(nbInstance, "GetServerInfo", null) as ServerInfo; } catch { return null; } return si; }
private static void GetDefaultServerInfo() { si = new ServerInfo(); si.BitsServer = ConfigUtils.GlobalConfig.BitsServer; si.CentralConfigConnection = ConfigUtils.GlobalConfig.CentralConfigConnection; si.CentralConfigServer = ConfigUtils.GlobalConfig.CentralConfigServer; si.GenevaFileServer = ConfigUtils.GlobalConfig.GenevaFileServer; si.GenevaSoapUrl = ConfigUtils.GlobalConfig.GenevaSoapUrl; si.ReportsServer = ConfigUtils.GlobalConfig.ReportsServer; si.RunInstance = ConfigUtils.GlobalConfig.RunInstance; si.StaarsServer = ConfigUtils.GlobalConfig.StaarsServer; }
private void UpdateNbStatus() { try { // test the connection delVerifyConnection dlgt = new delVerifyConnection(VerifyConnection); IAsyncResult iasr = dlgt.BeginInvoke(Config.NbDefault, null, null); if (iasr.AsyncWaitHandle.WaitOne(THREAD_GUIREFRESHSTATUS_INTERVAL)) { si = (ServerInfo)dlgt.EndInvoke(iasr); if (si != null) { ifDisconnectedFromNB = false; } else { ifDisconnectedFromNB = true; } } Application.DoEvents(); if (lockNbStatus || !ifDisconnectedFromNB) return; lockNbStatus = true; delHandleNbStatus d = new delHandleNbStatus(HandleNbStatus); this.BeginInvoke(d); } catch { } finally { } }
private void tsNetBrokers_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { string selectedEnvironment = e.ClickedItem.ToString(); tsNetBrokers.Text = selectedEnvironment; Config.NbDefault = tsNetBrokers.Text; log.InfoFormat("User selected NB instance {0}", selectedEnvironment); si = null; ifDisconnectedFromNB = true; Application.DoEvents(); if (lockNbStatus || !ifDisconnectedFromNB) return; lockNbStatus = true; delHandleNbStatus d = new delHandleNbStatus(HandleNbStatus); this.BeginInvoke(d); }