* Patch from Justincc that swaps out LLUUIDs for Guid on the inventory REST calls

afrisby
Teravus Ovares 2007-12-14 07:55:33 +00:00
parent c65b2a38d8
commit 79935881aa
7 changed files with 31 additions and 21 deletions

View File

@ -75,6 +75,12 @@ namespace OpenSim.Framework.Communications
} }
} }
public List<InventoryFolderBase> RequestFirstLevelFolders(Guid rawUserID)
{
LLUUID userID = new LLUUID(rawUserID);
return RequestFirstLevelFolders(userID);
}
/// <summary> /// <summary>
/// Returns the root folder plus any folders in root (so down one level in the Inventory folders tree) /// Returns the root folder plus any folders in root (so down one level in the Inventory folders tree)
/// </summary> /// </summary>

View File

@ -72,8 +72,10 @@ namespace OpenSim.Grid.InventoryServer
} }
} }
public InventoryCollection GetUserInventory(LLUUID userID) public InventoryCollection GetUserInventory(Guid rawUserID)
{ {
LLUUID userID = new LLUUID(rawUserID);
InventoryCollection invCollection = new InventoryCollection(); InventoryCollection invCollection = new InventoryCollection();
List<InventoryFolderBase> folders; List<InventoryFolderBase> folders;
List<InventoryItemBase> allItems; List<InventoryItemBase> allItems;
@ -86,10 +88,12 @@ namespace OpenSim.Grid.InventoryServer
return invCollection; return invCollection;
} }
public bool CreateUsersInventory(LLUUID user) public bool CreateUsersInventory(Guid rawUserID)
{ {
Console.WriteLine("Creating New Set of Inventory Folders for " + user.ToStringHyphenated()); LLUUID userID = new LLUUID(rawUserID);
CreateNewUserInventory(user);
Console.WriteLine("Creating New Set of Inventory Folders for " + userID.ToStringHyphenated());
CreateNewUserInventory(userID);
return true; return true;
} }

View File

@ -78,10 +78,10 @@ namespace OpenSim.Grid.InventoryServer
MainLog.Instance.Notice(LogName, "Starting HTTP server ..."); MainLog.Instance.Notice(LogName, "Starting HTTP server ...");
BaseHttpServer httpServer = new BaseHttpServer(m_config.HttpPort); BaseHttpServer httpServer = new BaseHttpServer(m_config.HttpPort);
httpServer.AddStreamHandler( httpServer.AddStreamHandler(
new RestDeserialisehandler<LLUUID, InventoryCollection>("POST", "/GetInventory/", new RestDeserialisehandler<Guid, InventoryCollection>("POST", "/GetInventory/",
m_inventoryService.GetUserInventory)); m_inventoryService.GetUserInventory));
httpServer.AddStreamHandler( httpServer.AddStreamHandler(
new RestDeserialisehandler<LLUUID, bool>("POST", "/CreateInventory/", new RestDeserialisehandler<Guid, bool>("POST", "/CreateInventory/",
m_inventoryService.CreateUsersInventory)); m_inventoryService.CreateUsersInventory));
httpServer.AddStreamHandler( httpServer.AddStreamHandler(
new RestDeserialisehandler<InventoryFolderBase, bool>("POST", "/NewFolder/", new RestDeserialisehandler<InventoryFolderBase, bool>("POST", "/NewFolder/",
@ -95,7 +95,7 @@ namespace OpenSim.Grid.InventoryServer
m_inventoryService.DeleteInvItem)); m_inventoryService.DeleteInvItem));
httpServer.AddStreamHandler( httpServer.AddStreamHandler(
new RestDeserialisehandler<LLUUID, List<InventoryFolderBase>>("POST", "/RootFolders/", new RestDeserialisehandler<Guid, List<InventoryFolderBase>>("POST", "/RootFolders/",
m_inventoryService.RequestFirstLevelFolders)); m_inventoryService.RequestFirstLevelFolders));
// httpServer.AddStreamHandler(new InventoryManager.GetInventory(m_inventoryManager)); // httpServer.AddStreamHandler(new InventoryManager.GetInventory(m_inventoryManager));
@ -120,7 +120,7 @@ namespace OpenSim.Grid.InventoryServer
{ {
case "quit": case "quit":
case "add-user": case "add-user":
m_inventoryService.CreateUsersInventory(LLUUID.Random()); m_inventoryService.CreateUsersInventory(LLUUID.Random().UUID);
break; break;
case "shutdown": case "shutdown":
m_console.Close(); m_console.Close();

View File

@ -129,7 +129,7 @@ namespace OpenSim.Grid.UserServer
tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + "");
LLUUID userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); LLUUID userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
RestObjectPoster.BeginPostObject<LLUUID>(m_userManager._config.InventoryUrl + "CreateInventory/", userID); RestObjectPoster.BeginPostObject<Guid>(m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID);
m_lastCreatedUser = userID; m_lastCreatedUser = userID;
break; break;
} }

View File

@ -198,8 +198,8 @@ namespace OpenSim.Grid.UserServer
protected override InventoryData CreateInventoryData(LLUUID userID) protected override InventoryData CreateInventoryData(LLUUID userID)
{ {
List<InventoryFolderBase> folders List<InventoryFolderBase> folders
= SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>( = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
"POST", m_config.InventoryUrl + "RootFolders/", userID); "POST", m_config.InventoryUrl + "RootFolders/", userID.UUID);
// In theory, the user will only ever be missing a root folder in situations where a grid // In theory, the user will only ever be missing a root folder in situations where a grid
// which didn't previously run a grid wide inventory server is being transitioned to one // which didn't previously run a grid wide inventory server is being transitioned to one
@ -211,15 +211,15 @@ namespace OpenSim.Grid.UserServer
"A root inventory folder for user ID " + userID + " was not found. A new set" "A root inventory folder for user ID " + userID + " was not found. A new set"
+ " of empty inventory folders is being created."); + " of empty inventory folders is being created.");
RestObjectPoster.BeginPostObject<LLUUID>( RestObjectPoster.BeginPostObject<Guid>(
m_config.InventoryUrl + "CreateInventory/", userID); m_config.InventoryUrl + "CreateInventory/", userID.UUID);
// A big delay should be okay here since the recreation of the user's root folders should // A big delay should be okay here since the recreation of the user's root folders should
// only ever happen once. We need to sleep to let the inventory server do its work - // only ever happen once. We need to sleep to let the inventory server do its work -
// previously 1000ms has been found to be too short. // previously 1000ms has been found to be too short.
Thread.Sleep(10000); Thread.Sleep(10000);
folders = SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>( folders = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
"POST", m_config.InventoryUrl + "RootFolders/", userID); "POST", m_config.InventoryUrl + "RootFolders/", userID.UUID);
} }
if (folders.Count > 0) if (folders.Count > 0)

View File

@ -65,8 +65,8 @@ namespace OpenSim.Region.Communications.OGS1
{ {
RestObjectPosterResponse<InventoryCollection> requester = new RestObjectPosterResponse<InventoryCollection>(); RestObjectPosterResponse<InventoryCollection> requester = new RestObjectPosterResponse<InventoryCollection>();
requester.ResponseCallback = InventoryResponse; requester.ResponseCallback = InventoryResponse;
// THIS SHOULD BE A Guid, NOT A LLUUID! No longer Serializable! This will fail EVERY TIME.
requester.BeginPostObject<LLUUID>(_inventoryServerUrl + "/GetInventory/", userID); requester.BeginPostObject<Guid>(_inventoryServerUrl + "/GetInventory/", userID.UUID);
} }
catch (Exception) catch (Exception)
{ {