* Refactor: Remove the unused userID parameter that was being passed into almost every inventory method

* This allows lots of redundant inventory methods with only slightly different names to be eliminated.
0.6.0-stable
Justin Clarke Casey 2008-05-01 20:47:33 +00:00
parent e41232bac5
commit 1de6cffa28
9 changed files with 155 additions and 316 deletions

View File

@ -333,61 +333,12 @@ namespace OpenSim.Data.MySQL
item.Creator = new LLUUID((string) reader["creatorID"]); item.Creator = new LLUUID((string) reader["creatorID"]);
item.BasePermissions = (uint) reader["inventoryBasePermissions"]; item.BasePermissions = (uint) reader["inventoryBasePermissions"];
item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"]; item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"];
item.SalePrice = (int) reader["salePrice"];
try item.SaleType = Convert.ToByte(reader["saleType"]);
{ item.CreationDate = (int) reader["creationDate"];
item.SalePrice = (int) reader["salePrice"]; item.GroupID = new LLUUID(reader["groupID"].ToString());
} item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]);
catch (InvalidCastException) item.Flags = (uint) reader["flags"];
{
m_log.WarnFormat("Could not cast salePrice {0} to {1}", reader["salePrice"], "int");
}
try
{
item.SaleType = Convert.ToByte(reader["saleType"]);
}
catch (InvalidCastException)
{
m_log.WarnFormat("Could not convert saleType {0} to {1}", reader["saleType"], "byte");
}
try
{
item.CreationDate = (int) reader["creationDate"];
}
catch (InvalidCastException)
{
m_log.WarnFormat("Could not cast creationDate {0} to {1}", reader["creationDate"], "int");
}
try
{
item.GroupID = new LLUUID(reader["groupID"].ToString());
}
catch (Exception)
{
item.GroupID = LLUUID.Zero;
m_log.WarnFormat("Could not convert groupID {0} to {1}", reader["groupID"], "LLUUID");
}
try
{
item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]);
}
catch (InvalidCastException)
{
m_log.WarnFormat("Could not cast groupOwned {0} to {1}", reader["groupOwned"], "boolean");
}
try
{
item.Flags = (uint) reader["flags"];
}
catch (InvalidCastException)
{
m_log.WarnFormat("Could not cast flags {0} to {1}", reader["flags"], "uint");
}
return item; return item;
} }

View File

@ -166,12 +166,12 @@ namespace OpenSim.Framework.Communications.Cache
{ {
foreach (InventoryFolderImpl folder in folders) foreach (InventoryFolderImpl folder in folders)
{ {
FolderReceive(userID, folder); FolderReceive(folder);
} }
foreach (InventoryItemBase item in items) foreach (InventoryItemBase item in items)
{ {
ItemReceive(userID, item); ItemReceive(item);
} }
} }
catch (Exception e) catch (Exception e)
@ -198,56 +198,53 @@ namespace OpenSim.Framework.Communications.Cache
/// </summary> /// </summary>
/// <param name="userID"></param> /// <param name="userID"></param>
/// <param name="folderInfo"></param> /// <param name="folderInfo"></param>
private void FolderReceive(LLUUID userID, InventoryFolderImpl folderInfo) private void FolderReceive(InventoryFolderImpl folderInfo)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[INVENTORY CACHE]: Received folder {0} {1} for user {2}", // "[INVENTORY CACHE]: Received folder {0} {1} for user {2}",
// folderInfo.Name, folderInfo.ID, userID); // folderInfo.Name, folderInfo.ID, userID);
if (userID == UserProfile.ID) if (RootFolder == null)
{ {
if (RootFolder == null) if (folderInfo.ParentID == LLUUID.Zero)
{ {
if (folderInfo.ParentID == LLUUID.Zero) m_rootFolder = folderInfo;
{
m_rootFolder = folderInfo;
}
} }
else if (RootFolder.ID == folderInfo.ParentID)
{
lock (RootFolder.SubFolders)
{
if (!RootFolder.SubFolders.ContainsKey(folderInfo.ID))
{
RootFolder.SubFolders.Add(folderInfo.ID, folderInfo);
}
else
{
AddPendingFolder(folderInfo);
}
}
}
else
{
InventoryFolderImpl folder = RootFolder.GetDescendentFolder(folderInfo.ParentID);
lock (folder.SubFolders)
{
if (folder != null)
{
if (!folder.SubFolders.ContainsKey(folderInfo.ID))
{
folder.SubFolders.Add(folderInfo.ID, folderInfo);
}
}
else
{
AddPendingFolder(folderInfo);
}
}
}
ResolvePendingFolders(folderInfo);
} }
else if (RootFolder.ID == folderInfo.ParentID)
{
lock (RootFolder.SubFolders)
{
if (!RootFolder.SubFolders.ContainsKey(folderInfo.ID))
{
RootFolder.SubFolders.Add(folderInfo.ID, folderInfo);
}
else
{
AddPendingFolder(folderInfo);
}
}
}
else
{
InventoryFolderImpl folder = RootFolder.GetDescendentFolder(folderInfo.ParentID);
lock (folder.SubFolders)
{
if (folder != null)
{
if (!folder.SubFolders.ContainsKey(folderInfo.ID))
{
folder.SubFolders.Add(folderInfo.ID, folderInfo);
}
}
else
{
AddPendingFolder(folderInfo);
}
}
}
ResolvePendingFolders(folderInfo);
} }
/// <summary> /// <summary>
@ -256,15 +253,14 @@ namespace OpenSim.Framework.Communications.Cache
/// We're assuming here that items are always received after all the folders have been /// We're assuming here that items are always received after all the folders have been
/// received. /// received.
/// </summary> /// </summary>
/// <param name="userID"></param>
/// <param name="folderInfo"></param> /// <param name="folderInfo"></param>
private void ItemReceive(LLUUID userID, InventoryItemBase itemInfo) private void ItemReceive(InventoryItemBase itemInfo)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[INVENTORY CACHE]: Received item {0} {1} for user {2}", // "[INVENTORY CACHE]: Received item {0} {1} for user {2}",
// itemInfo.Name, itemInfo.ID, userID); // itemInfo.Name, itemInfo.ID, userID);
if ((userID == UserProfile.ID) && (RootFolder != null)) if (RootFolder != null)
{ {
if (itemInfo.Folder == RootFolder.ID) if (itemInfo.Folder == RootFolder.ID)
{ {
@ -305,14 +301,13 @@ namespace OpenSim.Framework.Communications.Cache
/// <summary> /// <summary>
/// Add an item to the user's inventory /// Add an item to the user's inventory
/// </summary> /// </summary>
/// <param name="userID"></param>
/// <param name="itemInfo"></param> /// <param name="itemInfo"></param>
public void AddItem(LLUUID userID, InventoryItemBase itemInfo) public void AddItem(LLUUID userID, InventoryItemBase itemInfo)
{ {
if ((userID == UserProfile.ID) && HasInventory) if (HasInventory)
{ {
ItemReceive(userID, itemInfo); ItemReceive(itemInfo);
m_commsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); m_commsManager.InventoryService.AddItem(itemInfo);
} }
} }
@ -325,7 +320,7 @@ namespace OpenSim.Framework.Communications.Cache
{ {
if ((userID == UserProfile.ID) && HasInventory) if ((userID == UserProfile.ID) && HasInventory)
{ {
m_commsManager.InventoryService.UpdateInventoryItem(userID, itemInfo); m_commsManager.InventoryService.UpdateItem(itemInfo);
} }
} }
@ -343,7 +338,7 @@ namespace OpenSim.Framework.Communications.Cache
result = RootFolder.DeleteItem(item.ID); result = RootFolder.DeleteItem(item.ID);
if (result) if (result)
{ {
m_commsManager.InventoryService.DeleteInventoryItem(userID, item); m_commsManager.InventoryService.DeleteItem(item);
} }
} }

View File

@ -181,7 +181,8 @@ namespace OpenSim.Framework.Communications.Cache
createdBaseFolder.ParentID = createdFolder.ParentID; createdBaseFolder.ParentID = createdFolder.ParentID;
createdBaseFolder.Type = createdFolder.Type; createdBaseFolder.Type = createdFolder.Type;
createdBaseFolder.Version = createdFolder.Version; createdBaseFolder.Version = createdFolder.Version;
m_commsManager.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdBaseFolder);
m_commsManager.InventoryService.AddFolder(createdBaseFolder);
} }
else else
{ {
@ -207,7 +208,7 @@ namespace OpenSim.Framework.Communications.Cache
createdBaseFolder.Type = createdFolder.Type; createdBaseFolder.Type = createdFolder.Type;
createdBaseFolder.Version = createdFolder.Version; createdBaseFolder.Version = createdFolder.Version;
m_commsManager.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdBaseFolder); m_commsManager.InventoryService.AddFolder(createdBaseFolder);
} }
else else
{ {
@ -265,7 +266,8 @@ namespace OpenSim.Framework.Communications.Cache
baseFolder.ParentID = parentID; baseFolder.ParentID = parentID;
baseFolder.Type = (short) type; baseFolder.Type = (short) type;
baseFolder.Version = userProfile.RootFolder.Version; baseFolder.Version = userProfile.RootFolder.Version;
m_commsManager.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, baseFolder);
m_commsManager.InventoryService.AddFolder(baseFolder);
} }
else else
{ {
@ -299,7 +301,8 @@ namespace OpenSim.Framework.Communications.Cache
baseFolder.Owner = remoteClient.AgentId; baseFolder.Owner = remoteClient.AgentId;
baseFolder.ID = folderID; baseFolder.ID = folderID;
baseFolder.ParentID = parentID; baseFolder.ParentID = parentID;
m_commsManager.InventoryService.MoveInventoryFolder(remoteClient.AgentId, baseFolder);
m_commsManager.InventoryService.MoveFolder(baseFolder);
} }
else else
{ {
@ -544,7 +547,7 @@ namespace OpenSim.Framework.Communications.Cache
purgedBaseFolder.Type = purgedFolder.Type; purgedBaseFolder.Type = purgedFolder.Type;
purgedBaseFolder.Version = purgedFolder.Version; purgedBaseFolder.Version = purgedFolder.Version;
m_commsManager.InventoryService.PurgeInventoryFolder(remoteClient.AgentId, purgedBaseFolder); m_commsManager.InventoryService.PurgeFolder(purgedBaseFolder);
purgedFolder.Purge(); purgedFolder.Purge();
} }

View File

@ -50,46 +50,46 @@ namespace OpenSim.Framework.Communications
void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback); void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback);
/// <summary> /// <summary>
/// Add a new folder to the given user's inventory /// Add a new folder to the user's inventory
/// </summary> /// </summary>
/// <param name="userID"></param>
/// <param name="folder"></param> /// <param name="folder"></param>
void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder); /// <returns>true if the folder was successfully added</returns>
bool AddFolder(InventoryFolderBase folder);
/// <summary> /// <summary>
/// Move an inventory folder to a new location /// Move an inventory folder to a new location
/// </summary> /// </summary>
/// <param name="userID"></param>
/// <param name="folder">A folder containing the details of the new location</param> /// <param name="folder">A folder containing the details of the new location</param>
void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder); /// <returns>true if the folder was successfully moved</returns>
bool MoveFolder(InventoryFolderBase folder);
/// <summary> /// <summary>
/// Purge an inventory folder of all its items and subfolders. /// Purge an inventory folder of all its items and subfolders.
/// </summary> /// </summary>
/// <param name="userID"></param>
/// <param name="folder"></param> /// <param name="folder"></param>
void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder); /// <returns>true if the folder was successfully purged</returns>
bool PurgeFolder(InventoryFolderBase folder);
/// <summary> /// <summary>
/// Add a new item to the given user's inventory /// Add a new item to the user's inventory
/// </summary> /// </summary>
/// <param name="userID"></param>
/// <param name="item"></param> /// <param name="item"></param>
void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); /// <returns>true if the item was successfully added</returns>
bool AddItem(InventoryItemBase item);
/// <summary> /// <summary>
/// Update an item in the given user's inventory /// Update an item in the user's inventory
/// </summary> /// </summary>
/// <param name="userID"></param>
/// <param name="item"></param> /// <param name="item"></param>
void UpdateInventoryItem(LLUUID userID, InventoryItemBase item); /// <returns>true if the item was successfully updated</returns>
bool UpdateItem(InventoryItemBase item);
/// <summary> /// <summary>
/// Delete an item from the given user's inventory /// Delete an item from the user's inventory
/// </summary> /// </summary>
/// <param name="userID"></param>
/// <param name="item"></param> /// <param name="item"></param>
void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); /// <returns>true if the item was successfully deleted</returns>
bool DeleteItem(InventoryItemBase item);
/// <summary> /// <summary>
/// Create a new inventory for the given user. /// Create a new inventory for the given user.

View File

@ -107,16 +107,6 @@ namespace OpenSim.Framework.Communications
return userFolders; return userFolders;
} }
// See IInventoryServices
public void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder)
{
// FIXME: Probably doesn't do what was originally intended - only ever queries the first plugin
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
{
plugin.Value.moveInventoryFolder(folder);
}
}
// See IInventoryServices // See IInventoryServices
public virtual bool HasInventoryForUser(LLUUID userID) public virtual bool HasInventoryForUser(LLUUID userID)
{ {
@ -161,24 +151,6 @@ namespace OpenSim.Framework.Communications
// See IInventoryServices // See IInventoryServices
public abstract void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback); public abstract void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback);
// See IInventoryServices
public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder);
// See IInventoryServices
public abstract void MoveExistingInventoryFolder(InventoryFolderBase folder);
// See IInventoryServices
public abstract void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder);
// See IInventoryServices
public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
// See IInventoryServices
public abstract void UpdateInventoryItem(LLUUID userID, InventoryItemBase item);
// See IInventoryServices
public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
#endregion #endregion
#region Methods used by GridInventoryService #region Methods used by GridInventoryService
@ -206,47 +178,74 @@ namespace OpenSim.Framework.Communications
#endregion #endregion
protected void AddFolder(InventoryFolderBase folder) public bool AddFolder(InventoryFolderBase folder)
{ {
m_log.DebugFormat( m_log.DebugFormat(
"[INVENTORY SERVICE BASE]: Adding folder {0}, {1} to {2}", folder.Name, folder.ID, folder.ParentID); "[AGENT INVENTORY]: Adding folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
{ {
plugin.Value.addInventoryFolder(folder); plugin.Value.addInventoryFolder(folder);
} }
// FIXME: Should return false on failure
return true;
} }
protected void MoveFolder(InventoryFolderBase folder) public bool MoveFolder(InventoryFolderBase folder)
{ {
m_log.DebugFormat(
"[AGENT INVENTORY]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
{ {
plugin.Value.moveInventoryFolder(folder); plugin.Value.moveInventoryFolder(folder);
} }
// FIXME: Should return false on failure
return true;
} }
protected void AddItem(InventoryItemBase item) public bool AddItem(InventoryItemBase item)
{ {
m_log.DebugFormat(
"[AGENT INVENTORY]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder);
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
{ {
plugin.Value.addInventoryItem(item); plugin.Value.addInventoryItem(item);
} }
// FIXME: Should return false on failure
return true;
} }
protected void UpdateItem(InventoryItemBase item) public bool UpdateItem(InventoryItemBase item)
{ {
m_log.InfoFormat(
"[AGENT INVENTORY]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder);
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
{ {
plugin.Value.updateInventoryItem(item); plugin.Value.updateInventoryItem(item);
} }
// FIXME: Should return false on failure
return true;
} }
protected void DeleteItem(InventoryItemBase item) public bool DeleteItem(InventoryItemBase item)
{ {
m_log.InfoFormat(
"[AGENT INVENTORY]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder);
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
{ {
plugin.Value.deleteInventoryItem(item.ID); plugin.Value.deleteInventoryItem(item.ID);
} }
// FIXME: Should return false on failure
return true;
} }
/// <summary> /// <summary>
@ -256,8 +255,11 @@ namespace OpenSim.Framework.Communications
/// already know... Needs heavy refactoring. /// already know... Needs heavy refactoring.
/// </summary> /// </summary>
/// <param name="folder"></param> /// <param name="folder"></param>
protected void PurgeFolder(InventoryFolderBase folder) public bool PurgeFolder(InventoryFolderBase folder)
{ {
m_log.DebugFormat(
"[AGENT INVENTORY]: Purging folder {0} {1} of its contents", folder.Name, folder.ID);
List<InventoryFolderBase> subFolders = RequestSubFolders(folder.ID); List<InventoryFolderBase> subFolders = RequestSubFolders(folder.ID);
foreach (InventoryFolderBase subFolder in subFolders) foreach (InventoryFolderBase subFolder in subFolders)
@ -276,6 +278,9 @@ namespace OpenSim.Framework.Communications
{ {
DeleteItem(item); DeleteItem(item);
} }
// FIXME: Should return false on failure
return true;
} }
private void AddNewInventorySet(UsersInventory inventory) private void AddNewInventorySet(UsersInventory inventory)

View File

@ -182,89 +182,7 @@ namespace OpenSim.Grid.InventoryServer
m_log.InfoFormat("[GRID AGENT INVENTORY]: Creating new set of inventory folders for user {0}", userID); m_log.InfoFormat("[GRID AGENT INVENTORY]: Creating new set of inventory folders for user {0}", userID);
CreateNewUserInventory(userID); return CreateNewUserInventory(userID);
return true;
}
public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
{
AddFolder(folder);
}
public override void MoveExistingInventoryFolder(InventoryFolderBase folder)
{
MoveFolder(folder);
}
public override void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder)
{
PurgeFolder(folder);
}
public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
{
AddItem(item);
}
public override void UpdateInventoryItem(LLUUID userID, InventoryItemBase item)
{
UpdateItem(item);
}
public bool AddInventoryFolder(InventoryFolderBase folder)
{
// Right now, this actions act more like an update/insert combination than a simple create.
m_log.InfoFormat(
"[GRID AGENT INVENTORY]: Creating folder {0} {1} in folder {2}", folder.Name, folder.ID, folder.ParentID);
AddNewInventoryFolder(folder.Owner, folder);
return true;
}
public bool MoveInventoryFolder(InventoryFolderBase folder)
{
m_log.InfoFormat(
"[GRID AGENT INVENTORY]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
MoveExistingInventoryFolder(folder);
return true;
}
public bool PurgeInventoryFolder(InventoryFolderBase folder)
{
m_log.InfoFormat(
"[GRID AGENT INVENTORY]: Purging folder {0} {1} of its contents", folder.Name, folder.ID);
PurgeInventoryFolder(folder.Owner, folder);
return true;
}
public bool AddInventoryItem(InventoryItemBase item)
{
// Right now, this actions act more like an update/insert combination than a simple create.
m_log.InfoFormat("[GRID AGENT INVENTORY]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder);
AddNewInventoryItem(item.Owner, item);
return true;
}
public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
{
m_log.InfoFormat("[GRID AGENT INVENTORY]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder);
DeleteItem(item);
}
/// <summary>
/// FIXME: Get DeleteInventoryItem to return a bool
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public bool DeleteInvItem(InventoryItemBase item)
{
DeleteInventoryItem(item.Owner, item);
return true;
} }
} }
} }

View File

@ -95,23 +95,23 @@ namespace OpenSim.Grid.InventoryServer
m_httpServer.AddStreamHandler( m_httpServer.AddStreamHandler(
new RestDeserialisehandler<InventoryFolderBase, bool>( new RestDeserialisehandler<InventoryFolderBase, bool>(
"POST", "/NewFolder/", m_inventoryService.AddInventoryFolder)); "POST", "/NewFolder/", m_inventoryService.AddFolder));
m_httpServer.AddStreamHandler( m_httpServer.AddStreamHandler(
new RestDeserialisehandler<InventoryFolderBase, bool>( new RestDeserialisehandler<InventoryFolderBase, bool>(
"POST", "/MoveFolder/", m_inventoryService.MoveInventoryFolder)); "POST", "/MoveFolder/", m_inventoryService.MoveFolder));
m_httpServer.AddStreamHandler( m_httpServer.AddStreamHandler(
new RestDeserialisehandler<InventoryFolderBase, bool>( new RestDeserialisehandler<InventoryFolderBase, bool>(
"POST", "/PurgeFolder/", m_inventoryService.PurgeInventoryFolder)); "POST", "/PurgeFolder/", m_inventoryService.PurgeFolder));
m_httpServer.AddStreamHandler( m_httpServer.AddStreamHandler(
new RestDeserialisehandler<InventoryItemBase, bool>( new RestDeserialisehandler<InventoryItemBase, bool>(
"POST", "/NewItem/", m_inventoryService.AddInventoryItem)); "POST", "/NewItem/", m_inventoryService.AddItem));
m_httpServer.AddStreamHandler( m_httpServer.AddStreamHandler(
new RestDeserialisehandler<InventoryItemBase, bool>( new RestDeserialisehandler<InventoryItemBase, bool>(
"POST", "/DeleteItem/", m_inventoryService.DeleteInvItem)); "POST", "/DeleteItem/", m_inventoryService.DeleteItem));
// WARNING: Root folders no longer just delivers the root and immediate child folders (e.g // WARNING: Root folders no longer just delivers the root and immediate child folders (e.g
// system folders such as Objects, Textures), but it now returns the entire inventory skeleton. // system folders such as Objects, Textures), but it now returns the entire inventory skeleton.

View File

@ -80,41 +80,6 @@ namespace OpenSim.Region.Communications.Local
callback(userID, folders, items); callback(userID, folders, items);
} }
public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
{
AddFolder(folder);
}
public override void MoveExistingInventoryFolder(InventoryFolderBase folder)
{
MoveFolder(folder);
}
public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
{
AddItem(item);
}
public override void UpdateInventoryItem(LLUUID userID, InventoryItemBase item)
{
UpdateItem(item);
}
public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
{
DeleteItem(item);
}
/// <summary>
/// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
/// </summary>
/// <param name="userID"></param>
/// <param name="folder"></param>
public override void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder)
{
PurgeFolder(folder);
}
public override bool HasInventoryForUser(LLUUID userID) public override bool HasInventoryForUser(LLUUID userID)
{ {
InventoryFolderBase root = RequestRootFolder(userID); InventoryFolderBase root = RequestRootFolder(userID);

View File

@ -155,13 +155,11 @@ namespace OpenSim.Region.Communications.OGS1
/// <summary> /// <summary>
/// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
/// </summary> /// </summary>
/// <param name="userID"></param> public bool AddFolder(InventoryFolderBase folder)
/// <param name="folder"></param>
public void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
{ {
try try
{ {
SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>( return SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>(
"POST", _inventoryServerUrl + "/NewFolder/", folder); "POST", _inventoryServerUrl + "/NewFolder/", folder);
} }
catch (WebException e) catch (WebException e)
@ -169,18 +167,19 @@ namespace OpenSim.Region.Communications.OGS1
m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory folder operation failed, {0} {1}", m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory folder operation failed, {0} {1}",
e.Source, e.Message); e.Source, e.Message);
} }
return false;
} }
/// <summary> /// <summary>
/// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
/// </summary> /// </summary>
/// <param name="userID"></param>
/// <param name="folder"></param> /// <param name="folder"></param>
public void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder) public bool MoveFolder(InventoryFolderBase folder)
{ {
try try
{ {
SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>( return SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>(
"POST", _inventoryServerUrl + "/MoveFolder/", folder); "POST", _inventoryServerUrl + "/MoveFolder/", folder);
} }
catch (WebException e) catch (WebException e)
@ -188,19 +187,18 @@ namespace OpenSim.Region.Communications.OGS1
m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}", m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}",
e.Source, e.Message); e.Source, e.Message);
} }
return false;
} }
/// <summary> /// <summary>
/// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
/// </summary> /// </summary>
/// <param name="userID"></param> public bool PurgeFolder(InventoryFolderBase folder)
/// <param name="folder"></param>
/// <returns></returns>
public void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder)
{ {
try try
{ {
SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>( return SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>(
"POST", _inventoryServerUrl + "/PurgeFolder/", folder); "POST", _inventoryServerUrl + "/PurgeFolder/", folder);
} }
catch (WebException e) catch (WebException e)
@ -208,18 +206,18 @@ namespace OpenSim.Region.Communications.OGS1
m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}", m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}",
e.Source, e.Message); e.Source, e.Message);
} }
return false;
} }
/// <summary> /// <summary>
/// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
/// </summary> /// </summary>
/// <param name="userID"></param> public bool AddItem(InventoryItemBase item)
/// <param name="folder"></param>
public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
{ {
try try
{ {
SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>( return SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
"POST", _inventoryServerUrl + "/NewItem/", item); "POST", _inventoryServerUrl + "/NewItem/", item);
} }
catch (WebException e) catch (WebException e)
@ -227,14 +225,16 @@ namespace OpenSim.Region.Communications.OGS1
m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory item operation failed, {0} {1}", m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory item operation failed, {0} {1}",
e.Source, e.Message); e.Source, e.Message);
} }
return false;
} }
// TODO: this is a temporary workaround, the UpdateInventoryItem method need to be implemented // TODO: this is a temporary workaround, the UpdateInventoryItem method need to be implemented
public void UpdateInventoryItem(LLUUID userID, InventoryItemBase item) public bool UpdateItem(InventoryItemBase item)
{ {
try try
{ {
SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>( return SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
"POST", _inventoryServerUrl + "/NewItem/", item); "POST", _inventoryServerUrl + "/NewItem/", item);
} }
catch (WebException e) catch (WebException e)
@ -242,18 +242,18 @@ namespace OpenSim.Region.Communications.OGS1
m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Update new inventory item operation failed, {0} {1}", m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Update new inventory item operation failed, {0} {1}",
e.Source, e.Message); e.Source, e.Message);
} }
return false;
} }
/// <summary> /// <summary>
/// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
/// </summary> /// </summary>
/// <param name="userID"></param> public bool DeleteItem(InventoryItemBase item)
/// <param name="folder"></param>
public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
{ {
try try
{ {
SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>( return SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
"POST", _inventoryServerUrl + "/DeleteItem/", item); "POST", _inventoryServerUrl + "/DeleteItem/", item);
} }
catch (WebException e) catch (WebException e)
@ -261,6 +261,8 @@ namespace OpenSim.Region.Communications.OGS1
m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Delete inventory item operation failed, {0} {1}", m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Delete inventory item operation failed, {0} {1}",
e.Source, e.Message); e.Source, e.Message);
} }
return false;
} }
public bool HasInventoryForUser(LLUUID userID) public bool HasInventoryForUser(LLUUID userID)