aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-05-01 20:47:33 +0000
committerJustin Clarke Casey2008-05-01 20:47:33 +0000
commit1de6cffa28348975a2492ce1e8a85c365df4dfaf (patch)
tree6431e5598defd603a4b2a8c5020b65d7df5a56a7 /OpenSim
parentcreate pass through of UserManagerBase to plugin calls (diff)
downloadopensim-SC-1de6cffa28348975a2492ce1e8a85c365df4dfaf.zip
opensim-SC-1de6cffa28348975a2492ce1e8a85c365df4dfaf.tar.gz
opensim-SC-1de6cffa28348975a2492ce1e8a85c365df4dfaf.tar.bz2
opensim-SC-1de6cffa28348975a2492ce1e8a85c365df4dfaf.tar.xz
* Refactor: Remove the unused userID parameter that was being passed into almost every inventory method
* This allows lots of redundant inventory methods with only slightly different names to be eliminated.
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLInventoryData.cs63
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs81
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs13
-rw-r--r--OpenSim/Framework/Communications/IInventoryServices.cs32
-rw-r--r--OpenSim/Framework/Communications/InventoryServiceBase.cs79
-rw-r--r--OpenSim/Grid/InventoryServer/GridInventoryService.cs84
-rw-r--r--OpenSim/Grid/InventoryServer/Main.cs10
-rw-r--r--OpenSim/Region/Communications/Local/LocalInventoryService.cs35
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs54
9 files changed, 145 insertions, 306 deletions
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs
index c9765c0..b529d4e 100644
--- a/OpenSim/Data/MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs
@@ -332,62 +332,13 @@ namespace OpenSim.Data.MySQL
332 item.InvType = (int) reader["invType"]; 332 item.InvType = (int) reader["invType"];
333 item.Creator = new LLUUID((string) reader["creatorID"]); 333 item.Creator = new LLUUID((string) reader["creatorID"]);
334 item.BasePermissions = (uint) reader["inventoryBasePermissions"]; 334 item.BasePermissions = (uint) reader["inventoryBasePermissions"];
335 item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"]; 335 item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"];
336 336 item.SalePrice = (int) reader["salePrice"];
337 try 337 item.SaleType = Convert.ToByte(reader["saleType"]);
338 { 338 item.CreationDate = (int) reader["creationDate"];
339 item.SalePrice = (int) reader["salePrice"]; 339 item.GroupID = new LLUUID(reader["groupID"].ToString());
340 } 340 item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]);
341 catch (InvalidCastException) 341 item.Flags = (uint) reader["flags"];
342 {
343 m_log.WarnFormat("Could not cast salePrice {0} to {1}", reader["salePrice"], "int");
344 }
345
346 try
347 {
348 item.SaleType = Convert.ToByte(reader["saleType"]);
349 }
350 catch (InvalidCastException)
351 {
352 m_log.WarnFormat("Could not convert saleType {0} to {1}", reader["saleType"], "byte");
353 }
354
355 try
356 {
357 item.CreationDate = (int) reader["creationDate"];
358 }
359 catch (InvalidCastException)
360 {
361 m_log.WarnFormat("Could not cast creationDate {0} to {1}", reader["creationDate"], "int");
362 }
363
364 try
365 {
366 item.GroupID = new LLUUID(reader["groupID"].ToString());
367 }
368 catch (Exception)
369 {
370 item.GroupID = LLUUID.Zero;
371 m_log.WarnFormat("Could not convert groupID {0} to {1}", reader["groupID"], "LLUUID");
372 }
373
374 try
375 {
376 item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]);
377 }
378 catch (InvalidCastException)
379 {
380 m_log.WarnFormat("Could not cast groupOwned {0} to {1}", reader["groupOwned"], "boolean");
381 }
382
383 try
384 {
385 item.Flags = (uint) reader["flags"];
386 }
387 catch (InvalidCastException)
388 {
389 m_log.WarnFormat("Could not cast flags {0} to {1}", reader["flags"], "uint");
390 }
391 342
392 return item; 343 return item;
393 } 344 }
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 7902240..adf01b9 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -166,12 +166,12 @@ namespace OpenSim.Framework.Communications.Cache
166 { 166 {
167 foreach (InventoryFolderImpl folder in folders) 167 foreach (InventoryFolderImpl folder in folders)
168 { 168 {
169 FolderReceive(userID, folder); 169 FolderReceive(folder);
170 } 170 }
171 171
172 foreach (InventoryItemBase item in items) 172 foreach (InventoryItemBase item in items)
173 { 173 {
174 ItemReceive(userID, item); 174 ItemReceive(item);
175 } 175 }
176 } 176 }
177 catch (Exception e) 177 catch (Exception e)
@@ -198,56 +198,53 @@ namespace OpenSim.Framework.Communications.Cache
198 /// </summary> 198 /// </summary>
199 /// <param name="userID"></param> 199 /// <param name="userID"></param>
200 /// <param name="folderInfo"></param> 200 /// <param name="folderInfo"></param>
201 private void FolderReceive(LLUUID userID, InventoryFolderImpl folderInfo) 201 private void FolderReceive(InventoryFolderImpl folderInfo)
202 { 202 {
203// m_log.DebugFormat( 203// m_log.DebugFormat(
204// "[INVENTORY CACHE]: Received folder {0} {1} for user {2}", 204// "[INVENTORY CACHE]: Received folder {0} {1} for user {2}",
205// folderInfo.Name, folderInfo.ID, userID); 205// folderInfo.Name, folderInfo.ID, userID);
206 206
207 if (userID == UserProfile.ID) 207 if (RootFolder == null)
208 { 208 {
209 if (RootFolder == null) 209 if (folderInfo.ParentID == LLUUID.Zero)
210 { 210 {
211 if (folderInfo.ParentID == LLUUID.Zero) 211 m_rootFolder = folderInfo;
212 {
213 m_rootFolder = folderInfo;
214 }
215 } 212 }
216 else if (RootFolder.ID == folderInfo.ParentID) 213 }
214 else if (RootFolder.ID == folderInfo.ParentID)
215 {
216 lock (RootFolder.SubFolders)
217 { 217 {
218 lock (RootFolder.SubFolders) 218 if (!RootFolder.SubFolders.ContainsKey(folderInfo.ID))
219 { 219 {
220 if (!RootFolder.SubFolders.ContainsKey(folderInfo.ID)) 220 RootFolder.SubFolders.Add(folderInfo.ID, folderInfo);
221 {
222 RootFolder.SubFolders.Add(folderInfo.ID, folderInfo);
223 }
224 else
225 {
226 AddPendingFolder(folderInfo);
227 }
228 } 221 }
222 else
223 {
224 AddPendingFolder(folderInfo);
225 }
229 } 226 }
230 else 227 }
228 else
229 {
230 InventoryFolderImpl folder = RootFolder.GetDescendentFolder(folderInfo.ParentID);
231 lock (folder.SubFolders)
231 { 232 {
232 InventoryFolderImpl folder = RootFolder.GetDescendentFolder(folderInfo.ParentID); 233 if (folder != null)
233 lock (folder.SubFolders)
234 { 234 {
235 if (folder != null) 235 if (!folder.SubFolders.ContainsKey(folderInfo.ID))
236 { 236 {
237 if (!folder.SubFolders.ContainsKey(folderInfo.ID)) 237 folder.SubFolders.Add(folderInfo.ID, folderInfo);
238 {
239 folder.SubFolders.Add(folderInfo.ID, folderInfo);
240 }
241 }
242 else
243 {
244 AddPendingFolder(folderInfo);
245 } 238 }
246 } 239 }
240 else
241 {
242 AddPendingFolder(folderInfo);
243 }
247 } 244 }
248
249 ResolvePendingFolders(folderInfo);
250 } 245 }
246
247 ResolvePendingFolders(folderInfo);
251 } 248 }
252 249
253 /// <summary> 250 /// <summary>
@@ -256,15 +253,14 @@ namespace OpenSim.Framework.Communications.Cache
256 /// We're assuming here that items are always received after all the folders have been 253 /// We're assuming here that items are always received after all the folders have been
257 /// received. 254 /// received.
258 /// </summary> 255 /// </summary>
259 /// <param name="userID"></param>
260 /// <param name="folderInfo"></param> 256 /// <param name="folderInfo"></param>
261 private void ItemReceive(LLUUID userID, InventoryItemBase itemInfo) 257 private void ItemReceive(InventoryItemBase itemInfo)
262 { 258 {
263// m_log.DebugFormat( 259// m_log.DebugFormat(
264// "[INVENTORY CACHE]: Received item {0} {1} for user {2}", 260// "[INVENTORY CACHE]: Received item {0} {1} for user {2}",
265// itemInfo.Name, itemInfo.ID, userID); 261// itemInfo.Name, itemInfo.ID, userID);
266 262
267 if ((userID == UserProfile.ID) && (RootFolder != null)) 263 if (RootFolder != null)
268 { 264 {
269 if (itemInfo.Folder == RootFolder.ID) 265 if (itemInfo.Folder == RootFolder.ID)
270 { 266 {
@@ -305,14 +301,13 @@ namespace OpenSim.Framework.Communications.Cache
305 /// <summary> 301 /// <summary>
306 /// Add an item to the user's inventory 302 /// Add an item to the user's inventory
307 /// </summary> 303 /// </summary>
308 /// <param name="userID"></param>
309 /// <param name="itemInfo"></param> 304 /// <param name="itemInfo"></param>
310 public void AddItem(LLUUID userID, InventoryItemBase itemInfo) 305 public void AddItem(LLUUID userID, InventoryItemBase itemInfo)
311 { 306 {
312 if ((userID == UserProfile.ID) && HasInventory) 307 if (HasInventory)
313 { 308 {
314 ItemReceive(userID, itemInfo); 309 ItemReceive(itemInfo);
315 m_commsManager.InventoryService.AddNewInventoryItem(userID, itemInfo); 310 m_commsManager.InventoryService.AddItem(itemInfo);
316 } 311 }
317 } 312 }
318 313
@@ -325,7 +320,7 @@ namespace OpenSim.Framework.Communications.Cache
325 { 320 {
326 if ((userID == UserProfile.ID) && HasInventory) 321 if ((userID == UserProfile.ID) && HasInventory)
327 { 322 {
328 m_commsManager.InventoryService.UpdateInventoryItem(userID, itemInfo); 323 m_commsManager.InventoryService.UpdateItem(itemInfo);
329 } 324 }
330 } 325 }
331 326
@@ -343,7 +338,7 @@ namespace OpenSim.Framework.Communications.Cache
343 result = RootFolder.DeleteItem(item.ID); 338 result = RootFolder.DeleteItem(item.ID);
344 if (result) 339 if (result)
345 { 340 {
346 m_commsManager.InventoryService.DeleteInventoryItem(userID, item); 341 m_commsManager.InventoryService.DeleteItem(item);
347 } 342 }
348 } 343 }
349 344
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index 392d796..befb6c7 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -181,7 +181,8 @@ namespace OpenSim.Framework.Communications.Cache
181 createdBaseFolder.ParentID = createdFolder.ParentID; 181 createdBaseFolder.ParentID = createdFolder.ParentID;
182 createdBaseFolder.Type = createdFolder.Type; 182 createdBaseFolder.Type = createdFolder.Type;
183 createdBaseFolder.Version = createdFolder.Version; 183 createdBaseFolder.Version = createdFolder.Version;
184 m_commsManager.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdBaseFolder); 184
185 m_commsManager.InventoryService.AddFolder(createdBaseFolder);
185 } 186 }
186 else 187 else
187 { 188 {
@@ -207,7 +208,7 @@ namespace OpenSim.Framework.Communications.Cache
207 createdBaseFolder.Type = createdFolder.Type; 208 createdBaseFolder.Type = createdFolder.Type;
208 createdBaseFolder.Version = createdFolder.Version; 209 createdBaseFolder.Version = createdFolder.Version;
209 210
210 m_commsManager.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdBaseFolder); 211 m_commsManager.InventoryService.AddFolder(createdBaseFolder);
211 } 212 }
212 else 213 else
213 { 214 {
@@ -265,7 +266,8 @@ namespace OpenSim.Framework.Communications.Cache
265 baseFolder.ParentID = parentID; 266 baseFolder.ParentID = parentID;
266 baseFolder.Type = (short) type; 267 baseFolder.Type = (short) type;
267 baseFolder.Version = userProfile.RootFolder.Version; 268 baseFolder.Version = userProfile.RootFolder.Version;
268 m_commsManager.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, baseFolder); 269
270 m_commsManager.InventoryService.AddFolder(baseFolder);
269 } 271 }
270 else 272 else
271 { 273 {
@@ -299,7 +301,8 @@ namespace OpenSim.Framework.Communications.Cache
299 baseFolder.Owner = remoteClient.AgentId; 301 baseFolder.Owner = remoteClient.AgentId;
300 baseFolder.ID = folderID; 302 baseFolder.ID = folderID;
301 baseFolder.ParentID = parentID; 303 baseFolder.ParentID = parentID;
302 m_commsManager.InventoryService.MoveInventoryFolder(remoteClient.AgentId, baseFolder); 304
305 m_commsManager.InventoryService.MoveFolder(baseFolder);
303 } 306 }
304 else 307 else
305 { 308 {
@@ -544,7 +547,7 @@ namespace OpenSim.Framework.Communications.Cache
544 purgedBaseFolder.Type = purgedFolder.Type; 547 purgedBaseFolder.Type = purgedFolder.Type;
545 purgedBaseFolder.Version = purgedFolder.Version; 548 purgedBaseFolder.Version = purgedFolder.Version;
546 549
547 m_commsManager.InventoryService.PurgeInventoryFolder(remoteClient.AgentId, purgedBaseFolder); 550 m_commsManager.InventoryService.PurgeFolder(purgedBaseFolder);
548 551
549 purgedFolder.Purge(); 552 purgedFolder.Purge();
550 } 553 }
diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs
index c82c946..5907c38 100644
--- a/OpenSim/Framework/Communications/IInventoryServices.cs
+++ b/OpenSim/Framework/Communications/IInventoryServices.cs
@@ -50,46 +50,46 @@ namespace OpenSim.Framework.Communications
50 void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback); 50 void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback);
51 51
52 /// <summary> 52 /// <summary>
53 /// Add a new folder to the given user's inventory 53 /// Add a new folder to the user's inventory
54 /// </summary> 54 /// </summary>
55 /// <param name="userID"></param>
56 /// <param name="folder"></param> 55 /// <param name="folder"></param>
57 void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder); 56 /// <returns>true if the folder was successfully added</returns>
57 bool AddFolder(InventoryFolderBase folder);
58 58
59 /// <summary> 59 /// <summary>
60 /// Move an inventory folder to a new location 60 /// Move an inventory folder to a new location
61 /// </summary> 61 /// </summary>
62 /// <param name="userID"></param>
63 /// <param name="folder">A folder containing the details of the new location</param> 62 /// <param name="folder">A folder containing the details of the new location</param>
64 void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder); 63 /// <returns>true if the folder was successfully moved</returns>
64 bool MoveFolder(InventoryFolderBase folder);
65 65
66 /// <summary> 66 /// <summary>
67 /// Purge an inventory folder of all its items and subfolders. 67 /// Purge an inventory folder of all its items and subfolders.
68 /// </summary> 68 /// </summary>
69 /// <param name="userID"></param>
70 /// <param name="folder"></param> 69 /// <param name="folder"></param>
71 void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder); 70 /// <returns>true if the folder was successfully purged</returns>
71 bool PurgeFolder(InventoryFolderBase folder);
72 72
73 /// <summary> 73 /// <summary>
74 /// Add a new item to the given user's inventory 74 /// Add a new item to the user's inventory
75 /// </summary> 75 /// </summary>
76 /// <param name="userID"></param>
77 /// <param name="item"></param> 76 /// <param name="item"></param>
78 void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); 77 /// <returns>true if the item was successfully added</returns>
78 bool AddItem(InventoryItemBase item);
79 79
80 /// <summary> 80 /// <summary>
81 /// Update an item in the given user's inventory 81 /// Update an item in the user's inventory
82 /// </summary> 82 /// </summary>
83 /// <param name="userID"></param>
84 /// <param name="item"></param> 83 /// <param name="item"></param>
85 void UpdateInventoryItem(LLUUID userID, InventoryItemBase item); 84 /// <returns>true if the item was successfully updated</returns>
85 bool UpdateItem(InventoryItemBase item);
86 86
87 /// <summary> 87 /// <summary>
88 /// Delete an item from the given user's inventory 88 /// Delete an item from the user's inventory
89 /// </summary> 89 /// </summary>
90 /// <param name="userID"></param>
91 /// <param name="item"></param> 90 /// <param name="item"></param>
92 void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); 91 /// <returns>true if the item was successfully deleted</returns>
92 bool DeleteItem(InventoryItemBase item);
93 93
94 /// <summary> 94 /// <summary>
95 /// Create a new inventory for the given user. 95 /// Create a new inventory for the given user.
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs
index dab6a16..1601963 100644
--- a/OpenSim/Framework/Communications/InventoryServiceBase.cs
+++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs
@@ -106,16 +106,6 @@ namespace OpenSim.Framework.Communications
106 106
107 return userFolders; 107 return userFolders;
108 } 108 }
109
110 // See IInventoryServices
111 public void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder)
112 {
113 // FIXME: Probably doesn't do what was originally intended - only ever queries the first plugin
114 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
115 {
116 plugin.Value.moveInventoryFolder(folder);
117 }
118 }
119 109
120 // See IInventoryServices 110 // See IInventoryServices
121 public virtual bool HasInventoryForUser(LLUUID userID) 111 public virtual bool HasInventoryForUser(LLUUID userID)
@@ -159,25 +149,7 @@ namespace OpenSim.Framework.Communications
159 } 149 }
160 150
161 // See IInventoryServices 151 // See IInventoryServices
162 public abstract void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback); 152 public abstract void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback);
163
164 // See IInventoryServices
165 public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder);
166
167 // See IInventoryServices
168 public abstract void MoveExistingInventoryFolder(InventoryFolderBase folder);
169
170 // See IInventoryServices
171 public abstract void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder);
172
173 // See IInventoryServices
174 public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
175
176 // See IInventoryServices
177 public abstract void UpdateInventoryItem(LLUUID userID, InventoryItemBase item);
178
179 // See IInventoryServices
180 public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
181 153
182 #endregion 154 #endregion
183 155
@@ -206,47 +178,74 @@ namespace OpenSim.Framework.Communications
206 178
207 #endregion 179 #endregion
208 180
209 protected void AddFolder(InventoryFolderBase folder) 181 public bool AddFolder(InventoryFolderBase folder)
210 { 182 {
211 m_log.DebugFormat( 183 m_log.DebugFormat(
212 "[INVENTORY SERVICE BASE]: Adding folder {0}, {1} to {2}", folder.Name, folder.ID, folder.ParentID); 184 "[AGENT INVENTORY]: Adding folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
213 185
214 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) 186 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
215 { 187 {
216 plugin.Value.addInventoryFolder(folder); 188 plugin.Value.addInventoryFolder(folder);
217 } 189 }
190
191 // FIXME: Should return false on failure
192 return true;
218 } 193 }
219 194
220 protected void MoveFolder(InventoryFolderBase folder) 195 public bool MoveFolder(InventoryFolderBase folder)
221 { 196 {
197 m_log.DebugFormat(
198 "[AGENT INVENTORY]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
199
222 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) 200 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
223 { 201 {
224 plugin.Value.moveInventoryFolder(folder); 202 plugin.Value.moveInventoryFolder(folder);
225 } 203 }
204
205 // FIXME: Should return false on failure
206 return true;
226 } 207 }
227 208
228 protected void AddItem(InventoryItemBase item) 209 public bool AddItem(InventoryItemBase item)
229 { 210 {
211 m_log.DebugFormat(
212 "[AGENT INVENTORY]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder);
213
230 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) 214 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
231 { 215 {
232 plugin.Value.addInventoryItem(item); 216 plugin.Value.addInventoryItem(item);
233 } 217 }
218
219 // FIXME: Should return false on failure
220 return true;
234 } 221 }
235 222
236 protected void UpdateItem(InventoryItemBase item) 223 public bool UpdateItem(InventoryItemBase item)
237 { 224 {
225 m_log.InfoFormat(
226 "[AGENT INVENTORY]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder);
227
238 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) 228 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
239 { 229 {
240 plugin.Value.updateInventoryItem(item); 230 plugin.Value.updateInventoryItem(item);
241 } 231 }
232
233 // FIXME: Should return false on failure
234 return true;
242 } 235 }
243 236
244 protected void DeleteItem(InventoryItemBase item) 237 public bool DeleteItem(InventoryItemBase item)
245 { 238 {
239 m_log.InfoFormat(
240 "[AGENT INVENTORY]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder);
241
246 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) 242 foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
247 { 243 {
248 plugin.Value.deleteInventoryItem(item.ID); 244 plugin.Value.deleteInventoryItem(item.ID);
249 } 245 }
246
247 // FIXME: Should return false on failure
248 return true;
250 } 249 }
251 250
252 /// <summary> 251 /// <summary>
@@ -256,8 +255,11 @@ namespace OpenSim.Framework.Communications
256 /// already know... Needs heavy refactoring. 255 /// already know... Needs heavy refactoring.
257 /// </summary> 256 /// </summary>
258 /// <param name="folder"></param> 257 /// <param name="folder"></param>
259 protected void PurgeFolder(InventoryFolderBase folder) 258 public bool PurgeFolder(InventoryFolderBase folder)
260 { 259 {
260 m_log.DebugFormat(
261 "[AGENT INVENTORY]: Purging folder {0} {1} of its contents", folder.Name, folder.ID);
262
261 List<InventoryFolderBase> subFolders = RequestSubFolders(folder.ID); 263 List<InventoryFolderBase> subFolders = RequestSubFolders(folder.ID);
262 264
263 foreach (InventoryFolderBase subFolder in subFolders) 265 foreach (InventoryFolderBase subFolder in subFolders)
@@ -276,6 +278,9 @@ namespace OpenSim.Framework.Communications
276 { 278 {
277 DeleteItem(item); 279 DeleteItem(item);
278 } 280 }
281
282 // FIXME: Should return false on failure
283 return true;
279 } 284 }
280 285
281 private void AddNewInventorySet(UsersInventory inventory) 286 private void AddNewInventorySet(UsersInventory inventory)
@@ -283,7 +288,7 @@ namespace OpenSim.Framework.Communications
283 foreach (InventoryFolderBase folder in inventory.Folders.Values) 288 foreach (InventoryFolderBase folder in inventory.Folders.Values)
284 { 289 {
285 AddFolder(folder); 290 AddFolder(folder);
286 } 291 }
287 } 292 }
288 293
289 /// <summary> 294 /// <summary>
diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs
index db9a864..d9510e9 100644
--- a/OpenSim/Grid/InventoryServer/GridInventoryService.cs
+++ b/OpenSim/Grid/InventoryServer/GridInventoryService.cs
@@ -182,89 +182,7 @@ namespace OpenSim.Grid.InventoryServer
182 182
183 m_log.InfoFormat("[GRID AGENT INVENTORY]: Creating new set of inventory folders for user {0}", userID); 183 m_log.InfoFormat("[GRID AGENT INVENTORY]: Creating new set of inventory folders for user {0}", userID);
184 184
185 CreateNewUserInventory(userID); 185 return CreateNewUserInventory(userID);
186 return true;
187 }
188
189
190 public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
191 {
192 AddFolder(folder);
193 }
194
195 public override void MoveExistingInventoryFolder(InventoryFolderBase folder)
196 {
197 MoveFolder(folder);
198 }
199
200 public override void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder)
201 {
202 PurgeFolder(folder);
203 }
204
205 public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
206 {
207 AddItem(item);
208 }
209
210 public override void UpdateInventoryItem(LLUUID userID, InventoryItemBase item)
211 {
212 UpdateItem(item);
213 }
214
215 public bool AddInventoryFolder(InventoryFolderBase folder)
216 {
217 // Right now, this actions act more like an update/insert combination than a simple create.
218 m_log.InfoFormat(
219 "[GRID AGENT INVENTORY]: Creating folder {0} {1} in folder {2}", folder.Name, folder.ID, folder.ParentID);
220
221 AddNewInventoryFolder(folder.Owner, folder);
222 return true;
223 }
224
225 public bool MoveInventoryFolder(InventoryFolderBase folder)
226 {
227 m_log.InfoFormat(
228 "[GRID AGENT INVENTORY]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
229
230 MoveExistingInventoryFolder(folder);
231 return true;
232 }
233
234 public bool PurgeInventoryFolder(InventoryFolderBase folder)
235 {
236 m_log.InfoFormat(
237 "[GRID AGENT INVENTORY]: Purging folder {0} {1} of its contents", folder.Name, folder.ID);
238
239 PurgeInventoryFolder(folder.Owner, folder);
240 return true;
241 }
242
243 public bool AddInventoryItem(InventoryItemBase item)
244 {
245 // Right now, this actions act more like an update/insert combination than a simple create.
246 m_log.InfoFormat("[GRID AGENT INVENTORY]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder);
247
248 AddNewInventoryItem(item.Owner, item);
249 return true;
250 }
251
252 public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
253 {
254 m_log.InfoFormat("[GRID AGENT INVENTORY]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder);
255
256 DeleteItem(item);
257 }
258
259 /// <summary>
260 /// FIXME: Get DeleteInventoryItem to return a bool
261 /// </summary>
262 /// <param name="item"></param>
263 /// <returns></returns>
264 public bool DeleteInvItem(InventoryItemBase item)
265 {
266 DeleteInventoryItem(item.Owner, item);
267 return true;
268 } 186 }
269 } 187 }
270} 188}
diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs
index 870997b..4076d21 100644
--- a/OpenSim/Grid/InventoryServer/Main.cs
+++ b/OpenSim/Grid/InventoryServer/Main.cs
@@ -95,23 +95,23 @@ namespace OpenSim.Grid.InventoryServer
95 95
96 m_httpServer.AddStreamHandler( 96 m_httpServer.AddStreamHandler(
97 new RestDeserialisehandler<InventoryFolderBase, bool>( 97 new RestDeserialisehandler<InventoryFolderBase, bool>(
98 "POST", "/NewFolder/", m_inventoryService.AddInventoryFolder)); 98 "POST", "/NewFolder/", m_inventoryService.AddFolder));
99 99
100 m_httpServer.AddStreamHandler( 100 m_httpServer.AddStreamHandler(
101 new RestDeserialisehandler<InventoryFolderBase, bool>( 101 new RestDeserialisehandler<InventoryFolderBase, bool>(
102 "POST", "/MoveFolder/", m_inventoryService.MoveInventoryFolder)); 102 "POST", "/MoveFolder/", m_inventoryService.MoveFolder));
103 103
104 m_httpServer.AddStreamHandler( 104 m_httpServer.AddStreamHandler(
105 new RestDeserialisehandler<InventoryFolderBase, bool>( 105 new RestDeserialisehandler<InventoryFolderBase, bool>(
106 "POST", "/PurgeFolder/", m_inventoryService.PurgeInventoryFolder)); 106 "POST", "/PurgeFolder/", m_inventoryService.PurgeFolder));
107 107
108 m_httpServer.AddStreamHandler( 108 m_httpServer.AddStreamHandler(
109 new RestDeserialisehandler<InventoryItemBase, bool>( 109 new RestDeserialisehandler<InventoryItemBase, bool>(
110 "POST", "/NewItem/", m_inventoryService.AddInventoryItem)); 110 "POST", "/NewItem/", m_inventoryService.AddItem));
111 111
112 m_httpServer.AddStreamHandler( 112 m_httpServer.AddStreamHandler(
113 new RestDeserialisehandler<InventoryItemBase, bool>( 113 new RestDeserialisehandler<InventoryItemBase, bool>(
114 "POST", "/DeleteItem/", m_inventoryService.DeleteInvItem)); 114 "POST", "/DeleteItem/", m_inventoryService.DeleteItem));
115 115
116 // WARNING: Root folders no longer just delivers the root and immediate child folders (e.g 116 // WARNING: Root folders no longer just delivers the root and immediate child folders (e.g
117 // system folders such as Objects, Textures), but it now returns the entire inventory skeleton. 117 // system folders such as Objects, Textures), but it now returns the entire inventory skeleton.
diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
index 0de00a1..80108e3 100644
--- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs
+++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
@@ -80,41 +80,6 @@ namespace OpenSim.Region.Communications.Local
80 callback(userID, folders, items); 80 callback(userID, folders, items);
81 } 81 }
82 82
83 public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
84 {
85 AddFolder(folder);
86 }
87
88 public override void MoveExistingInventoryFolder(InventoryFolderBase folder)
89 {
90 MoveFolder(folder);
91 }
92
93 public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
94 {
95 AddItem(item);
96 }
97
98 public override void UpdateInventoryItem(LLUUID userID, InventoryItemBase item)
99 {
100 UpdateItem(item);
101 }
102
103 public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
104 {
105 DeleteItem(item);
106 }
107
108 /// <summary>
109 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
110 /// </summary>
111 /// <param name="userID"></param>
112 /// <param name="folder"></param>
113 public override void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder)
114 {
115 PurgeFolder(folder);
116 }
117
118 public override bool HasInventoryForUser(LLUUID userID) 83 public override bool HasInventoryForUser(LLUUID userID)
119 { 84 {
120 InventoryFolderBase root = RequestRootFolder(userID); 85 InventoryFolderBase root = RequestRootFolder(userID);
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
index 8a35519..ba91f14 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
@@ -154,14 +154,12 @@ namespace OpenSim.Region.Communications.OGS1
154 154
155 /// <summary> 155 /// <summary>
156 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> 156 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
157 /// </summary> 157 /// </summary>
158 /// <param name="userID"></param> 158 public bool AddFolder(InventoryFolderBase folder)
159 /// <param name="folder"></param>
160 public void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
161 { 159 {
162 try 160 try
163 { 161 {
164 SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>( 162 return SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>(
165 "POST", _inventoryServerUrl + "/NewFolder/", folder); 163 "POST", _inventoryServerUrl + "/NewFolder/", folder);
166 } 164 }
167 catch (WebException e) 165 catch (WebException e)
@@ -169,18 +167,19 @@ namespace OpenSim.Region.Communications.OGS1
169 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory folder operation failed, {0} {1}", 167 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory folder operation failed, {0} {1}",
170 e.Source, e.Message); 168 e.Source, e.Message);
171 } 169 }
170
171 return false;
172 } 172 }
173 173
174 /// <summary> 174 /// <summary>
175 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> 175 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
176 /// </summary> 176 /// </summary>
177 /// <param name="userID"></param>
178 /// <param name="folder"></param> 177 /// <param name="folder"></param>
179 public void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder) 178 public bool MoveFolder(InventoryFolderBase folder)
180 { 179 {
181 try 180 try
182 { 181 {
183 SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>( 182 return SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>(
184 "POST", _inventoryServerUrl + "/MoveFolder/", folder); 183 "POST", _inventoryServerUrl + "/MoveFolder/", folder);
185 } 184 }
186 catch (WebException e) 185 catch (WebException e)
@@ -188,19 +187,18 @@ namespace OpenSim.Region.Communications.OGS1
188 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}", 187 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}",
189 e.Source, e.Message); 188 e.Source, e.Message);
190 } 189 }
190
191 return false;
191 } 192 }
192 193
193 /// <summary> 194 /// <summary>
194 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> 195 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
195 /// </summary> 196 /// </summary>
196 /// <param name="userID"></param> 197 public bool PurgeFolder(InventoryFolderBase folder)
197 /// <param name="folder"></param>
198 /// <returns></returns>
199 public void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder)
200 { 198 {
201 try 199 try
202 { 200 {
203 SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>( 201 return SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>(
204 "POST", _inventoryServerUrl + "/PurgeFolder/", folder); 202 "POST", _inventoryServerUrl + "/PurgeFolder/", folder);
205 } 203 }
206 catch (WebException e) 204 catch (WebException e)
@@ -208,33 +206,35 @@ namespace OpenSim.Region.Communications.OGS1
208 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}", 206 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}",
209 e.Source, e.Message); 207 e.Source, e.Message);
210 } 208 }
209
210 return false;
211 } 211 }
212 212
213 /// <summary> 213 /// <summary>
214 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> 214 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
215 /// </summary> 215 /// </summary>
216 /// <param name="userID"></param> 216 public bool AddItem(InventoryItemBase item)
217 /// <param name="folder"></param>
218 public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
219 { 217 {
220 try 218 try
221 { 219 {
222 SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>( 220 return SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
223 "POST", _inventoryServerUrl + "/NewItem/", item); 221 "POST", _inventoryServerUrl + "/NewItem/", item);
224 } 222 }
225 catch (WebException e) 223 catch (WebException e)
226 { 224 {
227 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory item operation failed, {0} {1}", 225 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory item operation failed, {0} {1}",
228 e.Source, e.Message); 226 e.Source, e.Message);
229 } 227 }
228
229 return false;
230 } 230 }
231 231
232 // TODO: this is a temporary workaround, the UpdateInventoryItem method need to be implemented 232 // TODO: this is a temporary workaround, the UpdateInventoryItem method need to be implemented
233 public void UpdateInventoryItem(LLUUID userID, InventoryItemBase item) 233 public bool UpdateItem(InventoryItemBase item)
234 { 234 {
235 try 235 try
236 { 236 {
237 SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>( 237 return SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
238 "POST", _inventoryServerUrl + "/NewItem/", item); 238 "POST", _inventoryServerUrl + "/NewItem/", item);
239 } 239 }
240 catch (WebException e) 240 catch (WebException e)
@@ -242,18 +242,18 @@ namespace OpenSim.Region.Communications.OGS1
242 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Update new inventory item operation failed, {0} {1}", 242 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Update new inventory item operation failed, {0} {1}",
243 e.Source, e.Message); 243 e.Source, e.Message);
244 } 244 }
245
246 return false;
245 } 247 }
246 248
247 /// <summary> 249 /// <summary>
248 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> 250 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
249 /// </summary> 251 /// </summary>
250 /// <param name="userID"></param> 252 public bool DeleteItem(InventoryItemBase item)
251 /// <param name="folder"></param>
252 public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
253 { 253 {
254 try 254 try
255 { 255 {
256 SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>( 256 return SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
257 "POST", _inventoryServerUrl + "/DeleteItem/", item); 257 "POST", _inventoryServerUrl + "/DeleteItem/", item);
258 } 258 }
259 catch (WebException e) 259 catch (WebException e)
@@ -261,6 +261,8 @@ namespace OpenSim.Region.Communications.OGS1
261 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Delete inventory item operation failed, {0} {1}", 261 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Delete inventory item operation failed, {0} {1}",
262 e.Source, e.Message); 262 e.Source, e.Message);
263 } 263 }
264
265 return false;
264 } 266 }
265 267
266 public bool HasInventoryForUser(LLUUID userID) 268 public bool HasInventoryForUser(LLUUID userID)