From 1de6cffa28348975a2492ce1e8a85c365df4dfaf Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Thu, 1 May 2008 20:47:33 +0000 Subject: * Refactor: Remove the unused userID parameter that was being passed into almost every inventory method * This allows lots of redundant inventory methods with only slightly different names to be eliminated. --- OpenSim/Data/MySQL/MySQLInventoryData.cs | 63 ++-------------- .../Communications/Cache/CachedUserInfo.cs | 81 ++++++++++----------- .../Cache/UserProfileCacheService.cs | 13 ++-- .../Framework/Communications/IInventoryServices.cs | 32 ++++----- .../Communications/InventoryServiceBase.cs | 79 ++++++++++---------- .../Grid/InventoryServer/GridInventoryService.cs | 84 +--------------------- OpenSim/Grid/InventoryServer/Main.cs | 10 +-- .../Communications/Local/LocalInventoryService.cs | 35 --------- .../Communications/OGS1/OGS1InventoryService.cs | 54 +++++++------- 9 files changed, 145 insertions(+), 306 deletions(-) diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index c9765c0..b529d4e 100644 --- a/OpenSim/Data/MySQL/MySQLInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs @@ -332,62 +332,13 @@ namespace OpenSim.Data.MySQL item.InvType = (int) reader["invType"]; item.Creator = new LLUUID((string) reader["creatorID"]); item.BasePermissions = (uint) reader["inventoryBasePermissions"]; - item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"]; - - try - { - item.SalePrice = (int) reader["salePrice"]; - } - catch (InvalidCastException) - { - m_log.WarnFormat("Could not cast salePrice {0} to {1}", reader["salePrice"], "int"); - } - - try - { - item.SaleType = Convert.ToByte(reader["saleType"]); - } - catch (InvalidCastException) - { - m_log.WarnFormat("Could not convert saleType {0} to {1}", reader["saleType"], "byte"); - } - - try - { - item.CreationDate = (int) reader["creationDate"]; - } - catch (InvalidCastException) - { - m_log.WarnFormat("Could not cast creationDate {0} to {1}", reader["creationDate"], "int"); - } - - try - { - item.GroupID = new LLUUID(reader["groupID"].ToString()); - } - catch (Exception) - { - item.GroupID = LLUUID.Zero; - m_log.WarnFormat("Could not convert groupID {0} to {1}", reader["groupID"], "LLUUID"); - } - - try - { - item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]); - } - catch (InvalidCastException) - { - m_log.WarnFormat("Could not cast groupOwned {0} to {1}", reader["groupOwned"], "boolean"); - } - - try - { - item.Flags = (uint) reader["flags"]; - } - catch (InvalidCastException) - { - m_log.WarnFormat("Could not cast flags {0} to {1}", reader["flags"], "uint"); - } + item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"]; + item.SalePrice = (int) reader["salePrice"]; + item.SaleType = Convert.ToByte(reader["saleType"]); + item.CreationDate = (int) reader["creationDate"]; + item.GroupID = new LLUUID(reader["groupID"].ToString()); + item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]); + item.Flags = (uint) reader["flags"]; return item; } diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index 7902240..adf01b9 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs @@ -166,12 +166,12 @@ namespace OpenSim.Framework.Communications.Cache { foreach (InventoryFolderImpl folder in folders) { - FolderReceive(userID, folder); + FolderReceive(folder); } foreach (InventoryItemBase item in items) { - ItemReceive(userID, item); + ItemReceive(item); } } catch (Exception e) @@ -198,56 +198,53 @@ namespace OpenSim.Framework.Communications.Cache /// /// /// - private void FolderReceive(LLUUID userID, InventoryFolderImpl folderInfo) + private void FolderReceive(InventoryFolderImpl folderInfo) { // m_log.DebugFormat( // "[INVENTORY CACHE]: Received folder {0} {1} for user {2}", // folderInfo.Name, folderInfo.ID, userID); - - if (userID == UserProfile.ID) + + if (RootFolder == null) { - if (RootFolder == null) + if (folderInfo.ParentID == LLUUID.Zero) { - if (folderInfo.ParentID == LLUUID.Zero) - { - m_rootFolder = folderInfo; - } + m_rootFolder = folderInfo; } - else if (RootFolder.ID == folderInfo.ParentID) + } + else if (RootFolder.ID == folderInfo.ParentID) + { + lock (RootFolder.SubFolders) { - lock (RootFolder.SubFolders) + if (!RootFolder.SubFolders.ContainsKey(folderInfo.ID)) { - if (!RootFolder.SubFolders.ContainsKey(folderInfo.ID)) - { - RootFolder.SubFolders.Add(folderInfo.ID, folderInfo); - } - else - { - AddPendingFolder(folderInfo); - } + RootFolder.SubFolders.Add(folderInfo.ID, folderInfo); } + else + { + AddPendingFolder(folderInfo); + } } - else + } + else + { + InventoryFolderImpl folder = RootFolder.GetDescendentFolder(folderInfo.ParentID); + lock (folder.SubFolders) { - InventoryFolderImpl folder = RootFolder.GetDescendentFolder(folderInfo.ParentID); - lock (folder.SubFolders) + if (folder != null) { - if (folder != null) + if (!folder.SubFolders.ContainsKey(folderInfo.ID)) { - if (!folder.SubFolders.ContainsKey(folderInfo.ID)) - { - folder.SubFolders.Add(folderInfo.ID, folderInfo); - } - } - else - { - AddPendingFolder(folderInfo); + folder.SubFolders.Add(folderInfo.ID, folderInfo); } } + else + { + AddPendingFolder(folderInfo); + } } - - ResolvePendingFolders(folderInfo); } + + ResolvePendingFolders(folderInfo); } /// @@ -256,15 +253,14 @@ namespace OpenSim.Framework.Communications.Cache /// We're assuming here that items are always received after all the folders have been /// received. /// - /// /// - private void ItemReceive(LLUUID userID, InventoryItemBase itemInfo) + private void ItemReceive(InventoryItemBase itemInfo) { // m_log.DebugFormat( // "[INVENTORY CACHE]: Received item {0} {1} for user {2}", // itemInfo.Name, itemInfo.ID, userID); - if ((userID == UserProfile.ID) && (RootFolder != null)) + if (RootFolder != null) { if (itemInfo.Folder == RootFolder.ID) { @@ -305,14 +301,13 @@ namespace OpenSim.Framework.Communications.Cache /// /// Add an item to the user's inventory /// - /// /// public void AddItem(LLUUID userID, InventoryItemBase itemInfo) { - if ((userID == UserProfile.ID) && HasInventory) + if (HasInventory) { - ItemReceive(userID, itemInfo); - m_commsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); + ItemReceive(itemInfo); + m_commsManager.InventoryService.AddItem(itemInfo); } } @@ -325,7 +320,7 @@ namespace OpenSim.Framework.Communications.Cache { if ((userID == UserProfile.ID) && HasInventory) { - m_commsManager.InventoryService.UpdateInventoryItem(userID, itemInfo); + m_commsManager.InventoryService.UpdateItem(itemInfo); } } @@ -343,7 +338,7 @@ namespace OpenSim.Framework.Communications.Cache result = RootFolder.DeleteItem(item.ID); if (result) { - m_commsManager.InventoryService.DeleteInventoryItem(userID, item); + m_commsManager.InventoryService.DeleteItem(item); } } diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index 392d796..befb6c7 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs @@ -181,7 +181,8 @@ namespace OpenSim.Framework.Communications.Cache createdBaseFolder.ParentID = createdFolder.ParentID; createdBaseFolder.Type = createdFolder.Type; createdBaseFolder.Version = createdFolder.Version; - m_commsManager.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdBaseFolder); + + m_commsManager.InventoryService.AddFolder(createdBaseFolder); } else { @@ -207,7 +208,7 @@ namespace OpenSim.Framework.Communications.Cache createdBaseFolder.Type = createdFolder.Type; createdBaseFolder.Version = createdFolder.Version; - m_commsManager.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdBaseFolder); + m_commsManager.InventoryService.AddFolder(createdBaseFolder); } else { @@ -265,7 +266,8 @@ namespace OpenSim.Framework.Communications.Cache baseFolder.ParentID = parentID; baseFolder.Type = (short) type; baseFolder.Version = userProfile.RootFolder.Version; - m_commsManager.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, baseFolder); + + m_commsManager.InventoryService.AddFolder(baseFolder); } else { @@ -299,7 +301,8 @@ namespace OpenSim.Framework.Communications.Cache baseFolder.Owner = remoteClient.AgentId; baseFolder.ID = folderID; baseFolder.ParentID = parentID; - m_commsManager.InventoryService.MoveInventoryFolder(remoteClient.AgentId, baseFolder); + + m_commsManager.InventoryService.MoveFolder(baseFolder); } else { @@ -544,7 +547,7 @@ namespace OpenSim.Framework.Communications.Cache purgedBaseFolder.Type = purgedFolder.Type; purgedBaseFolder.Version = purgedFolder.Version; - m_commsManager.InventoryService.PurgeInventoryFolder(remoteClient.AgentId, purgedBaseFolder); + m_commsManager.InventoryService.PurgeFolder(purgedBaseFolder); purgedFolder.Purge(); } diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs index c82c946..5907c38 100644 --- a/OpenSim/Framework/Communications/IInventoryServices.cs +++ b/OpenSim/Framework/Communications/IInventoryServices.cs @@ -50,46 +50,46 @@ namespace OpenSim.Framework.Communications void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback); /// - /// Add a new folder to the given user's inventory + /// Add a new folder to the user's inventory /// - /// /// - void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder); + /// true if the folder was successfully added + bool AddFolder(InventoryFolderBase folder); /// /// Move an inventory folder to a new location /// - /// /// A folder containing the details of the new location - void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder); + /// true if the folder was successfully moved + bool MoveFolder(InventoryFolderBase folder); /// /// Purge an inventory folder of all its items and subfolders. /// - /// /// - void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder); + /// true if the folder was successfully purged + bool PurgeFolder(InventoryFolderBase folder); /// - /// Add a new item to the given user's inventory + /// Add a new item to the user's inventory /// - /// /// - void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); + /// true if the item was successfully added + bool AddItem(InventoryItemBase item); /// - /// Update an item in the given user's inventory + /// Update an item in the user's inventory /// - /// /// - void UpdateInventoryItem(LLUUID userID, InventoryItemBase item); + /// true if the item was successfully updated + bool UpdateItem(InventoryItemBase item); /// - /// Delete an item from the given user's inventory + /// Delete an item from the user's inventory /// - /// /// - void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); + /// true if the item was successfully deleted + bool DeleteItem(InventoryItemBase item); /// /// Create a new inventory for the given user. diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index dab6a16..1601963 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs @@ -106,16 +106,6 @@ namespace OpenSim.Framework.Communications return userFolders; } - - // See IInventoryServices - public void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder) - { - // FIXME: Probably doesn't do what was originally intended - only ever queries the first plugin - foreach (KeyValuePair plugin in m_plugins) - { - plugin.Value.moveInventoryFolder(folder); - } - } // See IInventoryServices public virtual bool HasInventoryForUser(LLUUID userID) @@ -159,25 +149,7 @@ namespace OpenSim.Framework.Communications } // See IInventoryServices - public abstract void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback); - - // See IInventoryServices - public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder); - - // See IInventoryServices - public abstract void MoveExistingInventoryFolder(InventoryFolderBase folder); - - // See IInventoryServices - public abstract void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder); - - // See IInventoryServices - public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); - - // See IInventoryServices - public abstract void UpdateInventoryItem(LLUUID userID, InventoryItemBase item); - - // See IInventoryServices - public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); + public abstract void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback); #endregion @@ -206,47 +178,74 @@ namespace OpenSim.Framework.Communications #endregion - protected void AddFolder(InventoryFolderBase folder) + public bool AddFolder(InventoryFolderBase folder) { m_log.DebugFormat( - "[INVENTORY SERVICE BASE]: Adding folder {0}, {1} to {2}", folder.Name, folder.ID, folder.ParentID); + "[AGENT INVENTORY]: Adding folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); foreach (KeyValuePair plugin in m_plugins) { plugin.Value.addInventoryFolder(folder); } + + // FIXME: Should return false on failure + return true; } - protected void MoveFolder(InventoryFolderBase folder) + public bool MoveFolder(InventoryFolderBase folder) { + m_log.DebugFormat( + "[AGENT INVENTORY]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); + foreach (KeyValuePair plugin in m_plugins) { plugin.Value.moveInventoryFolder(folder); } + + // FIXME: Should return false on failure + return true; } - protected void AddItem(InventoryItemBase item) + public bool AddItem(InventoryItemBase item) { + m_log.DebugFormat( + "[AGENT INVENTORY]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder); + foreach (KeyValuePair plugin in m_plugins) { plugin.Value.addInventoryItem(item); } + + // FIXME: Should return false on failure + return true; } - protected void UpdateItem(InventoryItemBase item) + public bool UpdateItem(InventoryItemBase item) { + m_log.InfoFormat( + "[AGENT INVENTORY]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder); + foreach (KeyValuePair plugin in m_plugins) { plugin.Value.updateInventoryItem(item); } + + // FIXME: Should return false on failure + return true; } - protected void DeleteItem(InventoryItemBase item) + public bool DeleteItem(InventoryItemBase item) { + m_log.InfoFormat( + "[AGENT INVENTORY]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder); + foreach (KeyValuePair plugin in m_plugins) { plugin.Value.deleteInventoryItem(item.ID); } + + // FIXME: Should return false on failure + return true; } /// @@ -256,8 +255,11 @@ namespace OpenSim.Framework.Communications /// already know... Needs heavy refactoring. /// /// - protected void PurgeFolder(InventoryFolderBase folder) + public bool PurgeFolder(InventoryFolderBase folder) { + m_log.DebugFormat( + "[AGENT INVENTORY]: Purging folder {0} {1} of its contents", folder.Name, folder.ID); + List subFolders = RequestSubFolders(folder.ID); foreach (InventoryFolderBase subFolder in subFolders) @@ -276,6 +278,9 @@ namespace OpenSim.Framework.Communications { DeleteItem(item); } + + // FIXME: Should return false on failure + return true; } private void AddNewInventorySet(UsersInventory inventory) @@ -283,7 +288,7 @@ namespace OpenSim.Framework.Communications foreach (InventoryFolderBase folder in inventory.Folders.Values) { AddFolder(folder); - } + } } /// diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs index db9a864..d9510e9 100644 --- a/OpenSim/Grid/InventoryServer/GridInventoryService.cs +++ b/OpenSim/Grid/InventoryServer/GridInventoryService.cs @@ -182,89 +182,7 @@ namespace OpenSim.Grid.InventoryServer m_log.InfoFormat("[GRID AGENT INVENTORY]: Creating new set of inventory folders for user {0}", userID); - CreateNewUserInventory(userID); - return true; - } - - - public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) - { - AddFolder(folder); - } - - public override void MoveExistingInventoryFolder(InventoryFolderBase folder) - { - MoveFolder(folder); - } - - public override void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder) - { - PurgeFolder(folder); - } - - public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) - { - AddItem(item); - } - - public override void UpdateInventoryItem(LLUUID userID, InventoryItemBase item) - { - UpdateItem(item); - } - - public bool AddInventoryFolder(InventoryFolderBase folder) - { - // Right now, this actions act more like an update/insert combination than a simple create. - m_log.InfoFormat( - "[GRID AGENT INVENTORY]: Creating folder {0} {1} in folder {2}", folder.Name, folder.ID, folder.ParentID); - - AddNewInventoryFolder(folder.Owner, folder); - return true; - } - - public bool MoveInventoryFolder(InventoryFolderBase folder) - { - m_log.InfoFormat( - "[GRID AGENT INVENTORY]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); - - MoveExistingInventoryFolder(folder); - return true; - } - - public bool PurgeInventoryFolder(InventoryFolderBase folder) - { - m_log.InfoFormat( - "[GRID AGENT INVENTORY]: Purging folder {0} {1} of its contents", folder.Name, folder.ID); - - PurgeInventoryFolder(folder.Owner, folder); - return true; - } - - public bool AddInventoryItem(InventoryItemBase item) - { - // Right now, this actions act more like an update/insert combination than a simple create. - m_log.InfoFormat("[GRID AGENT INVENTORY]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder); - - AddNewInventoryItem(item.Owner, item); - return true; - } - - public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) - { - m_log.InfoFormat("[GRID AGENT INVENTORY]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder); - - DeleteItem(item); - } - - /// - /// FIXME: Get DeleteInventoryItem to return a bool - /// - /// - /// - public bool DeleteInvItem(InventoryItemBase item) - { - DeleteInventoryItem(item.Owner, item); - return true; + return CreateNewUserInventory(userID); } } } diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs index 870997b..4076d21 100644 --- a/OpenSim/Grid/InventoryServer/Main.cs +++ b/OpenSim/Grid/InventoryServer/Main.cs @@ -95,23 +95,23 @@ namespace OpenSim.Grid.InventoryServer m_httpServer.AddStreamHandler( new RestDeserialisehandler( - "POST", "/NewFolder/", m_inventoryService.AddInventoryFolder)); + "POST", "/NewFolder/", m_inventoryService.AddFolder)); m_httpServer.AddStreamHandler( new RestDeserialisehandler( - "POST", "/MoveFolder/", m_inventoryService.MoveInventoryFolder)); + "POST", "/MoveFolder/", m_inventoryService.MoveFolder)); m_httpServer.AddStreamHandler( new RestDeserialisehandler( - "POST", "/PurgeFolder/", m_inventoryService.PurgeInventoryFolder)); + "POST", "/PurgeFolder/", m_inventoryService.PurgeFolder)); m_httpServer.AddStreamHandler( new RestDeserialisehandler( - "POST", "/NewItem/", m_inventoryService.AddInventoryItem)); + "POST", "/NewItem/", m_inventoryService.AddItem)); m_httpServer.AddStreamHandler( new RestDeserialisehandler( - "POST", "/DeleteItem/", m_inventoryService.DeleteInvItem)); + "POST", "/DeleteItem/", m_inventoryService.DeleteItem)); // WARNING: Root folders no longer just delivers the root and immediate child folders (e.g // system folders such as Objects, Textures), but it now returns the entire inventory skeleton. diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs index 0de00a1..80108e3 100644 --- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs +++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs @@ -80,41 +80,6 @@ namespace OpenSim.Region.Communications.Local callback(userID, folders, items); } - public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) - { - AddFolder(folder); - } - - public override void MoveExistingInventoryFolder(InventoryFolderBase folder) - { - MoveFolder(folder); - } - - public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) - { - AddItem(item); - } - - public override void UpdateInventoryItem(LLUUID userID, InventoryItemBase item) - { - UpdateItem(item); - } - - public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) - { - DeleteItem(item); - } - - /// - /// - /// - /// - /// - public override void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder) - { - PurgeFolder(folder); - } - public override bool HasInventoryForUser(LLUUID userID) { InventoryFolderBase root = RequestRootFolder(userID); diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs index 8a35519..ba91f14 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs @@ -154,14 +154,12 @@ namespace OpenSim.Region.Communications.OGS1 /// /// - /// - /// - /// - public void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) + /// + public bool AddFolder(InventoryFolderBase folder) { try { - SynchronousRestObjectPoster.BeginPostObject( + return SynchronousRestObjectPoster.BeginPostObject( "POST", _inventoryServerUrl + "/NewFolder/", folder); } catch (WebException e) @@ -169,18 +167,19 @@ namespace OpenSim.Region.Communications.OGS1 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory folder operation failed, {0} {1}", e.Source, e.Message); } + + return false; } /// /// /// - /// /// - public void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder) + public bool MoveFolder(InventoryFolderBase folder) { try { - SynchronousRestObjectPoster.BeginPostObject( + return SynchronousRestObjectPoster.BeginPostObject( "POST", _inventoryServerUrl + "/MoveFolder/", folder); } catch (WebException e) @@ -188,19 +187,18 @@ namespace OpenSim.Region.Communications.OGS1 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}", e.Source, e.Message); } + + return false; } /// /// /// - /// - /// - /// - public void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder) + public bool PurgeFolder(InventoryFolderBase folder) { try { - SynchronousRestObjectPoster.BeginPostObject( + return SynchronousRestObjectPoster.BeginPostObject( "POST", _inventoryServerUrl + "/PurgeFolder/", folder); } catch (WebException e) @@ -208,33 +206,35 @@ namespace OpenSim.Region.Communications.OGS1 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}", e.Source, e.Message); } + + return false; } /// /// - /// - /// - /// - public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) + /// + public bool AddItem(InventoryItemBase item) { try { - SynchronousRestObjectPoster.BeginPostObject( + return SynchronousRestObjectPoster.BeginPostObject( "POST", _inventoryServerUrl + "/NewItem/", item); } catch (WebException e) { m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory item operation failed, {0} {1}", e.Source, e.Message); - } + } + + return false; } // TODO: this is a temporary workaround, the UpdateInventoryItem method need to be implemented - public void UpdateInventoryItem(LLUUID userID, InventoryItemBase item) + public bool UpdateItem(InventoryItemBase item) { try { - SynchronousRestObjectPoster.BeginPostObject( + return SynchronousRestObjectPoster.BeginPostObject( "POST", _inventoryServerUrl + "/NewItem/", item); } catch (WebException e) @@ -242,18 +242,18 @@ namespace OpenSim.Region.Communications.OGS1 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Update new inventory item operation failed, {0} {1}", e.Source, e.Message); } + + return false; } /// /// - /// - /// - /// - public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) + /// + public bool DeleteItem(InventoryItemBase item) { try { - SynchronousRestObjectPoster.BeginPostObject( + return SynchronousRestObjectPoster.BeginPostObject( "POST", _inventoryServerUrl + "/DeleteItem/", item); } catch (WebException e) @@ -261,6 +261,8 @@ namespace OpenSim.Region.Communications.OGS1 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Delete inventory item operation failed, {0} {1}", e.Source, e.Message); } + + return false; } public bool HasInventoryForUser(LLUUID userID) -- cgit v1.1