aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/Inventory
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/Connectors/Inventory')
-rw-r--r--OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs30
-rw-r--r--OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs11
-rw-r--r--OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs68
-rw-r--r--OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs7
4 files changed, 109 insertions, 7 deletions
diff --git a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs
index 94b4ad9..45e921a 100644
--- a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs
@@ -214,6 +214,19 @@ namespace OpenSim.Services.Connectors.Inventory
214 return false; 214 return false;
215 } 215 }
216 216
217 public List<InventoryItemBase> GetFolderItems(string id, UUID folderID, UUID sessionID)
218 {
219 string url = string.Empty;
220 string userID = string.Empty;
221
222 if (StringToUrlAndUserID(id, out url, out userID))
223 {
224 ISessionAuthInventoryService connector = GetConnector(url);
225 return connector.GetFolderItems(userID, folderID, sessionID);
226 }
227 return new List<InventoryItemBase>();
228 }
229
217 public bool AddItem(string id, InventoryItemBase item, UUID sessionID) 230 public bool AddItem(string id, InventoryItemBase item, UUID sessionID)
218 { 231 {
219 string url = string.Empty; 232 string url = string.Empty;
@@ -240,7 +253,7 @@ namespace OpenSim.Services.Connectors.Inventory
240 return false; 253 return false;
241 } 254 }
242 255
243 public bool DeleteItem(string id, InventoryItemBase item, UUID sessionID) 256 public bool MoveItems(string id, List<InventoryItemBase> items, UUID sessionID)
244 { 257 {
245 string url = string.Empty; 258 string url = string.Empty;
246 string userID = string.Empty; 259 string userID = string.Empty;
@@ -248,7 +261,20 @@ namespace OpenSim.Services.Connectors.Inventory
248 if (StringToUrlAndUserID(id, out url, out userID)) 261 if (StringToUrlAndUserID(id, out url, out userID))
249 { 262 {
250 ISessionAuthInventoryService connector = GetConnector(url); 263 ISessionAuthInventoryService connector = GetConnector(url);
251 return connector.UpdateItem(userID, item, sessionID); 264 return connector.MoveItems(userID, items, sessionID);
265 }
266 return false;
267 }
268
269 public bool DeleteItems(string id, List<UUID> itemIDs, UUID sessionID)
270 {
271 string url = string.Empty;
272 string userID = string.Empty;
273
274 if (StringToUrlAndUserID(id, out url, out userID))
275 {
276 ISessionAuthInventoryService connector = GetConnector(url);
277 return connector.DeleteItems(userID, itemIDs, sessionID);
252 } 278 }
253 return false; 279 return false;
254 } 280 }
diff --git a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs
index f50bcf5..c89c9b7 100644
--- a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs
+++ b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs
@@ -96,6 +96,13 @@ namespace OpenSim.Services.Connectors
96 bool PurgeFolder(string userID, InventoryFolderBase folder, UUID session_id); 96 bool PurgeFolder(string userID, InventoryFolderBase folder, UUID session_id);
97 97
98 /// <summary> 98 /// <summary>
99 /// Get items from a folder.
100 /// </summary>
101 /// <param name="folder"></param>
102 /// <returns>true if the folder was successfully purged</returns>
103 List<InventoryItemBase> GetFolderItems(string userID, UUID folderID, UUID session_id);
104
105 /// <summary>
99 /// Add a new item to the user's inventory 106 /// Add a new item to the user's inventory
100 /// </summary> 107 /// </summary>
101 /// <param name="item"></param> 108 /// <param name="item"></param>
@@ -109,12 +116,14 @@ namespace OpenSim.Services.Connectors
109 /// <returns>true if the item was successfully updated</returns> 116 /// <returns>true if the item was successfully updated</returns>
110 bool UpdateItem(string userID, InventoryItemBase item, UUID session_id); 117 bool UpdateItem(string userID, InventoryItemBase item, UUID session_id);
111 118
119 bool MoveItems(string userID, List<InventoryItemBase> items, UUID session_id);
120
112 /// <summary> 121 /// <summary>
113 /// Delete an item from the user's inventory 122 /// Delete an item from the user's inventory
114 /// </summary> 123 /// </summary>
115 /// <param name="item"></param> 124 /// <param name="item"></param>
116 /// <returns>true if the item was successfully deleted</returns> 125 /// <returns>true if the item was successfully deleted</returns>
117 bool DeleteItem(string userID, InventoryItemBase item, UUID session_id); 126 bool DeleteItems(string userID, List<UUID> itemIDs, UUID session_id);
118 127
119 InventoryItemBase QueryItem(string userID, InventoryItemBase item, UUID session_id); 128 InventoryItemBase QueryItem(string userID, InventoryItemBase item, UUID session_id);
120 129
diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs
index 5d94eac..bcf9d87 100644
--- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs
@@ -334,6 +334,23 @@ namespace OpenSim.Services.Connectors
334 return false; 334 return false;
335 } 335 }
336 336
337 public List<InventoryItemBase> GetFolderItems(string userID, UUID folderID, UUID sessionID)
338 {
339 try
340 {
341 InventoryFolderBase folder = new InventoryFolderBase(folderID, new UUID(userID));
342 return SynchronousRestSessionObjectPoster<InventoryFolderBase, List<InventoryItemBase>>.BeginPostObject(
343 "POST", m_ServerURI + "/GetItems/", folder, sessionID.ToString(), userID);
344 }
345 catch (Exception e)
346 {
347 m_log.ErrorFormat("[INVENTORY CONNECTOR]: Get folder items operation failed, {0} {1}",
348 e.Source, e.Message);
349 }
350
351 return null;
352 }
353
337 public bool AddItem(string userID, InventoryItemBase item, UUID sessionID) 354 public bool AddItem(string userID, InventoryItemBase item, UUID sessionID)
338 { 355 {
339 try 356 try
@@ -366,12 +383,57 @@ namespace OpenSim.Services.Connectors
366 return false; 383 return false;
367 } 384 }
368 385
369 public bool DeleteItem(string userID, InventoryItemBase item, UUID sessionID) 386 /**
387 * MoveItems Async group
388 */
389
390 delegate void MoveItemsDelegate(string userID, List<InventoryItemBase> items, UUID sessionID);
391
392 private void MoveItemsAsync(string userID, List<InventoryItemBase> items, UUID sessionID)
370 { 393 {
371 try 394 try
372 { 395 {
373 return SynchronousRestSessionObjectPoster<InventoryItemBase, bool>.BeginPostObject( 396 SynchronousRestSessionObjectPoster<List<InventoryItemBase>, bool>.BeginPostObject(
374 "POST", m_ServerURI + "/DeleteItem/", item, sessionID.ToString(), item.Owner.ToString()); 397 "POST", m_ServerURI + "/MoveItems/", items, sessionID.ToString(), userID.ToString());
398
399 // Success
400 return;
401 }
402 catch (Exception e)
403 {
404 m_log.ErrorFormat("[INVENTORY CONNECTOR]: Move inventory items operation failed, {0} {1} (old server?). Trying slow way.",
405 e.Source, e.Message);
406 }
407
408 foreach (InventoryItemBase item in items)
409 {
410 InventoryItemBase itm = this.QueryItem(userID, item, sessionID);
411 itm.Name = item.Name;
412 itm.Folder = item.Folder;
413 this.UpdateItem(userID, itm, sessionID);
414 }
415 }
416
417 private void MoveItemsCompleted(IAsyncResult iar)
418 {
419 }
420
421 public bool MoveItems(string userID, List<InventoryItemBase> items, UUID sessionID)
422 {
423 MoveItemsDelegate d = MoveItemsAsync;
424 d.BeginInvoke(userID, items, sessionID, MoveItemsCompleted, d);
425 return true;
426 }
427
428 public bool DeleteItems(string userID, List<UUID> items, UUID sessionID)
429 {
430 try
431 {
432 List<Guid> guids = new List<Guid>();
433 foreach (UUID u in items)
434 guids.Add(u.Guid);
435 return SynchronousRestSessionObjectPoster<List<Guid>, bool>.BeginPostObject(
436 "POST", m_ServerURI + "/DeleteItem/", guids, sessionID.ToString(), userID);
375 } 437 }
376 catch (Exception e) 438 catch (Exception e)
377 { 439 {
diff --git a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs
index 5cbd307..cd283ff 100644
--- a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs
@@ -151,7 +151,12 @@ namespace OpenSim.Services.Connectors
151 return false; 151 return false;
152 } 152 }
153 153
154 public bool DeleteItem(InventoryItemBase item) 154 public bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
155 {
156 return false;
157 }
158
159 public bool DeleteItems(UUID owner, List<UUID> itemIDs)
155 { 160 {
156 return false; 161 return false;
157 } 162 }