From 51e487a172d97d17e3a02f8f3479af24a1d1ae41 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 19 Aug 2009 12:02:57 -0700 Subject: Makes the inventory connectors fully compatible with the old Grid.InventoryServer. WARNING: interacting with the old server is _much_ slower than interacting with the new one. Grids with the old server will not see any improvements on crossings and TPs, because inventory needs to be fetched from it in its entirety. --- .../Inventory/InventoryServiceConnector.cs | 64 ++++++++++++---------- 1 file changed, 35 insertions(+), 29 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs index bcf9d87..b573a06 100644 --- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs @@ -178,30 +178,36 @@ namespace OpenSim.Services.Connectors catch (Exception e) { // Maybe we're talking to an old inventory server. Try this other thing. - m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetSystemFolders operation failed, {0} {1}. Trying RootFolders.", + m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetSystemFolders operation failed, {0} {1} (old sever?). Trying GetInventory.", e.Source, e.Message); try { - folders = SynchronousRestSessionObjectPoster>.BeginPostObject( - "POST", m_ServerURI + "/RootFolders/", new Guid(userID), sessionID.ToString(), userID.ToString()); + InventoryCollection inventory = SynchronousRestSessionObjectPoster.BeginPostObject( + "POST", m_ServerURI + "/GetInventory/", new Guid(userID), sessionID.ToString(), userID.ToString()); + folders = inventory.Folders; } catch (Exception ex) { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: RootFolders operation also failed, {0} {1}. Give up.", + m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetInventory operation also failed, {0} {1}. Giving up.", e.Source, ex.Message); } if ((folders != null) && (folders.Count > 0)) { - dFolders[AssetType.Folder] = folders[0]; // Root folder is the first one - folders.RemoveAt(0); + m_log.DebugFormat("[INVENTORY CONNECTOR]: Received entire inventory ({0} folders) for user {1}", + folders.Count, userID); foreach (InventoryFolderBase f in folders) { if ((f.Type != (short)AssetType.Folder) && (f.Type != (short)AssetType.Unknown)) dFolders[(AssetType)f.Type] = f; } + UUID rootFolderID = dFolders[AssetType.Animation].ParentID; + InventoryFolderBase rootFolder = new InventoryFolderBase(rootFolderID, new UUID(userID)); + rootFolder = QueryFolder(userID, rootFolder, sessionID); + dFolders[AssetType.Folder] = rootFolder; + m_log.DebugFormat("[INVENTORY CONNECTOR]: {0} system folders for user {1}", dFolders.Count, userID); return dFolders; } } @@ -226,48 +232,48 @@ namespace OpenSim.Services.Connectors catch (Exception e) { // Maybe we're talking to an old inventory server. Try this other thing. - m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderForType operation failed, {0} {1}. Trying RootFolders and GetItems.", + m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderContent operation failed, {0} {1} (old server?). Trying GetInventory.", e.Source, e.Message); + InventoryCollection inventory; List folders = null; try { - folders = SynchronousRestSessionObjectPoster>.BeginPostObject( - "POST", m_ServerURI + "/RootFolders/", new Guid(userID), sessionID.ToString(), userID.ToString()); + inventory = SynchronousRestSessionObjectPoster.BeginPostObject( + "POST", m_ServerURI + "/GetInventory/", new Guid(userID), sessionID.ToString(), userID.ToString()); + if (inventory != null) + folders = inventory.Folders; } catch (Exception ex) { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: RootFolders operation also failed, {0} {1}. Give up.", + m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetInventory operation also failed, {0} {1}. Giving up.", e.Source, ex.Message); + return new InventoryCollection(); } if ((folders != null) && (folders.Count > 0)) { - folders = folders.FindAll(delegate (InventoryFolderBase f) { return f.ParentID == folderID ; }); + m_log.DebugFormat("[INVENTORY CONNECTOR]: Received entire inventory ({0} folders) for user {1}", + folders.Count, userID); - try + folders = folders.FindAll(delegate(InventoryFolderBase f) { return f.ParentID == folderID; }); + List items = inventory.Items; + if (items != null) { - List items = SynchronousRestSessionObjectPoster>.BeginPostObject( - "POST", m_ServerURI + "/GetItems/", folderID.Guid, sessionID.ToString(), userID.ToString()); - - if (items != null) - { - InventoryCollection result = new InventoryCollection(); - result.Folders = folders; - result.Items = items; - result.UserID = new UUID(userID); - return result; - } - } - catch (Exception ex) - { - m_log.ErrorFormat("[INVENTORY CONNECTOR]: QueryFolder and GetItems operation failed, {0} {1}. Give up.", - e.Source, ex.Message); + items = items.FindAll(delegate(InventoryItemBase i) { return i.Folder == folderID; }); } + + inventory.Items = items; + inventory.Folders = folders; + return inventory; } } - return null; + InventoryCollection nullCollection = new InventoryCollection(); + nullCollection.Folders = new List(); + nullCollection.Items = new List(); + nullCollection.UserID = new UUID(userID); + return nullCollection; } public bool AddFolder(string userID, InventoryFolderBase folder, UUID sessionID) -- cgit v1.1