aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs')
-rw-r--r--OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs87
1 files changed, 87 insertions, 0 deletions
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs
index 50ffbb0..9177cc3 100644
--- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs
@@ -1,3 +1,29 @@
1/*
2* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are met:
6* * Redistributions of source code must retain the above copyright
7* notice, this list of conditions and the following disclaimer.
8* * Redistributions in binary form must reproduce the above copyright
9* notice, this list of conditions and the following disclaimer in the
10* documentation and/or other materials provided with the distribution.
11* * Neither the name of the <organization> nor the
12* names of its contributors may be used to endorse or promote products
13* derived from this software without specific prior written permission.
14*
15* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
16* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
19* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*
26*/
1using System; 27using System;
2using System.Collections.Generic; 28using System.Collections.Generic;
3using System.Text; 29using System.Text;
@@ -5,10 +31,19 @@ using libsecondlife;
5 31
6namespace OpenGrid.Framework.Data.MySQL 32namespace OpenGrid.Framework.Data.MySQL
7{ 33{
34 /// <summary>
35 /// A MySQL interface for the inventory server
36 /// </summary>
8 class MySQLInventoryData : IInventoryData 37 class MySQLInventoryData : IInventoryData
9 { 38 {
39 /// <summary>
40 /// The database manager
41 /// </summary>
10 public MySQLManager database; 42 public MySQLManager database;
11 43
44 /// <summary>
45 /// Loads and initialises this database plugin
46 /// </summary>
12 public void Initialise() 47 public void Initialise()
13 { 48 {
14 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); 49 IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
@@ -22,21 +57,37 @@ namespace OpenGrid.Framework.Data.MySQL
22 database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); 57 database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort);
23 } 58 }
24 59
60 /// <summary>
61 /// The name of this DB provider
62 /// </summary>
63 /// <returns>Name of DB provider</returns>
25 public string getName() 64 public string getName()
26 { 65 {
27 return "MySQL Inventory Data Interface"; 66 return "MySQL Inventory Data Interface";
28 } 67 }
29 68
69 /// <summary>
70 /// Closes this DB provider
71 /// </summary>
30 public void Close() 72 public void Close()
31 { 73 {
32 // Do nothing. 74 // Do nothing.
33 } 75 }
34 76
77 /// <summary>
78 /// Returns the version of this DB provider
79 /// </summary>
80 /// <returns>A string containing the DB provider</returns>
35 public string getVersion() 81 public string getVersion()
36 { 82 {
37 return "0.1"; 83 return "0.1";
38 } 84 }
39 85
86 /// <summary>
87 /// Returns a list of items in a specified folder
88 /// </summary>
89 /// <param name="folderID">The folder to search</param>
90 /// <returns>A list containing inventory items</returns>
40 public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID) 91 public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID)
41 { 92 {
42 try 93 try
@@ -65,6 +116,11 @@ namespace OpenGrid.Framework.Data.MySQL
65 } 116 }
66 } 117 }
67 118
119 /// <summary>
120 /// Returns a list of the root folders within a users inventory
121 /// </summary>
122 /// <param name="user">The user whos inventory is to be searched</param>
123 /// <returns>A list of folder objects</returns>
68 public List<InventoryFolderBase> getUserRootFolders(LLUUID user) 124 public List<InventoryFolderBase> getUserRootFolders(LLUUID user)
69 { 125 {
70 try 126 try
@@ -94,6 +150,11 @@ namespace OpenGrid.Framework.Data.MySQL
94 } 150 }
95 } 151 }
96 152
153 /// <summary>
154 /// Returns a list of folders in a users inventory contained within the specified folder
155 /// </summary>
156 /// <param name="parentID">The folder to search</param>
157 /// <returns>A list of inventory folders</returns>
97 public List<InventoryFolderBase> getInventoryFolders(LLUUID parentID) 158 public List<InventoryFolderBase> getInventoryFolders(LLUUID parentID)
98 { 159 {
99 try 160 try
@@ -122,6 +183,11 @@ namespace OpenGrid.Framework.Data.MySQL
122 } 183 }
123 } 184 }
124 185
186 /// <summary>
187 /// Returns a specified inventory item
188 /// </summary>
189 /// <param name="item">The item to return</param>
190 /// <returns>An inventory item</returns>
125 public InventoryItemBase getInventoryItem(LLUUID item) 191 public InventoryItemBase getInventoryItem(LLUUID item)
126 { 192 {
127 try 193 try
@@ -157,6 +223,11 @@ namespace OpenGrid.Framework.Data.MySQL
157 } 223 }
158 } 224 }
159 225
226 /// <summary>
227 /// Returns a specified inventory folder
228 /// </summary>
229 /// <param name="folder">The folder to return</param>
230 /// <returns>A folder class</returns>
160 public InventoryFolderBase getInventoryFolder(LLUUID folder) 231 public InventoryFolderBase getInventoryFolder(LLUUID folder)
161 { 232 {
162 try 233 try
@@ -192,6 +263,10 @@ namespace OpenGrid.Framework.Data.MySQL
192 } 263 }
193 } 264 }
194 265
266 /// <summary>
267 /// Adds a specified item to the database
268 /// </summary>
269 /// <param name="item">The inventory item</param>
195 public void addInventoryItem(InventoryItemBase item) 270 public void addInventoryItem(InventoryItemBase item)
196 { 271 {
197 lock (database) 272 lock (database)
@@ -200,11 +275,19 @@ namespace OpenGrid.Framework.Data.MySQL
200 } 275 }
201 } 276 }
202 277
278 /// <summary>
279 /// Updates the specified inventory item
280 /// </summary>
281 /// <param name="item">Inventory item to update</param>
203 public void updateInventoryItem(InventoryItemBase item) 282 public void updateInventoryItem(InventoryItemBase item)
204 { 283 {
205 addInventoryItem(item); 284 addInventoryItem(item);
206 } 285 }
207 286
287 /// <summary>
288 /// Creates a new inventory folder
289 /// </summary>
290 /// <param name="folder">Folder to create</param>
208 public void addInventoryFolder(InventoryFolderBase folder) 291 public void addInventoryFolder(InventoryFolderBase folder)
209 { 292 {
210 lock (database) 293 lock (database)
@@ -213,6 +296,10 @@ namespace OpenGrid.Framework.Data.MySQL
213 } 296 }
214 } 297 }
215 298
299 /// <summary>
300 /// Updates an inventory folder
301 /// </summary>
302 /// <param name="folder">Folder to update</param>
216 public void updateInventoryFolder(InventoryFolderBase folder) 303 public void updateInventoryFolder(InventoryFolderBase folder)
217 { 304 {
218 addInventoryFolder(folder); 305 addInventoryFolder(folder);