diff options
author | Diva Canto | 2010-01-30 15:43:10 -0800 |
---|---|---|
committer | Diva Canto | 2010-01-30 15:43:10 -0800 |
commit | a0d79e621cc8ee4935dfc2816da75db9c23c1b84 (patch) | |
tree | b4850a6ee90f4cd98f68109dad29b7b9c8c9f242 /OpenSim/Region | |
parent | * HGScene is no more. (diff) | |
download | opensim-SC-a0d79e621cc8ee4935dfc2816da75db9c23c1b84.zip opensim-SC-a0d79e621cc8ee4935dfc2816da75db9c23c1b84.tar.gz opensim-SC-a0d79e621cc8ee4935dfc2816da75db9c23c1b84.tar.bz2 opensim-SC-a0d79e621cc8ee4935dfc2816da75db9c23c1b84.tar.xz |
Bug fix: change HGBroker to a INonSharedRegionModule
Diffstat (limited to 'OpenSim/Region')
3 files changed, 82 insertions, 71 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index ecd7002..09798aa 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | |||
@@ -183,7 +183,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
183 | public bool IsForeignUser(UUID userID, out string assetServerURL) | 183 | public bool IsForeignUser(UUID userID, out string assetServerURL) |
184 | { | 184 | { |
185 | assetServerURL = string.Empty; | 185 | assetServerURL = string.Empty; |
186 | UserAccount account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID); | 186 | UserAccount account = null; |
187 | if (m_Scene.UserAccountService != null) | ||
188 | account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID); | ||
189 | |||
187 | if (account == null) // foreign | 190 | if (account == null) // foreign |
188 | { | 191 | { |
189 | ScenePresence sp = null; | 192 | ScenePresence sp = null; |
@@ -193,7 +196,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
193 | if (aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) | 196 | if (aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) |
194 | { | 197 | { |
195 | assetServerURL = aCircuit.ServiceURLs["AssetServerURI"].ToString(); | 198 | assetServerURL = aCircuit.ServiceURLs["AssetServerURI"].ToString(); |
196 | return true; | 199 | assetServerURL = assetServerURL.Trim(new char[] { '/' }); return true; |
197 | } | 200 | } |
198 | } | 201 | } |
199 | } | 202 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs index 811569f..1e51187 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs | |||
@@ -40,12 +40,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
40 | { | 40 | { |
41 | public abstract class BaseInventoryConnector : IInventoryService | 41 | public abstract class BaseInventoryConnector : IInventoryService |
42 | { | 42 | { |
43 | protected InventoryCache m_cache; | 43 | protected static InventoryCache m_cache; |
44 | private static bool m_Initialized; | ||
44 | 45 | ||
45 | protected virtual void Init(IConfigSource source) | 46 | protected virtual void Init(IConfigSource source) |
46 | { | 47 | { |
47 | m_cache = new InventoryCache(); | 48 | if (!m_Initialized) |
48 | m_cache.Init(source, this); | 49 | { |
50 | m_cache = new InventoryCache(); | ||
51 | m_cache.Init(source, this); | ||
52 | m_Initialized = true; | ||
53 | } | ||
49 | } | 54 | } |
50 | 55 | ||
51 | /// <summary> | 56 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index b6718a8..c6312e0 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | |||
@@ -41,20 +41,21 @@ using OpenMetaverse; | |||
41 | 41 | ||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | 42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory |
43 | { | 43 | { |
44 | public class HGInventoryBroker : BaseInventoryConnector, ISharedRegionModule, IInventoryService | 44 | public class HGInventoryBroker : BaseInventoryConnector, INonSharedRegionModule, IInventoryService |
45 | { | 45 | { |
46 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
47 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
48 | MethodBase.GetCurrentMethod().DeclaringType); | 48 | MethodBase.GetCurrentMethod().DeclaringType); |
49 | 49 | ||
50 | private bool m_Enabled = false; | 50 | private static bool m_Initialized = false; |
51 | private bool m_Initialized = false; | 51 | private static bool m_Enabled = false; |
52 | |||
53 | private static IInventoryService m_GridService; | ||
54 | private static ISessionAuthInventoryService m_HGService; | ||
55 | |||
52 | private Scene m_Scene; | 56 | private Scene m_Scene; |
53 | private IUserAccountService m_UserAccountService; | 57 | private IUserAccountService m_UserAccountService; |
54 | 58 | ||
55 | private IInventoryService m_GridService; | ||
56 | private ISessionAuthInventoryService m_HGService; | ||
57 | |||
58 | public Type ReplaceableInterface | 59 | public Type ReplaceableInterface |
59 | { | 60 | { |
60 | get { return null; } | 61 | get { return null; } |
@@ -67,63 +68,67 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
67 | 68 | ||
68 | public void Initialise(IConfigSource source) | 69 | public void Initialise(IConfigSource source) |
69 | { | 70 | { |
70 | IConfig moduleConfig = source.Configs["Modules"]; | 71 | if (!m_Initialized) |
71 | if (moduleConfig != null) | ||
72 | { | 72 | { |
73 | string name = moduleConfig.GetString("InventoryServices", ""); | 73 | IConfig moduleConfig = source.Configs["Modules"]; |
74 | if (name == Name) | 74 | if (moduleConfig != null) |
75 | { | 75 | { |
76 | IConfig inventoryConfig = source.Configs["InventoryService"]; | 76 | string name = moduleConfig.GetString("InventoryServices", ""); |
77 | if (inventoryConfig == null) | 77 | if (name == Name) |
78 | { | ||
79 | m_log.Error("[HG INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); | ||
80 | return; | ||
81 | } | ||
82 | |||
83 | string localDll = inventoryConfig.GetString("LocalGridInventoryService", | ||
84 | String.Empty); | ||
85 | string HGDll = inventoryConfig.GetString("HypergridInventoryService", | ||
86 | String.Empty); | ||
87 | |||
88 | if (localDll == String.Empty) | ||
89 | { | ||
90 | m_log.Error("[HG INVENTORY CONNECTOR]: No LocalGridInventoryService named in section InventoryService"); | ||
91 | //return; | ||
92 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | ||
93 | } | ||
94 | |||
95 | if (HGDll == String.Empty) | ||
96 | { | 78 | { |
97 | m_log.Error("[HG INVENTORY CONNECTOR]: No HypergridInventoryService named in section InventoryService"); | 79 | IConfig inventoryConfig = source.Configs["InventoryService"]; |
98 | //return; | 80 | if (inventoryConfig == null) |
99 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | 81 | { |
82 | m_log.Error("[HG INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); | ||
83 | return; | ||
84 | } | ||
85 | |||
86 | string localDll = inventoryConfig.GetString("LocalGridInventoryService", | ||
87 | String.Empty); | ||
88 | string HGDll = inventoryConfig.GetString("HypergridInventoryService", | ||
89 | String.Empty); | ||
90 | |||
91 | if (localDll == String.Empty) | ||
92 | { | ||
93 | m_log.Error("[HG INVENTORY CONNECTOR]: No LocalGridInventoryService named in section InventoryService"); | ||
94 | //return; | ||
95 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | ||
96 | } | ||
97 | |||
98 | if (HGDll == String.Empty) | ||
99 | { | ||
100 | m_log.Error("[HG INVENTORY CONNECTOR]: No HypergridInventoryService named in section InventoryService"); | ||
101 | //return; | ||
102 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | ||
103 | } | ||
104 | |||
105 | Object[] args = new Object[] { source }; | ||
106 | m_GridService = | ||
107 | ServerUtils.LoadPlugin<IInventoryService>(localDll, | ||
108 | args); | ||
109 | |||
110 | m_HGService = | ||
111 | ServerUtils.LoadPlugin<ISessionAuthInventoryService>(HGDll, | ||
112 | args); | ||
113 | |||
114 | if (m_GridService == null) | ||
115 | { | ||
116 | m_log.Error("[HG INVENTORY CONNECTOR]: Can't load local inventory service"); | ||
117 | return; | ||
118 | } | ||
119 | if (m_HGService == null) | ||
120 | { | ||
121 | m_log.Error("[HG INVENTORY CONNECTOR]: Can't load hypergrid inventory service"); | ||
122 | return; | ||
123 | } | ||
124 | |||
125 | Init(source); | ||
126 | |||
127 | m_Enabled = true; | ||
128 | m_log.Info("[HG INVENTORY CONNECTOR]: HG inventory broker enabled"); | ||
100 | } | 129 | } |
101 | |||
102 | Object[] args = new Object[] { source }; | ||
103 | m_GridService = | ||
104 | ServerUtils.LoadPlugin<IInventoryService>(localDll, | ||
105 | args); | ||
106 | |||
107 | m_HGService = | ||
108 | ServerUtils.LoadPlugin<ISessionAuthInventoryService>(HGDll, | ||
109 | args); | ||
110 | |||
111 | if (m_GridService == null) | ||
112 | { | ||
113 | m_log.Error("[HG INVENTORY CONNECTOR]: Can't load local inventory service"); | ||
114 | return; | ||
115 | } | ||
116 | if (m_HGService == null) | ||
117 | { | ||
118 | m_log.Error("[HG INVENTORY CONNECTOR]: Can't load hypergrid inventory service"); | ||
119 | return; | ||
120 | } | ||
121 | |||
122 | Init(source); | ||
123 | |||
124 | m_Enabled = true; | ||
125 | m_log.Info("[HG INVENTORY CONNECTOR]: HG inventory broker enabled"); | ||
126 | } | 130 | } |
131 | m_Initialized = true; | ||
127 | } | 132 | } |
128 | } | 133 | } |
129 | 134 | ||
@@ -140,13 +145,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
140 | if (!m_Enabled) | 145 | if (!m_Enabled) |
141 | return; | 146 | return; |
142 | 147 | ||
143 | if (!m_Initialized) | 148 | m_Scene = scene; |
144 | { | 149 | m_UserAccountService = m_Scene.UserAccountService; |
145 | m_Scene = scene; | ||
146 | m_UserAccountService = m_Scene.UserAccountService; | ||
147 | |||
148 | m_Initialized = true; | ||
149 | } | ||
150 | 150 | ||
151 | scene.RegisterModuleInterface<IInventoryService>(this); | 151 | scene.RegisterModuleInterface<IInventoryService>(this); |
152 | m_cache.AddRegion(scene); | 152 | m_cache.AddRegion(scene); |
@@ -514,7 +514,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
514 | private bool IsForeignUser(UUID userID, out string inventoryURL) | 514 | private bool IsForeignUser(UUID userID, out string inventoryURL) |
515 | { | 515 | { |
516 | inventoryURL = string.Empty; | 516 | inventoryURL = string.Empty; |
517 | UserAccount account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID); | 517 | UserAccount account = null; |
518 | if (m_Scene.UserAccountService != null) | ||
519 | account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID); | ||
520 | |||
518 | if (account == null) // foreign user | 521 | if (account == null) // foreign user |
519 | { | 522 | { |
520 | ScenePresence sp = null; | 523 | ScenePresence sp = null; |