aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Services/HGInventoryService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications/Services/HGInventoryService.cs')
-rw-r--r--OpenSim/Framework/Communications/Services/HGInventoryService.cs73
1 files changed, 65 insertions, 8 deletions
diff --git a/OpenSim/Framework/Communications/Services/HGInventoryService.cs b/OpenSim/Framework/Communications/Services/HGInventoryService.cs
index 33d7722..eef9e80 100644
--- a/OpenSim/Framework/Communications/Services/HGInventoryService.cs
+++ b/OpenSim/Framework/Communications/Services/HGInventoryService.cs
@@ -35,7 +35,7 @@ using Nini.Config;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenSim.Data; 36using OpenSim.Data;
37using OpenSim.Framework; 37using OpenSim.Framework;
38//using OpenSim.Framework.Communications; 38using OpenSim.Framework.Communications.Clients;
39using OpenSim.Framework.Communications.Cache; 39using OpenSim.Framework.Communications.Cache;
40using Caps = OpenSim.Framework.Communications.Capabilities.Caps; 40using Caps = OpenSim.Framework.Communications.Capabilities.Caps;
41using LLSDHelpers = OpenSim.Framework.Communications.Capabilities.LLSDHelpers; 41using LLSDHelpers = OpenSim.Framework.Communications.Capabilities.LLSDHelpers;
@@ -64,6 +64,7 @@ namespace OpenSim.Framework.Communications.Services
64 // These two used for remote access 64 // These two used for remote access
65 string m_UserServerURL = string.Empty; 65 string m_UserServerURL = string.Empty;
66 string m_AssetServerURL = string.Empty; 66 string m_AssetServerURL = string.Empty;
67 SynchronousGridAssetClient m_AssetClient = null;
67 68
68 // Constructor for grid inventory server 69 // Constructor for grid inventory server
69 public HGInventoryService(InventoryServiceBase invService, string assetServiceURL, string userServiceURL, IHttpServer httpserver, string thisurl) 70 public HGInventoryService(InventoryServiceBase invService, string assetServiceURL, string userServiceURL, IHttpServer httpserver, string thisurl)
@@ -71,6 +72,8 @@ namespace OpenSim.Framework.Communications.Services
71 m_UserServerURL = userServiceURL; 72 m_UserServerURL = userServiceURL;
72 m_AssetServerURL = assetServiceURL; 73 m_AssetServerURL = assetServiceURL;
73 74
75 m_AssetClient = new SynchronousGridAssetClient(m_AssetServerURL);
76
74 Init(invService, thisurl, httpserver); 77 Init(invService, thisurl, httpserver);
75 } 78 }
76 79
@@ -298,7 +301,7 @@ namespace OpenSim.Framework.Communications.Services
298 Item.Owner = olditem.Owner; 301 Item.Owner = olditem.Owner;
299 // There should be some tests here about the owner, etc but I'm going to ignore that 302 // There should be some tests here about the owner, etc but I'm going to ignore that
300 // because I'm not sure it makes any sense 303 // because I'm not sure it makes any sense
301 // Also I should probably close the asset... 304 // Also I should probably clone the asset...
302 m_inventoryService.AddItem(Item); 305 m_inventoryService.AddItem(Item);
303 return Item; 306 return Item;
304 } 307 }
@@ -319,7 +322,7 @@ namespace OpenSim.Framework.Communications.Services
319 public List<InventoryFolderBase> GetInventorySkeleton(Guid rawUserID) 322 public List<InventoryFolderBase> GetInventorySkeleton(Guid rawUserID)
320 { 323 {
321 UUID userID = new UUID(rawUserID); 324 UUID userID = new UUID(rawUserID);
322 return ((InventoryServiceBase)m_inventoryService).GetInventorySkeleton(userID); 325 return m_inventoryService.GetInventorySkeleton(userID);
323 } 326 }
324 327
325 public List<InventoryItemBase> GetActiveGestures(Guid rawUserID) 328 public List<InventoryItemBase> GetActiveGestures(Guid rawUserID)
@@ -328,7 +331,7 @@ namespace OpenSim.Framework.Communications.Services
328 331
329 m_log.InfoFormat("[HGStandaloneInvService]: fetching active gestures for user {0}", userID); 332 m_log.InfoFormat("[HGStandaloneInvService]: fetching active gestures for user {0}", userID);
330 333
331 return ((InventoryServiceBase)m_inventoryService).GetActiveGestures(userID); 334 return m_inventoryService.GetActiveGestures(userID);
332 } 335 }
333 336
334 public AssetBase GetAsset(InventoryItemBase item) 337 public AssetBase GetAsset(InventoryItemBase item)
@@ -348,8 +351,10 @@ namespace OpenSim.Framework.Communications.Services
348 } 351 }
349 352
350 // All good, get the asset 353 // All good, get the asset
351 AssetBase theasset = m_assetProvider.FetchAsset(item.AssetID); 354 //AssetBase theasset = m_assetProvider.FetchAsset(item.AssetID);
352 m_log.Debug("[HGStandaloneInvService] Found asset " + ((theasset == null)? "NULL" : "Not Null")); 355 AssetBase theasset = FetchAsset(item.AssetID, (item.InvType == (int)InventoryType.Texture));
356
357 m_log.Debug("[HGStandaloneInvService] Found asset " + ((theasset == null) ? "NULL" : "Not Null"));
353 if (theasset != null) 358 if (theasset != null)
354 { 359 {
355 asset = theasset; 360 asset = theasset;
@@ -361,7 +366,8 @@ namespace OpenSim.Framework.Communications.Services
361 public bool PostAsset(AssetBase asset) 366 public bool PostAsset(AssetBase asset)
362 { 367 {
363 m_log.Info("[HGStandaloneInvService]: Post asset " + asset.FullID); 368 m_log.Info("[HGStandaloneInvService]: Post asset " + asset.FullID);
364 m_assetProvider.CreateAsset(asset); 369 //m_assetProvider.CreateAsset(asset);
370 StoreAsset(asset);
365 371
366 return true; 372 return true;
367 } 373 }
@@ -492,7 +498,7 @@ namespace OpenSim.Framework.Communications.Services
492 return; 498 return;
493 } 499 }
494 500
495 bool success = ((IAuthentication)m_userService).VerifyKey(userID, authToken); 501 bool success = VerifyKey(userID, authToken);
496 502
497 if (success) 503 if (success)
498 { 504 {
@@ -653,5 +659,56 @@ namespace OpenSim.Framework.Communications.Services
653 } 659 }
654 660
655 #endregion Caps 661 #endregion Caps
662
663 #region Local vs Remote
664
665 bool VerifyKey(UUID userID, string key)
666 {
667 // Remote call to the Authorization server
668 if (m_userService == null)
669 return AuthClient.VerifyKey(m_UserServerURL, userID, key);
670 // local call
671 else
672 return ((IAuthentication)m_userService).VerifyKey(userID, key);
673 }
674
675 AssetBase FetchAsset(UUID assetID, bool isTexture)
676 {
677 // Remote call to the Asset server
678 if (m_assetProvider == null)
679 return m_AssetClient.SyncGetAsset(assetID, isTexture);
680 // local call
681 else
682 return m_assetProvider.FetchAsset(assetID);
683 }
684
685 void StoreAsset(AssetBase asset)
686 {
687 // Remote call to the Asset server
688 if (m_assetProvider == null)
689 m_AssetClient.StoreAsset(asset);
690 // local call
691 else
692 m_assetProvider.CreateAsset(asset);
693 }
694
695 #endregion Local vs Remote
696 }
697
698 class SynchronousGridAssetClient : GridAssetClient
699 {
700 public SynchronousGridAssetClient(string url)
701 : base(url)
702 {
703 }
704
705 public AssetBase SyncGetAsset(UUID assetID, bool isTexture)
706 {
707 AssetRequest assReq = new AssetRequest();
708 assReq.AssetID = assetID;
709 assReq.IsTexture = isTexture;
710 return base.GetAsset(assReq);
711 }
712
656 } 713 }
657} 714}