public GatekeeperService(IConfigSource config, ISimulationService simService) { if (!m_Initialized) { m_Initialized = true; IConfig serverConfig = config.Configs["GatekeeperService"]; if (serverConfig == null) { throw new Exception(String.Format("No section GatekeeperService in config file")); } string accountService = serverConfig.GetString("UserAccountService", String.Empty); string homeUsersService = serverConfig.GetString("UserAgentService", string.Empty); string gridService = serverConfig.GetString("GridService", String.Empty); string presenceService = serverConfig.GetString("PresenceService", String.Empty); string simulationService = serverConfig.GetString("SimulationService", String.Empty); string gridUserService = serverConfig.GetString("GridUserService", String.Empty); string bansService = serverConfig.GetString("BansService", String.Empty); // These are mandatory, the others aren't if (gridService == string.Empty || presenceService == string.Empty) { throw new Exception("Incomplete specifications, Gatekeeper Service cannot function."); } string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString()); UUID.TryParse(scope, out m_ScopeID); //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!"); m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true); m_ExternalName = Util.GetConfigVarFromSections <string>(config, "GatekeeperURI", new string[] { "Startup", "Hypergrid", "GatekeeperService" }, String.Empty); m_ExternalName = serverConfig.GetString("ExternalName", m_ExternalName); if (m_ExternalName != string.Empty && !m_ExternalName.EndsWith("/")) { m_ExternalName = m_ExternalName + "/"; } try { m_Uri = new Uri(m_ExternalName); } catch { m_log.WarnFormat("[GATEKEEPER SERVICE]: Malformed gatekeeper address {0}", m_ExternalName); } Object[] args = new Object[] { config }; m_GridService = ServerUtils.LoadPlugin <IGridService>(gridService, args); m_PresenceService = ServerUtils.LoadPlugin <IPresenceService>(presenceService, args); if (accountService != string.Empty) { m_UserAccountService = ServerUtils.LoadPlugin <IUserAccountService>(accountService, args); } if (homeUsersService != string.Empty) { m_UserAgentService = ServerUtils.LoadPlugin <IUserAgentService>(homeUsersService, args); } if (gridUserService != string.Empty) { m_GridUserService = ServerUtils.LoadPlugin <IGridUserService>(gridUserService, args); } if (bansService != string.Empty) { m_BansService = ServerUtils.LoadPlugin <IBansService>(bansService, args); } if (simService != null) { m_SimulationService = simService; } else if (simulationService != string.Empty) { m_SimulationService = ServerUtils.LoadPlugin <ISimulationService>(simulationService, args); } string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "GatekeeperService" }; m_AllowedClients = Util.GetConfigVarFromSections <string>( config, "AllowedClients", possibleAccessControlConfigSections, string.Empty); m_DeniedClients = Util.GetConfigVarFromSections <string>( config, "DeniedClients", possibleAccessControlConfigSections, string.Empty); m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true); LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions); LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_ForeignsDisallowedExceptions); if (m_GridService == null || m_PresenceService == null || m_SimulationService == null) { throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); } m_log.Debug("[GATEKEEPER SERVICE]: Starting..."); } }
public GatekeeperService(IConfigSource config, ISimulationService simService) { if (!m_Initialized) { m_Initialized = true; IConfig serverConfig = config.Configs["GatekeeperService"]; if (serverConfig == null) { throw new Exception(String.Format("No section GatekeeperService in config file")); } string accountService = serverConfig.GetString("UserAccountService", string.Empty); string homeUsersService = serverConfig.GetString("UserAgentService", string.Empty); string gridService = serverConfig.GetString("GridService", string.Empty); string presenceService = serverConfig.GetString("PresenceService", string.Empty); string simulationService = serverConfig.GetString("SimulationService", string.Empty); string gridUserService = serverConfig.GetString("GridUserService", string.Empty); string bansService = serverConfig.GetString("BansService", string.Empty); // These are mandatory, the others aren't if (gridService == string.Empty || presenceService == string.Empty) { throw new Exception("Incomplete specifications, Gatekeeper Service cannot function."); } string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString()); UUID.TryParse(scope, out m_ScopeID); //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!"); m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true); string[] sections = new string[] { "Const, Startup", "Hypergrid", "GatekeeperService" }; string externalName = Util.GetConfigVarFromSections <string>(config, "GatekeeperURI", sections, string.Empty); if (string.IsNullOrEmpty(externalName)) { externalName = serverConfig.GetString("ExternalName", string.Empty); } m_gatekeeperHost = new OSHHTPHost(externalName, true); if (!m_gatekeeperHost.IsResolvedHost) { m_log.Error((m_gatekeeperHost.IsValidHost ? "Could not resolve GatekeeperURI" : "GatekeeperURI is a invalid host ") + externalName ?? ""); throw new Exception("GatekeeperURI is invalid"); } m_gatekeeperURL = m_gatekeeperHost.URIwEndSlash; string gatekeeperURIAlias = Util.GetConfigVarFromSections <string>(config, "GatekeeperURIAlias", sections, string.Empty); if (!string.IsNullOrWhiteSpace(gatekeeperURIAlias)) { string[] alias = gatekeeperURIAlias.Split(','); for (int i = 0; i < alias.Length; ++i) { OSHHTPHost tmp = new OSHHTPHost(alias[i].Trim(), false); if (tmp.IsValidHost) { if (m_gateKeeperAlias == null) { m_gateKeeperAlias = new HashSet <OSHHTPHost>(); } m_gateKeeperAlias.Add(tmp); } } } object[] args = new object[] { config }; m_GridService = ServerUtils.LoadPlugin <IGridService>(gridService, args); m_PresenceService = ServerUtils.LoadPlugin <IPresenceService>(presenceService, args); if (accountService != string.Empty) { m_UserAccountService = ServerUtils.LoadPlugin <IUserAccountService>(accountService, args); } if (homeUsersService != string.Empty) { m_UserAgentService = ServerUtils.LoadPlugin <IUserAgentService>(homeUsersService, args); } if (gridUserService != string.Empty) { m_GridUserService = ServerUtils.LoadPlugin <IGridUserService>(gridUserService, args); } if (bansService != string.Empty) { m_BansService = ServerUtils.LoadPlugin <IBansService>(bansService, args); } if (simService != null) { m_SimulationService = simService; } else if (simulationService != string.Empty) { m_SimulationService = ServerUtils.LoadPlugin <ISimulationService>(simulationService, args); } string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "GatekeeperService" }; m_AllowedClients = Util.GetConfigVarFromSections <string>( config, "AllowedClients", possibleAccessControlConfigSections, string.Empty); m_DeniedClients = Util.GetConfigVarFromSections <string>( config, "DeniedClients", possibleAccessControlConfigSections, string.Empty); m_DeniedMacs = Util.GetConfigVarFromSections <string>( config, "DeniedMacs", possibleAccessControlConfigSections, string.Empty); m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true); LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions); LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_ForeignsDisallowedExceptions); if (m_GridService == null || m_PresenceService == null || m_SimulationService == null) { throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); } IConfig presenceConfig = config.Configs["PresenceService"]; if (presenceConfig != null) { m_allowDuplicatePresences = presenceConfig.GetBoolean("AllowDuplicatePresences", m_allowDuplicatePresences); } IConfig messagingConfig = config.Configs["Messaging"]; if (messagingConfig != null) { m_messageKey = messagingConfig.GetString("MessageKey", String.Empty); } m_log.Debug("[GATEKEEPER SERVICE]: Starting..."); } }
public GatekeeperService(IConfigSource config, ISimulationService simService) { if (!m_Initialized) { m_Initialized = true; IConfig serverConfig = config.Configs["GatekeeperService"]; if (serverConfig == null) throw new Exception(String.Format("No section GatekeeperService in config file")); string accountService = serverConfig.GetString("UserAccountService", String.Empty); string homeUsersService = serverConfig.GetString("UserAgentService", string.Empty); string gridService = serverConfig.GetString("GridService", String.Empty); string presenceService = serverConfig.GetString("PresenceService", String.Empty); string simulationService = serverConfig.GetString("SimulationService", String.Empty); string gridUserService = serverConfig.GetString("GridUserService", String.Empty); string bansService = serverConfig.GetString("BansService", String.Empty); // These are mandatory, the others aren't if (gridService == string.Empty || presenceService == string.Empty) throw new Exception("Incomplete specifications, Gatekeeper Service cannot function."); string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString()); UUID.TryParse(scope, out m_ScopeID); //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!"); m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true); m_ExternalName = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", new string[] { "Startup", "Hypergrid", "GatekeeperService" }, String.Empty); m_ExternalName = serverConfig.GetString("ExternalName", m_ExternalName); if (m_ExternalName != string.Empty && !m_ExternalName.EndsWith("/")) m_ExternalName = m_ExternalName + "/"; try { m_Uri = new Uri(m_ExternalName); } catch { m_log.WarnFormat("[GATEKEEPER SERVICE]: Malformed gatekeeper address {0}", m_ExternalName); } Object[] args = new Object[] { config }; m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args); if (accountService != string.Empty) m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); if (homeUsersService != string.Empty) m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args); if (gridUserService != string.Empty) m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args); if (bansService != string.Empty) m_BansService = ServerUtils.LoadPlugin<IBansService>(bansService, args); if (simService != null) m_SimulationService = simService; else if (simulationService != string.Empty) m_SimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args); m_AllowedClients = serverConfig.GetString("AllowedClients", string.Empty); m_DeniedClients = serverConfig.GetString("DeniedClients", string.Empty); m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true); LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions); LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_ForeignsDisallowedExceptions); if (m_GridService == null || m_PresenceService == null || m_SimulationService == null) throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function."); m_log.Debug("[GATEKEEPER SERVICE]: Starting..."); } }
public BansController(IBansService bansService, IMapper mapper) : base(mapper) { _bansService = bansService; }