aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMike Mazur2009-03-05 08:29:52 +0000
committerMike Mazur2009-03-05 08:29:52 +0000
commit367606227774c4551a8929b2b42f8d014efff318 (patch)
treef4d9bfe81c36c62a1c62bef29f95835aa61ffa0f /OpenSim
parentA couple cosmetic changes in inventory storage plugin. (diff)
downloadopensim-SC-367606227774c4551a8929b2b42f8d014efff318.zip
opensim-SC-367606227774c4551a8929b2b42f8d014efff318.tar.gz
opensim-SC-367606227774c4551a8929b2b42f8d014efff318.tar.bz2
opensim-SC-367606227774c4551a8929b2b42f8d014efff318.tar.xz
Use Inventory{Item,Folder}Base in AssetInventoryServer.
Also the first inventory storage methods are implemented.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Interfaces.cs14
-rw-r--r--OpenSim/Grid/AssetInventoryServer/InventoryObjects.cs123
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryService.cs49
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs186
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs82
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Utils.cs49
6 files changed, 235 insertions, 268 deletions
diff --git a/OpenSim/Grid/AssetInventoryServer/Interfaces.cs b/OpenSim/Grid/AssetInventoryServer/Interfaces.cs
index b8c8f88..e808dd3 100644
--- a/OpenSim/Grid/AssetInventoryServer/Interfaces.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Interfaces.cs
@@ -81,17 +81,17 @@ namespace OpenSim.Grid.AssetInventoryServer
81 81
82 public interface IInventoryStorageProvider : IAssetInventoryServerPlugin 82 public interface IInventoryStorageProvider : IAssetInventoryServerPlugin
83 { 83 {
84 BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItem item); 84 BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItemBase item);
85 BackendResponse TryFetchFolder(Uri owner, UUID folderID, out InventoryFolder folder); 85 BackendResponse TryFetchFolder(Uri owner, UUID folderID, out InventoryFolderWithChildren folder);
86 BackendResponse TryFetchFolderContents(Uri owner, UUID folderID, out InventoryCollection contents); 86 BackendResponse TryFetchFolderContents(Uri owner, UUID folderID, out InventoryCollection contents);
87 BackendResponse TryFetchFolderList(Uri owner, out List<InventoryFolder> folders); 87 BackendResponse TryFetchFolderList(Uri owner, out List<InventoryFolderWithChildren> folders);
88 BackendResponse TryFetchInventory(Uri owner, out InventoryCollection inventory); 88 BackendResponse TryFetchInventory(Uri owner, out InventoryCollection inventory);
89 89
90 BackendResponse TryFetchActiveGestures(Uri owner, out List<InventoryItem> gestures); 90 BackendResponse TryFetchActiveGestures(Uri owner, out List<InventoryItemBase> gestures);
91 91
92 BackendResponse TryCreateItem(Uri owner, InventoryItem item); 92 BackendResponse TryCreateItem(Uri owner, InventoryItemBase item);
93 BackendResponse TryCreateFolder(Uri owner, InventoryFolder folder); 93 BackendResponse TryCreateFolder(Uri owner, InventoryFolderWithChildren folder);
94 BackendResponse TryCreateInventory(Uri owner, InventoryFolder rootFolder); 94 BackendResponse TryCreateInventory(Uri owner, InventoryFolderWithChildren rootFolder);
95 95
96 BackendResponse TryDeleteItem(Uri owner, UUID itemID); 96 BackendResponse TryDeleteItem(Uri owner, UUID itemID);
97 BackendResponse TryDeleteFolder(Uri owner, UUID folderID); 97 BackendResponse TryDeleteFolder(Uri owner, UUID folderID);
diff --git a/OpenSim/Grid/AssetInventoryServer/InventoryObjects.cs b/OpenSim/Grid/AssetInventoryServer/InventoryObjects.cs
index 7392f1d..5fa4274 100644
--- a/OpenSim/Grid/AssetInventoryServer/InventoryObjects.cs
+++ b/OpenSim/Grid/AssetInventoryServer/InventoryObjects.cs
@@ -28,78 +28,85 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenMetaverse; 30using OpenMetaverse;
31using OpenSim.Framework;
31 32
32namespace OpenSim.Grid.AssetInventoryServer 33namespace OpenSim.Grid.AssetInventoryServer
33{ 34{
34 public class InventoryBase 35 //public class InventoryBase
35 { 36 //{
36 } 37 //}
37 38
38 public class InventoryFolder : InventoryBase 39 //public class InventoryFolder : InventoryBase
39 { 40 //{
40 public string Name; 41 // public string Name;
41 public UUID Owner; 42 // public UUID Owner;
42 public UUID ParentID; 43 // public UUID ParentID;
43 public UUID ID; 44 // public UUID ID;
44 public short Type; 45 // public short Type;
45 public ushort Version; 46 // public ushort Version;
46 47
47 [NonSerialized] 48 // [NonSerialized]
48 public Dictionary<UUID, InventoryBase> Children = new Dictionary<UUID, InventoryBase>(); 49 // public Dictionary<UUID, InventoryBase> Children = new Dictionary<UUID, InventoryBase>();
49 50
50 public InventoryFolder() 51 // public InventoryFolder()
51 { 52 // {
52 } 53 // }
53 54
54 public InventoryFolder(string name, UUID ownerID, UUID parentID, short assetType) 55 // public InventoryFolder(string name, UUID ownerID, UUID parentID, short assetType)
55 { 56 // {
56 ID = UUID.Random(); 57 // ID = UUID.Random();
57 Name = name; 58 // Name = name;
58 Owner = ownerID; 59 // Owner = ownerID;
59 ParentID = parentID; 60 // ParentID = parentID;
60 Type = assetType; 61 // Type = assetType;
61 Version = 1; 62 // Version = 1;
62 } 63 // }
63 64
64 public override string ToString() 65 // public override string ToString()
65 { 66 // {
66 return String.Format("{0} ({1})", Name, ID); 67 // return String.Format("{0} ({1})", Name, ID);
67 } 68 // }
68 } 69 //}
69 70
70 public class InventoryItem : InventoryBase 71 //public class InventoryItem : InventoryBase
71 { 72 //{
72 public UUID ID; 73 // public UUID ID;
73 public int InvType; 74 // public int InvType;
74 public UUID Folder; 75 // public UUID Folder;
75 public UUID Owner; 76 // public UUID Owner;
76 public UUID Creator; 77 // public UUID Creator;
77 public string Name; 78 // public string Name;
78 public string Description; 79 // public string Description;
79 public uint NextPermissions; 80 // public uint NextPermissions;
80 public uint CurrentPermissions; 81 // public uint CurrentPermissions;
81 public uint BasePermissions; 82 // public uint BasePermissions;
82 public uint EveryOnePermissions; 83 // public uint EveryOnePermissions;
83 public uint GroupPermissions; 84 // public uint GroupPermissions;
84 public int AssetType; 85 // public int AssetType;
85 public UUID AssetID; 86 // public UUID AssetID;
86 public UUID GroupID; 87 // public UUID GroupID;
87 public bool GroupOwned; 88 // public bool GroupOwned;
88 public int SalePrice; 89 // public int SalePrice;
89 public byte SaleType; 90 // public byte SaleType;
90 public uint Flags; 91 // public uint Flags;
91 public int CreationDate; 92 // public int CreationDate;
93
94 // public override string ToString()
95 // {
96 // return String.Format("{0} ({1})", Name, ID);
97 // }
98 //}
92 99
93 public override string ToString() 100 public class InventoryFolderWithChildren : InventoryFolderBase
94 { 101 {
95 return String.Format("{0} ({1})", Name, ID); 102 [NonSerialized]
96 } 103 public Dictionary<UUID, InventoryNodeBase> Children = new Dictionary<UUID, InventoryNodeBase>();
97 } 104 }
98 105
99 public class InventoryCollection 106 public class InventoryCollection
100 { 107 {
101 public Dictionary<UUID, InventoryFolder> Folders; 108 public Dictionary<UUID, InventoryFolderWithChildren> Folders;
102 public Dictionary<UUID, InventoryItem> Items; 109 public Dictionary<UUID, InventoryItemBase> Items;
103 public UUID UserID; 110 public UUID UserID;
104 } 111 }
105} 112}
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryService.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryService.cs
new file mode 100644
index 0000000..d742d25
--- /dev/null
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryService.cs
@@ -0,0 +1,49 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29using OpenSim.Framework;
30using OpenSim.Framework.Communications;
31using OpenSim.Data;
32
33namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
34{
35 public class OpenSimInventoryService : InventoryServiceBase
36 {
37 public override void RequestInventoryForUser(UUID userID, InventoryReceiptCallback callback) {}
38
39 public InventoryFolderBase GetInventoryFolder(UUID folderID)
40 {
41 foreach (IInventoryDataPlugin plugin in m_plugins)
42 {
43 return plugin.getInventoryFolder(folderID);
44 }
45
46 return null;
47 }
48 }
49}
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs
index 7c9646e..851cc4a 100644
--- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimInventoryStoragePlugin.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -42,17 +42,19 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43 const string EXTENSION_NAME = "OpenSimInventoryStorage"; // Used in metrics reporting 43 const string EXTENSION_NAME = "OpenSimInventoryStorage"; // Used in metrics reporting
44 44
45 //private AssetInventoryServer m_server; 45 private AssetInventoryServer m_server;
46 private IInventoryDataPlugin m_inventoryProvider; 46 private IInventoryDataPlugin m_inventoryProvider;
47 private IConfig m_openSimConfig; 47 private IConfig m_openSimConfig;
48 private OpenSimInventoryService m_inventoryService;
48 49
49 public OpenSimInventoryStoragePlugin() 50 public OpenSimInventoryStoragePlugin()
50 { 51 {
52 m_inventoryService = new OpenSimInventoryService();
51 } 53 }
52 54
53 #region IInventoryStorageProvider implementation 55 #region IInventoryStorageProvider implementation
54 56
55 public BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItem item) 57 public BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItemBase item)
56 { 58 {
57 item = null; 59 item = null;
58 //BackendResponse ret; 60 //BackendResponse ret;
@@ -74,7 +76,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
74 76
75 // if (reader.Read()) 77 // if (reader.Read())
76 // { 78 // {
77 // item = new InventoryItem(); 79 // item = new InventoryItemBase();
78 // item.ID = itemID; 80 // item.ID = itemID;
79 // item.AssetID = UUID.Parse(reader.GetString(0)); 81 // item.AssetID = UUID.Parse(reader.GetString(0));
80 // item.AssetType = reader.GetInt32(1); 82 // item.AssetType = reader.GetInt32(1);
@@ -116,7 +118,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
116 return BackendResponse.Success; 118 return BackendResponse.Success;
117 } 119 }
118 120
119 public BackendResponse TryFetchFolder(Uri owner, UUID folderID, out InventoryFolder folder) 121 public BackendResponse TryFetchFolder(Uri owner, UUID folderID, out InventoryFolderWithChildren folder)
120 { 122 {
121 folder = null; 123 folder = null;
122 //BackendResponse ret; 124 //BackendResponse ret;
@@ -136,7 +138,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
136 138
137 // if (reader.Read()) 139 // if (reader.Read())
138 // { 140 // {
139 // folder = new InventoryFolder(); 141 // folder = new InventoryFolderWithChildren();
140 // folder.Children = null; // This call only returns data for the folder itself, no children data 142 // folder.Children = null; // This call only returns data for the folder itself, no children data
141 // folder.ID = folderID; 143 // folder.ID = folderID;
142 // folder.Name = reader.GetString(0); 144 // folder.Name = reader.GetString(0);
@@ -186,11 +188,11 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
186 // folderID.ToString()); 188 // folderID.ToString());
187 // reader = command.ExecuteReader(); 189 // reader = command.ExecuteReader();
188 190
189 // contents.Folders = new Dictionary<UUID, InventoryFolder>(); 191 // contents.Folders = new Dictionary<UUID, InventoryFolderWithChildren>();
190 192
191 // while (reader.Read()) 193 // while (reader.Read())
192 // { 194 // {
193 // InventoryFolder folder = new InventoryFolder(); 195 // InventoryFolderWithChildren folder = new InventoryFolderWithChildren();
194 // folder.ParentID = folderID; 196 // folder.ParentID = folderID;
195 // folder.Children = null; // This call doesn't do recursion 197 // folder.Children = null; // This call doesn't do recursion
196 // folder.Name = reader.GetString(0); 198 // folder.Name = reader.GetString(0);
@@ -216,11 +218,11 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
216 // folderID.ToString()); 218 // folderID.ToString());
217 // reader = command.ExecuteReader(); 219 // reader = command.ExecuteReader();
218 220
219 // contents.Items = new Dictionary<UUID, InventoryItem>(); 221 // contents.Items = new Dictionary<UUID, InventoryItemBase>();
220 222
221 // while (reader.Read()) 223 // while (reader.Read())
222 // { 224 // {
223 // InventoryItem item = new InventoryItem(); 225 // InventoryItemBase item = new InventoryItemBase();
224 // item.Folder = folderID; 226 // item.Folder = folderID;
225 // item.AssetID = UUID.Parse(reader.GetString(0)); 227 // item.AssetID = UUID.Parse(reader.GetString(0));
226 // item.AssetType = reader.GetInt32(1); 228 // item.AssetType = reader.GetInt32(1);
@@ -263,7 +265,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
263 return BackendResponse.Success; 265 return BackendResponse.Success;
264 } 266 }
265 267
266 public BackendResponse TryFetchFolderList(Uri owner, out List<InventoryFolder> folders) 268 public BackendResponse TryFetchFolderList(Uri owner, out List<InventoryFolderWithChildren> folders)
267 { 269 {
268 folders = null; 270 folders = null;
269 //BackendResponse ret; 271 //BackendResponse ret;
@@ -278,7 +280,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
278 // try 280 // try
279 // { 281 // {
280 // dbConnection.Open(); 282 // dbConnection.Open();
281 // folders = new List<InventoryFolder>(); 283 // folders = new List<InventoryFolderWithChildren>();
282 284
283 // IDbCommand command = dbConnection.CreateCommand(); 285 // IDbCommand command = dbConnection.CreateCommand();
284 // command.CommandText = String.Format("SELECT folderName,type,version,folderID,parentFolderID FROM inventoryfolders WHERE agentID='{0}'", 286 // 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
287 289
288 // while (reader.Read()) 290 // while (reader.Read())
289 // { 291 // {
290 // InventoryFolder folder = new InventoryFolder(); 292 // InventoryFolderWithChildren folder = new InventoryFolderWithChildren();
291 // folder.Owner = ownerID; 293 // folder.Owner = ownerID;
292 // folder.Children = null; // This call does not create a folder hierarchy 294 // folder.Children = null; // This call does not create a folder hierarchy
293 // folder.Name = reader.GetString(0); 295 // folder.Name = reader.GetString(0);
@@ -322,7 +324,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
322 { 324 {
323 inventory = null; 325 inventory = null;
324 //BackendResponse ret; 326 //BackendResponse ret;
325 //List<InventoryFolder> folders; 327 //List<InventoryFolderWithChildren> folders;
326 //UUID ownerID; 328 //UUID ownerID;
327 329
328 //ret = TryFetchFolderList(owner, out folders); 330 //ret = TryFetchFolderList(owner, out folders);
@@ -331,8 +333,8 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
331 //{ 333 //{
332 // // Add the retrieved folders to the inventory collection 334 // // Add the retrieved folders to the inventory collection
333 // inventory = new InventoryCollection(); 335 // inventory = new InventoryCollection();
334 // inventory.Folders = new Dictionary<UUID, InventoryFolder>(folders.Count); 336 // inventory.Folders = new Dictionary<UUID, InventoryFolderWithChildren>(folders.Count);
335 // foreach (InventoryFolder folder in folders) 337 // foreach (InventoryFolderWithChildren folder in folders)
336 // inventory.Folders[folder.ID] = folder; 338 // inventory.Folders[folder.ID] = folder;
337 339
338 // // Fetch inventory items 340 // // Fetch inventory items
@@ -354,11 +356,11 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
354 // reader = command.ExecuteReader(); 356 // reader = command.ExecuteReader();
355 357
356 // inventory.UserID = ownerID; 358 // inventory.UserID = ownerID;
357 // inventory.Items = new Dictionary<UUID, InventoryItem>(); 359 // inventory.Items = new Dictionary<UUID, InventoryItemBase>();
358 360
359 // while (reader.Read()) 361 // while (reader.Read())
360 // { 362 // {
361 // InventoryItem item = new InventoryItem(); 363 // InventoryItemBase item = new InventoryItemBase();
362 // item.Owner = ownerID; 364 // item.Owner = ownerID;
363 // item.AssetID = UUID.Parse(reader.GetString(0)); 365 // item.AssetID = UUID.Parse(reader.GetString(0));
364 // item.AssetType = reader.GetInt32(1); 366 // item.AssetType = reader.GetInt32(1);
@@ -403,7 +405,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
403 return BackendResponse.Success; 405 return BackendResponse.Success;
404 } 406 }
405 407
406 public BackendResponse TryFetchActiveGestures(Uri owner, out List<InventoryItem> gestures) 408 public BackendResponse TryFetchActiveGestures(Uri owner, out List<InventoryItemBase> gestures)
407 { 409 {
408 gestures = null; 410 gestures = null;
409 //BackendResponse ret; 411 //BackendResponse ret;
@@ -429,7 +431,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
429 431
430 // while (reader.Read()) 432 // while (reader.Read())
431 // { 433 // {
432 // InventoryItem item = new InventoryItem(); 434 // InventoryItemBase item = new InventoryItemBase();
433 // item.Owner = ownerID; 435 // item.Owner = ownerID;
434 // item.AssetType = (int)AssetType.Gesture; 436 // item.AssetType = (int)AssetType.Gesture;
435 // item.Flags = (uint)1; 437 // item.Flags = (uint)1;
@@ -473,75 +475,24 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
473 return BackendResponse.Success; 475 return BackendResponse.Success;
474 } 476 }
475 477
476 public BackendResponse TryCreateItem(Uri owner, InventoryItem item) 478 public BackendResponse TryCreateItem(Uri owner, InventoryItemBase item)
477 { 479 {
478 //BackendResponse ret; 480 BackendResponse ret;
479 481
480 //using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect"))) 482 if (m_inventoryService.AddItem(item))
481 //{ 483 {
482 // try 484 ret = BackendResponse.Success;
483 // { 485 }
484 // dbConnection.Open(); 486 else
485 487 {
486 // MySqlCommand command = new MySqlCommand( 488 ret = BackendResponse.Failure;
487 // "REPLACE INTO inventoryitems (assetID,assetType,inventoryName,inventoryDescription,inventoryNextPermissions," + 489 }
488 // "inventoryCurrentPermissions,invType,creatorID,inventoryBasePermissions,inventoryEveryOnePermissions,salePrice,saleType," +
489 // "creationDate,groupID,groupOwned,flags,inventoryID,avatarID,parentFolderID,inventoryGroupPermissions) VALUES " +
490
491 // "(?assetID,?assetType,?inventoryName,?inventoryDescription,?inventoryNextPermissions,?inventoryCurrentPermissions,?invType," +
492 // "?creatorID,?inventoryBasePermissions,?inventoryEveryOnePermissions,?salePrice,?saleType,?creationDate,?groupID,?groupOwned," +
493 // "?flags,?inventoryID,?avatarID,?parentFolderID,?inventoryGroupPermissions)", dbConnection);
494
495 // command.Parameters.AddWithValue("?assetID", item.AssetID.ToString());
496 // command.Parameters.AddWithValue("?assetType", item.AssetType);
497 // command.Parameters.AddWithValue("?inventoryName", item.Name);
498 // command.Parameters.AddWithValue("?inventoryDescription", item.Description);
499 // command.Parameters.AddWithValue("?inventoryNextPermissions", item.NextPermissions);
500 // command.Parameters.AddWithValue("?inventoryCurrentPermissions", item.CurrentPermissions);
501 // command.Parameters.AddWithValue("?invType", item.InvType);
502 // command.Parameters.AddWithValue("?creatorID", item.Creator.ToString());
503 // command.Parameters.AddWithValue("?inventoryBasePermissions", item.BasePermissions);
504 // command.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions);
505 // command.Parameters.AddWithValue("?salePrice", item.SalePrice);
506 // command.Parameters.AddWithValue("?saleType", item.SaleType);
507 // command.Parameters.AddWithValue("?creationDate", item.CreationDate);
508 // command.Parameters.AddWithValue("?groupID", item.GroupID.ToString());
509 // command.Parameters.AddWithValue("?groupOwned", item.GroupOwned);
510 // command.Parameters.AddWithValue("?flags", item.Flags);
511 // command.Parameters.AddWithValue("?inventoryID", item.ID);
512 // command.Parameters.AddWithValue("?avatarID", item.Owner);
513 // command.Parameters.AddWithValue("?parentFolderID", item.Folder);
514 // command.Parameters.AddWithValue("?inventoryGroupPermissions", item.GroupPermissions);
515
516 // int rowsAffected = command.ExecuteNonQuery();
517 // if (rowsAffected == 1)
518 // {
519 // ret = BackendResponse.Success;
520 // }
521 // else if (rowsAffected == 2)
522 // {
523 // m_log.Info("[OPENSIMINVENTORYSTORAGE]: Replaced inventory item " + item.ID.ToString());
524 // ret = BackendResponse.Success;
525 // }
526 // else
527 // {
528 // m_log.ErrorFormat("[OPENSIMINVENTORYSTORAGE]: MySQL REPLACE query affected {0} rows", rowsAffected);
529 // ret = BackendResponse.Failure;
530 // }
531 // }
532 // catch (MySqlException ex)
533 // {
534 // m_log.Error("[OPENSIMINVENTORYSTORAGE]: Connection to MySQL backend failed: " + ex.Message);
535 // ret = BackendResponse.Failure;
536 // }
537 //}
538 490
539 //m_server.MetricsProvider.LogInventoryCreate(EXTENSION_NAME, ret, owner, false, DateTime.Now); 491 m_server.MetricsProvider.LogInventoryCreate(EXTENSION_NAME, ret, owner, false, DateTime.Now);
540 //return ret; 492 return ret;
541 return BackendResponse.Success;
542 } 493 }
543 494
544 public BackendResponse TryCreateFolder(Uri owner, InventoryFolder folder) 495 public BackendResponse TryCreateFolder(Uri owner, InventoryFolderWithChildren folder)
545 { 496 {
546 //BackendResponse ret; 497 //BackendResponse ret;
547 498
@@ -590,7 +541,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
590 return BackendResponse.Success; 541 return BackendResponse.Success;
591 } 542 }
592 543
593 public BackendResponse TryCreateInventory(Uri owner, InventoryFolder rootFolder) 544 public BackendResponse TryCreateInventory(Uri owner, InventoryFolderWithChildren rootFolder)
594 { 545 {
595 return TryCreateFolder(owner, rootFolder); 546 return TryCreateFolder(owner, rootFolder);
596 } 547 }
@@ -692,60 +643,19 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
692 643
693 public BackendResponse TryPurgeFolder(Uri owner, UUID folderID) 644 public BackendResponse TryPurgeFolder(Uri owner, UUID folderID)
694 { 645 {
695 //BackendResponse ret; 646 BackendResponse ret;
696 //UUID ownerID;
697 647
698 //if (Utils.TryGetOpenSimUUID(owner, out ownerID)) 648 if (m_inventoryService.PurgeFolder(m_inventoryService.GetInventoryFolder(folderID)))
699 //{ 649 {
700 // using (MySqlConnection dbConnection = new MySqlConnection(m_openSimConfig.GetString("inventory_database_connect"))) 650 ret = BackendResponse.Success;
701 // { 651 }
702 // try 652 else
703 // { 653 {
704 // dbConnection.Open(); 654 ret = BackendResponse.Failure;
705 655 }
706 // #region Delete items
707
708 // MySqlCommand command = new MySqlCommand(
709 // "DELETE FROM inventoryitems WHERE parentFolderID=?parentFolderID AND avatarID=?avatarID", dbConnection);
710
711 // command.Parameters.AddWithValue("?parentFolderID", folderID.ToString());
712 // command.Parameters.AddWithValue("?avatarID", ownerID.ToString());
713
714 // int rowsAffected = command.ExecuteNonQuery();
715
716 // #endregion Delete items
717
718 // #region Delete folders
719
720 // command = new MySqlCommand(
721 // "DELETE FROM inventoryfolders WHERE parentFolderID=?parentFolderID AND agentID=?agentID", dbConnection);
722
723 // command.Parameters.AddWithValue("?parentFolderID", folderID.ToString());
724 // command.Parameters.AddWithValue("?agentID", ownerID.ToString());
725
726 // rowsAffected += command.ExecuteNonQuery();
727
728 // #endregion Delete folders
729
730 // m_log.DebugFormat("[OPENSIMINVENTORYSTORAGE]: Deleted {0} inventory objects from MySQL in a folder purge", rowsAffected);
731
732 // ret = BackendResponse.Success;
733 // }
734 // catch (MySqlException ex)
735 // {
736 // m_log.Error("[OPENSIMINVENTORYSTORAGE]: Connection to MySQL backend failed: " + ex.Message);
737 // ret = BackendResponse.Failure;
738 // }
739 // }
740 //}
741 //else
742 //{
743 // ret = BackendResponse.NotFound;
744 //}
745 656
746 //m_server.MetricsProvider.LogInventoryPurgeFolder(EXTENSION_NAME, ret, owner, folderID, DateTime.Now); 657 m_server.MetricsProvider.LogInventoryPurgeFolder(EXTENSION_NAME, ret, owner, folderID, DateTime.Now);
747 //return ret; 658 return ret;
748 return BackendResponse.Success;
749 } 659 }
750 660
751 public int ForEach(Action<AssetMetadata> action, int start, int count) 661 public int ForEach(Action<AssetMetadata> action, int start, int count)
@@ -798,7 +708,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim
798 708
799 public void Initialise(AssetInventoryServer server) 709 public void Initialise(AssetInventoryServer server)
800 { 710 {
801 //m_server = server; 711 m_server = server;
802 m_openSimConfig = server.ConfigFile.Configs["OpenSim"]; 712 m_openSimConfig = server.ConfigFile.Configs["OpenSim"];
803 713
804 try 714 try
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs
index cab8700..4010818 100644
--- a/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/Simple/SimpleInventoryStoragePlugin.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 AssetInventoryServer server; 45 AssetInventoryServer server;
46 Dictionary<Uri, InventoryCollection> inventories = new Dictionary<Uri, InventoryCollection>(); 46 Dictionary<Uri, InventoryCollection> inventories = new Dictionary<Uri, InventoryCollection>();
47 Dictionary<Uri, List<InventoryItem>> activeGestures = new Dictionary<Uri, List<InventoryItem>>(); 47 Dictionary<Uri, List<InventoryItemBase>> activeGestures = new Dictionary<Uri, List<InventoryItemBase>>();
48 Utils.InventoryItemSerializer itemSerializer = new Utils.InventoryItemSerializer(); 48 Utils.InventoryItemSerializer itemSerializer = new Utils.InventoryItemSerializer();
49 Utils.InventoryFolderSerializer folderSerializer = new Utils.InventoryFolderSerializer(); 49 Utils.InventoryFolderSerializer folderSerializer = new Utils.InventoryFolderSerializer();
50 50
@@ -54,7 +54,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
54 54
55 #region Required Interfaces 55 #region Required Interfaces
56 56
57 public BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItem item) 57 public BackendResponse TryFetchItem(Uri owner, UUID itemID, out InventoryItemBase item)
58 { 58 {
59 item = null; 59 item = null;
60 BackendResponse ret; 60 BackendResponse ret;
@@ -69,7 +69,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
69 return ret; 69 return ret;
70 } 70 }
71 71
72 public BackendResponse TryFetchFolder(Uri owner, UUID folderID, out InventoryFolder folder) 72 public BackendResponse TryFetchFolder(Uri owner, UUID folderID, out InventoryFolderWithChildren folder)
73 { 73 {
74 folder = null; 74 folder = null;
75 BackendResponse ret; 75 BackendResponse ret;
@@ -90,25 +90,25 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
90 BackendResponse ret; 90 BackendResponse ret;
91 91
92 InventoryCollection collection; 92 InventoryCollection collection;
93 InventoryFolder folder; 93 InventoryFolderWithChildren folder;
94 94
95 if (inventories.TryGetValue(owner, out collection) && collection.Folders.TryGetValue(folderID, out folder)) 95 if (inventories.TryGetValue(owner, out collection) && collection.Folders.TryGetValue(folderID, out folder))
96 { 96 {
97 contents = new InventoryCollection(); 97 contents = new InventoryCollection();
98 contents.UserID = collection.UserID; 98 contents.UserID = collection.UserID;
99 contents.Folders = new Dictionary<UUID, InventoryFolder>(); 99 contents.Folders = new Dictionary<UUID, InventoryFolderWithChildren>();
100 contents.Items = new Dictionary<UUID, InventoryItem>(); 100 contents.Items = new Dictionary<UUID, InventoryItemBase>();
101 101
102 foreach (InventoryBase invBase in folder.Children.Values) 102 foreach (InventoryNodeBase invBase in folder.Children.Values)
103 { 103 {
104 if (invBase is InventoryItem) 104 if (invBase is InventoryItemBase)
105 { 105 {
106 InventoryItem invItem = invBase as InventoryItem; 106 InventoryItemBase invItem = invBase as InventoryItemBase;
107 contents.Items.Add(invItem.ID, invItem); 107 contents.Items.Add(invItem.ID, invItem);
108 } 108 }
109 else 109 else
110 { 110 {
111 InventoryFolder invFolder = invBase as InventoryFolder; 111 InventoryFolderWithChildren invFolder = invBase as InventoryFolderWithChildren;
112 contents.Folders.Add(invFolder.ID, invFolder); 112 contents.Folders.Add(invFolder.ID, invFolder);
113 } 113 }
114 } 114 }
@@ -124,7 +124,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
124 return ret; 124 return ret;
125 } 125 }
126 126
127 public BackendResponse TryFetchFolderList(Uri owner, out List<InventoryFolder> folders) 127 public BackendResponse TryFetchFolderList(Uri owner, out List<InventoryFolderWithChildren> folders)
128 { 128 {
129 folders = null; 129 folders = null;
130 BackendResponse ret; 130 BackendResponse ret;
@@ -132,7 +132,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
132 InventoryCollection collection; 132 InventoryCollection collection;
133 if (inventories.TryGetValue(owner, out collection)) 133 if (inventories.TryGetValue(owner, out collection))
134 { 134 {
135 folders = new List<InventoryFolder>(collection.Folders.Values); 135 folders = new List<InventoryFolderWithChildren>(collection.Folders.Values);
136 return BackendResponse.Success; 136 return BackendResponse.Success;
137 } 137 }
138 else 138 else
@@ -158,7 +158,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
158 return ret; 158 return ret;
159 } 159 }
160 160
161 public BackendResponse TryFetchActiveGestures(Uri owner, out List<InventoryItem> gestures) 161 public BackendResponse TryFetchActiveGestures(Uri owner, out List<InventoryItemBase> gestures)
162 { 162 {
163 gestures = null; 163 gestures = null;
164 BackendResponse ret; 164 BackendResponse ret;
@@ -172,7 +172,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
172 return ret; 172 return ret;
173 } 173 }
174 174
175 public BackendResponse TryCreateItem(Uri owner, InventoryItem item) 175 public BackendResponse TryCreateItem(Uri owner, InventoryItemBase item)
176 { 176 {
177 BackendResponse ret; 177 BackendResponse ret;
178 178
@@ -180,7 +180,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
180 if (inventories.TryGetValue(owner, out collection)) 180 if (inventories.TryGetValue(owner, out collection))
181 { 181 {
182 // Delete this item first if it already exists 182 // Delete this item first if it already exists
183 InventoryItem oldItem; 183 InventoryItemBase oldItem;
184 if (collection.Items.TryGetValue(item.ID, out oldItem)) 184 if (collection.Items.TryGetValue(item.ID, out oldItem))
185 TryDeleteItem(owner, item.ID); 185 TryDeleteItem(owner, item.ID);
186 186
@@ -193,7 +193,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
193 lock (collection) collection.Items[item.ID] = item; 193 lock (collection) collection.Items[item.ID] = item;
194 194
195 // Add the item to its parent folder 195 // Add the item to its parent folder
196 InventoryFolder parent; 196 InventoryFolderWithChildren parent;
197 if (collection.Folders.TryGetValue(item.Folder, out parent)) 197 if (collection.Folders.TryGetValue(item.Folder, out parent))
198 lock (parent.Children) parent.Children.Add(item.ID, item); 198 lock (parent.Children) parent.Children.Add(item.ID, item);
199 199
@@ -221,7 +221,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
221 return ret; 221 return ret;
222 } 222 }
223 223
224 public BackendResponse TryCreateFolder(Uri owner, InventoryFolder folder) 224 public BackendResponse TryCreateFolder(Uri owner, InventoryFolderWithChildren folder)
225 { 225 {
226 BackendResponse ret; 226 BackendResponse ret;
227 227
@@ -229,7 +229,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
229 if (inventories.TryGetValue(owner, out collection)) 229 if (inventories.TryGetValue(owner, out collection))
230 { 230 {
231 // Delete this folder first if it already exists 231 // Delete this folder first if it already exists
232 InventoryFolder oldFolder; 232 InventoryFolderWithChildren oldFolder;
233 if (collection.Folders.TryGetValue(folder.ID, out oldFolder)) 233 if (collection.Folders.TryGetValue(folder.ID, out oldFolder))
234 TryDeleteFolder(owner, folder.ID); 234 TryDeleteFolder(owner, folder.ID);
235 235
@@ -242,7 +242,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
242 lock (collection) collection.Folders[folder.ID] = folder; 242 lock (collection) collection.Folders[folder.ID] = folder;
243 243
244 // Add the folder to its parent folder 244 // Add the folder to its parent folder
245 InventoryFolder parent; 245 InventoryFolderWithChildren parent;
246 if (collection.Folders.TryGetValue(folder.ParentID, out parent)) 246 if (collection.Folders.TryGetValue(folder.ParentID, out parent))
247 lock (parent.Children) parent.Children.Add(folder.ID, folder); 247 lock (parent.Children) parent.Children.Add(folder.ID, folder);
248 248
@@ -263,7 +263,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
263 return ret; 263 return ret;
264 } 264 }
265 265
266 public BackendResponse TryCreateInventory(Uri owner, InventoryFolder rootFolder) 266 public BackendResponse TryCreateInventory(Uri owner, InventoryFolderWithChildren rootFolder)
267 { 267 {
268 BackendResponse ret; 268 BackendResponse ret;
269 269
@@ -273,9 +273,9 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
273 { 273 {
274 InventoryCollection collection = new InventoryCollection(); 274 InventoryCollection collection = new InventoryCollection();
275 collection.UserID = rootFolder.Owner; 275 collection.UserID = rootFolder.Owner;
276 collection.Folders = new Dictionary<UUID, InventoryFolder>(); 276 collection.Folders = new Dictionary<UUID, InventoryFolderWithChildren>();
277 collection.Folders.Add(rootFolder.ID, rootFolder); 277 collection.Folders.Add(rootFolder.ID, rootFolder);
278 collection.Items = new Dictionary<UUID, InventoryItem>(); 278 collection.Items = new Dictionary<UUID, InventoryItemBase>();
279 279
280 inventories.Add(owner, collection); 280 inventories.Add(owner, collection);
281 281
@@ -318,11 +318,11 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
318 BackendResponse ret; 318 BackendResponse ret;
319 319
320 InventoryCollection collection; 320 InventoryCollection collection;
321 InventoryItem item; 321 InventoryItemBase item;
322 if (inventories.TryGetValue(owner, out collection) && collection.Items.TryGetValue(itemID, out item)) 322 if (inventories.TryGetValue(owner, out collection) && collection.Items.TryGetValue(itemID, out item))
323 { 323 {
324 // Remove the item from its parent folder 324 // Remove the item from its parent folder
325 InventoryFolder parent; 325 InventoryFolderWithChildren parent;
326 if (collection.Folders.TryGetValue(item.Folder, out parent)) 326 if (collection.Folders.TryGetValue(item.Folder, out parent))
327 lock (parent.Children) parent.Children.Remove(itemID); 327 lock (parent.Children) parent.Children.Remove(itemID);
328 328
@@ -371,11 +371,11 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
371 BackendResponse ret; 371 BackendResponse ret;
372 372
373 InventoryCollection collection; 373 InventoryCollection collection;
374 InventoryFolder folder; 374 InventoryFolderWithChildren folder;
375 if (inventories.TryGetValue(owner, out collection) && collection.Folders.TryGetValue(folderID, out folder)) 375 if (inventories.TryGetValue(owner, out collection) && collection.Folders.TryGetValue(folderID, out folder))
376 { 376 {
377 // Remove the folder from its parent folder 377 // Remove the folder from its parent folder
378 InventoryFolder parent; 378 InventoryFolderWithChildren parent;
379 if (collection.Folders.TryGetValue(folder.ParentID, out parent)) 379 if (collection.Folders.TryGetValue(folder.ParentID, out parent))
380 lock (parent.Children) parent.Children.Remove(folderID); 380 lock (parent.Children) parent.Children.Remove(folderID);
381 381
@@ -408,19 +408,19 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
408 BackendResponse ret; 408 BackendResponse ret;
409 409
410 InventoryCollection collection; 410 InventoryCollection collection;
411 InventoryFolder folder; 411 InventoryFolderWithChildren folder;
412 if (inventories.TryGetValue(owner, out collection) && collection.Folders.TryGetValue(folderID, out folder)) 412 if (inventories.TryGetValue(owner, out collection) && collection.Folders.TryGetValue(folderID, out folder))
413 { 413 {
414 // Delete all of the folder children 414 // Delete all of the folder children
415 foreach (InventoryBase obj in new List<InventoryBase>(folder.Children.Values)) 415 foreach (InventoryNodeBase obj in new List<InventoryNodeBase>(folder.Children.Values))
416 { 416 {
417 if (obj is InventoryItem) 417 if (obj is InventoryItemBase)
418 { 418 {
419 TryDeleteItem(owner, (obj as InventoryItem).ID); 419 TryDeleteItem(owner, (obj as InventoryItemBase).ID);
420 } 420 }
421 else 421 else
422 { 422 {
423 InventoryFolder childFolder = obj as InventoryFolder; 423 InventoryFolderWithChildren childFolder = obj as InventoryFolderWithChildren;
424 TryPurgeFolder(owner, childFolder.ID); 424 TryPurgeFolder(owner, childFolder.ID);
425 TryDeleteFolder(owner, childFolder.ID); 425 TryDeleteFolder(owner, childFolder.ID);
426 } 426 }
@@ -439,7 +439,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
439 439
440 #endregion Required Interfaces 440 #endregion Required Interfaces
441 441
442 void SaveItem(InventoryItem item) 442 void SaveItem(InventoryItemBase item)
443 { 443 {
444 string filename = String.Format("{0}-{1}.item", SanitizeFilename(item.Name), item.ID); 444 string filename = String.Format("{0}-{1}.item", SanitizeFilename(item.Name), item.ID);
445 445
@@ -453,7 +453,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
453 } 453 }
454 } 454 }
455 455
456 void SaveFolder(InventoryFolder folder) 456 void SaveFolder(InventoryFolderWithChildren folder)
457 { 457 {
458 string filename = String.Format("{0}-{1}.folder", SanitizeFilename(folder.Name), folder.ID); 458 string filename = String.Format("{0}-{1}.folder", SanitizeFilename(folder.Name), folder.ID);
459 459
@@ -530,42 +530,42 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.Simple
530 if (ownerID != UUID.Zero && owner != null) 530 if (ownerID != UUID.Zero && owner != null)
531 { 531 {
532 // Initialize the active gestures list for this agent 532 // Initialize the active gestures list for this agent
533 activeGestures.Add(owner, new List<InventoryItem>()); 533 activeGestures.Add(owner, new List<InventoryItemBase>());
534 534
535 InventoryCollection collection = new InventoryCollection(); 535 InventoryCollection collection = new InventoryCollection();
536 collection.UserID = ownerID; 536 collection.UserID = ownerID;
537 537
538 // Load all of the folders for this agent 538 // Load all of the folders for this agent
539 string[] folders = Directory.GetFiles(foldername, "*.folder", SearchOption.TopDirectoryOnly); 539 string[] folders = Directory.GetFiles(foldername, "*.folder", SearchOption.TopDirectoryOnly);
540 collection.Folders = new Dictionary<UUID,InventoryFolder>(folders.Length); 540 collection.Folders = new Dictionary<UUID,InventoryFolderWithChildren>(folders.Length);
541 541
542 for (int j = 0; j < folders.Length; j++) 542 for (int j = 0; j < folders.Length; j++)
543 { 543 {
544 InventoryFolder invFolder = (InventoryFolder)folderSerializer.Deserialize( 544 InventoryFolderWithChildren invFolder = (InventoryFolderWithChildren)folderSerializer.Deserialize(
545 new FileStream(folders[j], FileMode.Open, FileAccess.Read)); 545 new FileStream(folders[j], FileMode.Open, FileAccess.Read));
546 collection.Folders[invFolder.ID] = invFolder; 546 collection.Folders[invFolder.ID] = invFolder;
547 } 547 }
548 548
549 // Iterate over the folders collection, adding children to their parents 549 // Iterate over the folders collection, adding children to their parents
550 foreach (InventoryFolder invFolder in collection.Folders.Values) 550 foreach (InventoryFolderWithChildren invFolder in collection.Folders.Values)
551 { 551 {
552 InventoryFolder parent; 552 InventoryFolderWithChildren parent;
553 if (collection.Folders.TryGetValue(invFolder.ParentID, out parent)) 553 if (collection.Folders.TryGetValue(invFolder.ParentID, out parent))
554 parent.Children[invFolder.ID] = invFolder; 554 parent.Children[invFolder.ID] = invFolder;
555 } 555 }
556 556
557 // Load all of the items for this agent 557 // Load all of the items for this agent
558 string[] files = Directory.GetFiles(foldername, "*.item", SearchOption.TopDirectoryOnly); 558 string[] files = Directory.GetFiles(foldername, "*.item", SearchOption.TopDirectoryOnly);
559 collection.Items = new Dictionary<UUID, InventoryItem>(files.Length); 559 collection.Items = new Dictionary<UUID, InventoryItemBase>(files.Length);
560 560
561 for (int j = 0; j < files.Length; j++) 561 for (int j = 0; j < files.Length; j++)
562 { 562 {
563 InventoryItem invItem = (InventoryItem)itemSerializer.Deserialize( 563 InventoryItemBase invItem = (InventoryItemBase)itemSerializer.Deserialize(
564 new FileStream(files[j], FileMode.Open, FileAccess.Read)); 564 new FileStream(files[j], FileMode.Open, FileAccess.Read));
565 collection.Items[invItem.ID] = invItem; 565 collection.Items[invItem.ID] = invItem;
566 566
567 // Add items to their parent folders 567 // Add items to their parent folders
568 InventoryFolder parent; 568 InventoryFolderWithChildren parent;
569 if (collection.Folders.TryGetValue(invItem.Folder, out parent)) 569 if (collection.Folders.TryGetValue(invItem.Folder, out parent))
570 parent.Children[invItem.ID] = invItem; 570 parent.Children[invItem.ID] = invItem;
571 571
diff --git a/OpenSim/Grid/AssetInventoryServer/Utils.cs b/OpenSim/Grid/AssetInventoryServer/Utils.cs
index cc59051..58b0c67 100644
--- a/OpenSim/Grid/AssetInventoryServer/Utils.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Utils.cs
@@ -30,6 +30,7 @@ using System.Globalization;
30using System.Xml; 30using System.Xml;
31using System.Xml.Serialization; 31using System.Xml.Serialization;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework;
33using OpenSim.Framework.Servers; 34using OpenSim.Framework.Servers;
34 35
35namespace OpenSim.Grid.AssetInventoryServer 36namespace OpenSim.Grid.AssetInventoryServer
@@ -278,9 +279,9 @@ namespace OpenSim.Grid.AssetInventoryServer
278 return ReadObject_InventoryCollection(true, true); 279 return ReadObject_InventoryCollection(true, true);
279 } 280 }
280 281
281 public InventoryFolder ReadObject_InventoryFolder(bool isNullable, bool checkType) 282 public InventoryFolderWithChildren ReadObject_InventoryFolder(bool isNullable, bool checkType)
282 { 283 {
283 InventoryFolder ob = null; 284 InventoryFolderWithChildren ob = null;
284 if (isNullable && ReadNull()) return null; 285 if (isNullable && ReadNull()) return null;
285 286
286 if (checkType) 287 if (checkType)
@@ -292,7 +293,7 @@ namespace OpenSim.Grid.AssetInventoryServer
292 throw CreateUnknownTypeException(t); 293 throw CreateUnknownTypeException(t);
293 } 294 }
294 295
295 ob = (InventoryFolder)Activator.CreateInstance(typeof(InventoryFolder), true); 296 ob = (InventoryFolderWithChildren)Activator.CreateInstance(typeof(InventoryFolderWithChildren), true);
296 297
297 Reader.MoveToElement(); 298 Reader.MoveToElement();
298 299
@@ -373,9 +374,9 @@ namespace OpenSim.Grid.AssetInventoryServer
373 return ob; 374 return ob;
374 } 375 }
375 376
376 public InventoryItem ReadObject_InventoryItem(bool isNullable, bool checkType) 377 public InventoryItemBase ReadObject_InventoryItem(bool isNullable, bool checkType)
377 { 378 {
378 InventoryItem ob = null; 379 InventoryItemBase ob = null;
379 if (isNullable && ReadNull()) return null; 380 if (isNullable && ReadNull()) return null;
380 381
381 if (checkType) 382 if (checkType)
@@ -387,7 +388,7 @@ namespace OpenSim.Grid.AssetInventoryServer
387 throw CreateUnknownTypeException(t); 388 throw CreateUnknownTypeException(t);
388 } 389 }
389 390
390 ob = (InventoryItem)Activator.CreateInstance(typeof(InventoryItem), true); 391 ob = (InventoryItemBase)Activator.CreateInstance(typeof(InventoryItemBase), true);
391 392
392 Reader.MoveToElement(); 393 Reader.MoveToElement();
393 394
@@ -585,11 +586,11 @@ namespace OpenSim.Grid.AssetInventoryServer
585 Reader.Skip(); 586 Reader.Skip();
586 if (ob.@Folders == null) 587 if (ob.@Folders == null)
587 { 588 {
588 ob.@Folders = new System.Collections.Generic.Dictionary<UUID, InventoryFolder>(); 589 ob.@Folders = new System.Collections.Generic.Dictionary<UUID, InventoryFolderWithChildren>();
589 } 590 }
590 if (ob.@Items == null) 591 if (ob.@Items == null)
591 { 592 {
592 ob.@Items = new System.Collections.Generic.Dictionary<UUID, InventoryItem>(); 593 ob.@Items = new System.Collections.Generic.Dictionary<UUID, InventoryItemBase>();
593 } 594 }
594 return ob; 595 return ob;
595 } 596 }
@@ -610,10 +611,10 @@ namespace OpenSim.Grid.AssetInventoryServer
610 } 611 }
611 else if (Reader.LocalName == "Items" && Reader.NamespaceURI == "" && !b44) 612 else if (Reader.LocalName == "Items" && Reader.NamespaceURI == "" && !b44)
612 { 613 {
613 System.Collections.Generic.Dictionary<UUID, InventoryItem> o46 = ob.@Items; 614 System.Collections.Generic.Dictionary<UUID, InventoryItemBase> o46 = ob.@Items;
614 if (((object)o46) == null) 615 if (((object)o46) == null)
615 { 616 {
616 o46 = new System.Collections.Generic.Dictionary<UUID, InventoryItem>(); 617 o46 = new System.Collections.Generic.Dictionary<UUID, InventoryItemBase>();
617 ob.@Items = o46; 618 ob.@Items = o46;
618 } 619 }
619 if (Reader.IsEmptyElement) 620 if (Reader.IsEmptyElement)
@@ -634,7 +635,7 @@ namespace OpenSim.Grid.AssetInventoryServer
634 { 635 {
635 if (((object)o46) == null) 636 if (((object)o46) == null)
636 throw CreateReadOnlyCollectionException("System.Collections.Generic.List<InventoryItemBase>"); 637 throw CreateReadOnlyCollectionException("System.Collections.Generic.List<InventoryItemBase>");
637 InventoryItem item = ReadObject_InventoryItem(true, true); 638 InventoryItemBase item = ReadObject_InventoryItem(true, true);
638 o46.Add(item.ID, item); 639 o46.Add(item.ID, item);
639 n47++; 640 n47++;
640 } 641 }
@@ -650,10 +651,10 @@ namespace OpenSim.Grid.AssetInventoryServer
650 } 651 }
651 else if (Reader.LocalName == "Folders" && Reader.NamespaceURI == "" && !b43) 652 else if (Reader.LocalName == "Folders" && Reader.NamespaceURI == "" && !b43)
652 { 653 {
653 System.Collections.Generic.Dictionary<UUID, InventoryFolder> o48 = ob.@Folders; 654 System.Collections.Generic.Dictionary<UUID, InventoryFolderWithChildren> o48 = ob.@Folders;
654 if (((object)o48) == null) 655 if (((object)o48) == null)
655 { 656 {
656 o48 = new System.Collections.Generic.Dictionary<UUID, InventoryFolder>(); 657 o48 = new System.Collections.Generic.Dictionary<UUID, InventoryFolderWithChildren>();
657 ob.@Folders = o48; 658 ob.@Folders = o48;
658 } 659 }
659 if (Reader.IsEmptyElement) 660 if (Reader.IsEmptyElement)
@@ -674,7 +675,7 @@ namespace OpenSim.Grid.AssetInventoryServer
674 { 675 {
675 if (((object)o48) == null) 676 if (((object)o48) == null)
676 throw CreateReadOnlyCollectionException("System.Collections.Generic.List<InventoryFolderBase>"); 677 throw CreateReadOnlyCollectionException("System.Collections.Generic.List<InventoryFolderBase>");
677 InventoryFolder folder = ReadObject_InventoryFolder(true, true); 678 InventoryFolderWithChildren folder = ReadObject_InventoryFolder(true, true);
678 o48.Add(folder.ID, folder); 679 o48.Add(folder.ID, folder);
679 n49++; 680 n49++;
680 } 681 }
@@ -700,11 +701,11 @@ namespace OpenSim.Grid.AssetInventoryServer
700 } 701 }
701 if (ob.@Folders == null) 702 if (ob.@Folders == null)
702 { 703 {
703 ob.@Folders = new System.Collections.Generic.Dictionary<UUID, InventoryFolder>(); 704 ob.@Folders = new System.Collections.Generic.Dictionary<UUID, InventoryFolderWithChildren>();
704 } 705 }
705 if (ob.@Items == null) 706 if (ob.@Items == null)
706 { 707 {
707 ob.@Items = new System.Collections.Generic.Dictionary<UUID, InventoryItem>(); 708 ob.@Items = new System.Collections.Generic.Dictionary<UUID, InventoryItemBase>();
708 } 709 }
709 710
710 ReadEndElement(); 711 ReadEndElement();
@@ -793,7 +794,7 @@ namespace OpenSim.Grid.AssetInventoryServer
793 public void WriteRoot_InventoryFolder(object o) 794 public void WriteRoot_InventoryFolder(object o)
794 { 795 {
795 WriteStartDocument(); 796 WriteStartDocument();
796 InventoryFolder ob = (InventoryFolder)o; 797 InventoryFolderWithChildren ob = (InventoryFolderWithChildren)o;
797 TopLevelElement(); 798 TopLevelElement();
798 WriteObject_InventoryFolder(ob, "InventoryFolderBase", "", true, false, true); 799 WriteObject_InventoryFolder(ob, "InventoryFolderBase", "", true, false, true);
799 } 800 }
@@ -801,7 +802,7 @@ namespace OpenSim.Grid.AssetInventoryServer
801 public void WriteRoot_InventoryItem(object o) 802 public void WriteRoot_InventoryItem(object o)
802 { 803 {
803 WriteStartDocument(); 804 WriteStartDocument();
804 InventoryItem ob = (InventoryItem)o; 805 InventoryItemBase ob = (InventoryItemBase)o;
805 TopLevelElement(); 806 TopLevelElement();
806 WriteObject_InventoryItem(ob, "InventoryItemBase", "", true, false, true); 807 WriteObject_InventoryItem(ob, "InventoryItemBase", "", true, false, true);
807 } 808 }
@@ -814,7 +815,7 @@ namespace OpenSim.Grid.AssetInventoryServer
814 WriteObject_InventoryCollection(ob, "InventoryCollection", "", true, false, true); 815 WriteObject_InventoryCollection(ob, "InventoryCollection", "", true, false, true);
815 } 816 }
816 817
817 void WriteObject_InventoryFolder(InventoryFolder ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) 818 void WriteObject_InventoryFolder(InventoryFolderWithChildren ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
818 { 819 {
819 if (((object)ob) == null) 820 if (((object)ob) == null)
820 { 821 {
@@ -824,7 +825,7 @@ namespace OpenSim.Grid.AssetInventoryServer
824 } 825 }
825 826
826 System.Type type = ob.GetType(); 827 System.Type type = ob.GetType();
827 if (type == typeof(InventoryFolder)) 828 if (type == typeof(InventoryFolderWithChildren))
828 { } 829 { }
829 else 830 else
830 { 831 {
@@ -847,7 +848,7 @@ namespace OpenSim.Grid.AssetInventoryServer
847 if (writeWrappingElem) WriteEndElement(ob); 848 if (writeWrappingElem) WriteEndElement(ob);
848 } 849 }
849 850
850 void WriteObject_InventoryItem(InventoryItem ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) 851 void WriteObject_InventoryItem(InventoryItemBase ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
851 { 852 {
852 if (((object)ob) == null) 853 if (((object)ob) == null)
853 { 854 {
@@ -857,7 +858,7 @@ namespace OpenSim.Grid.AssetInventoryServer
857 } 858 }
858 859
859 System.Type type = ob.GetType(); 860 System.Type type = ob.GetType();
860 if (type == typeof(InventoryItem)) 861 if (type == typeof(InventoryItemBase))
861 { } 862 { }
862 else 863 else
863 { 864 {
@@ -921,7 +922,7 @@ namespace OpenSim.Grid.AssetInventoryServer
921 if (ob.@Folders != null) 922 if (ob.@Folders != null)
922 { 923 {
923 WriteStartElement("Folders", "", ob.@Folders); 924 WriteStartElement("Folders", "", ob.@Folders);
924 foreach (InventoryFolder folder in ob.Folders.Values) 925 foreach (InventoryFolderWithChildren folder in ob.Folders.Values)
925 { 926 {
926 WriteObject_InventoryFolder(folder, "InventoryFolderBase", "", true, false, true); 927 WriteObject_InventoryFolder(folder, "InventoryFolderBase", "", true, false, true);
927 } 928 }
@@ -930,7 +931,7 @@ namespace OpenSim.Grid.AssetInventoryServer
930 if (ob.@Items != null) 931 if (ob.@Items != null)
931 { 932 {
932 WriteStartElement("Items", "", ob.@Items); 933 WriteStartElement("Items", "", ob.@Items);
933 foreach (InventoryItem item in ob.Items.Values) 934 foreach (InventoryItemBase item in ob.Items.Values)
934 { 935 {
935 WriteObject_InventoryItem(item, "InventoryItemBase", "", true, false, true); 936 WriteObject_InventoryItem(item, "InventoryItemBase", "", true, false, true);
936 } 937 }