public PresenceServiceBase(IConfigSource config) : base(config) { string dllName = String.Empty; string connString = String.Empty; string realm = "Presence"; // // Try reading the [DatabaseService] section, if it exists // IConfig dbConfig = config.Configs["DatabaseService"]; if (dbConfig != null) { if (dllName == String.Empty) { dllName = dbConfig.GetString("StorageProvider", String.Empty); } if (connString == String.Empty) { connString = dbConfig.GetString("ConnectionString", String.Empty); } } // // [PresenceService] section overrides [DatabaseService], if it exists // IConfig presenceConfig = config.Configs["PresenceService"]; if (presenceConfig != null) { dllName = presenceConfig.GetString("StorageProvider", dllName); connString = presenceConfig.GetString("ConnectionString", connString); realm = presenceConfig.GetString("Realm", realm); } // // We tried, but this doesn't exist. We can't proceed. // if (dllName.Equals(String.Empty)) { throw new Exception("No StorageProvider configured"); } m_Database = LoadPlugin <IPresenceData>(dllName, new Object[] { connString, realm }); if (m_Database == null) { throw new Exception("Could not find a storage interface in the given module " + dllName); } }
public PresenceServiceBase(IConfigSource config) : base(config) { string dllName = String.Empty; string connString = String.Empty; string realm = "Presence"; // // Try reading the [DatabaseService] section, if it exists // IConfig dbConfig = config.Configs["DatabaseService"]; if (dbConfig != null) { if (dllName == String.Empty) dllName = dbConfig.GetString("StorageProvider", String.Empty); if (connString == String.Empty) connString = dbConfig.GetString("ConnectionString", String.Empty); } // // [PresenceService] section overrides [DatabaseService], if it exists // IConfig presenceConfig = config.Configs["PresenceService"]; if (presenceConfig != null) { dllName = presenceConfig.GetString("StorageProvider", dllName); connString = presenceConfig.GetString("ConnectionString", connString); realm = presenceConfig.GetString("Realm", realm); } // // We tried, but this doesn't exist. We can't proceed. // if (dllName.Equals(String.Empty)) throw new Exception("No StorageProvider configured"); m_Database = LoadPlugin<IPresenceData>(dllName, new Object[] { connString, realm }); if (m_Database == null) throw new Exception("Could not find a storage interface in the given module " + dllName); }
public void Initialize(IConfigSource config, IRegistryCore registry) { string dllName = String.Empty; string connString = String.Empty; ///This was decamel-cased, and it will break MONO appearently as MySQL on MONO cares about case. string realm = "Presence"; // // Try reading the [DatabaseService] section, if it exists // IConfig dbConfig = config.Configs["DatabaseService"]; if (dbConfig != null) { if (dllName == String.Empty) dllName = dbConfig.GetString("StorageProvider", String.Empty); if (connString == String.Empty) connString = dbConfig.GetString("ConnectionString", String.Empty); } // // [PresenceService] section overrides [DatabaseService], if it exists // IConfig presenceConfig = config.Configs["PresenceService"]; if (presenceConfig != null) { dllName = presenceConfig.GetString("StorageProvider", dllName); connString = presenceConfig.GetString("ConnectionString", connString); realm = presenceConfig.GetString("Realm", realm); } // // We tried, but this doesn't exist. We can't proceed. // if (dllName.Equals(String.Empty)) throw new Exception("No StorageProvider configured"); m_Database = AuroraModuleLoader.LoadPlugin<IPresenceData>(dllName, new Object[] { connString, realm }); if (m_Database == null) throw new Exception("Could not find a storage interface in the given module " + dllName); if (presenceConfig != null) { m_allowDuplicatePresences = presenceConfig.GetBoolean("AllowDuplicatePresences", m_allowDuplicatePresences); m_checkLastSeen = presenceConfig.GetBoolean("CheckLastSeen", m_checkLastSeen); } registry.RegisterModuleInterface<IPresenceService>(this); m_log.Debug("[PRESENCE SERVICE]: Starting presence service"); }