diff options
author | Melanie | 2012-04-07 04:52:14 +0100 |
---|---|---|
committer | Melanie | 2012-04-07 04:52:14 +0100 |
commit | b39de2425cac4c2a94a7fdd6c77100ef831d66b4 (patch) | |
tree | 9258928681a82d68b408354e534c32bcf283ad3a /OpenSim/Region/CoreModules/ServiceConnectorsOut | |
parent | Merge branch 'ubitwork' (diff) | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-b39de2425cac4c2a94a7fdd6c77100ef831d66b4.zip opensim-SC-b39de2425cac4c2a94a7fdd6c77100ef831d66b4.tar.gz opensim-SC-b39de2425cac4c2a94a7fdd6c77100ef831d66b4.tar.bz2 opensim-SC-b39de2425cac4c2a94a7fdd6c77100ef831d66b4.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
OpenSim/Region/CoreModules/World/Land/LandObject.cs
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut')
3 files changed, 97 insertions, 12 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 4be3804..cf6d2f7 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | |||
@@ -297,14 +297,35 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
297 | return m_LocalGridInventoryService.CreateUserInventory(userID); | 297 | return m_LocalGridInventoryService.CreateUserInventory(userID); |
298 | } | 298 | } |
299 | 299 | ||
300 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | 300 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userID) |
301 | { | 301 | { |
302 | return m_LocalGridInventoryService.GetInventorySkeleton(userId); | 302 | string invURL = GetInventoryServiceURL(userID); |
303 | |||
304 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
305 | return m_LocalGridInventoryService.GetInventorySkeleton(userID); | ||
306 | |||
307 | IInventoryService connector = GetConnector(invURL); | ||
308 | |||
309 | return connector.GetInventorySkeleton(userID); | ||
303 | } | 310 | } |
304 | 311 | ||
305 | public InventoryCollection GetUserInventory(UUID userID) | 312 | public InventoryCollection GetUserInventory(UUID userID) |
306 | { | 313 | { |
307 | return null; | 314 | string invURL = GetInventoryServiceURL(userID); |
315 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetUserInventory for {0} {1}", userID, invURL); | ||
316 | |||
317 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
318 | return m_LocalGridInventoryService.GetUserInventory(userID); | ||
319 | |||
320 | InventoryCollection c = m_Cache.GetUserInventory(userID); | ||
321 | if (c != null) | ||
322 | return c; | ||
323 | |||
324 | IInventoryService connector = GetConnector(invURL); | ||
325 | c = connector.GetUserInventory(userID); | ||
326 | |||
327 | m_Cache.Cache(userID, c); | ||
328 | return c; | ||
308 | } | 329 | } |
309 | 330 | ||
310 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | 331 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) |
@@ -362,8 +383,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
362 | if (invURL == null) // not there, forward to local inventory connector to resolve | 383 | if (invURL == null) // not there, forward to local inventory connector to resolve |
363 | return m_LocalGridInventoryService.GetFolderContent(userID, folderID); | 384 | return m_LocalGridInventoryService.GetFolderContent(userID, folderID); |
364 | 385 | ||
365 | IInventoryService connector = GetConnector(invURL); | 386 | InventoryCollection c = m_Cache.GetFolderContent(userID, folderID); |
387 | if (c != null) | ||
388 | { | ||
389 | m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderContent found content in cache " + folderID); | ||
390 | return c; | ||
391 | } | ||
366 | 392 | ||
393 | IInventoryService connector = GetConnector(invURL); | ||
367 | return connector.GetFolderContent(userID, folderID); | 394 | return connector.GetFolderContent(userID, folderID); |
368 | 395 | ||
369 | } | 396 | } |
@@ -377,8 +404,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
377 | if (invURL == null) // not there, forward to local inventory connector to resolve | 404 | if (invURL == null) // not there, forward to local inventory connector to resolve |
378 | return m_LocalGridInventoryService.GetFolderItems(userID, folderID); | 405 | return m_LocalGridInventoryService.GetFolderItems(userID, folderID); |
379 | 406 | ||
380 | IInventoryService connector = GetConnector(invURL); | 407 | List<InventoryItemBase> items = m_Cache.GetFolderItems(userID, folderID); |
408 | if (items != null) | ||
409 | { | ||
410 | m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderItems found items in cache " + folderID); | ||
411 | return items; | ||
412 | } | ||
381 | 413 | ||
414 | IInventoryService connector = GetConnector(invURL); | ||
382 | return connector.GetFolderItems(userID, folderID); | 415 | return connector.GetFolderItems(userID, folderID); |
383 | 416 | ||
384 | } | 417 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs index 0fe778d..1e434b9 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs | |||
@@ -12,6 +12,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
12 | 12 | ||
13 | private static ExpiringCache<UUID, InventoryFolderBase> m_RootFolders = new ExpiringCache<UUID, InventoryFolderBase>(); | 13 | private static ExpiringCache<UUID, InventoryFolderBase> m_RootFolders = new ExpiringCache<UUID, InventoryFolderBase>(); |
14 | private static ExpiringCache<UUID, Dictionary<AssetType, InventoryFolderBase>> m_FolderTypes = new ExpiringCache<UUID, Dictionary<AssetType, InventoryFolderBase>>(); | 14 | private static ExpiringCache<UUID, Dictionary<AssetType, InventoryFolderBase>> m_FolderTypes = new ExpiringCache<UUID, Dictionary<AssetType, InventoryFolderBase>>(); |
15 | private static ExpiringCache<UUID, InventoryCollection> m_Inventories = new ExpiringCache<UUID, InventoryCollection>(); | ||
15 | 16 | ||
16 | public void Cache(UUID userID, InventoryFolderBase root) | 17 | public void Cache(UUID userID, InventoryFolderBase root) |
17 | { | 18 | { |
@@ -55,5 +56,55 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
55 | 56 | ||
56 | return null; | 57 | return null; |
57 | } | 58 | } |
59 | |||
60 | public void Cache(UUID userID, InventoryCollection inv) | ||
61 | { | ||
62 | lock (m_Inventories) | ||
63 | m_Inventories.AddOrUpdate(userID, inv, 120); | ||
64 | } | ||
65 | |||
66 | public InventoryCollection GetUserInventory(UUID userID) | ||
67 | { | ||
68 | InventoryCollection inv = null; | ||
69 | if (m_Inventories.TryGetValue(userID, out inv)) | ||
70 | return inv; | ||
71 | return null; | ||
72 | } | ||
73 | |||
74 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) | ||
75 | { | ||
76 | InventoryCollection inv = null; | ||
77 | InventoryCollection c; | ||
78 | if (m_Inventories.TryGetValue(userID, out inv)) | ||
79 | { | ||
80 | c = new InventoryCollection(); | ||
81 | c.UserID = userID; | ||
82 | |||
83 | c.Folders = inv.Folders.FindAll(delegate(InventoryFolderBase f) | ||
84 | { | ||
85 | return f.ParentID == folderID; | ||
86 | }); | ||
87 | c.Items = inv.Items.FindAll(delegate(InventoryItemBase i) | ||
88 | { | ||
89 | return i.Folder == folderID; | ||
90 | }); | ||
91 | return c; | ||
92 | } | ||
93 | return null; | ||
94 | } | ||
95 | |||
96 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
97 | { | ||
98 | InventoryCollection inv = null; | ||
99 | if (m_Inventories.TryGetValue(userID, out inv)) | ||
100 | { | ||
101 | List<InventoryItemBase> items = inv.Items.FindAll(delegate(InventoryItemBase i) | ||
102 | { | ||
103 | return i.Folder == folderID; | ||
104 | }); | ||
105 | return items; | ||
106 | } | ||
107 | return null; | ||
108 | } | ||
58 | } | 109 | } |
59 | } | 110 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs index 77573c3..990dffb 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs | |||
@@ -172,7 +172,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
172 | 172 | ||
173 | public InventoryCollection GetUserInventory(UUID userID) | 173 | public InventoryCollection GetUserInventory(UUID userID) |
174 | { | 174 | { |
175 | return null; | 175 | return m_RemoteConnector.GetUserInventory(userID); |
176 | } | 176 | } |
177 | 177 | ||
178 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | 178 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) |
@@ -193,16 +193,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
193 | { | 193 | { |
194 | InventoryCollection invCol = m_RemoteConnector.GetFolderContent(userID, folderID); | 194 | InventoryCollection invCol = m_RemoteConnector.GetFolderContent(userID, folderID); |
195 | 195 | ||
196 | if (UserManager != null) | 196 | if (invCol != null && UserManager != null) |
197 | { | 197 | { |
198 | // Protect ourselves against the caller subsequently modifying the items list | 198 | // Protect ourselves against the caller subsequently modifying the items list |
199 | List<InventoryItemBase> items = new List<InventoryItemBase>(invCol.Items); | 199 | List<InventoryItemBase> items = new List<InventoryItemBase>(invCol.Items); |
200 | 200 | ||
201 | Util.FireAndForget(delegate | 201 | if (items != null && items.Count > 0) |
202 | { | 202 | Util.FireAndForget(delegate |
203 | foreach (InventoryItemBase item in items) | 203 | { |
204 | UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); | 204 | foreach (InventoryItemBase item in items) |
205 | }); | 205 | UserManager.AddUser(item.CreatorIdAsUuid, item.CreatorData); |
206 | }); | ||
206 | } | 207 | } |
207 | 208 | ||
208 | return invCol; | 209 | return invCol; |