diff options
author | Diva Canto | 2012-03-27 10:08:13 -0700 |
---|---|---|
committer | Diva Canto | 2012-03-27 10:08:13 -0700 |
commit | 8131a24cde3f3877b3b8dd850871c57c17b2b216 (patch) | |
tree | c5909ee4f38507d0d48ab98274b1507170325bcd /OpenSim/Services | |
parent | Add some more overloads to allow registering overloaded methods and lists (diff) | |
download | opensim-SC-8131a24cde3f3877b3b8dd850871c57c17b2b216.zip opensim-SC-8131a24cde3f3877b3b8dd850871c57c17b2b216.tar.gz opensim-SC-8131a24cde3f3877b3b8dd850871c57c17b2b216.tar.bz2 opensim-SC-8131a24cde3f3877b3b8dd850871c57c17b2b216.tar.xz |
Send the config section name up to the service classes themselves (XInventory and Assets).
Diffstat (limited to 'OpenSim/Services')
5 files changed, 38 insertions, 44 deletions
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index 4f4cbf6..137a9b0 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs | |||
@@ -46,7 +46,12 @@ namespace OpenSim.Services.AssetService | |||
46 | 46 | ||
47 | protected static AssetService m_RootInstance; | 47 | protected static AssetService m_RootInstance; |
48 | 48 | ||
49 | public AssetService(IConfigSource config) : base(config) | 49 | public AssetService(IConfigSource config) |
50 | : this(config, "AssetService") | ||
51 | { | ||
52 | } | ||
53 | |||
54 | public AssetService(IConfigSource config, string configName) : base(config, configName) | ||
50 | { | 55 | { |
51 | if (m_RootInstance == null) | 56 | if (m_RootInstance == null) |
52 | { | 57 | { |
@@ -54,9 +59,9 @@ namespace OpenSim.Services.AssetService | |||
54 | 59 | ||
55 | if (m_AssetLoader != null) | 60 | if (m_AssetLoader != null) |
56 | { | 61 | { |
57 | IConfig assetConfig = config.Configs["AssetService"]; | 62 | IConfig assetConfig = config.Configs[m_ConfigName]; |
58 | if (assetConfig == null) | 63 | if (assetConfig == null) |
59 | throw new Exception("No AssetService configuration"); | 64 | throw new Exception("No " + m_ConfigName + " configuration"); |
60 | 65 | ||
61 | string loaderArgs = assetConfig.GetString("AssetLoaderArgs", | 66 | string loaderArgs = assetConfig.GetString("AssetLoaderArgs", |
62 | String.Empty); | 67 | String.Empty); |
diff --git a/OpenSim/Services/AssetService/AssetServiceBase.cs b/OpenSim/Services/AssetService/AssetServiceBase.cs index 86752f9..177c565 100644 --- a/OpenSim/Services/AssetService/AssetServiceBase.cs +++ b/OpenSim/Services/AssetService/AssetServiceBase.cs | |||
@@ -39,16 +39,25 @@ namespace OpenSim.Services.AssetService | |||
39 | { | 39 | { |
40 | protected IAssetDataPlugin m_Database = null; | 40 | protected IAssetDataPlugin m_Database = null; |
41 | protected IAssetLoader m_AssetLoader = null; | 41 | protected IAssetLoader m_AssetLoader = null; |
42 | protected string m_ConfigName = "AssetService"; | ||
42 | 43 | ||
43 | public AssetServiceBase(IConfigSource config) : base(config) | 44 | public AssetServiceBase(IConfigSource config) |
45 | : this(config, "AssetService") | ||
44 | { | 46 | { |
47 | } | ||
48 | |||
49 | public AssetServiceBase(IConfigSource config, string configName) : base(config) | ||
50 | { | ||
51 | if (configName != string.Empty) | ||
52 | m_ConfigName = configName; | ||
53 | |||
45 | string dllName = String.Empty; | 54 | string dllName = String.Empty; |
46 | string connString = String.Empty; | 55 | string connString = String.Empty; |
47 | 56 | ||
48 | // | 57 | // |
49 | // Try reading the [AssetService] section first, if it exists | 58 | // Try reading the [AssetService] section, if it exists |
50 | // | 59 | // |
51 | IConfig assetConfig = config.Configs["AssetService"]; | 60 | IConfig assetConfig = config.Configs[m_ConfigName]; |
52 | if (assetConfig != null) | 61 | if (assetConfig != null) |
53 | { | 62 | { |
54 | dllName = assetConfig.GetString("StorageProvider", dllName); | 63 | dllName = assetConfig.GetString("StorageProvider", dllName); |
diff --git a/OpenSim/Services/HypergridService/HGAssetService.cs b/OpenSim/Services/HypergridService/HGAssetService.cs index 22e233a..db98166 100644 --- a/OpenSim/Services/HypergridService/HGAssetService.cs +++ b/OpenSim/Services/HypergridService/HGAssetService.cs | |||
@@ -58,10 +58,10 @@ namespace OpenSim.Services.HypergridService | |||
58 | 58 | ||
59 | private UserAccountCache m_Cache; | 59 | private UserAccountCache m_Cache; |
60 | 60 | ||
61 | public HGAssetService(IConfigSource config) : base(config) | 61 | public HGAssetService(IConfigSource config, string configName) : base(config, configName) |
62 | { | 62 | { |
63 | m_log.Debug("[HGAsset Service]: Starting"); | 63 | m_log.Debug("[HGAsset Service]: Starting"); |
64 | IConfig assetConfig = config.Configs["HGAssetService"]; | 64 | IConfig assetConfig = config.Configs[configName]; |
65 | if (assetConfig == null) | 65 | if (assetConfig == null) |
66 | throw new Exception("No HGAssetService configuration"); | 66 | throw new Exception("No HGAssetService configuration"); |
67 | 67 | ||
diff --git a/OpenSim/Services/HypergridService/HGInventoryService.cs b/OpenSim/Services/HypergridService/HGInventoryService.cs index 41d5a7a..a1287fd 100644 --- a/OpenSim/Services/HypergridService/HGInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGInventoryService.cs | |||
@@ -60,36 +60,19 @@ namespace OpenSim.Services.HypergridService | |||
60 | 60 | ||
61 | private UserAccountCache m_Cache; | 61 | private UserAccountCache m_Cache; |
62 | 62 | ||
63 | public HGInventoryService(IConfigSource config) | 63 | public HGInventoryService(IConfigSource config, string configName) |
64 | : base(config) | 64 | : base(config, configName) |
65 | { | 65 | { |
66 | m_log.Debug("[HGInventory Service]: Starting"); | 66 | m_log.Debug("[HGInventory Service]: Starting"); |
67 | 67 | if (configName != string.Empty) | |
68 | string dllName = String.Empty; | 68 | m_ConfigName = configName; |
69 | string connString = String.Empty; | ||
70 | //string realm = "Inventory"; // OSG version doesn't use this | ||
71 | |||
72 | // | ||
73 | // Try reading the [DatabaseService] section, if it exists | ||
74 | // | ||
75 | IConfig dbConfig = config.Configs["DatabaseService"]; | ||
76 | if (dbConfig != null) | ||
77 | { | ||
78 | if (dllName == String.Empty) | ||
79 | dllName = dbConfig.GetString("StorageProvider", String.Empty); | ||
80 | if (connString == String.Empty) | ||
81 | connString = dbConfig.GetString("ConnectionString", String.Empty); | ||
82 | } | ||
83 | 69 | ||
84 | // | 70 | // |
85 | // Try reading the [InventoryService] section, if it exists | 71 | // Try reading the [InventoryService] section, if it exists |
86 | // | 72 | // |
87 | IConfig invConfig = config.Configs["HGInventoryService"]; | 73 | IConfig invConfig = config.Configs[m_ConfigName]; |
88 | if (invConfig != null) | 74 | if (invConfig != null) |
89 | { | 75 | { |
90 | dllName = invConfig.GetString("StorageProvider", dllName); | ||
91 | connString = invConfig.GetString("ConnectionString", connString); | ||
92 | |||
93 | // realm = authConfig.GetString("Realm", realm); | 76 | // realm = authConfig.GetString("Realm", realm); |
94 | string userAccountsDll = invConfig.GetString("UserAccountsService", string.Empty); | 77 | string userAccountsDll = invConfig.GetString("UserAccountsService", string.Empty); |
95 | if (userAccountsDll == string.Empty) | 78 | if (userAccountsDll == string.Empty) |
@@ -108,17 +91,6 @@ namespace OpenSim.Services.HypergridService | |||
108 | m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); | 91 | m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); |
109 | } | 92 | } |
110 | 93 | ||
111 | // | ||
112 | // We tried, but this doesn't exist. We can't proceed. | ||
113 | // | ||
114 | if (dllName == String.Empty) | ||
115 | throw new Exception("No StorageProvider configured"); | ||
116 | |||
117 | m_Database = LoadPlugin<IXInventoryData>(dllName, | ||
118 | new Object[] {connString, String.Empty}); | ||
119 | if (m_Database == null) | ||
120 | throw new Exception("Could not find a storage interface in the given module"); | ||
121 | |||
122 | m_log.Debug("[HG INVENTORY SERVICE]: Starting..."); | 94 | m_log.Debug("[HG INVENTORY SERVICE]: Starting..."); |
123 | } | 95 | } |
124 | 96 | ||
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 1648b51..8c57d17 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs | |||
@@ -46,9 +46,17 @@ namespace OpenSim.Services.InventoryService | |||
46 | 46 | ||
47 | protected IXInventoryData m_Database; | 47 | protected IXInventoryData m_Database; |
48 | protected bool m_AllowDelete = true; | 48 | protected bool m_AllowDelete = true; |
49 | protected string m_ConfigName = "InventoryService"; | ||
49 | 50 | ||
50 | public XInventoryService(IConfigSource config) : base(config) | 51 | public XInventoryService(IConfigSource config) |
52 | : this(config, "InventoryService") | ||
51 | { | 53 | { |
54 | } | ||
55 | public XInventoryService(IConfigSource config, string configName) : base(config) | ||
56 | { | ||
57 | if (configName != string.Empty) | ||
58 | m_ConfigName = configName; | ||
59 | |||
52 | string dllName = String.Empty; | 60 | string dllName = String.Empty; |
53 | string connString = String.Empty; | 61 | string connString = String.Empty; |
54 | //string realm = "Inventory"; // OSG version doesn't use this | 62 | //string realm = "Inventory"; // OSG version doesn't use this |
@@ -56,7 +64,7 @@ namespace OpenSim.Services.InventoryService | |||
56 | // | 64 | // |
57 | // Try reading the [InventoryService] section first, if it exists | 65 | // Try reading the [InventoryService] section first, if it exists |
58 | // | 66 | // |
59 | IConfig authConfig = config.Configs["InventoryService"]; | 67 | IConfig authConfig = config.Configs[m_ConfigName]; |
60 | if (authConfig != null) | 68 | if (authConfig != null) |
61 | { | 69 | { |
62 | dllName = authConfig.GetString("StorageProvider", dllName); | 70 | dllName = authConfig.GetString("StorageProvider", dllName); |