aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
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/Data
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/Data')
-rw-r--r--OpenSim/Data/IInventoryData.cs157
-rw-r--r--OpenSim/Data/Tests/BasicInventoryTest.cs20
2 files changed, 167 insertions, 10 deletions
diff --git a/OpenSim/Data/IInventoryData.cs b/OpenSim/Data/IInventoryData.cs
new file mode 100644
index 0000000..03b1cbe
--- /dev/null
+++ b/OpenSim/Data/IInventoryData.cs
@@ -0,0 +1,157 @@
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;
30using OpenSim.Framework;
31
32namespace OpenSim.Data
33{
34 /// <summary>
35 /// An interface for accessing inventory data from a storage server
36 /// </summary>
37 public interface IInventoryDataPlugin : IPlugin
38 {
39 /// <summary>
40 /// Initialises the interface
41 /// </summary>
42 void Initialise(string connect);
43
44 /// <summary>
45 /// Returns all descendent folders of this folder. Does not return the parent folder itself.
46 /// </summary>
47 /// <param name="parentID">The folder to get subfolders for</param>
48 /// <returns>A list of inventory folders</returns>
49 List<InventoryFolderBase> getFolderHierarchy(UUID parentID);
50
51 /// <summary>
52 /// Returns a list of inventory items contained within the specified folder
53 /// </summary>
54 /// <param name="folderID">The UUID of the target folder</param>
55 /// <returns>A List of InventoryItemBase items</returns>
56 List<InventoryItemBase> getInventoryInFolder(UUID folderID);
57
58 /// <summary>
59 /// Returns a list of the root folders within a users inventory
60 /// </summary>
61 /// <param name="user">The user whos inventory is to be searched</param>
62 /// <returns>A list of folder objects</returns>
63 List<InventoryFolderBase> getUserRootFolders(UUID user);
64
65 /// <summary>
66 /// Returns the users inventory root folder.
67 /// </summary>
68 /// <param name="user">The UUID of the user who is having inventory being returned</param>
69 /// <returns>Root inventory folder, null if no root inventory folder was found</returns>
70 InventoryFolderBase getUserRootFolder(UUID user);
71
72 /// <summary>
73 /// Returns a list of inventory folders contained in the folder 'parentID'
74 /// </summary>
75 /// <param name="parentID">The folder to get subfolders for</param>
76 /// <returns>A list of inventory folders</returns>
77 List<InventoryFolderBase> getInventoryFolders(UUID parentID);
78
79 /// <summary>
80 /// Returns an inventory item by its UUID
81 /// </summary>
82 /// <param name="item">The UUID of the item to be returned</param>
83 /// <returns>A class containing item information</returns>
84 InventoryItemBase getInventoryItem(UUID item);
85
86 /// <summary>
87 /// Returns a specified inventory folder by its UUID
88 /// </summary>
89 /// <param name="folder">The UUID of the folder to be returned</param>
90 /// <returns>A class containing folder information</returns>
91 InventoryFolderBase getInventoryFolder(UUID folder);
92
93 /// <summary>
94 /// Creates a new inventory item based on item
95 /// </summary>
96 /// <param name="item">The item to be created</param>
97 void addInventoryItem(InventoryItemBase item);
98
99 /// <summary>
100 /// Updates an inventory item with item (updates based on ID)
101 /// </summary>
102 /// <param name="item">The updated item</param>
103 void updateInventoryItem(InventoryItemBase item);
104
105 /// <summary>
106 ///
107 /// </summary>
108 /// <param name="item"></param>
109 void deleteInventoryItem(UUID item);
110
111 /// <summary>
112 /// Adds a new folder specified by folder
113 /// </summary>
114 /// <param name="folder">The inventory folder</param>
115 void addInventoryFolder(InventoryFolderBase folder);
116
117 /// <summary>
118 /// Updates a folder based on its ID with folder
119 /// </summary>
120 /// <param name="folder">The inventory folder</param>
121 void updateInventoryFolder(InventoryFolderBase folder);
122
123 /// <summary>
124 /// Updates a folder based on its ID with folder
125 /// </summary>
126 /// <param name="folder">The inventory folder</param>
127 void moveInventoryFolder(InventoryFolderBase folder);
128
129 /// <summary>
130 /// Deletes a folder. Thie will delete both the folder itself and its contents (items and descendent folders)
131 /// </summary>
132 /// <param name="folder">The id of the folder</param>
133 void deleteInventoryFolder(UUID folder);
134
135 /// <summary>
136 /// Returns all activated gesture-items in the inventory of the specified avatar.
137 /// </summary>
138 /// <param name="avatarID">
139 /// The <see cref="UUID"/> of the avatar
140 /// </param>
141 /// <returns>
142 /// The list of gestures (<see cref="InventoryItemBase"/>s)
143 /// </returns>
144 List<InventoryItemBase> fetchActiveGestures(UUID avatarID);
145 }
146
147 public class InventoryDataInitialiser : PluginInitialiserBase
148 {
149 private string connect;
150 public InventoryDataInitialiser (string s) { connect = s; }
151 public override void Initialise (IPlugin plugin)
152 {
153 IInventoryDataPlugin p = plugin as IInventoryDataPlugin;
154 p.Initialise (connect);
155 }
156 }
157}
diff --git a/OpenSim/Data/Tests/BasicInventoryTest.cs b/OpenSim/Data/Tests/BasicInventoryTest.cs
index ea8e4e8..2e6226f 100644
--- a/OpenSim/Data/Tests/BasicInventoryTest.cs
+++ b/OpenSim/Data/Tests/BasicInventoryTest.cs
@@ -94,9 +94,9 @@ namespace OpenSim.Data.Tests
94 iname1 = "Shirt"; 94 iname1 = "Shirt";
95 iname2 = "Text Board"; 95 iname2 = "Text Board";
96 iname3 = "No Pants Barrel"; 96 iname3 = "No Pants Barrel";
97 97
98 } 98 }
99 99
100 [Test] 100 [Test]
101 public void T001_LoadEmpty() 101 public void T001_LoadEmpty()
102 { 102 {
@@ -163,7 +163,7 @@ namespace OpenSim.Data.Tests
163 { 163 {
164 InventoryFolderBase f2 = NewFolder(folder3, folder1, owner1, name3); 164 InventoryFolderBase f2 = NewFolder(folder3, folder1, owner1, name3);
165 db.addInventoryFolder(f2); 165 db.addInventoryFolder(f2);
166 166
167 Assert.That(db.getInventoryFolders(zero).Count, Is.EqualTo(1)); 167 Assert.That(db.getInventoryFolders(zero).Count, Is.EqualTo(1));
168 Assert.That(db.getInventoryFolders(folder1).Count, Is.EqualTo(2)); 168 Assert.That(db.getInventoryFolders(folder1).Count, Is.EqualTo(2));
169 Assert.That(db.getInventoryFolders(folder2).Count, Is.EqualTo(0)); 169 Assert.That(db.getInventoryFolders(folder2).Count, Is.EqualTo(0));
@@ -171,7 +171,7 @@ namespace OpenSim.Data.Tests
171 Assert.That(db.getInventoryFolders(UUID.Random()).Count, Is.EqualTo(0)); 171 Assert.That(db.getInventoryFolders(UUID.Random()).Count, Is.EqualTo(0));
172 172
173 } 173 }
174 174
175 [Test] 175 [Test]
176 public void T013_FolderHierarchy() 176 public void T013_FolderHierarchy()
177 { 177 {
@@ -182,14 +182,14 @@ namespace OpenSim.Data.Tests
182 Assert.That(db.getFolderHierarchy(UUID.Random()).Count, Is.EqualTo(0)); 182 Assert.That(db.getFolderHierarchy(UUID.Random()).Count, Is.EqualTo(0));
183 } 183 }
184 184
185 185
186 [Test] 186 [Test]
187 public void T014_MoveFolder() 187 public void T014_MoveFolder()
188 { 188 {
189 InventoryFolderBase f2 = db.getInventoryFolder(folder2); 189 InventoryFolderBase f2 = db.getInventoryFolder(folder2);
190 f2.ParentID = folder3; 190 f2.ParentID = folder3;
191 db.moveInventoryFolder(f2); 191 db.moveInventoryFolder(f2);
192 192
193 Assert.That(db.getInventoryFolders(zero).Count, Is.EqualTo(1)); 193 Assert.That(db.getInventoryFolders(zero).Count, Is.EqualTo(1));
194 Assert.That(db.getInventoryFolders(folder1).Count, Is.EqualTo(1)); 194 Assert.That(db.getInventoryFolders(folder1).Count, Is.EqualTo(1));
195 Assert.That(db.getInventoryFolders(folder2).Count, Is.EqualTo(0)); 195 Assert.That(db.getInventoryFolders(folder2).Count, Is.EqualTo(0));
@@ -228,7 +228,7 @@ namespace OpenSim.Data.Tests
228 db.addInventoryItem(NewItem(item3, folder3, owner1, iname3, asset3)); 228 db.addInventoryItem(NewItem(item3, folder3, owner1, iname3, asset3));
229 Assert.That(db.getInventoryInFolder(folder3).Count, Is.EqualTo(3)); 229 Assert.That(db.getInventoryInFolder(folder3).Count, Is.EqualTo(3));
230 } 230 }
231 231
232 [Test] 232 [Test]
233 public void T102_CompareItems() 233 public void T102_CompareItems()
234 { 234 {
@@ -245,7 +245,7 @@ namespace OpenSim.Data.Tests
245 Assert.That(i2.AssetID, Is.EqualTo(asset2)); 245 Assert.That(i2.AssetID, Is.EqualTo(asset2));
246 Assert.That(i3.AssetID, Is.EqualTo(asset3)); 246 Assert.That(i3.AssetID, Is.EqualTo(asset3));
247 } 247 }
248 248
249 [Test] 249 [Test]
250 public void T103UpdateItem() 250 public void T103UpdateItem()
251 { 251 {
@@ -257,7 +257,7 @@ namespace OpenSim.Data.Tests
257 i1.Description = niname1; 257 i1.Description = niname1;
258 i1.Owner = owner2; 258 i1.Owner = owner2;
259 db.updateInventoryItem(i1); 259 db.updateInventoryItem(i1);
260 260
261 i1 = db.getInventoryItem(item1); 261 i1 = db.getInventoryItem(item1);
262 Assert.That(i1.Name, Is.EqualTo(niname1)); 262 Assert.That(i1.Name, Is.EqualTo(niname1));
263 Assert.That(i1.Description, Is.EqualTo(niname1)); 263 Assert.That(i1.Description, Is.EqualTo(niname1));
@@ -287,4 +287,4 @@ namespace OpenSim.Data.Tests
287 return f; 287 return f;
288 } 288 }
289 } 289 }
290} \ No newline at end of file 290}