Added some padding to the remote inventory connector so that it tries to operate with the old Grid.InventoryServer.exe. Untested, but it should work -- slow.

arthursv
Diva Canto 2009-08-17 14:14:22 -07:00
parent 59b4cf2d5b
commit 3a3f9d5abb
1 changed files with 70 additions and 4 deletions

View File

@ -163,20 +163,47 @@ namespace OpenSim.Services.Connectors
/// <returns></returns> /// <returns></returns>
public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(string userID, UUID sessionID) public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(string userID, UUID sessionID)
{ {
List<InventoryFolderBase> folders = null;
Dictionary<AssetType, InventoryFolderBase> dFolders = new Dictionary<AssetType, InventoryFolderBase>();
try try
{ {
List<InventoryFolderBase> folders = SynchronousRestSessionObjectPoster<Guid, List<InventoryFolderBase>>.BeginPostObject( folders = SynchronousRestSessionObjectPoster<Guid, List<InventoryFolderBase>>.BeginPostObject(
"POST", m_ServerURI + "/SystemFolders/", new Guid(userID), sessionID.ToString(), userID.ToString()); "POST", m_ServerURI + "/SystemFolders/", new Guid(userID), sessionID.ToString(), userID.ToString());
Dictionary<AssetType, InventoryFolderBase> dFolders = new Dictionary<AssetType, InventoryFolderBase>();
foreach (InventoryFolderBase f in folders) foreach (InventoryFolderBase f in folders)
dFolders[(AssetType)f.Type] = f; dFolders[(AssetType)f.Type] = f;
return dFolders; return dFolders;
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetSystemFolders operation failed, {0} {1}", // 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.",
e.Source, e.Message); e.Source, e.Message);
try
{
folders = SynchronousRestSessionObjectPoster<Guid, List<InventoryFolderBase>>.BeginPostObject(
"POST", m_ServerURI + "/RootFolders/", new Guid(userID), sessionID.ToString(), userID.ToString());
}
catch (Exception ex)
{
m_log.ErrorFormat("[INVENTORY CONNECTOR]: RootFolders operation also failed, {0} {1}. Give 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);
foreach (InventoryFolderBase f in folders)
{
if ((f.Type != (short)AssetType.Folder) && (f.Type != (short)AssetType.Unknown))
dFolders[(AssetType)f.Type] = f;
}
return dFolders;
}
} }
return new Dictionary<AssetType, InventoryFolderBase>(); return new Dictionary<AssetType, InventoryFolderBase>();
@ -192,13 +219,52 @@ namespace OpenSim.Services.Connectors
{ {
try try
{ {
// normal case
return SynchronousRestSessionObjectPoster<Guid, InventoryCollection>.BeginPostObject( return SynchronousRestSessionObjectPoster<Guid, InventoryCollection>.BeginPostObject(
"POST", m_ServerURI + "/GetFolderContent/", folderID.Guid, sessionID.ToString(), userID.ToString()); "POST", m_ServerURI + "/GetFolderContent/", folderID.Guid, sessionID.ToString(), userID.ToString());
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderForType operation failed, {0} {1}", // 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.",
e.Source, e.Message); e.Source, e.Message);
List<InventoryFolderBase> folders = null;
try
{
folders = SynchronousRestSessionObjectPoster<Guid, List<InventoryFolderBase>>.BeginPostObject(
"POST", m_ServerURI + "/RootFolders/", new Guid(userID), sessionID.ToString(), userID.ToString());
}
catch (Exception ex)
{
m_log.ErrorFormat("[INVENTORY CONNECTOR]: RootFolders operation also failed, {0} {1}. Give up.",
e.Source, ex.Message);
}
if ((folders != null) && (folders.Count > 0))
{
folders = folders.FindAll(delegate (InventoryFolderBase f) { return f.ParentID == folderID ; });
try
{
List<InventoryItemBase> items = SynchronousRestSessionObjectPoster<Guid, List<InventoryItemBase>>.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);
}
}
} }
return null; return null;