diff options
author | diva | 2009-03-25 05:21:47 +0000 |
---|---|---|
committer | diva | 2009-03-25 05:21:47 +0000 |
commit | 2afe3be2e6467ae93f0d909bbd244385d4fae1b6 (patch) | |
tree | 703ae7e189d8c81045b56d814d0e7c9fd73afacb | |
parent | Change llGetOwnerKey to use another overload of GetSceneObject. (diff) | |
download | opensim-SC_OLD-2afe3be2e6467ae93f0d909bbd244385d4fae1b6.zip opensim-SC_OLD-2afe3be2e6467ae93f0d909bbd244385d4fae1b6.tar.gz opensim-SC_OLD-2afe3be2e6467ae93f0d909bbd244385d4fae1b6.tar.bz2 opensim-SC_OLD-2afe3be2e6467ae93f0d909bbd244385d4fae1b6.tar.xz |
HGStandaloneInventoryService now serves inventory assets. No need for clients to have direct access to the asset service.
-rw-r--r-- | OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs index 35db298..1efac8d 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs | |||
@@ -33,8 +33,10 @@ using System.Reflection; | |||
33 | using log4net; | 33 | using log4net; |
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenSim.Data; | ||
36 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Framework.Communications.Cache; | ||
38 | using OpenSim.Framework.Servers; | 40 | using OpenSim.Framework.Servers; |
39 | using OpenSim.Framework.Servers.Interfaces; | 41 | using OpenSim.Framework.Servers.Interfaces; |
40 | using OpenSim.Region.Framework.Interfaces; | 42 | using OpenSim.Region.Framework.Interfaces; |
@@ -102,6 +104,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
102 | 104 | ||
103 | private InventoryServiceBase m_inventoryService; | 105 | private InventoryServiceBase m_inventoryService; |
104 | private UserManagerBase m_userService; | 106 | private UserManagerBase m_userService; |
107 | IAssetDataPlugin m_assetProvider; | ||
105 | private Scene m_scene; | 108 | private Scene m_scene; |
106 | private bool m_doLookup = false; | 109 | private bool m_doLookup = false; |
107 | private string m_thisInventoryUrl = "http://localhost:9000"; | 110 | private string m_thisInventoryUrl = "http://localhost:9000"; |
@@ -121,6 +124,8 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
121 | if (!m_thisInventoryUrl.EndsWith("/")) | 124 | if (!m_thisInventoryUrl.EndsWith("/")) |
122 | m_thisInventoryUrl += "/"; | 125 | m_thisInventoryUrl += "/"; |
123 | 126 | ||
127 | m_assetProvider = ((AssetServerBase)m_scene.CommsManager.AssetCache.AssetServer).AssetProviderPlugin; | ||
128 | |||
124 | AddHttpHandlers(); | 129 | AddHttpHandlers(); |
125 | } | 130 | } |
126 | 131 | ||
@@ -365,6 +370,31 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
365 | return ((InventoryServiceBase)m_inventoryService).GetActiveGestures(userID); | 370 | return ((InventoryServiceBase)m_inventoryService).GetActiveGestures(userID); |
366 | } | 371 | } |
367 | 372 | ||
373 | public AssetBase GetAsset(InventoryItemBase item) | ||
374 | { | ||
375 | m_log.Info("[HGStandaloneInvService]: Get asset " + item.AssetID + " for item " + item.ID); | ||
376 | InventoryItemBase item2 = ((InventoryServiceBase)m_inventoryService).GetInventoryItem(item.ID); | ||
377 | if (item2 == null) | ||
378 | { | ||
379 | m_log.Debug("[HGStandaloneInvService]: null item"); | ||
380 | return null; | ||
381 | } | ||
382 | if (item2.Owner != item.Owner) | ||
383 | { | ||
384 | m_log.Debug("[HGStandaloneInvService]: client is trying to get an item for which he is not the owner"); | ||
385 | return null; | ||
386 | } | ||
387 | |||
388 | // All good, get the asset | ||
389 | AssetBase asset = m_assetProvider.FetchAsset(item.AssetID); | ||
390 | m_log.Debug("[HGStandaloneInvService] Found asset " + ((asset == null)? "NULL" : "Not Null")); | ||
391 | if (asset == null) | ||
392 | { | ||
393 | m_log.Debug(" >> Sending assetID " + item.AssetID); | ||
394 | asset = new AssetBase(item.AssetID, "NULL"); | ||
395 | } | ||
396 | return asset; | ||
397 | } | ||
368 | 398 | ||
369 | #region Caps | 399 | #region Caps |
370 | 400 | ||
@@ -545,7 +575,12 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
545 | "POST", AddAndGetCapUrl(authToken, "/NewItem/", caps), m_inventoryService.AddItem, CheckAuthSession)); | 575 | "POST", AddAndGetCapUrl(authToken, "/NewItem/", caps), m_inventoryService.AddItem, CheckAuthSession)); |
546 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryItemBase, bool>( | 576 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryItemBase, bool>( |
547 | "POST", AddAndGetCapUrl(authToken, "/DeleteItem/", caps), m_inventoryService.DeleteItem, CheckAuthSession)); | 577 | "POST", AddAndGetCapUrl(authToken, "/DeleteItem/", caps), m_inventoryService.DeleteItem, CheckAuthSession)); |
548 | 578 | ||
579 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryItemBase, AssetBase>( | ||
580 | "POST", AddAndGetCapUrl(authToken, "/GetAsset/", caps), GetAsset, CheckAuthSession)); | ||
581 | //httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<AssetBase, bool>( | ||
582 | // "POST", AddAndGetCapUrl(authToken, "/PostAsset/", caps), m_inventoryService.DeleteItem, CheckAuthSession)); | ||
583 | |||
549 | lock (invCaps) | 584 | lock (invCaps) |
550 | invCaps.Add(userID, caps); | 585 | invCaps.Add(userID, caps); |
551 | } | 586 | } |