aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorMike Mazur2009-02-03 05:20:26 +0000
committerMike Mazur2009-02-03 05:20:26 +0000
commit9377c6f2b28c75a093fa554d64e0d63e6bdf2fa5 (patch)
tree8dbd671990b4d6c5a40d369b0d026df8851b3e1f /OpenSim/Framework
parent- move IAssetDataPlugin from OpenSim/Framework/IAssetProvider.cs to (diff)
downloadopensim-SC-9377c6f2b28c75a093fa554d64e0d63e6bdf2fa5.zip
opensim-SC-9377c6f2b28c75a093fa554d64e0d63e6bdf2fa5.tar.gz
opensim-SC-9377c6f2b28c75a093fa554d64e0d63e6bdf2fa5.tar.bz2
opensim-SC-9377c6f2b28c75a093fa554d64e0d63e6bdf2fa5.tar.xz
- move OpenSim/Framework/IInventoryData.cs to
OpenSim/Data/IInventoryData.cs - trim trailing whitespace
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/InventoryServiceBase.cs6
-rw-r--r--OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs111
-rw-r--r--OpenSim/Framework/IInventoryData.cs156
3 files changed, 60 insertions, 213 deletions
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs
index 7a44420..ec5c493 100644
--- a/OpenSim/Framework/Communications/InventoryServiceBase.cs
+++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs
@@ -33,6 +33,8 @@ using System.Threading;
33using OpenMetaverse; 33using OpenMetaverse;
34using log4net; 34using log4net;
35 35
36using OpenSim.Data;
37
36namespace OpenSim.Framework.Communications 38namespace OpenSim.Framework.Communications
37{ 39{
38 /// <summary> 40 /// <summary>
@@ -50,12 +52,12 @@ namespace OpenSim.Framework.Communications
50 /// <summary> 52 /// <summary>
51 /// Add a new inventory data plugin - plugins will be requested in the order they were added. 53 /// Add a new inventory data plugin - plugins will be requested in the order they were added.
52 /// </summary> 54 /// </summary>
53 /// <param name="plugin">The plugin that will provide data</param> 55 /// <param name="plugin">The plugin that will provide data</param>
54 public void AddPlugin(IInventoryDataPlugin plugin) 56 public void AddPlugin(IInventoryDataPlugin plugin)
55 { 57 {
56 m_plugins.Add(plugin); 58 m_plugins.Add(plugin);
57 } 59 }
58 60
59 /// <summary> 61 /// <summary>
60 /// Adds a new inventory data plugin - plugins will be requested in the order they were loaded. 62 /// Adds a new inventory data plugin - plugins will be requested in the order they were loaded.
61 /// </summary> 63 /// </summary>
diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
index 827a03b..86d85b1 100644
--- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
+++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
@@ -30,19 +30,20 @@ using log4net;
30using NUnit.Framework; 30using NUnit.Framework;
31using NUnit.Framework.SyntaxHelpers; 31using NUnit.Framework.SyntaxHelpers;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework; 33//using OpenSim.Framework;
34using OpenSim.Framework.Communications.Cache; 34using OpenSim.Framework.Communications.Cache;
35using OpenSim.Region.Communications.Local; 35using OpenSim.Region.Communications.Local;
36using OpenSim.Tests.Common.Mock; 36using OpenSim.Tests.Common.Mock;
37using OpenSim.Data;
37 38
38namespace OpenSim.Framework.Communications.Tests 39namespace OpenSim.Framework.Communications.Tests
39{ 40{
40 /// <summary> 41 /// <summary>
41 /// User profile cache service tests 42 /// User profile cache service tests
42 /// </summary> 43 /// </summary>
43 [TestFixture] 44 [TestFixture]
44 public class UserProfileCacheServiceTests 45 public class UserProfileCacheServiceTests
45 { 46 {
46 /// <summary> 47 /// <summary>
47 /// Test user details get. 48 /// Test user details get.
48 /// </summary> 49 /// </summary>
@@ -51,17 +52,17 @@ namespace OpenSim.Framework.Communications.Tests
51 { 52 {
52 UUID nonExistingUserId = UUID.Parse("00000000-0000-0000-0000-000000000001"); 53 UUID nonExistingUserId = UUID.Parse("00000000-0000-0000-0000-000000000001");
53 UUID existingUserId = UUID.Parse("00000000-0000-0000-0000-000000000002"); 54 UUID existingUserId = UUID.Parse("00000000-0000-0000-0000-000000000002");
54 55
55 TestCommunicationsManager commsManager = new TestCommunicationsManager(); 56 TestCommunicationsManager commsManager = new TestCommunicationsManager();
56 CachedUserInfo existingUserInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, existingUserId); 57 CachedUserInfo existingUserInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, existingUserId);
57 58
58 Assert.That(existingUserInfo, Is.Not.Null, "Existing user info unexpectedly not found"); 59 Assert.That(existingUserInfo, Is.Not.Null, "Existing user info unexpectedly not found");
59 60
60 CachedUserInfo nonExistingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(nonExistingUserId); 61 CachedUserInfo nonExistingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(nonExistingUserId);
61 62
62 Assert.That(nonExistingUserInfo, Is.Null, "Non existing user info unexpectedly found"); 63 Assert.That(nonExistingUserInfo, Is.Null, "Non existing user info unexpectedly found");
63 } 64 }
64 65
65 /// <summary> 66 /// <summary>
66 /// Test requesting inventory for a user 67 /// Test requesting inventory for a user
67 /// </summary> 68 /// </summary>
@@ -69,11 +70,11 @@ namespace OpenSim.Framework.Communications.Tests
69 public void TestRequestInventoryForUser() 70 public void TestRequestInventoryForUser()
70 { 71 {
71 TestCommunicationsManager commsManager = new TestCommunicationsManager(); 72 TestCommunicationsManager commsManager = new TestCommunicationsManager();
72 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); 73 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
73 74
74 Assert.That(userInfo.HasReceivedInventory, Is.True); 75 Assert.That(userInfo.HasReceivedInventory, Is.True);
75 } 76 }
76 77
77 /// <summary> 78 /// <summary>
78 /// Test retrieving a child folder 79 /// Test retrieving a child folder
79 /// </summary> 80 /// </summary>
@@ -82,45 +83,45 @@ namespace OpenSim.Framework.Communications.Tests
82 { 83 {
83 TestCommunicationsManager commsManager = new TestCommunicationsManager(); 84 TestCommunicationsManager commsManager = new TestCommunicationsManager();
84 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); 85 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
85 86
86 UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011"); 87 UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011");
87 88
88 Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Null); 89 Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Null);
89 userInfo.CreateFolder("testFolder", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID); 90 userInfo.CreateFolder("testFolder", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID);
90 91
91 Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Not.Null); 92 Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Not.Null);
92 } 93 }
93 94
94 /// <summary> 95 /// <summary>
95 /// Test creating an inventory folder 96 /// Test creating an inventory folder
96 /// </summary> 97 /// </summary>
97 [Test] 98 [Test]
98 public void TestCreateFolder() 99 public void TestCreateFolder()
99 { 100 {
100 TestCommunicationsManager commsManager = new TestCommunicationsManager(); 101 TestCommunicationsManager commsManager = new TestCommunicationsManager();
101 IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin; 102 IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin;
102 103
103 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); 104 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
104 105
105 UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010"); 106 UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010");
106 Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.False); 107 Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.False);
107 108
108 // 1: Try a folder create that should fail because the parent id given does not exist 109 // 1: Try a folder create that should fail because the parent id given does not exist
109 UUID missingFolderId = UUID.Random(); 110 UUID missingFolderId = UUID.Random();
110 111
111 Assert.That( 112 Assert.That(
112 userInfo.CreateFolder("testFolder1", folderId, (ushort)AssetType.Animation, missingFolderId), Is.False); 113 userInfo.CreateFolder("testFolder1", folderId, (ushort)AssetType.Animation, missingFolderId), Is.False);
113 Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Null); 114 Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Null);
114 Assert.That(userInfo.RootFolder.ContainsChildFolder(missingFolderId), Is.False); 115 Assert.That(userInfo.RootFolder.ContainsChildFolder(missingFolderId), Is.False);
115 Assert.That(userInfo.RootFolder.FindFolder(folderId), Is.Null); 116 Assert.That(userInfo.RootFolder.FindFolder(folderId), Is.Null);
116 117
117 // 2: Try a folder create that should work 118 // 2: Try a folder create that should work
118 Assert.That( 119 Assert.That(
119 userInfo.CreateFolder("testFolder2", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID), Is.True); 120 userInfo.CreateFolder("testFolder2", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID), Is.True);
120 Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Not.Null); 121 Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Not.Null);
121 Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.True); 122 Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.True);
122 } 123 }
123 124
124 /// <summary> 125 /// <summary>
125 /// Test updating a folder 126 /// Test updating a folder
126 /// </summary> 127 /// </summary>
@@ -129,54 +130,54 @@ namespace OpenSim.Framework.Communications.Tests
129 { 130 {
130 TestCommunicationsManager commsManager = new TestCommunicationsManager(); 131 TestCommunicationsManager commsManager = new TestCommunicationsManager();
131 IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin; 132 IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin;
132 133
133 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); 134 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
134 135
135 UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); 136 UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
136 InventoryFolderImpl rootFolder = userInfo.RootFolder; 137 InventoryFolderImpl rootFolder = userInfo.RootFolder;
137 138
138 userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID); 139 userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID);
139 140
140 // 1: Test updates that don't involve moving the folder 141 // 1: Test updates that don't involve moving the folder
141 { 142 {
142 string newFolderName1 = "newFolderName1"; 143 string newFolderName1 = "newFolderName1";
143 ushort folderType1 = (ushort)AssetType.Texture; 144 ushort folderType1 = (ushort)AssetType.Texture;
144 userInfo.UpdateFolder(newFolderName1, folder1Id, folderType1, rootFolder.ID); 145 userInfo.UpdateFolder(newFolderName1, folder1Id, folderType1, rootFolder.ID);
145 146
146 InventoryFolderImpl folder1 = rootFolder.GetChildFolder(folder1Id); 147 InventoryFolderImpl folder1 = rootFolder.GetChildFolder(folder1Id);
147 Assert.That(newFolderName1, Is.EqualTo(folder1.Name)); 148 Assert.That(newFolderName1, Is.EqualTo(folder1.Name));
148 Assert.That(folderType1, Is.EqualTo((ushort)folder1.Type)); 149 Assert.That(folderType1, Is.EqualTo((ushort)folder1.Type));
149 150
150 InventoryFolderBase dataFolder1 = inventoryDataPlugin.getInventoryFolder(folder1Id); 151 InventoryFolderBase dataFolder1 = inventoryDataPlugin.getInventoryFolder(folder1Id);
151 Assert.That(newFolderName1, Is.EqualTo(dataFolder1.Name)); 152 Assert.That(newFolderName1, Is.EqualTo(dataFolder1.Name));
152 Assert.That(folderType1, Is.EqualTo((ushort)dataFolder1.Type)); 153 Assert.That(folderType1, Is.EqualTo((ushort)dataFolder1.Type));
153 } 154 }
154 155
155 // 2: Test an update that also involves moving the folder 156 // 2: Test an update that also involves moving the folder
156 { 157 {
157 UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000061"); 158 UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000061");
158 userInfo.CreateFolder("folder2", folder2Id, (ushort)AssetType.Animation, rootFolder.ID); 159 userInfo.CreateFolder("folder2", folder2Id, (ushort)AssetType.Animation, rootFolder.ID);
159 InventoryFolderImpl folder2 = rootFolder.GetChildFolder(folder2Id); 160 InventoryFolderImpl folder2 = rootFolder.GetChildFolder(folder2Id);
160 161
161 string newFolderName2 = "newFolderName2"; 162 string newFolderName2 = "newFolderName2";
162 ushort folderType2 = (ushort)AssetType.Bodypart; 163 ushort folderType2 = (ushort)AssetType.Bodypart;
163 userInfo.UpdateFolder(newFolderName2, folder1Id, folderType2, folder2Id); 164 userInfo.UpdateFolder(newFolderName2, folder1Id, folderType2, folder2Id);
164 165
165 InventoryFolderImpl folder1 = folder2.GetChildFolder(folder1Id); 166 InventoryFolderImpl folder1 = folder2.GetChildFolder(folder1Id);
166 Assert.That(newFolderName2, Is.EqualTo(folder1.Name)); 167 Assert.That(newFolderName2, Is.EqualTo(folder1.Name));
167 Assert.That(folderType2, Is.EqualTo((ushort)folder1.Type)); 168 Assert.That(folderType2, Is.EqualTo((ushort)folder1.Type));
168 Assert.That(folder2Id, Is.EqualTo(folder1.ParentID)); 169 Assert.That(folder2Id, Is.EqualTo(folder1.ParentID));
169 170
170 Assert.That(folder2.ContainsChildFolder(folder1Id), Is.True); 171 Assert.That(folder2.ContainsChildFolder(folder1Id), Is.True);
171 Assert.That(rootFolder.ContainsChildFolder(folder1Id), Is.False); 172 Assert.That(rootFolder.ContainsChildFolder(folder1Id), Is.False);
172 173
173 InventoryFolderBase dataFolder1 = inventoryDataPlugin.getInventoryFolder(folder1Id); 174 InventoryFolderBase dataFolder1 = inventoryDataPlugin.getInventoryFolder(folder1Id);
174 Assert.That(newFolderName2, Is.EqualTo(dataFolder1.Name)); 175 Assert.That(newFolderName2, Is.EqualTo(dataFolder1.Name));
175 Assert.That(folderType2, Is.EqualTo((ushort)dataFolder1.Type)); 176 Assert.That(folderType2, Is.EqualTo((ushort)dataFolder1.Type));
176 Assert.That(folder2Id, Is.EqualTo(dataFolder1.ParentID)); 177 Assert.That(folder2Id, Is.EqualTo(dataFolder1.ParentID));
177 } 178 }
178 179
179 } 180 }
180 181
181 /// <summary> 182 /// <summary>
182 /// Test moving an inventory folder 183 /// Test moving an inventory folder
@@ -186,32 +187,32 @@ namespace OpenSim.Framework.Communications.Tests
186 { 187 {
187 TestCommunicationsManager commsManager = new TestCommunicationsManager(); 188 TestCommunicationsManager commsManager = new TestCommunicationsManager();
188 IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin; 189 IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin;
189 190
190 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); 191 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
191 192
192 UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000020"); 193 UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000020");
193 UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000021"); 194 UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000021");
194 UUID folderToMoveId = UUID.Parse("00000000-0000-0000-0000-000000000030"); 195 UUID folderToMoveId = UUID.Parse("00000000-0000-0000-0000-000000000030");
195 InventoryFolderImpl rootFolder = userInfo.RootFolder; 196 InventoryFolderImpl rootFolder = userInfo.RootFolder;
196 197
197 userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID); 198 userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID);
198 InventoryFolderImpl folder1 = rootFolder.GetChildFolder(folder1Id); 199 InventoryFolderImpl folder1 = rootFolder.GetChildFolder(folder1Id);
199 userInfo.CreateFolder("folder2", folder2Id, (ushort)AssetType.Animation, rootFolder.ID); 200 userInfo.CreateFolder("folder2", folder2Id, (ushort)AssetType.Animation, rootFolder.ID);
200 InventoryFolderImpl folder2 = rootFolder.GetChildFolder(folder2Id); 201 InventoryFolderImpl folder2 = rootFolder.GetChildFolder(folder2Id);
201 202
202 // Check folder is currently in folder1 203 // Check folder is currently in folder1
203 userInfo.CreateFolder("folderToMove", folderToMoveId, (ushort)AssetType.Animation, folder1Id); 204 userInfo.CreateFolder("folderToMove", folderToMoveId, (ushort)AssetType.Animation, folder1Id);
204 Assert.That(folder1.ContainsChildFolder(folderToMoveId), Is.True); 205 Assert.That(folder1.ContainsChildFolder(folderToMoveId), Is.True);
205 206
206 userInfo.MoveFolder(folderToMoveId, folder2Id); 207 userInfo.MoveFolder(folderToMoveId, folder2Id);
207 208
208 // Check folder is now in folder2 and no trace remains in folder1 209 // Check folder is now in folder2 and no trace remains in folder1
209 Assert.That(folder2.ContainsChildFolder(folderToMoveId), Is.True); 210 Assert.That(folder2.ContainsChildFolder(folderToMoveId), Is.True);
210 Assert.That(inventoryDataPlugin.getInventoryFolder(folderToMoveId).ParentID, Is.EqualTo(folder2Id)); 211 Assert.That(inventoryDataPlugin.getInventoryFolder(folderToMoveId).ParentID, Is.EqualTo(folder2Id));
211 212
212 Assert.That(folder1.ContainsChildFolder(folderToMoveId), Is.False); 213 Assert.That(folder1.ContainsChildFolder(folderToMoveId), Is.False);
213 } 214 }
214 215
215 /// <summary> 216 /// <summary>
216 /// Test purging an inventory folder 217 /// Test purging an inventory folder
217 /// </summary> 218 /// </summary>
@@ -219,21 +220,21 @@ namespace OpenSim.Framework.Communications.Tests
219 public void TestPurgeFolder() 220 public void TestPurgeFolder()
220 { 221 {
221 //log4net.Config.XmlConfigurator.Configure(); 222 //log4net.Config.XmlConfigurator.Configure();
222 223
223 TestCommunicationsManager commsManager = new TestCommunicationsManager(); 224 TestCommunicationsManager commsManager = new TestCommunicationsManager();
224 IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin; 225 IInventoryDataPlugin inventoryDataPlugin = commsManager.InventoryDataPlugin;
225 226
226 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); 227 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
227 228
228 UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000070"); 229 UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000070");
229 InventoryFolderImpl rootFolder = userInfo.RootFolder; 230 InventoryFolderImpl rootFolder = userInfo.RootFolder;
230 231
231 userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID); 232 userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID);
232 Assert.That(inventoryDataPlugin.getInventoryFolder(folder1Id), Is.Not.Null); 233 Assert.That(inventoryDataPlugin.getInventoryFolder(folder1Id), Is.Not.Null);
233 234
234 // Test purge 235 // Test purge
235 userInfo.PurgeFolder(rootFolder.ID); 236 userInfo.PurgeFolder(rootFolder.ID);
236 237
237 Assert.That(rootFolder.RequestListOfFolders(), Is.Empty); 238 Assert.That(rootFolder.RequestListOfFolders(), Is.Empty);
238 Assert.That(inventoryDataPlugin.getInventoryFolder(folder1Id), Is.Null); 239 Assert.That(inventoryDataPlugin.getInventoryFolder(folder1Id), Is.Null);
239 } 240 }
diff --git a/OpenSim/Framework/IInventoryData.cs b/OpenSim/Framework/IInventoryData.cs
deleted file mode 100644
index 8ea1fb3..0000000
--- a/OpenSim/Framework/IInventoryData.cs
+++ /dev/null
@@ -1,156 +0,0 @@
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 OpenSim 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 System.Collections.Generic;
29using OpenMetaverse;
30
31namespace OpenSim.Framework
32{
33 /// <summary>
34 /// An interface for accessing inventory data from a storage server
35 /// </summary>
36 public interface IInventoryDataPlugin : IPlugin
37 {
38 /// <summary>
39 /// Initialises the interface
40 /// </summary>
41 void Initialise(string connect);
42
43 /// <summary>
44 /// Returns all descendent folders of this folder. Does not return the parent folder itself.
45 /// </summary>
46 /// <param name="parentID">The folder to get subfolders for</param>
47 /// <returns>A list of inventory folders</returns>
48 List<InventoryFolderBase> getFolderHierarchy(UUID parentID);
49
50 /// <summary>
51 /// Returns a list of inventory items contained within the specified folder
52 /// </summary>
53 /// <param name="folderID">The UUID of the target folder</param>
54 /// <returns>A List of InventoryItemBase items</returns>
55 List<InventoryItemBase> getInventoryInFolder(UUID folderID);
56
57 /// <summary>
58 /// Returns a list of the root folders within a users inventory
59 /// </summary>
60 /// <param name="user">The user whos inventory is to be searched</param>
61 /// <returns>A list of folder objects</returns>
62 List<InventoryFolderBase> getUserRootFolders(UUID user);
63
64 /// <summary>
65 /// Returns the users inventory root folder.
66 /// </summary>
67 /// <param name="user">The UUID of the user who is having inventory being returned</param>
68 /// <returns>Root inventory folder, null if no root inventory folder was found</returns>
69 InventoryFolderBase getUserRootFolder(UUID user);
70
71 /// <summary>
72 /// Returns a list of inventory folders contained in the folder 'parentID'
73 /// </summary>
74 /// <param name="parentID">The folder to get subfolders for</param>
75 /// <returns>A list of inventory folders</returns>
76 List<InventoryFolderBase> getInventoryFolders(UUID parentID);
77
78 /// <summary>
79 /// Returns an inventory item by its UUID
80 /// </summary>
81 /// <param name="item">The UUID of the item to be returned</param>
82 /// <returns>A class containing item information</returns>
83 InventoryItemBase getInventoryItem(UUID item);
84
85 /// <summary>
86 /// Returns a specified inventory folder by its UUID
87 /// </summary>
88 /// <param name="folder">The UUID of the folder to be returned</param>
89 /// <returns>A class containing folder information</returns>
90 InventoryFolderBase getInventoryFolder(UUID folder);
91
92 /// <summary>
93 /// Creates a new inventory item based on item
94 /// </summary>
95 /// <param name="item">The item to be created</param>
96 void addInventoryItem(InventoryItemBase item);
97
98 /// <summary>
99 /// Updates an inventory item with item (updates based on ID)
100 /// </summary>
101 /// <param name="item">The updated item</param>
102 void updateInventoryItem(InventoryItemBase item);
103
104 /// <summary>
105 ///
106 /// </summary>
107 /// <param name="item"></param>
108 void deleteInventoryItem(UUID item);
109
110 /// <summary>
111 /// Adds a new folder specified by folder
112 /// </summary>
113 /// <param name="folder">The inventory folder</param>
114 void addInventoryFolder(InventoryFolderBase folder);
115
116 /// <summary>
117 /// Updates a folder based on its ID with folder
118 /// </summary>
119 /// <param name="folder">The inventory folder</param>
120 void updateInventoryFolder(InventoryFolderBase folder);
121
122 /// <summary>
123 /// Updates a folder based on its ID with folder
124 /// </summary>
125 /// <param name="folder">The inventory folder</param>
126 void moveInventoryFolder(InventoryFolderBase folder);
127
128 /// <summary>
129 /// Deletes a folder. Thie will delete both the folder itself and its contents (items and descendent folders)
130 /// </summary>
131 /// <param name="folder">The id of the folder</param>
132 void deleteInventoryFolder(UUID folder);
133
134 /// <summary>
135 /// Returns all activated gesture-items in the inventory of the specified avatar.
136 /// </summary>
137 /// <param name="avatarID">
138 /// The <see cref="UUID"/> of the avatar
139 /// </param>
140 /// <returns>
141 /// The list of gestures (<see cref="InventoryItemBase"/>s)
142 /// </returns>
143 List<InventoryItemBase> fetchActiveGestures(UUID avatarID);
144 }
145
146 public class InventoryDataInitialiser : PluginInitialiserBase
147 {
148 private string connect;
149 public InventoryDataInitialiser (string s) { connect = s; }
150 public override void Initialise (IPlugin plugin)
151 {
152 IInventoryDataPlugin p = plugin as IInventoryDataPlugin;
153 p.Initialise (connect);
154 }
155 }
156}