From 0f367bd7bbc5d22d4834e1eb0f1671381485143e Mon Sep 17 00:00:00 2001 From: diva Date: Wed, 10 Jun 2009 13:18:32 +0000 Subject: Heart surgery no.2: the inventory service hooks. Several improvements in the connectors themselves. Several improvements in configurations. Needed to add a hack in IUserService and UserManagerBase, to be removed when that service is refactored. --- .../InventoryService/InventoryServiceBase.cs | 40 ++++++++++++++++------ 1 file changed, 29 insertions(+), 11 deletions(-) (limited to 'OpenSim/Services/InventoryService/InventoryServiceBase.cs') diff --git a/OpenSim/Services/InventoryService/InventoryServiceBase.cs b/OpenSim/Services/InventoryService/InventoryServiceBase.cs index 179d541..4526c34 100644 --- a/OpenSim/Services/InventoryService/InventoryServiceBase.cs +++ b/OpenSim/Services/InventoryService/InventoryServiceBase.cs @@ -44,19 +44,37 @@ namespace OpenSim.Services.InventoryService public InventoryServiceBase(IConfigSource config) : base(config) { - IConfig assetConfig = config.Configs["InventoryService"]; - if (assetConfig == null) + string dllName = String.Empty; + string connString = String.Empty; + + // + // Try reading the [DatabaseService] section first, if it exists + // + IConfig dbConfig = config.Configs["DatabaseService"]; + if (dbConfig != null) + { + dllName = dbConfig.GetString("StorageProvider", String.Empty); + connString = dbConfig.GetString("ConnectionString", String.Empty); + } + else + Console.WriteLine("------ dbConfig = null!"); + + // + // Try reading the more specific [InventoryService] section, if it exists + // + IConfig inventoryConfig = config.Configs["InventoryService"]; + if (inventoryConfig != null) + { + dllName = inventoryConfig.GetString("StorageProvider", dllName); + connString = inventoryConfig.GetString("ConnectionString", connString); + } + + // + // We tried, but this doesn't exist. We can't proceed. + // + if (dllName.Equals(String.Empty)) throw new Exception("No InventoryService configuration"); - string dllName = assetConfig.GetString("StorageProvider", - String.Empty); - - if (dllName == String.Empty) - throw new Exception("No StorageProvider configured"); - - string connString = assetConfig.GetString("ConnectionString", - String.Empty); - m_Database = LoadPlugin(dllName); if (m_Database == null) throw new Exception("Could not find a storage interface in the given module"); -- cgit v1.1