From 3f9d38538e4d7f238eb901aced60de7e6673a92e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 27 Apr 2010 11:01:56 -0700 Subject: XInventory connector/handler showing signs of life. Tested, but needs more testing. --- .../Connectors/Inventory/XInventoryConnector.cs | 128 +++++++++++++-------- .../Services/InventoryService/XInventoryService.cs | 8 +- 2 files changed, 82 insertions(+), 54 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs index edf224f..52294da 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs @@ -112,8 +112,15 @@ namespace OpenSim.Services.Connectors List folders = new List(); - foreach (Object o in ret.Values) - folders.Add(BuildFolder((Dictionary)o)); + try + { + foreach (Object o in ret.Values) + folders.Add(BuildFolder((Dictionary)o)); + } + catch (Exception e) + { + m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception unwrapping folder list: {0}", e.Message); + } return folders; } @@ -130,7 +137,7 @@ namespace OpenSim.Services.Connectors if (ret.Count == 0) return null; - return BuildFolder(ret); + return BuildFolder((Dictionary)ret["folder"]); } public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) @@ -146,7 +153,7 @@ namespace OpenSim.Services.Connectors if (ret.Count == 0) return null; - return BuildFolder(ret); + return BuildFolder((Dictionary)ret["folder"]); } public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) @@ -173,10 +180,17 @@ namespace OpenSim.Services.Connectors Dictionary items = (Dictionary)ret["ITEMS"]; - foreach (Object o in folders.Values) - inventory.Folders.Add(BuildFolder((Dictionary)o)); - foreach (Object o in items.Values) - inventory.Items.Add(BuildItem((Dictionary)o)); + try + { + foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i + inventory.Folders.Add(BuildFolder((Dictionary)o)); + foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i + inventory.Items.Add(BuildItem((Dictionary)o)); + } + catch (Exception e) + { + m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception unwrapping content list: {0}", e.Message); + } return inventory; } @@ -194,13 +208,12 @@ namespace OpenSim.Services.Connectors if (ret.Count == 0) return null; - - List items = new List(); - - foreach (Object o in ret.Values) - items.Add(BuildItem((Dictionary)o)); + Dictionary items = (Dictionary)ret["ITEMS"]; + List fitems = new List(); + foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i + fitems.Add(BuildItem((Dictionary)o)); - return items; + return fitems; } public bool AddFolder(InventoryFolderBase folder) @@ -405,7 +418,7 @@ namespace OpenSim.Services.Connectors if (ret.Count == 0) return null; - return BuildItem(ret); + return BuildItem((Dictionary)ret["item"]); } public InventoryFolderBase GetFolder(InventoryFolderBase folder) @@ -420,7 +433,7 @@ namespace OpenSim.Services.Connectors if (ret.Count == 0) return null; - return BuildFolder(ret); + return BuildFolder((Dictionary)ret["folder"]); } public List GetActiveGestures(UUID principalID) @@ -435,8 +448,8 @@ namespace OpenSim.Services.Connectors List items = new List(); - foreach (Object o in ret.Values) - items.Add(BuildItem((Dictionary)o)); + foreach (Object o in ret.Values) // getting the values directly, we don't care about the keys item_i + items.Add(BuildItem((Dictionary)o)); return items; } @@ -469,13 +482,14 @@ namespace OpenSim.Services.Connectors try { - foreach (KeyValuePair kvp in ret) + Dictionary folders = (Dictionary)ret["FOLDERS"]; + + foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i { - InventoryFolderBase folder = BuildFolder((Dictionary)(kvp.Value)); - short type = 0; - if (Int16.TryParse(kvp.Key, out type)) - sfolders.Add((AssetType)type, folder); + InventoryFolderBase folder = BuildFolder((Dictionary)o); + sfolders.Add((AssetType)folder.Type, folder); } + } catch (Exception e) { @@ -522,13 +536,20 @@ namespace OpenSim.Services.Connectors { InventoryFolderBase folder = new InventoryFolderBase(); - folder.ParentID = new UUID(data["ParentID"].ToString()); - folder.Type = short.Parse(data["Type"].ToString()); - folder.Version = ushort.Parse(data["Version"].ToString()); - folder.Name = data["Name"].ToString(); - folder.Owner = new UUID(data["Owner"].ToString()); - folder.ID = new UUID(data["ID"].ToString()); - + try + { + folder.ParentID = new UUID(data["ParentID"].ToString()); + folder.Type = short.Parse(data["Type"].ToString()); + folder.Version = ushort.Parse(data["Version"].ToString()); + folder.Name = data["Name"].ToString(); + folder.Owner = new UUID(data["Owner"].ToString()); + folder.ID = new UUID(data["ID"].ToString()); + } + catch (Exception e) + { + m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception building folder: {0}", e.Message); + } + return folder; } @@ -536,26 +557,33 @@ namespace OpenSim.Services.Connectors { InventoryItemBase item = new InventoryItemBase(); - item.AssetID = new UUID(data["AssetID"].ToString()); - item.AssetType = int.Parse(data["AssetType"].ToString()); - item.Name = data["Name"].ToString(); - item.Owner = new UUID(data["Owner"].ToString()); - item.ID = new UUID(data["ID"].ToString()); - item.InvType = int.Parse(data["InvType"].ToString()); - item.Folder = new UUID(data["Folder"].ToString()); - item.CreatorId = data["CreatorId"].ToString(); - item.Description = data["Description"].ToString(); - item.NextPermissions = uint.Parse(data["NextPermissions"].ToString()); - item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString()); - item.BasePermissions = uint.Parse(data["BasePermissions"].ToString()); - item.EveryOnePermissions = uint.Parse(data["EveryOnePermissions"].ToString()); - item.GroupPermissions = uint.Parse(data["GroupPermissions"].ToString()); - item.GroupID = new UUID(data["GroupID"].ToString()); - item.GroupOwned = bool.Parse(data["GroupOwned"].ToString()); - item.SalePrice = int.Parse(data["SalePrice"].ToString()); - item.SaleType = byte.Parse(data["SaleType"].ToString()); - item.Flags = uint.Parse(data["Flags"].ToString()); - item.CreationDate = int.Parse(data["CreationDate"].ToString()); + try + { + item.AssetID = new UUID(data["AssetID"].ToString()); + item.AssetType = int.Parse(data["AssetType"].ToString()); + item.Name = data["Name"].ToString(); + item.Owner = new UUID(data["Owner"].ToString()); + item.ID = new UUID(data["ID"].ToString()); + item.InvType = int.Parse(data["InvType"].ToString()); + item.Folder = new UUID(data["Folder"].ToString()); + item.CreatorId = data["CreatorId"].ToString(); + item.Description = data["Description"].ToString(); + item.NextPermissions = uint.Parse(data["NextPermissions"].ToString()); + item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString()); + item.BasePermissions = uint.Parse(data["BasePermissions"].ToString()); + item.EveryOnePermissions = uint.Parse(data["EveryOnePermissions"].ToString()); + item.GroupPermissions = uint.Parse(data["GroupPermissions"].ToString()); + item.GroupID = new UUID(data["GroupID"].ToString()); + item.GroupOwned = bool.Parse(data["GroupOwned"].ToString()); + item.SalePrice = int.Parse(data["SalePrice"].ToString()); + item.SaleType = byte.Parse(data["SaleType"].ToString()); + item.Flags = uint.Parse(data["Flags"].ToString()); + item.CreationDate = int.Parse(data["CreationDate"].ToString()); + } + catch (Exception e) + { + m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception building item: {0}", e.Message); + } return item; } diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index bbd37d1..1409a01 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -184,7 +184,7 @@ namespace OpenSim.Services.InventoryService foreach (XInventoryFolder x in allFolders) { - m_log.DebugFormat("[INVENTORY]: Adding folder {0} to skeleton", x.folderName); + m_log.DebugFormat("[XINVENTORY]: Adding folder {0} to skeleton", x.folderName); folders.Add(ConvertToOpenSim(x)); } @@ -221,7 +221,7 @@ namespace OpenSim.Services.InventoryService // connector. So we disregard the principal and look // by ID. // - m_log.DebugFormat("[INVENTORY]: Fetch contents for folder {0}", folderID.ToString()); + m_log.DebugFormat("[XINVENTORY]: Fetch contents for folder {0}", folderID.ToString()); InventoryCollection inventory = new InventoryCollection(); inventory.UserID = principalID; inventory.Folders = new List(); @@ -233,7 +233,7 @@ namespace OpenSim.Services.InventoryService foreach (XInventoryFolder x in folders) { - m_log.DebugFormat("[INVENTORY]: Adding folder {0} to response", x.folderName); + m_log.DebugFormat("[XINVENTORY]: Adding folder {0} to response", x.folderName); inventory.Folders.Add(ConvertToOpenSim(x)); } @@ -243,7 +243,7 @@ namespace OpenSim.Services.InventoryService foreach (XInventoryItem i in items) { - m_log.DebugFormat("[INVENTORY]: Adding item {0} to response", i.inventoryName); + m_log.DebugFormat("[XINVENTORY]: Adding item {0} to response", i.inventoryName); inventory.Items.Add(ConvertToOpenSim(i)); } -- cgit v1.1 From e83877692046068735af97eb9f40cea1a09ae66c Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 27 Apr 2010 17:13:54 -0700 Subject: * Thanks cmickeyb, for a patch that sanity checks if the response from m_Database.GetAsset(assetID) is null in AssetService.cs --- OpenSim/Services/AssetService/AssetService.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index ed87f3f..4e512e7 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs @@ -106,7 +106,10 @@ namespace OpenSim.Services.AssetService return null; AssetBase asset = m_Database.GetAsset(assetID); - return asset.Metadata; + if (asset != null) + return asset.Metadata; + + return null; } public byte[] GetData(string id) -- cgit v1.1 From 044c1cf5f6e38799526be15cc2c7f4a7d0d9350f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 27 Apr 2010 18:37:34 -0700 Subject: Changed GetToken from protected to public. This is not exposed at the interface. --- OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs index 9af61a9..242aba3 100644 --- a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs +++ b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs @@ -127,7 +127,7 @@ namespace OpenSim.Services.AuthenticationService return true; } - protected string GetToken(UUID principalID, int lifetime) + public string GetToken(UUID principalID, int lifetime) { UUID token = UUID.Random(); -- cgit v1.1 From c54bc5094deedecbde2ca2283efefe6df70cc591 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 27 Apr 2010 18:52:15 -0700 Subject: Putting it back to protected; Melanie doesn't like it to be public. --- OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs index 242aba3..9af61a9 100644 --- a/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs +++ b/OpenSim/Services/AuthenticationService/AuthenticationServiceBase.cs @@ -127,7 +127,7 @@ namespace OpenSim.Services.AuthenticationService return true; } - public string GetToken(UUID principalID, int lifetime) + protected string GetToken(UUID principalID, int lifetime) { UUID token = UUID.Random(); -- cgit v1.1 From 423ff3b94bbbace7092f110b51d8723f7fc25713 Mon Sep 17 00:00:00 2001 From: AlexRa Date: Tue, 27 Apr 2010 10:53:54 +0300 Subject: Removed unused var from InventoryService.cs (-1 warning) --- OpenSim/Services/InventoryService/InventoryService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs index 0d6577e..fbcd663 100644 --- a/OpenSim/Services/InventoryService/InventoryService.cs +++ b/OpenSim/Services/InventoryService/InventoryService.cs @@ -109,7 +109,7 @@ namespace OpenSim.Services.InventoryService { existingRootFolder = GetRootFolder(user); } - catch (Exception e) + catch /*(Exception e)*/ { // Munch the exception, it has already been reported // -- cgit v1.1 From 6a4fae123ade98d53e7342309dfb52e254d4b5f2 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 29 Apr 2010 11:39:13 -0700 Subject: Started redoing HGInventoryBroker for XInventory and with multi-protocol in mind. Unfinished. --- OpenSim/Services/InventoryService/XInventoryService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 1409a01..4d7103b 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -184,7 +184,7 @@ namespace OpenSim.Services.InventoryService foreach (XInventoryFolder x in allFolders) { - m_log.DebugFormat("[XINVENTORY]: Adding folder {0} to skeleton", x.folderName); + //m_log.DebugFormat("[XINVENTORY]: Adding folder {0} to skeleton", x.folderName); folders.Add(ConvertToOpenSim(x)); } @@ -233,7 +233,7 @@ namespace OpenSim.Services.InventoryService foreach (XInventoryFolder x in folders) { - m_log.DebugFormat("[XINVENTORY]: Adding folder {0} to response", x.folderName); + //m_log.DebugFormat("[XINVENTORY]: Adding folder {0} to response", x.folderName); inventory.Folders.Add(ConvertToOpenSim(x)); } @@ -243,7 +243,7 @@ namespace OpenSim.Services.InventoryService foreach (XInventoryItem i in items) { - m_log.DebugFormat("[XINVENTORY]: Adding item {0} to response", i.inventoryName); + //m_log.DebugFormat("[XINVENTORY]: Adding item {0} to response", i.inventoryName); inventory.Items.Add(ConvertToOpenSim(i)); } -- cgit v1.1