Finally remove the requirement for an InventoryItem/FolderBase object to

be passed into inventory queries.
This makes the API more homogenous and also will more clearly show
coding
errors related to HG inventory where the .Owner field has a meaning
for a query but wasn't always set.
LSLKeyTest
Melanie Thielker 2016-07-04 03:35:48 +01:00
parent 6deced0193
commit ea8f3c83bf
33 changed files with 147 additions and 228 deletions

View File

@ -445,8 +445,7 @@ namespace OpenSim.Groups
UUID itemID = binBucketMap["item_id"].AsUUID(); UUID itemID = binBucketMap["item_id"].AsUUID();
UUID ownerID = binBucketMap["owner_id"].AsUUID(); UUID ownerID = binBucketMap["owner_id"].AsUUID();
item = new InventoryItemBase(itemID, ownerID); item = m_sceneList[0].InventoryService.GetItem(ownerID, itemID);
item = m_sceneList[0].InventoryService.GetItem(item);
} }
else else
m_log.DebugFormat("[Groups]: Received OSD with unexpected type: {0}", binBucketOSD.GetType()); m_log.DebugFormat("[Groups]: Received OSD with unexpected type: {0}", binBucketOSD.GetType());

View File

@ -2836,8 +2836,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
if (wearable[0].ItemID != UUID.Zero) if (wearable[0].ItemID != UUID.Zero)
{ {
// Get inventory item and copy it // Get inventory item and copy it
InventoryItemBase item = new InventoryItemBase(wearable[0].ItemID, source); InventoryItemBase item = inventoryService.GetItem(source, wearable[0].ItemID);
item = inventoryService.GetItem(item);
if (item != null) if (item != null)
{ {
@ -2890,8 +2889,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
if (itemID != UUID.Zero) if (itemID != UUID.Zero)
{ {
// Get inventory item and copy it // Get inventory item and copy it
InventoryItemBase item = new InventoryItemBase(itemID, source); InventoryItemBase item = inventoryService.GetItem(source, itemID);
item = inventoryService.GetItem(item);
if (item != null) if (item != null)
{ {

View File

@ -403,10 +403,7 @@ namespace OpenSim.Capabilities.Handlers
return contents; return contents;
} }
contents = fetchedContents; contents = fetchedContents;
InventoryFolderBase containingFolder = new InventoryFolderBase(); InventoryFolderBase containingFolder = m_InventoryService.GetFolder(agentID, folderID);
containingFolder.ID = folderID;
containingFolder.Owner = agentID;
containingFolder = m_InventoryService.GetFolder(containingFolder);
if (containingFolder != null) if (containingFolder != null)
{ {
@ -429,7 +426,7 @@ namespace OpenSim.Capabilities.Handlers
{ {
if (item.AssetType == (int)AssetType.Link) if (item.AssetType == (int)AssetType.Link)
{ {
InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID)); InventoryItemBase linkedItem = m_InventoryService.GetItem(agentID, item.AssetID);
// Take care of genuinely broken links where the target doesn't exist // Take care of genuinely broken links where the target doesn't exist
// HACK: Also, don't follow up links that just point to other links. In theory this is legitimate, // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
@ -659,10 +656,7 @@ from docs seems this was never a spec
// Must fetch it individually // Must fetch it individually
else if (contents.FolderID == UUID.Zero) else if (contents.FolderID == UUID.Zero)
{ {
InventoryFolderBase containingFolder = new InventoryFolderBase(); InventoryFolderBase containingFolder = m_InventoryService.GetFolder(freq.owner_id, freq.folder_id);
containingFolder.ID = freq.folder_id;
containingFolder.Owner = freq.owner_id;
containingFolder = m_InventoryService.GetFolder(containingFolder);
if (containingFolder != null) if (containingFolder != null)
{ {
@ -759,12 +753,9 @@ from docs seems this was never a spec
m_log.WarnFormat("[WEB FETCH INV DESC HANDLER]: GetMultipleItems failed. Falling back to fetching inventory items one by one."); m_log.WarnFormat("[WEB FETCH INV DESC HANDLER]: GetMultipleItems failed. Falling back to fetching inventory items one by one.");
linked = new InventoryItemBase[itemIDs.Count]; linked = new InventoryItemBase[itemIDs.Count];
int i = 0; int i = 0;
InventoryItemBase item = new InventoryItemBase();
item.Owner = freq.owner_id;
foreach (UUID id in itemIDs) foreach (UUID id in itemIDs)
{ {
item.ID = id; linked[i++] = m_InventoryService.GetItem(freq.owner_id, id);
linked[i++] = m_InventoryService.GetItem(item);
} }
} }
@ -850,4 +841,4 @@ from docs seems this was never a spec
public InventoryCollection Collection; public InventoryCollection Collection;
public int Descendents; public int Descendents;
} }
} }

View File

@ -81,24 +81,15 @@ namespace OpenSim.Capabilities.Handlers
// OMG!!! One by one!!! This is fallback code, in case the backend isn't updated // OMG!!! One by one!!! This is fallback code, in case the backend isn't updated
m_log.WarnFormat("[FETCH INVENTORY HANDLER]: GetMultipleItems failed. Falling back to fetching inventory items one by one."); m_log.WarnFormat("[FETCH INVENTORY HANDLER]: GetMultipleItems failed. Falling back to fetching inventory items one by one.");
items = new InventoryItemBase[itemsRequested.Count]; items = new InventoryItemBase[itemsRequested.Count];
InventoryItemBase item = new InventoryItemBase();
item.Owner = m_agentID;
foreach (UUID id in itemIDs) foreach (UUID id in itemIDs)
{ items[i++] = m_inventoryService.GetItem(m_agentID, id);
item.ID = id;
items[i++] = m_inventoryService.GetItem(item);
}
} }
} }
else else
{ {
items = new InventoryItemBase[itemsRequested.Count]; items = new InventoryItemBase[itemsRequested.Count];
InventoryItemBase item = new InventoryItemBase();
foreach (UUID id in itemIDs) foreach (UUID id in itemIDs)
{ items[i++] = m_inventoryService.GetItem(UUID.Zero, id);
item.ID = id;
items[i++] = m_inventoryService.GetItem(item);
}
} }
foreach (InventoryItemBase item in items) foreach (InventoryItemBase item in items)
@ -152,4 +143,4 @@ namespace OpenSim.Capabilities.Handlers
return llsdItem; return llsdItem;
} }
} }
} }

View File

@ -1386,7 +1386,7 @@ namespace OpenSim.Region.ClientStack.Linden
IClientAPI client = null; IClientAPI client = null;
m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client);
item = m_Scene.InventoryService.GetItem(new InventoryItemBase(itemID)); item = m_Scene.InventoryService.GetItem(m_HostCapsObj.AgentID, itemID);
if (item != null) if (item != null)
{ {
string message; string message;

View File

@ -898,8 +898,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, scriptedState); string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp, scriptedState);
InventoryItemBase item = new InventoryItemBase(grp.FromItemID, sp.UUID); InventoryItemBase item = m_scene.InventoryService.GetItem(sp.UUID, grp.FromItemID);
item = m_scene.InventoryService.GetItem(item);
if (item != null) if (item != null)
{ {
@ -1223,8 +1222,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return; return;
} }
InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID); InventoryItemBase item = m_scene.InventoryService.GetItem(sp.UUID, itemID);
item = m_scene.InventoryService.GetItem(item);
if (item == null) if (item == null)
return; return;

View File

@ -219,7 +219,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// sp.Appearance.GetAttachpoint(attSo.FromItemID), // sp.Appearance.GetAttachpoint(attSo.FromItemID),
// Is.EqualTo((int)AttachmentPoint.Chest)); // Is.EqualTo((int)AttachmentPoint.Chest));
InventoryItemBase attachmentItem = scene.InventoryService.GetItem(new InventoryItemBase(attSo.FromItemID)); InventoryItemBase attachmentItem = scene.InventoryService.GetItem(sp.UUID, attSo.FromItemID);
Assert.That(attachmentItem, Is.Not.Null); Assert.That(attachmentItem, Is.Not.Null);
Assert.That(attachmentItem.Name, Is.EqualTo(attName)); Assert.That(attachmentItem.Name, Is.EqualTo(attName));
@ -266,7 +266,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// sp.Appearance.GetAttachpoint(attSo.FromItemID), // sp.Appearance.GetAttachpoint(attSo.FromItemID),
// Is.EqualTo((int)AttachmentPoint.LeftHand)); // Is.EqualTo((int)AttachmentPoint.LeftHand));
InventoryItemBase attachmentItem = scene.InventoryService.GetItem(new InventoryItemBase(attSo.FromItemID)); InventoryItemBase attachmentItem = scene.InventoryService.GetItem(sp.UUID, attSo.FromItemID);
Assert.That(attachmentItem, Is.Not.Null); Assert.That(attachmentItem, Is.Not.Null);
Assert.That(attachmentItem.Name, Is.EqualTo(so.Name)); Assert.That(attachmentItem.Name, Is.EqualTo(so.Name));
@ -299,7 +299,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// sp.Appearance.GetAttachpoint(attSo.FromItemID), // sp.Appearance.GetAttachpoint(attSo.FromItemID),
// Is.EqualTo((int)AttachmentPoint.LeftHand)); // Is.EqualTo((int)AttachmentPoint.LeftHand));
InventoryItemBase attachmentItem = scene.InventoryService.GetItem(new InventoryItemBase(attSo.FromItemID)); InventoryItemBase attachmentItem = scene.InventoryService.GetItem(sp.UUID, attSo.FromItemID);
Assert.That(attachmentItem, Is.Not.Null); Assert.That(attachmentItem, Is.Not.Null);
Assert.That(attachmentItem.Name, Is.EqualTo(so2.Name)); Assert.That(attachmentItem.Name, Is.EqualTo(so2.Name));
@ -332,7 +332,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// sp.Appearance.GetAttachpoint(attSo.FromItemID), // sp.Appearance.GetAttachpoint(attSo.FromItemID),
// Is.EqualTo((int)AttachmentPoint.LeftHand)); // Is.EqualTo((int)AttachmentPoint.LeftHand));
InventoryItemBase attachmentItem = scene.InventoryService.GetItem(new InventoryItemBase(attSo.FromItemID)); InventoryItemBase attachmentItem = scene.InventoryService.GetItem(sp.UUID, attSo.FromItemID);
Assert.That(attachmentItem, Is.Not.Null); Assert.That(attachmentItem, Is.Not.Null);
Assert.That(attachmentItem.Name, Is.EqualTo(so2.Name)); Assert.That(attachmentItem.Name, Is.EqualTo(so2.Name));
@ -600,7 +600,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(0)); // Assert.That(sp.Appearance.GetAttachments().Count, Is.EqualTo(0));
// Check item status // Check item status
Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItem.ID)), Is.Null); Assert.That(scene.InventoryService.GetItem(sp.UUID, attItem.ID), Is.Null);
// Check object in scene // Check object in scene
SceneObjectGroup soInScene = scene.GetSceneObjectGroup("att"); SceneObjectGroup soInScene = scene.GetSceneObjectGroup("att");
@ -679,7 +679,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, rezzedSo); scene.AttachmentsModule.DetachSingleAttachmentToInv(sp, rezzedSo);
InventoryItemBase userItemUpdated = scene.InventoryService.GetItem(userItem); InventoryItemBase userItemUpdated = scene.InventoryService.GetItem(userItem.Owner, userItem.ID);
AssetBase asset = scene.AssetService.Get(userItemUpdated.AssetID.ToString()); AssetBase asset = scene.AssetService.Get(userItemUpdated.AssetID.ToString());
// TODO: It would probably be better here to check script state via the saving and retrieval of state // TODO: It would probably be better here to check script state via the saving and retrieval of state

View File

@ -904,8 +904,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
continue; continue;
} }
InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID); InventoryItemBase baseItem = invService.GetItem(userID, appearance.Wearables[i][j].ItemID);
baseItem = invService.GetItem(baseItem);
if (baseItem != null) if (baseItem != null)
{ {

View File

@ -239,8 +239,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
InventoryFolderBase trashFolder = InventoryFolderBase trashFolder =
invService.GetFolderForType(client.AgentId, FolderType.Trash); invService.GetFolderForType(client.AgentId, FolderType.Trash);
InventoryItemBase item = new InventoryItemBase(transactionID, client.AgentId); InventoryItemBase item = invService.GetItem(client.AgentId, transactionID);
item = invService.GetItem(item);
if (item != null && trashFolder != null) if (item != null && trashFolder != null)
{ {

View File

@ -86,8 +86,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures
{ {
IInventoryService invService = m_scene.InventoryService; IInventoryService invService = m_scene.InventoryService;
InventoryItemBase item = new InventoryItemBase(gestureId, client.AgentId); InventoryItemBase item = invService.GetItem(client.AgentId, gestureId);
item = invService.GetItem(item);
if (item != null) if (item != null)
{ {
item.Flags |= 1; item.Flags |= 1;
@ -102,8 +101,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures
{ {
IInventoryService invService = m_scene.InventoryService; IInventoryService invService = m_scene.InventoryService;
InventoryItemBase item = new InventoryItemBase(gestureId, client.AgentId); InventoryItemBase item = invService.GetItem(client.AgentId, gestureId);
item = invService.GetItem(item);
if (item != null) if (item != null)
{ {
item.Flags &= ~(uint)1; item.Flags &= ~(uint)1;

View File

@ -270,8 +270,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
// RLV uses this // RLV uses this
if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted) if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted)
{ {
InventoryFolderBase folder = new InventoryFolderBase(inventoryID, client.AgentId); InventoryFolderBase folder = invService.GetFolder(client.AgentId, inventoryID);
folder = invService.GetFolder(folder);
if (folder != null) if (folder != null)
{ {
@ -280,8 +279,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
UUID destFolderID = new UUID(im.binaryBucket, 0); UUID destFolderID = new UUID(im.binaryBucket, 0);
if (destFolderID != UUID.Zero) if (destFolderID != UUID.Zero)
{ {
InventoryFolderBase destFolder = new InventoryFolderBase(destFolderID, client.AgentId); InventoryFolderBase destFolder = invService.GetFolder(client.AgentId, destFolderID);
destFolder = invService.GetFolder(destFolder);
if (destFolder != null) if (destFolder != null)
{ {
if (folder.ParentID != destFolder.ID) if (folder.ParentID != destFolder.ID)
@ -339,8 +337,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId); InventoryItemBase item = invService.GetItem(client.AgentId, inventoryID);
item = invService.GetItem(item);
InventoryFolderBase folder = null; InventoryFolderBase folder = null;
UUID? previousParentFolderID = null; UUID? previousParentFolderID = null;
@ -354,8 +351,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
} }
else else
{ {
folder = new InventoryFolderBase(inventoryID, client.AgentId); folder = invService.GetFolder(client.AgentId, inventoryID);
folder = invService.GetFolder(folder);
if (folder != null) // It's a folder if (folder != null) // It's a folder
{ {
@ -368,9 +364,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
// Tell client about updates to original parent and new parent (this should probably be factored with existing move item/folder code). // Tell client about updates to original parent and new parent (this should probably be factored with existing move item/folder code).
if (previousParentFolderID != null) if (previousParentFolderID != null)
{ {
InventoryFolderBase previousParentFolder InventoryFolderBase previousParentFolder = invService.GetFolder(client.AgentId, (UUID)previousParentFolderID);
= new InventoryFolderBase((UUID)previousParentFolderID, client.AgentId);
previousParentFolder = invService.GetFolder(previousParentFolder);
scene.SendInventoryUpdate(client, previousParentFolder, true, true); scene.SendInventoryUpdate(client, previousParentFolder, true, true);
scene.SendInventoryUpdate(client, destinationFolder, true, true); scene.SendInventoryUpdate(client, destinationFolder, true, true);
@ -392,8 +386,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId); InventoryItemBase item = invService.GetItem(client.AgentId, inventoryID);
item = invService.GetItem(item);
InventoryFolderBase folder = null; InventoryFolderBase folder = null;
UUID? previousParentFolderID = null; UUID? previousParentFolderID = null;
@ -410,8 +403,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
} }
else else
{ {
folder = new InventoryFolderBase(inventoryID, client.AgentId); folder = invService.GetFolder(client.AgentId, inventoryID);
folder = invService.GetFolder(folder);
if (folder != null & trashFolder != null) if (folder != null & trashFolder != null)
{ {
@ -439,9 +431,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
// Tell client about updates to original parent and new parent (this should probably be factored with existing move item/folder code). // Tell client about updates to original parent and new parent (this should probably be factored with existing move item/folder code).
else if (previousParentFolderID != null) else if (previousParentFolderID != null)
{ {
InventoryFolderBase previousParentFolder InventoryFolderBase previousParentFolder = invService.GetFolder(client.AgentId, (UUID)previousParentFolderID);
= new InventoryFolderBase((UUID)previousParentFolderID, client.AgentId);
previousParentFolder = invService.GetFolder(previousParentFolder);
scene.SendInventoryUpdate(client, previousParentFolder, true, true); scene.SendInventoryUpdate(client, previousParentFolder, true, true);
scene.SendInventoryUpdate(client, trashFolder, true, true); scene.SendInventoryUpdate(client, trashFolder, true, true);
@ -500,10 +490,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
{ {
UUID folderID = new UUID(im.binaryBucket, 1); UUID folderID = new UUID(im.binaryBucket, 1);
InventoryFolderBase given =
new InventoryFolderBase(folderID, recipientID);
InventoryFolderBase folder = InventoryFolderBase folder =
scene.InventoryService.GetFolder(given); scene.InventoryService.GetFolder(recipientID, folderID);
if (folder != null) if (folder != null)
user.ControllingClient.SendBulkUpdateInventory(folder); user.ControllingClient.SendBulkUpdateInventory(folder);
@ -512,10 +500,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
{ {
UUID itemID = new UUID(im.binaryBucket, 1); UUID itemID = new UUID(im.binaryBucket, 1);
InventoryItemBase given =
new InventoryItemBase(itemID, recipientID);
InventoryItemBase item = InventoryItemBase item =
scene.InventoryService.GetItem(given); scene.InventoryService.GetItem(recipientID, itemID);
if (item != null) if (item != null)
{ {
@ -538,10 +524,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
{ {
UUID folderID = new UUID(im.imSessionID); UUID folderID = new UUID(im.imSessionID);
InventoryFolderBase given =
new InventoryFolderBase(folderID, recipientID);
InventoryFolderBase folder = InventoryFolderBase folder =
scene.InventoryService.GetFolder(given); scene.InventoryService.GetFolder(recipientID, folderID);
if (folder != null) if (folder != null)
user.ControllingClient.SendBulkUpdateInventory(folder); user.ControllingClient.SendBulkUpdateInventory(folder);
@ -550,10 +534,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
{ {
UUID itemID = new UUID(im.imSessionID); UUID itemID = new UUID(im.imSessionID);
InventoryItemBase given =
new InventoryItemBase(itemID, recipientID);
InventoryItemBase item = InventoryItemBase item =
scene.InventoryService.GetItem(given); scene.InventoryService.GetItem(recipientID, itemID);
if (item != null) if (item != null)
{ {

View File

@ -95,8 +95,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
foreach (AvatarAttachment att in a.GetAttachments()) foreach (AvatarAttachment att in a.GetAttachments())
{ {
InventoryItemBase item = new InventoryItemBase(att.ItemID, account.PrincipalID); InventoryItemBase item = Scene.InventoryService.GetItem(account.PrincipalID, att.ItemID);
item = Scene.InventoryService.GetItem(item);
if (item != null) if (item != null)
a.SetAttachment(att.AttachPoint, att.ItemID, item.AssetID); a.SetAttachment(att.AttachPoint, att.ItemID, item.AssetID);
else else

View File

@ -314,9 +314,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
//if (fromTaskID.Equals(UUID.Zero)) //if (fromTaskID.Equals(UUID.Zero))
//{ //{
InventoryItemBase item = new InventoryItemBase(itemID); InventoryItemBase item = m_Scene.InventoryService.GetItem(remoteClient.AgentId, itemID);
item.Owner = remoteClient.AgentId;
item = m_Scene.InventoryService.GetItem(item);
//if (item == null) //if (item == null)
//{ // Fetch the item //{ // Fetch the item
// item = new InventoryItemBase(); // item = new InventoryItemBase();

View File

@ -184,8 +184,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
if (!m_Scene.Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) if (!m_Scene.Permissions.CanCreateUserInventory(invType, remoteClient.AgentId))
return; return;
InventoryFolderBase f = new InventoryFolderBase(folderID, remoteClient.AgentId); InventoryFolderBase folder = m_Scene.InventoryService.GetFolder(remoteClient.AgentId, folderID);
InventoryFolderBase folder = m_Scene.InventoryService.GetFolder(f);
if (folder == null && Enum.IsDefined(typeof(FolderType), (sbyte)invType)) if (folder == null && Enum.IsDefined(typeof(FolderType), (sbyte)invType))
{ {
@ -260,8 +259,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
/// <returns></returns> /// <returns></returns>
public virtual UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data) public virtual UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data)
{ {
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); InventoryItemBase item = m_Scene.InventoryService.GetItem(remoteClient.AgentId, itemID);
item = m_Scene.InventoryService.GetItem(item);
if (item.Owner != remoteClient.AgentId) if (item.Owner != remoteClient.AgentId)
return UUID.Zero; return UUID.Zero;
@ -719,8 +717,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
if (DeRezAction.SaveToExistingUserInventoryItem == action) if (DeRezAction.SaveToExistingUserInventoryItem == action)
{ {
item = new InventoryItemBase(so.RootPart.FromUserInventoryItemID, userID); item = m_Scene.InventoryService.GetItem(userID, so.RootPart.FromUserInventoryItemID);
item = m_Scene.InventoryService.GetItem(item);
//item = userInfo.RootFolder.FindItem( //item = userInfo.RootFolder.FindItem(
// objectGroup.RootPart.FromUserInventoryItemID); // objectGroup.RootPart.FromUserInventoryItemID);
@ -792,9 +789,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{ {
if (so.FromFolderID != UUID.Zero && so.RootPart.OwnerID == remoteClient.AgentId) if (so.FromFolderID != UUID.Zero && so.RootPart.OwnerID == remoteClient.AgentId)
{ {
InventoryFolderBase f = new InventoryFolderBase(so.FromFolderID, userID); folder = m_Scene.InventoryService.GetFolder(userID, so.FromFolderID);
if (f != null)
folder = m_Scene.InventoryService.GetFolder(f);
if(folder.Type == 14 || folder.Type == 16) if(folder.Type == 14 || folder.Type == 16)
{ {
@ -830,8 +825,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment)
{ {
// m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID); // m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID);
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); InventoryItemBase item = m_Scene.InventoryService.GetItem(remoteClient.AgentId, itemID);
item = m_Scene.InventoryService.GetItem(item);
if (item == null) if (item == null)
{ {
@ -1289,8 +1283,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
protected virtual InventoryItemBase GetItem(UUID agentID, UUID itemID) protected virtual InventoryItemBase GetItem(UUID agentID, UUID itemID)
{ {
IInventoryService invService = m_Scene.RequestModuleInterface<IInventoryService>(); IInventoryService invService = m_Scene.RequestModuleInterface<IInventoryService>();
InventoryItemBase item = new InventoryItemBase(itemID, agentID); InventoryItemBase item = invService.GetItem(agentID, itemID);
item = invService.GetItem(item);
if (item != null && item.CreatorData != null && item.CreatorData != string.Empty) if (item != null && item.CreatorData != null && item.CreatorData != string.Empty)
UserManagementModule.AddUser(item.CreatorIdAsUuid, item.CreatorData); UserManagementModule.AddUser(item.CreatorIdAsUuid, item.CreatorData);

View File

@ -103,13 +103,8 @@ namespace OpenSim.Region.CoreModules.Framework.Library
{ {
InventoryItemBase[] itemColl = new InventoryItemBase[itemIDs.Length]; InventoryItemBase[] itemColl = new InventoryItemBase[itemIDs.Length];
int i = 0; int i = 0;
InventoryItemBase item = new InventoryItemBase();
item.Owner = principalID;
foreach (UUID fid in itemIDs) foreach (UUID fid in itemIDs)
{ itemColl[i++] = GetItem(principalID, fid);
item.ID = fid;
itemColl[i++] = GetItem(item);
}
return itemColl; return itemColl;
} }
@ -239,14 +234,14 @@ namespace OpenSim.Region.CoreModules.Framework.Library
/// </summary> /// </summary>
/// <param name="item"></param> /// <param name="item"></param>
/// <returns></returns> /// <returns></returns>
public InventoryItemBase GetItem(InventoryItemBase item) { return null; } public InventoryItemBase GetItem(UUID principalID, UUID itemID) { return null; }
/// <summary> /// <summary>
/// Get a folder, given by its UUID /// Get a folder, given by its UUID
/// </summary> /// </summary>
/// <param name="folder"></param> /// <param name="folder"></param>
/// <returns></returns> /// <returns></returns>
public InventoryFolderBase GetFolder(InventoryFolderBase folder) { return null; } public InventoryFolderBase GetFolder(UUID principalID, UUID folderID) { return null; }
/// <summary> /// <summary>
/// Does the given user have an inventory structure? /// Does the given user have an inventory structure?

View File

@ -598,21 +598,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return connector.DeleteItems(ownerID, itemIDs); return connector.DeleteItems(ownerID, itemIDs);
} }
public InventoryItemBase GetItem(InventoryItemBase item) public InventoryItemBase GetItem(UUID principalID, UUID itemID)
{ {
if (item == null)
return null;
//m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID); //m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID);
string invURL = GetInventoryServiceURL(item.Owner); string invURL = GetInventoryServiceURL(principalID);
if (invURL == null) // not there, forward to local inventory connector to resolve if (invURL == null) // not there, forward to local inventory connector to resolve
lock (m_Lock) lock (m_Lock)
return m_LocalGridInventoryService.GetItem(item); return m_LocalGridInventoryService.GetItem(principalID, itemID);
IInventoryService connector = GetConnector(invURL); IInventoryService connector = GetConnector(invURL);
return connector.GetItem(item); return connector.GetItem(principalID, itemID);
} }
public InventoryItemBase[] GetMultipleItems(UUID userID, UUID[] itemIDs) public InventoryItemBase[] GetMultipleItems(UUID userID, UUID[] itemIDs)
@ -632,22 +630,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return connector.GetMultipleItems(userID, itemIDs); return connector.GetMultipleItems(userID, itemIDs);
} }
public InventoryFolderBase GetFolder(InventoryFolderBase folder) public InventoryFolderBase GetFolder(UUID principalID, UUID folderID)
{ {
if (folder == null)
return null;
//m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolder " + folder.ID); //m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolder " + folder.ID);
string invURL = GetInventoryServiceURL(folder.Owner); string invURL = GetInventoryServiceURL(principalID);
if (invURL == null) // not there, forward to local inventory connector to resolve if (invURL == null) // not there, forward to local inventory connector to resolve
lock (m_Lock) lock (m_Lock)
return m_LocalGridInventoryService.GetFolder(folder); return m_LocalGridInventoryService.GetFolder(principalID, folderID);
IInventoryService connector = GetConnector(invURL); IInventoryService connector = GetConnector(invURL);
return connector.GetFolder(folder); return connector.GetFolder(principalID, folderID);
} }
public bool HasInventoryForUser(UUID userID) public bool HasInventoryForUser(UUID userID)
@ -710,4 +705,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return connector; return connector;
} }
} }
} }

View File

@ -292,13 +292,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_InventoryService.DeleteItems(ownerID, itemIDs); return m_InventoryService.DeleteItems(ownerID, itemIDs);
} }
public InventoryItemBase GetItem(InventoryItemBase item) public InventoryItemBase GetItem(UUID principalID, UUID itemID)
{ {
// m_log.DebugFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Requesting inventory item {0}", item.ID); // m_log.DebugFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Requesting inventory item {0}", item.ID);
// UUID requestedItemId = item.ID; // UUID requestedItemId = item.ID;
item = m_InventoryService.GetItem(item); InventoryItemBase item = m_InventoryService.GetItem(principalID, itemID);
// if (null == item) // if (null == item)
// m_log.ErrorFormat( // m_log.ErrorFormat(
@ -312,9 +312,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_InventoryService.GetMultipleItems(userID, itemIDs); return m_InventoryService.GetMultipleItems(userID, itemIDs);
} }
public InventoryFolderBase GetFolder(InventoryFolderBase folder) public InventoryFolderBase GetFolder(UUID principalID, UUID folderID)
{ {
return m_InventoryService.GetFolder(folder); return m_InventoryService.GetFolder(principalID, folderID);
} }
/// <summary> /// <summary>

View File

@ -292,15 +292,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.DeleteItems(ownerID, itemIDs); return m_RemoteConnector.DeleteItems(ownerID, itemIDs);
} }
public InventoryItemBase GetItem(InventoryItemBase item) public InventoryItemBase GetItem(UUID userID, UUID itemID)
{ {
//m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetItem {0}", item.ID); //m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetItem {0}", item.ID);
if (item == null)
return null;
if (m_RemoteConnector == null) if (m_RemoteConnector == null)
m_log.DebugFormat("[XINVENTORY CONNECTOR]: connector stub is null!!!"); m_log.DebugFormat("[XINVENTORY CONNECTOR]: connector stub is null!!!");
return m_RemoteConnector.GetItem(item); return m_RemoteConnector.GetItem(userID, itemID);
} }
public InventoryItemBase[] GetMultipleItems(UUID userID, UUID[] itemIDs) public InventoryItemBase[] GetMultipleItems(UUID userID, UUID[] itemIDs)
@ -311,13 +309,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.GetMultipleItems(userID, itemIDs); return m_RemoteConnector.GetMultipleItems(userID, itemIDs);
} }
public InventoryFolderBase GetFolder(InventoryFolderBase folder) public InventoryFolderBase GetFolder(UUID userID, UUID folderID)
{ {
//m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID); //m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID);
if (folder == null)
return null;
return m_RemoteConnector.GetFolder(folder); return m_RemoteConnector.GetFolder(userID, folderID);
} }
public bool HasInventoryForUser(UUID userID) public bool HasInventoryForUser(UUID userID)
@ -337,4 +333,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
#endregion #endregion
} }
} }

View File

@ -1100,8 +1100,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (objectID == UUID.Zero) // User inventory if (objectID == UUID.Zero) // User inventory
{ {
IInventoryService invService = m_scene.InventoryService; IInventoryService invService = m_scene.InventoryService;
InventoryItemBase assetRequestItem = new InventoryItemBase(notecard, user); InventoryItemBase assetRequestItem = invService.GetItem(user, notecard);
assetRequestItem = invService.GetItem(assetRequestItem);
if (assetRequestItem == null && LibraryRootFolder != null) // Library item if (assetRequestItem == null && LibraryRootFolder != null) // Library item
{ {
assetRequestItem = LibraryRootFolder.FindItem(notecard); assetRequestItem = LibraryRootFolder.FindItem(notecard);
@ -1625,8 +1624,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (objectID == UUID.Zero) // User inventory if (objectID == UUID.Zero) // User inventory
{ {
IInventoryService invService = m_scene.InventoryService; IInventoryService invService = m_scene.InventoryService;
InventoryItemBase assetRequestItem = new InventoryItemBase(script, user); InventoryItemBase assetRequestItem = invService.GetItem(user, script);
assetRequestItem = invService.GetItem(assetRequestItem);
if (assetRequestItem == null && LibraryRootFolder != null) // Library item if (assetRequestItem == null && LibraryRootFolder != null) // Library item
{ {
assetRequestItem = LibraryRootFolder.FindItem(script); assetRequestItem = LibraryRootFolder.FindItem(script);
@ -1722,8 +1720,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if (objectID == UUID.Zero) // User inventory if (objectID == UUID.Zero) // User inventory
{ {
IInventoryService invService = m_scene.InventoryService; IInventoryService invService = m_scene.InventoryService;
InventoryItemBase assetRequestItem = new InventoryItemBase(notecard, user); InventoryItemBase assetRequestItem = invService.GetItem(user, notecard);
assetRequestItem = invService.GetItem(assetRequestItem);
if (assetRequestItem == null && LibraryRootFolder != null) // Library item if (assetRequestItem == null && LibraryRootFolder != null) // Library item
{ {
assetRequestItem = LibraryRootFolder.FindItem(notecard); assetRequestItem = LibraryRootFolder.FindItem(notecard);

View File

@ -143,8 +143,7 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat( // m_log.DebugFormat(
// "[ASYNC INVENTORY SENDER]: Handling request from {0} for {1} on queue", fh.Client.Name, fh.ItemID); // "[ASYNC INVENTORY SENDER]: Handling request from {0} for {1} on queue", fh.Client.Name, fh.ItemID);
InventoryItemBase item = new InventoryItemBase(fh.ItemID, fh.Client.AgentId); InventoryItemBase item = m_scene.InventoryService.GetItem(fh.Client.AgentId, fh.ItemID);
item = m_scene.InventoryService.GetItem(item);
if (item != null) if (item != null)
fh.Client.SendInventoryItemDetails(item.Owner, item); fh.Client.SendInventoryItemDetails(item.Owner, item);
@ -153,4 +152,4 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} }
} }

View File

@ -223,8 +223,7 @@ namespace OpenSim.Region.Framework.Scenes
if (core.TryGet<IClientInventory>(out inv)) if (core.TryGet<IClientInventory>(out inv))
{ {
InventoryFolderBase parent = new InventoryFolderBase(f.ParentID, f.Owner); InventoryFolderBase parent = InventoryService.GetFolder(f.Owner, f.ParentID);
parent = InventoryService.GetFolder(parent);
inv.SendRemoveInventoryItems(new UUID[] { item.ID }); inv.SendRemoveInventoryItems(new UUID[] { item.ID });
inv.SendBulkUpdateInventory(new InventoryFolderBase[0], new InventoryItemBase[] { item }); inv.SendBulkUpdateInventory(new InventoryFolderBase[0], new InventoryItemBase[] { item });
string message = "The item was placed in folder " + f.Name; string message = "The item was placed in folder " + f.Name;
@ -407,8 +406,7 @@ namespace OpenSim.Region.Framework.Scenes
// inventory. Rut-Roh. Whatever. Make this secure. Yeah. // inventory. Rut-Roh. Whatever. Make this secure. Yeah.
// //
// Passing something to another avatar or a an object will already // Passing something to another avatar or a an object will already
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); InventoryItemBase item = InventoryService.GetItem(remoteClient.AgentId, itemID);
item = InventoryService.GetItem(item);
if (item != null) if (item != null)
{ {
@ -585,8 +583,7 @@ namespace OpenSim.Region.Framework.Scenes
return null; return null;
} }
InventoryItemBase item = new InventoryItemBase(itemId, senderId); InventoryItemBase item = InventoryService.GetItem(senderId, itemId);
item = InventoryService.GetItem(item);
if (item == null) if (item == null)
{ {
@ -807,7 +804,7 @@ namespace OpenSim.Region.Framework.Scenes
UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId) UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId)
{ {
//// Retrieve the folder from the sender //// Retrieve the folder from the sender
InventoryFolderBase folder = InventoryService.GetFolder(new InventoryFolderBase(folderId, senderId)); InventoryFolderBase folder = InventoryService.GetFolder(senderId, folderId);
if (null == folder) if (null == folder)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
@ -868,8 +865,7 @@ namespace OpenSim.Region.Framework.Scenes
if (item == null) if (item == null)
{ {
item = new InventoryItemBase(oldItemID, remoteClient.AgentId); item = InventoryService.GetItem(remoteClient.AgentId, oldItemID);
item = InventoryService.GetItem(item);
if (item == null) if (item == null)
{ {
@ -953,7 +949,7 @@ namespace OpenSim.Region.Framework.Scenes
foreach (InventoryItemBase b in items) foreach (InventoryItemBase b in items)
{ {
CopyInventoryItem(remoteClient, 0, remoteClient.AgentId, b.ID, b.Folder, null); CopyInventoryItem(remoteClient, 0, remoteClient.AgentId, b.ID, b.Folder, null);
InventoryItemBase n = InventoryService.GetItem(b); InventoryItemBase n = InventoryService.GetItem(b.Owner, b.ID);
n.Folder = destfolder; n.Folder = destfolder;
moveitems.Add(n); moveitems.Add(n);
remoteClient.SendInventoryItemCreateUpdate(n, 0); remoteClient.SendInventoryItemCreateUpdate(n, 0);
@ -1605,8 +1601,7 @@ namespace OpenSim.Region.Framework.Scenes
InventoryCollection contents = InventoryService.GetFolderContent(client.AgentId, folder.ID); InventoryCollection contents = InventoryService.GetFolderContent(client.AgentId, folder.ID);
// Fetch the folder itself to get its current version // Fetch the folder itself to get its current version
InventoryFolderBase containingFolder = new InventoryFolderBase(folder.ID, client.AgentId); InventoryFolderBase containingFolder = InventoryService.GetFolder(client.AgentId, folder.ID);
containingFolder = InventoryService.GetFolder(containingFolder);
// m_log.DebugFormat("[AGENT INVENTORY]: Sending inventory folder contents ({0} nodes) for \"{1}\" to {2} {3}", // m_log.DebugFormat("[AGENT INVENTORY]: Sending inventory folder contents ({0} nodes) for \"{1}\" to {2} {3}",
// contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName); // contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName);
@ -1620,7 +1615,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (item.AssetType == (int)AssetType.Link) if (item.AssetType == (int)AssetType.Link)
{ {
InventoryItemBase linkedItem = InventoryService.GetItem(new InventoryItemBase(item.AssetID)); InventoryItemBase linkedItem = InventoryService.GetItem(client.AgentId, item.AssetID);
// Take care of genuinely broken links where the target doesn't exist // Take care of genuinely broken links where the target doesn't exist
// HACK: Also, don't follow up links that just point to other links. In theory this is legitimate, // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate,
@ -1680,8 +1675,7 @@ namespace OpenSim.Region.Framework.Scenes
UUID copyID = UUID.Random(); UUID copyID = UUID.Random();
if (itemID != UUID.Zero) if (itemID != UUID.Zero)
{ {
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); InventoryItemBase item = InventoryService.GetItem(remoteClient.AgentId, itemID);
item = InventoryService.GetItem(item);
// Try library // Try library
if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null) if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null)
@ -1836,8 +1830,7 @@ namespace OpenSim.Region.Framework.Scenes
public SceneObjectPart RezScriptFromAgentInventory(UUID agentID, UUID fromItemID, uint localID) public SceneObjectPart RezScriptFromAgentInventory(UUID agentID, UUID fromItemID, uint localID)
{ {
UUID copyID = UUID.Random(); UUID copyID = UUID.Random();
InventoryItemBase item = new InventoryItemBase(fromItemID, agentID); InventoryItemBase item = InventoryService.GetItem(agentID, fromItemID);
item = InventoryService.GetItem(item);
// Try library // Try library
// XXX clumsy, possibly should be one call // XXX clumsy, possibly should be one call

View File

@ -627,8 +627,7 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat( // m_log.DebugFormat(
// "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId); // "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId);
InventoryFolderBase folder = new InventoryFolderBase(folderID, remoteClient.AgentId); InventoryFolderBase folder = InventoryService.GetFolder(remoteClient.AgentId, folderID);
folder = InventoryService.GetFolder(folder);
if (folder != null) if (folder != null)
{ {
folder.Name = name; folder.Name = name;
@ -645,8 +644,7 @@ namespace OpenSim.Region.Framework.Scenes
public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID) public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID)
{ {
InventoryFolderBase folder = new InventoryFolderBase(folderID, remoteClient.AgentId); InventoryFolderBase folder = InventoryService.GetFolder(remoteClient.AgentId, folderID);
folder = InventoryService.GetFolder(folder);
if (folder != null) if (folder != null)
{ {
folder.ParentID = parentID; folder.ParentID = parentID;

View File

@ -505,8 +505,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
//variable will be set to null and attachment will //variable will be set to null and attachment will
//not be included with the group notice. //not be included with the group notice.
Scene scene = (Scene)remoteClient.Scene; Scene scene = (Scene)remoteClient.Scene;
item = new InventoryItemBase(itemID, ownerID); item = scene.InventoryService.GetItem(ownerID, itemID);
item = scene.InventoryService.GetItem(item);
if (item != null) if (item != null)
{ {

View File

@ -114,12 +114,12 @@ namespace OpenSim.Server.Handlers.Inventory
"POST", "/DeleteItem/", DeleteItems, CheckAuthSession)); "POST", "/DeleteItem/", DeleteItems, CheckAuthSession));
m_httpServer.AddStreamHandler( m_httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>( new RestDeserialiseSecureHandler<Guid, InventoryItemBase>(
"POST", "/QueryItem/", m_InventoryService.GetItem, CheckAuthSession)); "POST", "/QueryItem/", GetItem, CheckAuthSession));
m_httpServer.AddStreamHandler( m_httpServer.AddStreamHandler(
new RestDeserialiseSecureHandler<InventoryFolderBase, InventoryFolderBase>( new RestDeserialiseSecureHandler<Guid, InventoryFolderBase>(
"POST", "/QueryFolder/", m_InventoryService.GetFolder, CheckAuthSession)); "POST", "/QueryFolder/", GetFolder, CheckAuthSession));
m_httpServer.AddStreamHandler( m_httpServer.AddStreamHandler(
new RestDeserialiseTrustedHandler<Guid, bool>( new RestDeserialiseTrustedHandler<Guid, bool>(
@ -205,6 +205,16 @@ namespace OpenSim.Server.Handlers.Inventory
return new Dictionary<AssetType, InventoryFolderBase>(); return new Dictionary<AssetType, InventoryFolderBase>();
} }
public InventoryItemBase GetItem(Guid guid)
{
return m_InventoryService.GetItem(UUID.Zero, new UUID(guid));
}
public InventoryFolderBase GetFolder(Guid guid)
{
return m_InventoryService.GetFolder(UUID.Zero, new UUID(guid));
}
public InventoryCollection GetFolderContent(Guid guid) public InventoryCollection GetFolderContent(Guid guid)
{ {
return m_InventoryService.GetFolderContent(UUID.Zero, new UUID(guid)); return m_InventoryService.GetFolderContent(UUID.Zero, new UUID(guid));

View File

@ -566,9 +566,11 @@ namespace OpenSim.Server.Handlers.Inventory
Dictionary<string,object> result = new Dictionary<string,object>(); Dictionary<string,object> result = new Dictionary<string,object>();
UUID id = UUID.Zero; UUID id = UUID.Zero;
UUID.TryParse(request["ID"].ToString(), out id); UUID.TryParse(request["ID"].ToString(), out id);
UUID user = UUID.Zero;
if (request.ContainsKey("PRINCIPAL"))
UUID.TryParse(request["PRINCIPAL"].ToString(), out user);
InventoryItemBase item = new InventoryItemBase(id); InventoryItemBase item = m_InventoryService.GetItem(user, id);
item = m_InventoryService.GetItem(item);
if (item != null) if (item != null)
result["item"] = EncodeItem(item); result["item"] = EncodeItem(item);
@ -617,9 +619,11 @@ namespace OpenSim.Server.Handlers.Inventory
Dictionary<string, object> result = new Dictionary<string, object>(); Dictionary<string, object> result = new Dictionary<string, object>();
UUID id = UUID.Zero; UUID id = UUID.Zero;
UUID.TryParse(request["ID"].ToString(), out id); UUID.TryParse(request["ID"].ToString(), out id);
UUID user = UUID.Zero;
if (request.ContainsKey("PRINCIPAL"))
UUID.TryParse(request["PRINCIPAL"].ToString(), out user);
InventoryFolderBase folder = new InventoryFolderBase(id); InventoryFolderBase folder = m_InventoryService.GetFolder(user, id);
folder = m_InventoryService.GetFolder(folder);
if (folder != null) if (folder != null)
result["folder"] = EncodeFolder(folder); result["folder"] = EncodeFolder(folder);

View File

@ -520,10 +520,10 @@ namespace OpenSim.Services.Connectors
return CheckReturn(ret); return CheckReturn(ret);
} }
public InventoryItemBase GetItem(InventoryItemBase item) public InventoryItemBase GetItem(UUID principalID, UUID itemID)
{ {
InventoryItemBase retrieved = null; InventoryItemBase retrieved = null;
if (m_ItemCache.TryGetValue(item.ID, out retrieved)) if (m_ItemCache.TryGetValue(itemID, out retrieved))
{ {
return retrieved; return retrieved;
} }
@ -532,7 +532,8 @@ namespace OpenSim.Services.Connectors
{ {
Dictionary<string, object> ret = MakeRequest("GETITEM", Dictionary<string, object> ret = MakeRequest("GETITEM",
new Dictionary<string, object> { new Dictionary<string, object> {
{ "ID", item.ID.ToString() } { "ID", itemID.ToString() },
{ "PRINCIPAL", principalID.ToString() }
}); });
if (!CheckReturn(ret)) if (!CheckReturn(ret))
@ -545,7 +546,7 @@ namespace OpenSim.Services.Connectors
m_log.Error("[XINVENTORY SERVICES CONNECTOR]: Exception in GetItem: ", e); m_log.Error("[XINVENTORY SERVICES CONNECTOR]: Exception in GetItem: ", e);
} }
m_ItemCache.AddOrUpdate(item.ID, retrieved, CACHE_EXPIRATION_SECONDS); m_ItemCache.AddOrUpdate(itemID, retrieved, CACHE_EXPIRATION_SECONDS);
return retrieved; return retrieved;
} }
@ -613,13 +614,14 @@ namespace OpenSim.Services.Connectors
return itemArr; return itemArr;
} }
public InventoryFolderBase GetFolder(InventoryFolderBase folder) public InventoryFolderBase GetFolder(UUID principalID, UUID folderID)
{ {
try try
{ {
Dictionary<string, object> ret = MakeRequest("GETFOLDER", Dictionary<string, object> ret = MakeRequest("GETFOLDER",
new Dictionary<string, object> { new Dictionary<string, object> {
{ "ID", folder.ID.ToString() } { "ID", folderID.ToString() },
{ "PRINCIPAL", principalID.ToString() }
}); });
if (!CheckReturn(ret)) if (!CheckReturn(ret))

View File

@ -277,17 +277,17 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// </summary> /// </summary>
/// <param name="item"></param> /// <param name="item"></param>
/// <returns></returns> /// <returns></returns>
public InventoryItemBase GetItem(InventoryItemBase item) public InventoryItemBase GetItem(UUID principalID, UUID itemID)
{ {
InventoryItemBase retrieved = null; InventoryItemBase retrieved = null;
if (m_ItemCache.TryGetValue(item.ID, out retrieved)) if (m_ItemCache.TryGetValue(itemID, out retrieved))
return retrieved; return retrieved;
NameValueCollection requestArgs = new NameValueCollection NameValueCollection requestArgs = new NameValueCollection
{ {
{ "RequestMethod", "GetInventoryNode" }, { "RequestMethod", "GetInventoryNode" },
{ "ItemID", item.ID.ToString() }, { "ItemID", itemID.ToString() },
{ "OwnerID", item.Owner.ToString() }, { "OwnerID", principalID.ToString() },
{ "IncludeFolders", "1" }, { "IncludeFolders", "1" },
{ "IncludeItems", "1" }, { "IncludeItems", "1" },
{ "ChildrenOnly", "1" } { "ChildrenOnly", "1" }
@ -303,17 +303,17 @@ namespace OpenSim.Services.Connectors.SimianGrid
// and sanity check just in case // and sanity check just in case
for (int i = 0; i < items.Count; i++) for (int i = 0; i < items.Count; i++)
{ {
if (items[i].ID == item.ID) if (items[i].ID == itemID)
{ {
retrieved = items[i]; retrieved = items[i];
m_ItemCache.AddOrUpdate(item.ID, retrieved, CACHE_EXPIRATION_SECONDS); m_ItemCache.AddOrUpdate(itemID, retrieved, CACHE_EXPIRATION_SECONDS);
return retrieved; return retrieved;
} }
} }
} }
} }
m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Item " + item.ID + " owned by " + item.Owner + " not found"); m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Item " + itemID + " owned by " + principalID + " not found");
return null; return null;
} }
@ -321,13 +321,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
{ {
InventoryItemBase[] result = new InventoryItemBase[itemIDs.Length]; InventoryItemBase[] result = new InventoryItemBase[itemIDs.Length];
int i = 0; int i = 0;
InventoryItemBase item = new InventoryItemBase();
item.Owner = principalID;
foreach (UUID id in itemIDs) foreach (UUID id in itemIDs)
{ result[i++] = GetItem(principalID, id);
item.ID = id;
result[i++] = GetItem(item);
}
return result; return result;
} }
@ -337,13 +332,13 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// </summary> /// </summary>
/// <param name="folder"></param> /// <param name="folder"></param>
/// <returns></returns> /// <returns></returns>
public InventoryFolderBase GetFolder(InventoryFolderBase folder) public InventoryFolderBase GetFolder(UUID principalID, UUID folderID)
{ {
NameValueCollection requestArgs = new NameValueCollection NameValueCollection requestArgs = new NameValueCollection
{ {
{ "RequestMethod", "GetInventoryNode" }, { "RequestMethod", "GetInventoryNode" },
{ "ItemID", folder.ID.ToString() }, { "ItemID", folderID.ToString() },
{ "OwnerID", folder.Owner.ToString() }, { "OwnerID", principalID.ToString() },
{ "IncludeFolders", "1" }, { "IncludeFolders", "1" },
{ "IncludeItems", "0" }, { "IncludeItems", "0" },
{ "ChildrenOnly", "1" } { "ChildrenOnly", "1" }
@ -353,7 +348,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
if (response["Success"].AsBoolean() && response["Items"] is OSDArray) if (response["Success"].AsBoolean() && response["Items"] is OSDArray)
{ {
OSDArray items = (OSDArray)response["Items"]; OSDArray items = (OSDArray)response["Items"];
List<InventoryFolderBase> folders = GetFoldersFromResponse(items, folder.ID, true); List<InventoryFolderBase> folders = GetFoldersFromResponse(items, folderID, true);
if (folders.Count > 0) if (folders.Count > 0)
return folders[0]; return folders[0];

View File

@ -291,9 +291,9 @@ namespace OpenSim.Services.HypergridService
//{ //{
//} //}
public override InventoryItemBase GetItem(InventoryItemBase item) public override InventoryItemBase GetItem(UUID principalID, UUID itemID)
{ {
InventoryItemBase it = base.GetItem(item); InventoryItemBase it = base.GetItem(principalID, itemID);
if (it != null) if (it != null)
{ {
UserAccount user = m_Cache.GetUser(it.CreatorId); UserAccount user = m_Cache.GetUser(it.CreatorId);

View File

@ -383,7 +383,7 @@ namespace OpenSim.Services.HypergridService
// Check the items' current folders // Check the items' current folders
foreach (InventoryItemBase item in items) foreach (InventoryItemBase item in items)
{ {
InventoryItemBase originalItem = base.GetItem(item); InventoryItemBase originalItem = base.GetItem(item.Owner, item.ID);
if (!IsWithinSuitcaseTree(originalItem.Owner, originalItem.Folder)) if (!IsWithinSuitcaseTree(originalItem.Owner, originalItem.Folder))
{ {
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner); m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: MoveItems: folder {0} (user {1}) is not within Suitcase tree", item.Folder, item.Owner);
@ -401,7 +401,7 @@ namespace OpenSim.Services.HypergridService
public new InventoryItemBase GetItem(InventoryItemBase item) public new InventoryItemBase GetItem(InventoryItemBase item)
{ {
InventoryItemBase it = base.GetItem(item); InventoryItemBase it = base.GetItem(item.Owner, item.ID);
if (it == null) if (it == null)
{ {
m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to retrieve item {0} ({1}) in folder {2}", m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to retrieve item {0} ({1}) in folder {2}",
@ -426,9 +426,9 @@ namespace OpenSim.Services.HypergridService
return it; return it;
} }
public new InventoryFolderBase GetFolder(InventoryFolderBase folder) public new InventoryFolderBase GetFolder(UUID principalID, UUID folderID)
{ {
InventoryFolderBase f = base.GetFolder(folder); InventoryFolderBase f = base.GetFolder(principalID, folderID);
if (f != null) if (f != null)
{ {

View File

@ -161,7 +161,7 @@ namespace OpenSim.Services.Interfaces
/// </summary> /// </summary>
/// <param name="item"></param> /// <param name="item"></param>
/// <returns>null if no item was found, otherwise the found item</returns> /// <returns>null if no item was found, otherwise the found item</returns>
InventoryItemBase GetItem(InventoryItemBase item); InventoryItemBase GetItem(UUID userID, UUID itemID);
/// <summary> /// <summary>
/// Get multiple items, given by their UUIDs /// Get multiple items, given by their UUIDs
@ -175,7 +175,7 @@ namespace OpenSim.Services.Interfaces
/// </summary> /// </summary>
/// <param name="folder"></param> /// <param name="folder"></param>
/// <returns></returns> /// <returns></returns>
InventoryFolderBase GetFolder(InventoryFolderBase folder); InventoryFolderBase GetFolder(UUID userID, UUID folderID);
/// <summary> /// <summary>
/// Does the given user have an inventory structure? /// Does the given user have an inventory structure?

View File

@ -90,8 +90,7 @@ namespace OpenSim.Services.InventoryService.Tests
Assert.That(xis.AddItem(itemToStore), Is.True); Assert.That(xis.AddItem(itemToStore), Is.True);
InventoryItemBase itemRetrieved = new InventoryItemBase(itemId); InventoryItemBase itemRetrieved = xis.GetItem(UUID.Zero, itemId);
itemRetrieved = xis.GetItem(itemRetrieved);
Assert.That(itemRetrieved, Is.Not.Null); Assert.That(itemRetrieved, Is.Not.Null);
Assert.That(itemRetrieved.CreatorId, Is.EqualTo(creatorId)); Assert.That(itemRetrieved.CreatorId, Is.EqualTo(creatorId));
@ -139,8 +138,7 @@ namespace OpenSim.Services.InventoryService.Tests
Assert.That(xis.UpdateItem(itemToStore), Is.True); Assert.That(xis.UpdateItem(itemToStore), Is.True);
InventoryItemBase itemRetrieved = new InventoryItemBase(itemId); InventoryItemBase itemRetrieved = xis.GetItem(UUID.Zero, itemId);
itemRetrieved = xis.GetItem(itemRetrieved);
Assert.That(itemRetrieved, Is.Not.Null); Assert.That(itemRetrieved, Is.Not.Null);
Assert.That(itemRetrieved.Name, Is.EqualTo(itemName2)); Assert.That(itemRetrieved.Name, Is.EqualTo(itemName2));
@ -162,7 +160,7 @@ namespace OpenSim.Services.InventoryService.Tests
Assert.That(xis.UpdateItem(itemToStore), Is.True); Assert.That(xis.UpdateItem(itemToStore), Is.True);
itemRetrieved = xis.GetItem(itemRetrieved); itemRetrieved = xis.GetItem(itemRetrieved.Owner, itemRetrieved.ID);
Assert.That(itemRetrieved, Is.Not.Null); Assert.That(itemRetrieved, Is.Not.Null);
Assert.That(itemRetrieved.CreatorId, Is.EqualTo(creatorId)); Assert.That(itemRetrieved.CreatorId, Is.EqualTo(creatorId));
@ -174,4 +172,4 @@ namespace OpenSim.Services.InventoryService.Tests
Assert.That(itemRetrieved.Name, Is.EqualTo(itemName3)); Assert.That(itemRetrieved.Name, Is.EqualTo(itemName3));
} }
} }
} }

View File

@ -315,8 +315,7 @@ namespace OpenSim.Services.InventoryService
inventory.Items.Add(ConvertToOpenSim(i)); inventory.Items.Add(ConvertToOpenSim(i));
} }
InventoryFolderBase f = new InventoryFolderBase(folderID, principalID); InventoryFolderBase f = GetFolder(principalID, folderID);
f = GetFolder(f);
if (f != null) if (f != null)
{ {
inventory.Version = f.Version; inventory.Version = f.Version;
@ -359,7 +358,7 @@ namespace OpenSim.Services.InventoryService
{ {
// m_log.DebugFormat("[XINVENTORY]: Add folder {0} type {1} in parent {2}", folder.Name, folder.Type, folder.ParentID); // m_log.DebugFormat("[XINVENTORY]: Add folder {0} type {1} in parent {2}", folder.Name, folder.Type, folder.ParentID);
InventoryFolderBase check = GetFolder(folder); InventoryFolderBase check = GetFolder(folder.Owner, folder.ID);
if (check != null) if (check != null)
return false; return false;
@ -402,7 +401,7 @@ namespace OpenSim.Services.InventoryService
// m_log.DebugFormat("[XINVENTORY]: Update folder {0} {1} ({2})", folder.Name, folder.Type, folder.ID); // m_log.DebugFormat("[XINVENTORY]: Update folder {0} {1} ({2})", folder.Name, folder.Type, folder.ID);
XInventoryFolder xFolder = ConvertFromOpenSim(folder); XInventoryFolder xFolder = ConvertFromOpenSim(folder);
InventoryFolderBase check = GetFolder(folder); InventoryFolderBase check = GetFolder(folder.Owner, folder.ID);
if (check == null) if (check == null)
return AddFolder(folder); return AddFolder(folder);
@ -512,7 +511,7 @@ namespace OpenSim.Services.InventoryService
// m_log.InfoFormat( // m_log.InfoFormat(
// "[XINVENTORY SERVICE]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder); // "[XINVENTORY SERVICE]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder);
InventoryItemBase retrievedItem = GetItem(item); InventoryItemBase retrievedItem = GetItem(item.Owner, item.ID);
if (retrievedItem == null) if (retrievedItem == null)
{ {
@ -598,11 +597,11 @@ namespace OpenSim.Services.InventoryService
return true; return true;
} }
public virtual InventoryItemBase GetItem(InventoryItemBase item) public virtual InventoryItemBase GetItem(UUID principalID, UUID itemID)
{ {
XInventoryItem[] items = m_Database.GetItems( XInventoryItem[] items = m_Database.GetItems(
new string[] { "inventoryID" }, new string[] { "inventoryID" },
new string[] { item.ID.ToString() }); new string[] { itemID.ToString() });
if (items.Length == 0) if (items.Length == 0)
return null; return null;
@ -614,22 +613,17 @@ namespace OpenSim.Services.InventoryService
{ {
InventoryItemBase[] items = new InventoryItemBase[ids.Length]; InventoryItemBase[] items = new InventoryItemBase[ids.Length];
int i = 0; int i = 0;
InventoryItemBase item = new InventoryItemBase();
item.Owner = userID;
foreach (UUID id in ids) foreach (UUID id in ids)
{ items[i++] = GetItem(userID, id);
item.ID = id;
items[i++] = GetItem(item);
}
return items; return items;
} }
public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder) public virtual InventoryFolderBase GetFolder(UUID principalID, UUID folderID)
{ {
XInventoryFolder[] folders = m_Database.GetFolders( XInventoryFolder[] folders = m_Database.GetFolders(
new string[] { "folderID"}, new string[] { "folderID"},
new string[] { folder.ID.ToString() }); new string[] { folderID.ToString() });
if (folders.Length == 0) if (folders.Length == 0)
return null; return null;

View File

@ -159,8 +159,7 @@ namespace Robust.Tests
XInventoryServicesConnector m_Connector = new XInventoryServicesConnector(DemonServer.Address); XInventoryServicesConnector m_Connector = new XInventoryServicesConnector(DemonServer.Address);
// Prefetch Notecard 1, will be cached from here on // Prefetch Notecard 1, will be cached from here on
InventoryItemBase item = new InventoryItemBase(new UUID("10000000-0000-0000-0000-000000000001"), m_userID); InventoryItemBase item = m_Connector.GetItem(m_userID, new UUID("10000000-0000-0000-0000-000000000001"));
item = m_Connector.GetItem(item);
Assert.NotNull(item, "Failed to get Notecard 1"); Assert.NotNull(item, "Failed to get Notecard 1");
Assert.AreEqual("Test Notecard 1", item.Name, "Wrong name for Notecard 1"); Assert.AreEqual("Test Notecard 1", item.Name, "Wrong name for Notecard 1");