Use Inventory{Item,Folder}Base in AssetInventoryServer.
Also the first inventory storage methods are implemented.0.6.4-rc1
parent
d38bddfb76
commit
3676062277
|
@ -81,17 +81,17 @@ namespace OpenSim.Grid.AssetInventoryServer
|
|||
|
||||
public interface IInventoryStorageProvider : IAssetInventoryServerPlugin
|
||||
{
|
||||
BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItem item);
|
||||
BackendResponse TryFetchFolder(Uri owner, UUID folderID, out InventoryFolder folder);
|
||||
BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItemBase item);
|
||||
BackendResponse TryFetchFolder(Uri owner, UUID folderID, out InventoryFolderWithChildren folder);
|
||||
BackendResponse TryFetchFolderContents(Uri owner, UUID folderID, out InventoryCollection contents);
|
||||
BackendResponse TryFetchFolderList(Uri owner, out List<InventoryFolder> folders);
|
||||
BackendResponse TryFetchFolderList(Uri owner, out List<InventoryFolderWithChildren> folders);
|
||||
BackendResponse TryFetchInventory(Uri owner, out InventoryCollection inventory);
|
||||
|
||||
BackendResponse TryFetchActiveGestures(Uri owner, out List<InventoryItem> gestures);
|
||||
BackendResponse TryFetchActiveGestures(Uri owner, out List<InventoryItemBase> gestures);
|
||||
|
||||
BackendResponse TryCreateItem(Uri owner, InventoryItem item);
|
||||
BackendResponse TryCreateFolder(Uri owner, InventoryFolder folder);
|
||||
BackendResponse TryCreateInventory(Uri owner, InventoryFolder rootFolder);
|
||||
BackendResponse TryCreateItem(Uri owner, InventoryItemBase item);
|
||||
BackendResponse TryCreateFolder(Uri owner, InventoryFolderWithChildren folder);
|
||||
BackendResponse TryCreateInventory(Uri owner, InventoryFolderWithChildren rootFolder);
|
||||
|
||||
BackendResponse TryDeleteItem(Uri owner, UUID itemID);
|
||||
BackendResponse TryDeleteFolder(Uri owner, UUID folderID);
|
||||
|
|
|
@ -28,78 +28,85 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Grid.AssetInventoryServer
|
||||
{
|
||||
public class InventoryBase
|
||||
{
|
||||
}
|
||||
//public class InventoryBase
|
||||
//{
|
||||
//}
|
||||
|
||||
public class InventoryFolder : InventoryBase
|
||||
{
|
||||
public string Name;
|
||||
public UUID Owner;
|
||||
public UUID ParentID;
|
||||
public UUID ID;
|
||||
public short Type;
|
||||
public ushort Version;
|
||||
//public class InventoryFolder : InventoryBase
|
||||
//{
|
||||
// public string Name;
|
||||
// public UUID Owner;
|
||||
// public UUID ParentID;
|
||||
// public UUID ID;
|
||||
// public short Type;
|
||||
// public ushort Version;
|
||||
|
||||
// [NonSerialized]
|
||||
// public Dictionary<UUID, InventoryBase> Children = new Dictionary<UUID, InventoryBase>();
|
||||
|
||||
// public InventoryFolder()
|
||||
// {
|
||||
// }
|
||||
|
||||
// public InventoryFolder(string name, UUID ownerID, UUID parentID, short assetType)
|
||||
// {
|
||||
// ID = UUID.Random();
|
||||
// Name = name;
|
||||
// Owner = ownerID;
|
||||
// ParentID = parentID;
|
||||
// Type = assetType;
|
||||
// Version = 1;
|
||||
// }
|
||||
|
||||
// public override string ToString()
|
||||
// {
|
||||
// return String.Format("{0} ({1})", Name, ID);
|
||||
// }
|
||||
//}
|
||||
|
||||
//public class InventoryItem : InventoryBase
|
||||
//{
|
||||
// public UUID ID;
|
||||
// public int InvType;
|
||||
// public UUID Folder;
|
||||
// public UUID Owner;
|
||||
// public UUID Creator;
|
||||
// public string Name;
|
||||
// public string Description;
|
||||
// public uint NextPermissions;
|
||||
// public uint CurrentPermissions;
|
||||
// public uint BasePermissions;
|
||||
// public uint EveryOnePermissions;
|
||||
// public uint GroupPermissions;
|
||||
// public int AssetType;
|
||||
// public UUID AssetID;
|
||||
// public UUID GroupID;
|
||||
// public bool GroupOwned;
|
||||
// public int SalePrice;
|
||||
// public byte SaleType;
|
||||
// public uint Flags;
|
||||
// public int CreationDate;
|
||||
|
||||
// public override string ToString()
|
||||
// {
|
||||
// return String.Format("{0} ({1})", Name, ID);
|
||||
// }
|
||||
//}
|
||||
|
||||
public class InventoryFolderWithChildren : InventoryFolderBase
|
||||
{
|
||||
[NonSerialized]
|
||||
public Dictionary<UUID, InventoryBase> Children = new Dictionary<UUID, InventoryBase>();
|
||||
|
||||
public InventoryFolder()
|
||||
{
|
||||
}
|
||||
|
||||
public InventoryFolder(string name, UUID ownerID, UUID parentID, short assetType)
|
||||
{
|
||||
ID = UUID.Random();
|
||||
Name = name;
|
||||
Owner = ownerID;
|
||||
ParentID = parentID;
|
||||
Type = assetType;
|
||||
Version = 1;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("{0} ({1})", Name, ID);
|
||||
}
|
||||
}
|
||||
|
||||
public class InventoryItem : InventoryBase
|
||||
{
|
||||
public UUID ID;
|
||||
public int InvType;
|
||||
public UUID Folder;
|
||||
public UUID Owner;
|
||||
public UUID Creator;
|
||||
public string Name;
|
||||
public string Description;
|
||||
public uint NextPermissions;
|
||||
public uint CurrentPermissions;
|
||||
public uint BasePermissions;
|
||||
public uint EveryOnePermissions;
|
||||
public uint GroupPermissions;
|
||||
public int AssetType;
|
||||
public UUID AssetID;
|
||||
public UUID GroupID;
|
||||
public bool GroupOwned;
|
||||
public int SalePrice;
|
||||
public byte SaleType;
|
||||
public uint Flags;
|
||||
public int CreationDate;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("{0} ({1})", Name, ID);
|
||||
}
|
||||
public Dictionary<UUID, InventoryNodeBase> Children = new Dictionary<UUID, InventoryNodeBase>();
|
||||
}
|
||||
|
||||
public class InventoryCollection
|
||||
{
|
||||
public Dictionary<UUID, InventoryFolder> Folders;
|
||||
public Dictionary<UUID, InventoryItem> Items;
|
||||
public Dictionary<UUID, InventoryFolderWithChildren> Folders;
|
||||
public Dictionary<UUID, InventoryItemBase> Items;
|
||||
public UUID UserID;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Data;
|
||||
|
||||
namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
||||
{
|
||||
public class OpenSimInventoryService : InventoryServiceBase
|
||||
{
|
||||
public override void RequestInventoryForUser(UUID userID, InventoryReceiptCallback callback) {}
|
||||
|
||||
public InventoryFolderBase GetInventoryFolder(UUID folderID)
|
||||
{
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
return plugin.getInventoryFolder(folderID);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
|
@ -42,17 +42,19 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
|||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
const string EXTENSION_NAME = "OpenSimInventoryStorage"; // Used in metrics reporting
|
||||
|
||||
//private AssetInventoryServer m_server;
|
||||
private AssetInventoryServer m_server;
|
||||
private IInventoryDataPlugin m_inventoryProvider;
|
||||
private IConfig m_openSimConfig;
|
||||
private OpenSimInventoryService m_inventoryService;
|
||||
|
||||
public OpenSimInventoryStoragePlugin()
|
||||
{
|
||||
m_inventoryService = new OpenSimInventoryService();
|
||||
}
|
||||
|
||||
#region IInventoryStorageProvider implementation
|
||||
|
||||
public BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItem item)
|
||||
public BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItemBase item)
|
||||
{
|
||||
item = null;
|
||||
//BackendResponse ret;
|
||||
|
@ -74,7 +76,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
|||
|
||||
// if (reader.Read())
|
||||
// {
|
||||
// item = new InventoryItem();
|
||||
// item = new InventoryItemBase();
|
||||
// item.ID = itemID;
|
||||
// item.AssetID = UUID.Parse(reader.GetString(0));
|
||||
// item.AssetType = reader.GetInt32(1);
|
||||
|
@ -116,7 +118,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
|||
return BackendResponse.Success;
|
||||
}
|
||||
|
||||
public BackendResponse TryFetchFolder(Uri owner, UUID folderID, out InventoryFolder folder)
|
||||
public BackendResponse TryFetchFolder(Uri owner, UUID folderID, out InventoryFolderWithChildren folder)
|
||||
{
|
||||
folder = null;
|
||||
//BackendResponse ret;
|
||||
|
@ -136,7 +138,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
|||
|
||||
// if (reader.Read())
|
||||
// {
|
||||
// folder = new InventoryFolder();
|
||||
// folder = new InventoryFolderWithChildren();
|
||||
// folder.Children = null; // This call only returns data for the folder itself, no children data
|
||||
// folder.ID = folderID;
|
||||
// folder.Name = reader.GetString(0);
|
||||
|
@ -186,11 +188,11 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
|||
// folderID.ToString());
|
||||
// reader = command.ExecuteReader();
|
||||
|
||||
// contents.Folders = new Dictionary<UUID, InventoryFolder>();
|
||||
// contents.Folders = new Dictionary<UUID, InventoryFolderWithChildren>();
|
||||
|
||||
// while (reader.Read())
|
||||
// {
|
||||
// InventoryFolder folder = new InventoryFolder();
|
||||
// InventoryFolderWithChildren folder = new InventoryFolderWithChildren();
|
||||
// folder.ParentID = folderID;
|
||||
// folder.Children = null; // This call doesn't do recursion
|
||||
// folder.Name = reader.GetString(0);
|
||||
|
@ -216,11 +218,11 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
|||
// folderID.ToString());
|
||||
// reader = command.ExecuteReader();
|
||||
|
||||
// contents.Items = new Dictionary<UUID, InventoryItem>();
|
||||
// contents.Items = new Dictionary<UUID, InventoryItemBase>();
|
||||
|
||||
// while (reader.Read())
|
||||
// {
|
||||
// InventoryItem item = new InventoryItem();
|
||||
// InventoryItemBase item = new InventoryItemBase();
|
||||
// item.Folder = folderID;
|
||||
// item.AssetID = UUID.Parse(reader.GetString(0));
|
||||
// item.AssetType = reader.GetInt32(1);
|
||||
|
@ -263,7 +265,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
|||
return BackendResponse.Success;
|
||||
}
|
||||
|
||||
public BackendResponse TryFetchFolderList(Uri owner, out List<InventoryFolder> folders)
|
||||
public BackendResponse TryFetchFolderList(Uri owner, out List<InventoryFolderWithChildren> folders)
|
||||
{
|
||||
folders = null;
|
||||
//BackendResponse ret;
|
||||
|
@ -278,7 +280,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
|||
// try
|
||||
// {
|
||||
// dbConnection.Open();
|
||||
// folders = new List<InventoryFolder>();
|
||||
// folders = new List<InventoryFolderWithChildren>();
|
||||
|
||||
// IDbCommand command = dbConnection.CreateCommand();
|
||||
// command.CommandText = String.Format("SELECT folderName,type,version,folderID,parentFolderID FROM inventoryfolders WHERE agentID='{0}'",
|
||||
|
@ -287,7 +289,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
|||
|
||||
// while (reader.Read())
|
||||
// {
|
||||
// InventoryFolder folder = new InventoryFolder();
|
||||
// InventoryFolderWithChildren folder = new InventoryFolderWithChildren();
|
||||
// folder.Owner = ownerID;
|
||||
// folder.Children = null; // This call does not create a folder hierarchy
|
||||
// folder.Name = reader.GetString(0);
|
||||
|
@ -322,7 +324,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
|||
{
|
||||
inventory = null;
|
||||
//BackendResponse ret;
|
||||
//List<InventoryFolder> folders;
|
||||
//List<InventoryFolderWithChildren> folders;
|
||||
//UUID ownerID;
|
||||
|
||||
//ret = TryFetchFolderList(owner, out folders);
|
||||
|
@ -331,8 +333,8 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
|||
//{
|
||||
// // Add the retrieved folders to the inventory collection
|
||||
// inventory = new InventoryCollection();
|
||||
// inventory.Folders = new Dictionary<UUID, InventoryFolder>(folders.Count);
|
||||
// foreach (InventoryFolder folder in folders)
|
||||
// inventory.Folders = new Dictionary<UUID, InventoryFolderWithChildren>(folders.Count);
|
||||
// foreach (InventoryFolderWithChildren folder in folders)
|
||||
// inventory.Folders[folder.ID] = folder;
|
||||
|
||||
// // Fetch inventory items
|
||||
|
@ -354,11 +356,11 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
|||
// reader = command.ExecuteReader();
|
||||
|
||||
// inventory.UserID = ownerID;
|
||||
// inventory.Items = new Dictionary<UUID, InventoryItem>();
|
||||
// inventory.Items = new Dictionary<UUID, InventoryItemBase>();
|
||||
|
||||
// while (reader.Read())
|
||||
// {
|
||||
// InventoryItem item = new InventoryItem();
|
||||
// InventoryItemBase item = new InventoryItemBase();
|
||||
// item.Owner = ownerID;
|
||||
// item.AssetID = UUID.Parse(reader.GetString(0));
|
||||
// item.AssetType = reader.GetInt32(1);
|
||||
|
@ -403,7 +405,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
|||
return BackendResponse.Success;
|
||||
}
|
||||
|
||||
public BackendResponse TryFetchActiveGestures(Uri owner, out List<InventoryItem> gestures)
|
||||
public BackendResponse TryFetchActiveGestures(Uri owner, out List<InventoryItemBase> gestures)
|
||||
{
|
||||
gestures = null;
|
||||
//BackendResponse ret;
|
||||
|
@ -429,7 +431,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
|||
|
||||
// while (reader.Read())
|
||||
// {
|
||||
// InventoryItem item = new InventoryItem();
|
||||
// InventoryItemBase item = new InventoryItemBase();
|
||||
// item.Owner = ownerID;
|
||||
// item.AssetType = (int)AssetType.Gesture;
|
||||
// item.Flags = (uint)1;
|
||||
|
@ -473,75 +475,24 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
|||
return BackendResponse.Success;
|
||||
}
|
||||
|
||||
public BackendResponse TryCreateItem(Uri owner, InventoryItem item)
|
||||
public BackendResponse TryCreateItem(Uri owner, InventoryItemBase item)
|
||||
{
|
||||
//BackendResponse ret;
|
||||
BackendResponse ret;
|
||||
|
||||
//using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// dbConnection.Open();
|
||||
if (m_inventoryService.AddItem(item))
|
||||
{
|
||||
ret = BackendResponse.Success;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = BackendResponse.Failure;
|
||||
}
|
||||
|
||||
// MySqlCommand command = new MySqlCommand(
|
||||
// "REPLACE INTO inventoryitems (assetID,assetType,inventoryName,inventoryDescription,inventoryNextPermissions," +
|
||||
// "inventoryCurrentPermissions,invType,creatorID,inventoryBasePermissions,inventoryEveryOnePermissions,salePrice,saleType," +
|
||||
// "creationDate,groupID,groupOwned,flags,inventoryID,avatarID,parentFolderID,inventoryGroupPermissions) VALUES " +
|
||||
|
||||
// "(?assetID,?assetType,?inventoryName,?inventoryDescription,?inventoryNextPermissions,?inventoryCurrentPermissions,?invType," +
|
||||
// "?creatorID,?inventoryBasePermissions,?inventoryEveryOnePermissions,?salePrice,?saleType,?creationDate,?groupID,?groupOwned," +
|
||||
// "?flags,?inventoryID,?avatarID,?parentFolderID,?inventoryGroupPermissions)", dbConnection);
|
||||
|
||||
// command.Parameters.AddWithValue("?assetID", item.AssetID.ToString());
|
||||
// command.Parameters.AddWithValue("?assetType", item.AssetType);
|
||||
// command.Parameters.AddWithValue("?inventoryName", item.Name);
|
||||
// command.Parameters.AddWithValue("?inventoryDescription", item.Description);
|
||||
// command.Parameters.AddWithValue("?inventoryNextPermissions", item.NextPermissions);
|
||||
// command.Parameters.AddWithValue("?inventoryCurrentPermissions", item.CurrentPermissions);
|
||||
// command.Parameters.AddWithValue("?invType", item.InvType);
|
||||
// command.Parameters.AddWithValue("?creatorID", item.Creator.ToString());
|
||||
// command.Parameters.AddWithValue("?inventoryBasePermissions", item.BasePermissions);
|
||||
// command.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions);
|
||||
// command.Parameters.AddWithValue("?salePrice", item.SalePrice);
|
||||
// command.Parameters.AddWithValue("?saleType", item.SaleType);
|
||||
// command.Parameters.AddWithValue("?creationDate", item.CreationDate);
|
||||
// command.Parameters.AddWithValue("?groupID", item.GroupID.ToString());
|
||||
// command.Parameters.AddWithValue("?groupOwned", item.GroupOwned);
|
||||
// command.Parameters.AddWithValue("?flags", item.Flags);
|
||||
// command.Parameters.AddWithValue("?inventoryID", item.ID);
|
||||
// command.Parameters.AddWithValue("?avatarID", item.Owner);
|
||||
// command.Parameters.AddWithValue("?parentFolderID", item.Folder);
|
||||
// command.Parameters.AddWithValue("?inventoryGroupPermissions", item.GroupPermissions);
|
||||
|
||||
// int rowsAffected = command.ExecuteNonQuery();
|
||||
// if (rowsAffected == 1)
|
||||
// {
|
||||
// ret = BackendResponse.Success;
|
||||
// }
|
||||
// else if (rowsAffected == 2)
|
||||
// {
|
||||
// m_log.Info("[OPENSIMINVENTORYSTORAGE]: Replaced inventory item " + item.ID.ToString());
|
||||
// ret = BackendResponse.Success;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// m_log.ErrorFormat("[OPENSIMINVENTORYSTORAGE]: MySQL REPLACE query affected {0} rows", rowsAffected);
|
||||
// ret = BackendResponse.Failure;
|
||||
// }
|
||||
// }
|
||||
// catch (MySqlException ex)
|
||||
// {
|
||||
// m_log.Error("[OPENSIMINVENTORYSTORAGE]: Connection to MySQL backend failed: " + ex.Message);
|
||||
// ret = BackendResponse.Failure;
|
||||
// }
|
||||
//}
|
||||
|
||||
//m_server.MetricsProvider.LogInventoryCreate(EXTENSION_NAME, ret, owner, false, DateTime.Now);
|
||||
//return ret;
|
||||
return BackendResponse.Success;
|
||||
m_server.MetricsProvider.LogInventoryCreate(EXTENSION_NAME, ret, owner, false, DateTime.Now);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public BackendResponse TryCreateFolder(Uri owner, InventoryFolder folder)
|
||||
public BackendResponse TryCreateFolder(Uri owner, InventoryFolderWithChildren folder)
|
||||
{
|
||||
//BackendResponse ret;
|
||||
|
||||
|
@ -590,7 +541,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
|||
return BackendResponse.Success;
|
||||
}
|
||||
|
||||
public BackendResponse TryCreateInventory(Uri owner, InventoryFolder rootFolder)
|
||||
public BackendResponse TryCreateInventory(Uri owner, InventoryFolderWithChildren rootFolder)
|
||||
{
|
||||
return TryCreateFolder(owner, rootFolder);
|
||||
}
|
||||
|
@ -692,60 +643,19 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
|||
|
||||
public BackendResponse TryPurgeFolder(Uri owner, UUID folderID)
|
||||
{
|
||||
//BackendResponse ret;
|
||||
//UUID ownerID;
|
||||
BackendResponse ret;
|
||||
|
||||
//if (Utils.TryGetOpenSimUUID(owner, out ownerID))
|
||||
//{
|
||||
// using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect")))
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// dbConnection.Open();
|
||||
if (m_inventoryService.PurgeFolder(m_inventoryService.GetInventoryFolder(folderID)))
|
||||
{
|
||||
ret = BackendResponse.Success;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = BackendResponse.Failure;
|
||||
}
|
||||
|
||||
// #region Delete items
|
||||
|
||||
// MySqlCommand command = new MySqlCommand(
|
||||
// "DELETE FROM inventoryitems WHERE parentFolderID=?parentFolderID AND avatarID=?avatarID", dbConnection);
|
||||
|
||||
// command.Parameters.AddWithValue("?parentFolderID", folderID.ToString());
|
||||
// command.Parameters.AddWithValue("?avatarID", ownerID.ToString());
|
||||
|
||||
// int rowsAffected = command.ExecuteNonQuery();
|
||||
|
||||
// #endregion Delete items
|
||||
|
||||
// #region Delete folders
|
||||
|
||||
// command = new MySqlCommand(
|
||||
// "DELETE FROM inventoryfolders WHERE parentFolderID=?parentFolderID AND agentID=?agentID", dbConnection);
|
||||
|
||||
// command.Parameters.AddWithValue("?parentFolderID", folderID.ToString());
|
||||
// command.Parameters.AddWithValue("?agentID", ownerID.ToString());
|
||||
|
||||
// rowsAffected += command.ExecuteNonQuery();
|
||||
|
||||
// #endregion Delete folders
|
||||
|
||||
// m_log.DebugFormat("[OPENSIMINVENTORYSTORAGE]: Deleted {0} inventory objects from MySQL in a folder purge", rowsAffected);
|
||||
|
||||
// ret = BackendResponse.Success;
|
||||
// }
|
||||
// catch (MySqlException ex)
|
||||
// {
|
||||
// m_log.Error("[OPENSIMINVENTORYSTORAGE]: Connection to MySQL backend failed: " + ex.Message);
|
||||
// ret = BackendResponse.Failure;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// ret = BackendResponse.NotFound;
|
||||
//}
|
||||
|
||||
//m_server.MetricsProvider.LogInventoryPurgeFolder(EXTENSION_NAME, ret, owner, folderID, DateTime.Now);
|
||||
//return ret;
|
||||
return BackendResponse.Success;
|
||||
m_server.MetricsProvider.LogInventoryPurgeFolder(EXTENSION_NAME, ret, owner, folderID, DateTime.Now);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public int ForEach(Action<AssetMetadata> action, int start, int count)
|
||||
|
@ -798,7 +708,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
|
|||
|
||||
public void Initialise(AssetInventoryServer server)
|
||||
{
|
||||
//m_server = server;
|
||||
m_server = server;
|
||||
m_openSimConfig = server.ConfigFile.Configs["OpenSim"];
|
||||
|
||||
try
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
|
|||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
AssetInventoryServer server;
|
||||
Dictionary<Uri, InventoryCollection> inventories = new Dictionary<Uri, InventoryCollection>();
|
||||
Dictionary<Uri, List<InventoryItem>> activeGestures = new Dictionary<Uri, List<InventoryItem>>();
|
||||
Dictionary<Uri, List<InventoryItemBase>> activeGestures = new Dictionary<Uri, List<InventoryItemBase>>();
|
||||
Utils.InventoryItemSerializer itemSerializer = new Utils.InventoryItemSerializer();
|
||||
Utils.InventoryFolderSerializer folderSerializer = new Utils.InventoryFolderSerializer();
|
||||
|
||||
|
@ -54,7 +54,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
|
|||
|
||||
#region Required Interfaces
|
||||
|
||||
public BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItem item)
|
||||
public BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItemBase item)
|
||||
{
|
||||
item = null;
|
||||
BackendResponse ret;
|
||||
|
@ -69,7 +69,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
|
|||
return ret;
|
||||
}
|
||||
|
||||
public BackendResponse TryFetchFolder(Uri owner, UUID folderID, out InventoryFolder folder)
|
||||
public BackendResponse TryFetchFolder(Uri owner, UUID folderID, out InventoryFolderWithChildren folder)
|
||||
{
|
||||
folder = null;
|
||||
BackendResponse ret;
|
||||
|
@ -90,25 +90,25 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
|
|||
BackendResponse ret;
|
||||
|
||||
InventoryCollection collection;
|
||||
InventoryFolder folder;
|
||||
InventoryFolderWithChildren folder;
|
||||
|
||||
if (inventories.TryGetValue(owner, out collection) && collection.Folders.TryGetValue(folderID, out folder))
|
||||
{
|
||||
contents = new InventoryCollection();
|
||||
contents.UserID = collection.UserID;
|
||||
contents.Folders = new Dictionary<UUID, InventoryFolder>();
|
||||
contents.Items = new Dictionary<UUID, InventoryItem>();
|
||||
contents.Folders = new Dictionary<UUID, InventoryFolderWithChildren>();
|
||||
contents.Items = new Dictionary<UUID, InventoryItemBase>();
|
||||
|
||||
foreach (InventoryBase invBase in folder.Children.Values)
|
||||
foreach (InventoryNodeBase invBase in folder.Children.Values)
|
||||
{
|
||||
if (invBase is InventoryItem)
|
||||
if (invBase is InventoryItemBase)
|
||||
{
|
||||
InventoryItem invItem = invBase as InventoryItem;
|
||||
InventoryItemBase invItem = invBase as InventoryItemBase;
|
||||
contents.Items.Add(invItem.ID, invItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
InventoryFolder invFolder = invBase as InventoryFolder;
|
||||
InventoryFolderWithChildren invFolder = invBase as InventoryFolderWithChildren;
|
||||
contents.Folders.Add(invFolder.ID, invFolder);
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
|
|||
return ret;
|
||||
}
|
||||
|
||||
public BackendResponse TryFetchFolderList(Uri owner, out List<InventoryFolder> folders)
|
||||
public BackendResponse TryFetchFolderList(Uri owner, out List<InventoryFolderWithChildren> folders)
|
||||
{
|
||||
folders = null;
|
||||
BackendResponse ret;
|
||||
|
@ -132,7 +132,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
|
|||
InventoryCollection collection;
|
||||
if (inventories.TryGetValue(owner, out collection))
|
||||
{
|
||||
folders = new List<InventoryFolder>(collection.Folders.Values);
|
||||
folders = new List<InventoryFolderWithChildren>(collection.Folders.Values);
|
||||
return BackendResponse.Success;
|
||||
}
|
||||
else
|
||||
|
@ -158,7 +158,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
|
|||
return ret;
|
||||
}
|
||||
|
||||
public BackendResponse TryFetchActiveGestures(Uri owner, out List<InventoryItem> gestures)
|
||||
public BackendResponse TryFetchActiveGestures(Uri owner, out List<InventoryItemBase> gestures)
|
||||
{
|
||||
gestures = null;
|
||||
BackendResponse ret;
|
||||
|
@ -172,7 +172,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
|
|||
return ret;
|
||||
}
|
||||
|
||||
public BackendResponse TryCreateItem(Uri owner, InventoryItem item)
|
||||
public BackendResponse TryCreateItem(Uri owner, InventoryItemBase item)
|
||||
{
|
||||
BackendResponse ret;
|
||||
|
||||
|
@ -180,7 +180,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
|
|||
if (inventories.TryGetValue(owner, out collection))
|
||||
{
|
||||
// Delete this item first if it already exists
|
||||
InventoryItem oldItem;
|
||||
InventoryItemBase oldItem;
|
||||
if (collection.Items.TryGetValue(item.ID, out oldItem))
|
||||
TryDeleteItem(owner, item.ID);
|
||||
|
||||
|
@ -193,7 +193,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
|
|||
lock (collection) collection.Items[item.ID] = item;
|
||||
|
||||
// Add the item to its parent folder
|
||||
InventoryFolder parent;
|
||||
InventoryFolderWithChildren parent;
|
||||
if (collection.Folders.TryGetValue(item.Folder, out parent))
|
||||
lock (parent.Children) parent.Children.Add(item.ID, item);
|
||||
|
||||
|
@ -221,7 +221,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
|
|||
return ret;
|
||||
}
|
||||
|
||||
public BackendResponse TryCreateFolder(Uri owner, InventoryFolder folder)
|
||||
public BackendResponse TryCreateFolder(Uri owner, InventoryFolderWithChildren folder)
|
||||
{
|
||||
BackendResponse ret;
|
||||
|
||||
|
@ -229,7 +229,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
|
|||
if (inventories.TryGetValue(owner, out collection))
|
||||
{
|
||||
// Delete this folder first if it already exists
|
||||
InventoryFolder oldFolder;
|
||||
InventoryFolderWithChildren oldFolder;
|
||||
if (collection.Folders.TryGetValue(folder.ID, out oldFolder))
|
||||
TryDeleteFolder(owner, folder.ID);
|
||||
|
||||
|
@ -242,7 +242,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
|
|||
lock (collection) collection.Folders[folder.ID] = folder;
|
||||
|
||||
// Add the folder to its parent folder
|
||||
InventoryFolder parent;
|
||||
InventoryFolderWithChildren parent;
|
||||
if (collection.Folders.TryGetValue(folder.ParentID, out parent))
|
||||
lock (parent.Children) parent.Children.Add(folder.ID, folder);
|
||||
|
||||
|
@ -263,7 +263,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
|
|||
return ret;
|
||||
}
|
||||
|
||||
public BackendResponse TryCreateInventory(Uri owner, InventoryFolder rootFolder)
|
||||
public BackendResponse TryCreateInventory(Uri owner, InventoryFolderWithChildren rootFolder)
|
||||
{
|
||||
BackendResponse ret;
|
||||
|
||||
|
@ -273,9 +273,9 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
|
|||
{
|
||||
InventoryCollection collection = new InventoryCollection();
|
||||
collection.UserID = rootFolder.Owner;
|
||||
collection.Folders = new Dictionary<UUID, InventoryFolder>();
|
||||
collection.Folders = new Dictionary<UUID, InventoryFolderWithChildren>();
|
||||
collection.Folders.Add(rootFolder.ID, rootFolder);
|
||||
collection.Items = new Dictionary<UUID, InventoryItem>();
|
||||
collection.Items = new Dictionary<UUID, InventoryItemBase>();
|
||||
|
||||
inventories.Add(owner, collection);
|
||||
|
||||
|
@ -318,11 +318,11 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
|
|||
BackendResponse ret;
|
||||
|
||||
InventoryCollection collection;
|
||||
InventoryItem item;
|
||||
InventoryItemBase item;
|
||||
if (inventories.TryGetValue(owner, out collection) && collection.Items.TryGetValue(itemID, out item))
|
||||
{
|
||||
// Remove the item from its parent folder
|
||||
InventoryFolder parent;
|
||||
InventoryFolderWithChildren parent;
|
||||
if (collection.Folders.TryGetValue(item.Folder, out parent))
|
||||
lock (parent.Children) parent.Children.Remove(itemID);
|
||||
|
||||
|
@ -371,11 +371,11 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
|
|||
BackendResponse ret;
|
||||
|
||||
InventoryCollection collection;
|
||||
InventoryFolder folder;
|
||||
InventoryFolderWithChildren folder;
|
||||
if (inventories.TryGetValue(owner, out collection) && collection.Folders.TryGetValue(folderID, out folder))
|
||||
{
|
||||
// Remove the folder from its parent folder
|
||||
InventoryFolder parent;
|
||||
InventoryFolderWithChildren parent;
|
||||
if (collection.Folders.TryGetValue(folder.ParentID, out parent))
|
||||
lock (parent.Children) parent.Children.Remove(folderID);
|
||||
|
||||
|
@ -408,19 +408,19 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
|
|||
BackendResponse ret;
|
||||
|
||||
InventoryCollection collection;
|
||||
InventoryFolder folder;
|
||||
InventoryFolderWithChildren folder;
|
||||
if (inventories.TryGetValue(owner, out collection) && collection.Folders.TryGetValue(folderID, out folder))
|
||||
{
|
||||
// Delete all of the folder children
|
||||
foreach (InventoryBase obj in new List<InventoryBase>(folder.Children.Values))
|
||||
foreach (InventoryNodeBase obj in new List<InventoryNodeBase>(folder.Children.Values))
|
||||
{
|
||||
if (obj is InventoryItem)
|
||||
if (obj is InventoryItemBase)
|
||||
{
|
||||
TryDeleteItem(owner, (obj as InventoryItem).ID);
|
||||
TryDeleteItem(owner, (obj as InventoryItemBase).ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
InventoryFolder childFolder = obj as InventoryFolder;
|
||||
InventoryFolderWithChildren childFolder = obj as InventoryFolderWithChildren;
|
||||
TryPurgeFolder(owner, childFolder.ID);
|
||||
TryDeleteFolder(owner, childFolder.ID);
|
||||
}
|
||||
|
@ -439,7 +439,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
|
|||
|
||||
#endregion Required Interfaces
|
||||
|
||||
void SaveItem(InventoryItem item)
|
||||
void SaveItem(InventoryItemBase item)
|
||||
{
|
||||
string filename = String.Format("{0}-{1}.item", SanitizeFilename(item.Name), item.ID);
|
||||
|
||||
|
@ -453,7 +453,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
|
|||
}
|
||||
}
|
||||
|
||||
void SaveFolder(InventoryFolder folder)
|
||||
void SaveFolder(InventoryFolderWithChildren folder)
|
||||
{
|
||||
string filename = String.Format("{0}-{1}.folder", SanitizeFilename(folder.Name), folder.ID);
|
||||
|
||||
|
@ -530,42 +530,42 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
|
|||
if (ownerID != UUID.Zero && owner != null)
|
||||
{
|
||||
// Initialize the active gestures list for this agent
|
||||
activeGestures.Add(owner, new List<InventoryItem>());
|
||||
activeGestures.Add(owner, new List<InventoryItemBase>());
|
||||
|
||||
InventoryCollection collection = new InventoryCollection();
|
||||
collection.UserID = ownerID;
|
||||
|
||||
// Load all of the folders for this agent
|
||||
string[] folders = Directory.GetFiles(foldername, "*.folder", SearchOption.TopDirectoryOnly);
|
||||
collection.Folders = new Dictionary<UUID,InventoryFolder>(folders.Length);
|
||||
collection.Folders = new Dictionary<UUID,InventoryFolderWithChildren>(folders.Length);
|
||||
|
||||
for (int j = 0; j < folders.Length; j++)
|
||||
{
|
||||
InventoryFolder invFolder = (InventoryFolder)folderSerializer.Deserialize(
|
||||
InventoryFolderWithChildren invFolder = (InventoryFolderWithChildren)folderSerializer.Deserialize(
|
||||
new FileStream(folders[j], FileMode.Open, FileAccess.Read));
|
||||
collection.Folders[invFolder.ID] = invFolder;
|
||||
}
|
||||
|
||||
// Iterate over the folders collection, adding children to their parents
|
||||
foreach (InventoryFolder invFolder in collection.Folders.Values)
|
||||
foreach (InventoryFolderWithChildren invFolder in collection.Folders.Values)
|
||||
{
|
||||
InventoryFolder parent;
|
||||
InventoryFolderWithChildren parent;
|
||||
if (collection.Folders.TryGetValue(invFolder.ParentID, out parent))
|
||||
parent.Children[invFolder.ID] = invFolder;
|
||||
}
|
||||
|
||||
// Load all of the items for this agent
|
||||
string[] files = Directory.GetFiles(foldername, "*.item", SearchOption.TopDirectoryOnly);
|
||||
collection.Items = new Dictionary<UUID, InventoryItem>(files.Length);
|
||||
collection.Items = new Dictionary<UUID, InventoryItemBase>(files.Length);
|
||||
|
||||
for (int j = 0; j < files.Length; j++)
|
||||
{
|
||||
InventoryItem invItem = (InventoryItem)itemSerializer.Deserialize(
|
||||
InventoryItemBase invItem = (InventoryItemBase)itemSerializer.Deserialize(
|
||||
new FileStream(files[j], FileMode.Open, FileAccess.Read));
|
||||
collection.Items[invItem.ID] = invItem;
|
||||
|
||||
// Add items to their parent folders
|
||||
InventoryFolder parent;
|
||||
InventoryFolderWithChildren parent;
|
||||
if (collection.Folders.TryGetValue(invItem.Folder, out parent))
|
||||
parent.Children[invItem.ID] = invItem;
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ using System.Globalization;
|
|||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
|
||||
namespace OpenSim.Grid.AssetInventoryServer
|
||||
|
@ -278,9 +279,9 @@ namespace OpenSim.Grid.AssetInventoryServer
|
|||
return ReadObject_InventoryCollection(true, true);
|
||||
}
|
||||
|
||||
public InventoryFolder ReadObject_InventoryFolder(bool isNullable, bool checkType)
|
||||
public InventoryFolderWithChildren ReadObject_InventoryFolder(bool isNullable, bool checkType)
|
||||
{
|
||||
InventoryFolder ob = null;
|
||||
InventoryFolderWithChildren ob = null;
|
||||
if (isNullable && ReadNull()) return null;
|
||||
|
||||
if (checkType)
|
||||
|
@ -292,7 +293,7 @@ namespace OpenSim.Grid.AssetInventoryServer
|
|||
throw CreateUnknownTypeException(t);
|
||||
}
|
||||
|
||||
ob = (InventoryFolder)Activator.CreateInstance(typeof(InventoryFolder), true);
|
||||
ob = (InventoryFolderWithChildren)Activator.CreateInstance(typeof(InventoryFolderWithChildren), true);
|
||||
|
||||
Reader.MoveToElement();
|
||||
|
||||
|
@ -373,9 +374,9 @@ namespace OpenSim.Grid.AssetInventoryServer
|
|||
return ob;
|
||||
}
|
||||
|
||||
public InventoryItem ReadObject_InventoryItem(bool isNullable, bool checkType)
|
||||
public InventoryItemBase ReadObject_InventoryItem(bool isNullable, bool checkType)
|
||||
{
|
||||
InventoryItem ob = null;
|
||||
InventoryItemBase ob = null;
|
||||
if (isNullable && ReadNull()) return null;
|
||||
|
||||
if (checkType)
|
||||
|
@ -387,7 +388,7 @@ namespace OpenSim.Grid.AssetInventoryServer
|
|||
throw CreateUnknownTypeException(t);
|
||||
}
|
||||
|
||||
ob = (InventoryItem)Activator.CreateInstance(typeof(InventoryItem), true);
|
||||
ob = (InventoryItemBase)Activator.CreateInstance(typeof(InventoryItemBase), true);
|
||||
|
||||
Reader.MoveToElement();
|
||||
|
||||
|
@ -585,11 +586,11 @@ namespace OpenSim.Grid.AssetInventoryServer
|
|||
Reader.Skip();
|
||||
if (ob.@Folders == null)
|
||||
{
|
||||
ob.@Folders = new System.Collections.Generic.Dictionary<UUID, InventoryFolder>();
|
||||
ob.@Folders = new System.Collections.Generic.Dictionary<UUID, InventoryFolderWithChildren>();
|
||||
}
|
||||
if (ob.@Items == null)
|
||||
{
|
||||
ob.@Items = new System.Collections.Generic.Dictionary<UUID, InventoryItem>();
|
||||
ob.@Items = new System.Collections.Generic.Dictionary<UUID, InventoryItemBase>();
|
||||
}
|
||||
return ob;
|
||||
}
|
||||
|
@ -610,10 +611,10 @@ namespace OpenSim.Grid.AssetInventoryServer
|
|||
}
|
||||
else if (Reader.LocalName == "Items" && Reader.NamespaceURI == "" && !b44)
|
||||
{
|
||||
System.Collections.Generic.Dictionary<UUID, InventoryItem> o46 = ob.@Items;
|
||||
System.Collections.Generic.Dictionary<UUID, InventoryItemBase> o46 = ob.@Items;
|
||||
if (((object)o46) == null)
|
||||
{
|
||||
o46 = new System.Collections.Generic.Dictionary<UUID, InventoryItem>();
|
||||
o46 = new System.Collections.Generic.Dictionary<UUID, InventoryItemBase>();
|
||||
ob.@Items = o46;
|
||||
}
|
||||
if (Reader.IsEmptyElement)
|
||||
|
@ -634,7 +635,7 @@ namespace OpenSim.Grid.AssetInventoryServer
|
|||
{
|
||||
if (((object)o46) == null)
|
||||
throw CreateReadOnlyCollectionException("System.Collections.Generic.List<InventoryItemBase>");
|
||||
InventoryItem item = ReadObject_InventoryItem(true, true);
|
||||
InventoryItemBase item = ReadObject_InventoryItem(true, true);
|
||||
o46.Add(item.ID, item);
|
||||
n47++;
|
||||
}
|
||||
|
@ -650,10 +651,10 @@ namespace OpenSim.Grid.AssetInventoryServer
|
|||
}
|
||||
else if (Reader.LocalName == "Folders" && Reader.NamespaceURI == "" && !b43)
|
||||
{
|
||||
System.Collections.Generic.Dictionary<UUID, InventoryFolder> o48 = ob.@Folders;
|
||||
System.Collections.Generic.Dictionary<UUID, InventoryFolderWithChildren> o48 = ob.@Folders;
|
||||
if (((object)o48) == null)
|
||||
{
|
||||
o48 = new System.Collections.Generic.Dictionary<UUID, InventoryFolder>();
|
||||
o48 = new System.Collections.Generic.Dictionary<UUID, InventoryFolderWithChildren>();
|
||||
ob.@Folders = o48;
|
||||
}
|
||||
if (Reader.IsEmptyElement)
|
||||
|
@ -674,7 +675,7 @@ namespace OpenSim.Grid.AssetInventoryServer
|
|||
{
|
||||
if (((object)o48) == null)
|
||||
throw CreateReadOnlyCollectionException("System.Collections.Generic.List<InventoryFolderBase>");
|
||||
InventoryFolder folder = ReadObject_InventoryFolder(true, true);
|
||||
InventoryFolderWithChildren folder = ReadObject_InventoryFolder(true, true);
|
||||
o48.Add(folder.ID, folder);
|
||||
n49++;
|
||||
}
|
||||
|
@ -700,11 +701,11 @@ namespace OpenSim.Grid.AssetInventoryServer
|
|||
}
|
||||
if (ob.@Folders == null)
|
||||
{
|
||||
ob.@Folders = new System.Collections.Generic.Dictionary<UUID, InventoryFolder>();
|
||||
ob.@Folders = new System.Collections.Generic.Dictionary<UUID, InventoryFolderWithChildren>();
|
||||
}
|
||||
if (ob.@Items == null)
|
||||
{
|
||||
ob.@Items = new System.Collections.Generic.Dictionary<UUID, InventoryItem>();
|
||||
ob.@Items = new System.Collections.Generic.Dictionary<UUID, InventoryItemBase>();
|
||||
}
|
||||
|
||||
ReadEndElement();
|
||||
|
@ -793,7 +794,7 @@ namespace OpenSim.Grid.AssetInventoryServer
|
|||
public void WriteRoot_InventoryFolder(object o)
|
||||
{
|
||||
WriteStartDocument();
|
||||
InventoryFolder ob = (InventoryFolder)o;
|
||||
InventoryFolderWithChildren ob = (InventoryFolderWithChildren)o;
|
||||
TopLevelElement();
|
||||
WriteObject_InventoryFolder(ob, "InventoryFolderBase", "", true, false, true);
|
||||
}
|
||||
|
@ -801,7 +802,7 @@ namespace OpenSim.Grid.AssetInventoryServer
|
|||
public void WriteRoot_InventoryItem(object o)
|
||||
{
|
||||
WriteStartDocument();
|
||||
InventoryItem ob = (InventoryItem)o;
|
||||
InventoryItemBase ob = (InventoryItemBase)o;
|
||||
TopLevelElement();
|
||||
WriteObject_InventoryItem(ob, "InventoryItemBase", "", true, false, true);
|
||||
}
|
||||
|
@ -814,7 +815,7 @@ namespace OpenSim.Grid.AssetInventoryServer
|
|||
WriteObject_InventoryCollection(ob, "InventoryCollection", "", true, false, true);
|
||||
}
|
||||
|
||||
void WriteObject_InventoryFolder(InventoryFolder ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
|
||||
void WriteObject_InventoryFolder(InventoryFolderWithChildren ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
|
||||
{
|
||||
if (((object)ob) == null)
|
||||
{
|
||||
|
@ -824,7 +825,7 @@ namespace OpenSim.Grid.AssetInventoryServer
|
|||
}
|
||||
|
||||
System.Type type = ob.GetType();
|
||||
if (type == typeof(InventoryFolder))
|
||||
if (type == typeof(InventoryFolderWithChildren))
|
||||
{ }
|
||||
else
|
||||
{
|
||||
|
@ -847,7 +848,7 @@ namespace OpenSim.Grid.AssetInventoryServer
|
|||
if (writeWrappingElem) WriteEndElement(ob);
|
||||
}
|
||||
|
||||
void WriteObject_InventoryItem(InventoryItem ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
|
||||
void WriteObject_InventoryItem(InventoryItemBase ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
|
||||
{
|
||||
if (((object)ob) == null)
|
||||
{
|
||||
|
@ -857,7 +858,7 @@ namespace OpenSim.Grid.AssetInventoryServer
|
|||
}
|
||||
|
||||
System.Type type = ob.GetType();
|
||||
if (type == typeof(InventoryItem))
|
||||
if (type == typeof(InventoryItemBase))
|
||||
{ }
|
||||
else
|
||||
{
|
||||
|
@ -921,7 +922,7 @@ namespace OpenSim.Grid.AssetInventoryServer
|
|||
if (ob.@Folders != null)
|
||||
{
|
||||
WriteStartElement("Folders", "", ob.@Folders);
|
||||
foreach (InventoryFolder folder in ob.Folders.Values)
|
||||
foreach (InventoryFolderWithChildren folder in ob.Folders.Values)
|
||||
{
|
||||
WriteObject_InventoryFolder(folder, "InventoryFolderBase", "", true, false, true);
|
||||
}
|
||||
|
@ -930,7 +931,7 @@ namespace OpenSim.Grid.AssetInventoryServer
|
|||
if (ob.@Items != null)
|
||||
{
|
||||
WriteStartElement("Items", "", ob.@Items);
|
||||
foreach (InventoryItem item in ob.Items.Values)
|
||||
foreach (InventoryItemBase item in ob.Items.Values)
|
||||
{
|
||||
WriteObject_InventoryItem(item, "InventoryItemBase", "", true, false, true);
|
||||
}
|
||||
|
|
|
@ -919,6 +919,7 @@
|
|||
<Reference name="OpenMetaverseTypes"/>
|
||||
<Reference name="OpenSim.Data" />
|
||||
<Reference name="OpenSim.Framework" />
|
||||
<Reference name="OpenSim.Framework.Communications" />
|
||||
<Reference name="OpenSim.Grid.AssetInventoryServer" />
|
||||
<Reference name="OpenSim.Framework.Servers"/>
|
||||
<Reference name="log4net"/>
|
||||
|
|
Loading…
Reference in New Issue