diff options
author | diva | 2009-03-26 03:45:49 +0000 |
---|---|---|
committer | diva | 2009-03-26 03:45:49 +0000 |
commit | 3b08f17fc247a14abd7967ffb212533ac00b418b (patch) | |
tree | 8401659ae39a32d1ec2f8a767814a2ab787ab223 /OpenSim/Region | |
parent | make some arrays static to prevent excessive re-initialization - suggested by... (diff) | |
download | opensim-SC_OLD-3b08f17fc247a14abd7967ffb212533ac00b418b.zip opensim-SC_OLD-3b08f17fc247a14abd7967ffb212533ac00b418b.tar.gz opensim-SC_OLD-3b08f17fc247a14abd7967ffb212533ac00b418b.tar.bz2 opensim-SC_OLD-3b08f17fc247a14abd7967ffb212533ac00b418b.tar.xz |
Half-way through supporting inventory access from outside the regions -- HG standalones only, for now.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs | 93 |
1 files changed, 84 insertions, 9 deletions
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs index 1efac8d..879e885 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs | |||
@@ -340,6 +340,12 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
340 | return invCollection; | 340 | return invCollection; |
341 | } | 341 | } |
342 | 342 | ||
343 | public bool RemoveFolder(InventoryFolderBase folder) | ||
344 | { | ||
345 | m_log.Debug("[HGStandaloneInvService]: Removefolder: Operation not implemented yet."); | ||
346 | return false; | ||
347 | } | ||
348 | |||
343 | public InventoryItemBase GetInventoryItem(InventoryItemBase item) | 349 | public InventoryItemBase GetInventoryItem(InventoryItemBase item) |
344 | { | 350 | { |
345 | m_log.Info("[HGStandaloneInvService]: Processing request for item " + item.ID); | 351 | m_log.Info("[HGStandaloneInvService]: Processing request for item " + item.ID); |
@@ -350,6 +356,61 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
350 | return item; | 356 | return item; |
351 | } | 357 | } |
352 | 358 | ||
359 | public InventoryItemBase AddItem(InventoryItemBase item) | ||
360 | { | ||
361 | if (m_inventoryService.AddItem(item)) | ||
362 | return item; | ||
363 | else | ||
364 | { | ||
365 | item.ID = UUID.Zero; | ||
366 | return item; | ||
367 | } | ||
368 | } | ||
369 | |||
370 | public InventoryItemBase UpdateItem(InventoryItemBase item) | ||
371 | { | ||
372 | if (m_inventoryService.UpdateItem(item)) | ||
373 | return item; | ||
374 | else | ||
375 | { | ||
376 | item.ID = UUID.Zero; | ||
377 | return item; | ||
378 | } | ||
379 | } | ||
380 | |||
381 | public InventoryItemBase MoveItem(InventoryItemBase newitem) | ||
382 | { | ||
383 | InventoryItemBase Item = m_inventoryService.GetInventoryItem(newitem.ID); | ||
384 | if (Item != null) | ||
385 | { | ||
386 | if (newitem.Name != String.Empty) | ||
387 | { | ||
388 | Item.Name = newitem.Name; | ||
389 | } | ||
390 | Item.Folder = newitem.Folder; | ||
391 | m_inventoryService.UpdateItem(Item); | ||
392 | return Item; | ||
393 | } | ||
394 | else | ||
395 | { | ||
396 | m_log.Debug("[HGStandaloneInvService]: Failed to find item " + newitem.ID); | ||
397 | newitem.ID = UUID.Zero; | ||
398 | return newitem; | ||
399 | } | ||
400 | |||
401 | } | ||
402 | public InventoryItemBase DeleteItem(InventoryItemBase item) | ||
403 | { | ||
404 | item = m_inventoryService.GetInventoryItem(item.ID); | ||
405 | if (m_inventoryService.DeleteItem(item)) | ||
406 | return item; | ||
407 | else | ||
408 | { | ||
409 | item.ID = UUID.Zero; | ||
410 | return item; | ||
411 | } | ||
412 | } | ||
413 | |||
353 | /// <summary> | 414 | /// <summary> |
354 | /// Guid to UUID wrapper for same name IInventoryServices method | 415 | /// Guid to UUID wrapper for same name IInventoryServices method |
355 | /// </summary> | 416 | /// </summary> |
@@ -391,11 +452,18 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
391 | if (asset == null) | 452 | if (asset == null) |
392 | { | 453 | { |
393 | m_log.Debug(" >> Sending assetID " + item.AssetID); | 454 | m_log.Debug(" >> Sending assetID " + item.AssetID); |
394 | asset = new AssetBase(item.AssetID, "NULL"); | 455 | asset = new AssetBase(item.AssetID, "NULL"); // send an asset with no data |
395 | } | 456 | } |
396 | return asset; | 457 | return asset; |
397 | } | 458 | } |
398 | 459 | ||
460 | public bool PostAsset(AssetBase asset) | ||
461 | { | ||
462 | m_log.Info("[HGStandaloneInvService]: Post asset " + asset.FullID); | ||
463 | m_assetProvider.CreateAsset(asset); | ||
464 | return true; | ||
465 | } | ||
466 | |||
399 | #region Caps | 467 | #region Caps |
400 | 468 | ||
401 | Dictionary<UUID, List<string>> invCaps = new Dictionary<UUID, List<string>>(); | 469 | Dictionary<UUID, List<string>> invCaps = new Dictionary<UUID, List<string>>(); |
@@ -561,8 +629,6 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
561 | 629 | ||
562 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryFolderBase, InventoryCollection>( | 630 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryFolderBase, InventoryCollection>( |
563 | "POST", AddAndGetCapUrl(authToken, "/FetchDescendants/", caps), FetchDescendants, CheckAuthSession)); | 631 | "POST", AddAndGetCapUrl(authToken, "/FetchDescendants/", caps), FetchDescendants, CheckAuthSession)); |
564 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>( | ||
565 | "POST", AddAndGetCapUrl(authToken, "/GetItem/", caps), GetInventoryItem, CheckAuthSession)); | ||
566 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | 632 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( |
567 | "POST", AddAndGetCapUrl(authToken, "/NewFolder/", caps), m_inventoryService.AddFolder, CheckAuthSession)); | 633 | "POST", AddAndGetCapUrl(authToken, "/NewFolder/", caps), m_inventoryService.AddFolder, CheckAuthSession)); |
568 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | 634 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( |
@@ -571,15 +637,24 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
571 | "POST", AddAndGetCapUrl(authToken, "/MoveFolder/", caps), m_inventoryService.MoveFolder, CheckAuthSession)); | 637 | "POST", AddAndGetCapUrl(authToken, "/MoveFolder/", caps), m_inventoryService.MoveFolder, CheckAuthSession)); |
572 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | 638 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( |
573 | "POST", AddAndGetCapUrl(authToken, "/PurgeFolder/", caps), m_inventoryService.PurgeFolder, CheckAuthSession)); | 639 | "POST", AddAndGetCapUrl(authToken, "/PurgeFolder/", caps), m_inventoryService.PurgeFolder, CheckAuthSession)); |
574 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryItemBase, bool>( | 640 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( |
575 | "POST", AddAndGetCapUrl(authToken, "/NewItem/", caps), m_inventoryService.AddItem, CheckAuthSession)); | 641 | "POST", AddAndGetCapUrl(authToken, "/RemoveFolder/", caps), RemoveFolder, CheckAuthSession)); |
576 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryItemBase, bool>( | 642 | |
577 | "POST", AddAndGetCapUrl(authToken, "/DeleteItem/", caps), m_inventoryService.DeleteItem, CheckAuthSession)); | 643 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>( |
644 | "POST", AddAndGetCapUrl(authToken, "/GetItem/", caps), GetInventoryItem, CheckAuthSession)); | ||
645 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>( | ||
646 | "POST", AddAndGetCapUrl(authToken, "/NewItem/", caps), AddItem, CheckAuthSession)); | ||
647 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>( | ||
648 | "POST", AddAndGetCapUrl(authToken, "/UpdateItem/", caps), UpdateItem, CheckAuthSession)); | ||
649 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>( | ||
650 | "POST", AddAndGetCapUrl(authToken, "/MoveItem/", caps), MoveItem, CheckAuthSession)); | ||
651 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>( | ||
652 | "POST", AddAndGetCapUrl(authToken, "/DeleteItem/", caps), DeleteItem, CheckAuthSession)); | ||
578 | 653 | ||
579 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryItemBase, AssetBase>( | 654 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryItemBase, AssetBase>( |
580 | "POST", AddAndGetCapUrl(authToken, "/GetAsset/", caps), GetAsset, CheckAuthSession)); | 655 | "POST", AddAndGetCapUrl(authToken, "/GetAsset/", caps), GetAsset, CheckAuthSession)); |
581 | //httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<AssetBase, bool>( | 656 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<AssetBase, bool>( |
582 | // "POST", AddAndGetCapUrl(authToken, "/PostAsset/", caps), m_inventoryService.DeleteItem, CheckAuthSession)); | 657 | "POST", AddAndGetCapUrl(authToken, "/PostAsset/", caps), PostAsset, CheckAuthSession)); |
583 | 658 | ||
584 | lock (invCaps) | 659 | lock (invCaps) |
585 | invCaps.Add(userID, caps); | 660 | invCaps.Add(userID, caps); |