aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/AssetService/AssetService.cs10
-rw-r--r--OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs43
-rw-r--r--OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs16
-rw-r--r--OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs175
-rw-r--r--OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs13
-rw-r--r--OpenSim/Services/Interfaces/IInventoryService.cs13
-rw-r--r--OpenSim/Services/InventoryService/InventoryService.cs54
7 files changed, 269 insertions, 55 deletions
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs
index fe663eb..88a905c 100644
--- a/OpenSim/Services/AssetService/AssetService.cs
+++ b/OpenSim/Services/AssetService/AssetService.cs
@@ -83,7 +83,7 @@ namespace OpenSim.Services.AssetService
83 if (!UUID.TryParse(id, out assetID)) 83 if (!UUID.TryParse(id, out assetID))
84 return null; 84 return null;
85 85
86 return m_Database.FetchAsset(assetID); 86 return m_Database.GetAsset(assetID);
87 } 87 }
88 88
89 public AssetMetadata GetMetadata(string id) 89 public AssetMetadata GetMetadata(string id)
@@ -93,7 +93,7 @@ namespace OpenSim.Services.AssetService
93 if (!UUID.TryParse(id, out assetID)) 93 if (!UUID.TryParse(id, out assetID))
94 return null; 94 return null;
95 95
96 AssetBase asset = m_Database.FetchAsset(assetID); 96 AssetBase asset = m_Database.GetAsset(assetID);
97 return asset.Metadata; 97 return asset.Metadata;
98 } 98 }
99 99
@@ -104,7 +104,7 @@ namespace OpenSim.Services.AssetService
104 if (!UUID.TryParse(id, out assetID)) 104 if (!UUID.TryParse(id, out assetID))
105 return null; 105 return null;
106 106
107 AssetBase asset = m_Database.FetchAsset(assetID); 107 AssetBase asset = m_Database.GetAsset(assetID);
108 return asset.Data; 108 return asset.Data;
109 } 109 }
110 110
@@ -117,7 +117,7 @@ namespace OpenSim.Services.AssetService
117 if (!UUID.TryParse(id, out assetID)) 117 if (!UUID.TryParse(id, out assetID))
118 return false; 118 return false;
119 119
120 AssetBase asset = m_Database.FetchAsset(assetID); 120 AssetBase asset = m_Database.GetAsset(assetID);
121 121
122 //m_log.DebugFormat("[AssetService]: Got asset {0}", asset); 122 //m_log.DebugFormat("[AssetService]: Got asset {0}", asset);
123 123
@@ -129,7 +129,7 @@ namespace OpenSim.Services.AssetService
129 public string Store(AssetBase asset) 129 public string Store(AssetBase asset)
130 { 130 {
131 //m_log.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID); 131 //m_log.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID);
132 m_Database.CreateAsset(asset); 132 m_Database.StoreAsset(asset);
133 133
134 return asset.ID; 134 return asset.ID;
135 } 135 }
diff --git a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs
index 94b4ad9..1004fb9 100644
--- a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs
@@ -201,6 +201,19 @@ namespace OpenSim.Services.Connectors.Inventory
201 return false; 201 return false;
202 } 202 }
203 203
204 public bool DeleteFolders(string id, List<UUID> folders, UUID sessionID)
205 {
206 string url = string.Empty;
207 string userID = string.Empty;
208
209 if (StringToUrlAndUserID(id, out url, out userID))
210 {
211 ISessionAuthInventoryService connector = GetConnector(url);
212 return connector.DeleteFolders(userID, folders, sessionID);
213 }
214 return false;
215 }
216
204 public bool PurgeFolder(string id, InventoryFolderBase folder, UUID sessionID) 217 public bool PurgeFolder(string id, InventoryFolderBase folder, UUID sessionID)
205 { 218 {
206 string url = string.Empty; 219 string url = string.Empty;
@@ -214,6 +227,19 @@ namespace OpenSim.Services.Connectors.Inventory
214 return false; 227 return false;
215 } 228 }
216 229
230 public List<InventoryItemBase> GetFolderItems(string id, UUID folderID, UUID sessionID)
231 {
232 string url = string.Empty;
233 string userID = string.Empty;
234
235 if (StringToUrlAndUserID(id, out url, out userID))
236 {
237 ISessionAuthInventoryService connector = GetConnector(url);
238 return connector.GetFolderItems(userID, folderID, sessionID);
239 }
240 return new List<InventoryItemBase>();
241 }
242
217 public bool AddItem(string id, InventoryItemBase item, UUID sessionID) 243 public bool AddItem(string id, InventoryItemBase item, UUID sessionID)
218 { 244 {
219 string url = string.Empty; 245 string url = string.Empty;
@@ -240,7 +266,7 @@ namespace OpenSim.Services.Connectors.Inventory
240 return false; 266 return false;
241 } 267 }
242 268
243 public bool DeleteItem(string id, InventoryItemBase item, UUID sessionID) 269 public bool MoveItems(string id, List<InventoryItemBase> items, UUID sessionID)
244 { 270 {
245 string url = string.Empty; 271 string url = string.Empty;
246 string userID = string.Empty; 272 string userID = string.Empty;
@@ -248,7 +274,20 @@ namespace OpenSim.Services.Connectors.Inventory
248 if (StringToUrlAndUserID(id, out url, out userID)) 274 if (StringToUrlAndUserID(id, out url, out userID))
249 { 275 {
250 ISessionAuthInventoryService connector = GetConnector(url); 276 ISessionAuthInventoryService connector = GetConnector(url);
251 return connector.UpdateItem(userID, item, sessionID); 277 return connector.MoveItems(userID, items, sessionID);
278 }
279 return false;
280 }
281
282 public bool DeleteItems(string id, List<UUID> itemIDs, UUID sessionID)
283 {
284 string url = string.Empty;
285 string userID = string.Empty;
286
287 if (StringToUrlAndUserID(id, out url, out userID))
288 {
289 ISessionAuthInventoryService connector = GetConnector(url);
290 return connector.DeleteItems(userID, itemIDs, sessionID);
252 } 291 }
253 return false; 292 return false;
254 } 293 }
diff --git a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs
index f50bcf5..da8c7e2 100644
--- a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs
+++ b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs
@@ -89,6 +89,11 @@ namespace OpenSim.Services.Connectors
89 bool MoveFolder(string userID, InventoryFolderBase folder, UUID session_id); 89 bool MoveFolder(string userID, InventoryFolderBase folder, UUID session_id);
90 90
91 /// <summary> 91 /// <summary>
92 /// Delete a list of inventory folders (from trash)
93 /// </summary>
94 bool DeleteFolders(string userID, List<UUID> folders, UUID session_id);
95
96 /// <summary>
92 /// Purge an inventory folder of all its items and subfolders. 97 /// Purge an inventory folder of all its items and subfolders.
93 /// </summary> 98 /// </summary>
94 /// <param name="folder"></param> 99 /// <param name="folder"></param>
@@ -96,6 +101,13 @@ namespace OpenSim.Services.Connectors
96 bool PurgeFolder(string userID, InventoryFolderBase folder, UUID session_id); 101 bool PurgeFolder(string userID, InventoryFolderBase folder, UUID session_id);
97 102
98 /// <summary> 103 /// <summary>
104 /// Get items from a folder.
105 /// </summary>
106 /// <param name="folder"></param>
107 /// <returns>true if the folder was successfully purged</returns>
108 List<InventoryItemBase> GetFolderItems(string userID, UUID folderID, UUID session_id);
109
110 /// <summary>
99 /// Add a new item to the user's inventory 111 /// Add a new item to the user's inventory
100 /// </summary> 112 /// </summary>
101 /// <param name="item"></param> 113 /// <param name="item"></param>
@@ -109,12 +121,14 @@ namespace OpenSim.Services.Connectors
109 /// <returns>true if the item was successfully updated</returns> 121 /// <returns>true if the item was successfully updated</returns>
110 bool UpdateItem(string userID, InventoryItemBase item, UUID session_id); 122 bool UpdateItem(string userID, InventoryItemBase item, UUID session_id);
111 123
124 bool MoveItems(string userID, List<InventoryItemBase> items, UUID session_id);
125
112 /// <summary> 126 /// <summary>
113 /// Delete an item from the user's inventory 127 /// Delete an item from the user's inventory
114 /// </summary> 128 /// </summary>
115 /// <param name="item"></param> 129 /// <param name="item"></param>
116 /// <returns>true if the item was successfully deleted</returns> 130 /// <returns>true if the item was successfully deleted</returns>
117 bool DeleteItem(string userID, InventoryItemBase item, UUID session_id); 131 bool DeleteItems(string userID, List<UUID> itemIDs, UUID session_id);
118 132
119 InventoryItemBase QueryItem(string userID, InventoryItemBase item, UUID session_id); 133 InventoryItemBase QueryItem(string userID, InventoryItemBase item, UUID session_id);
120 134
diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs
index 5d94eac..a2261ba 100644
--- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs
@@ -178,30 +178,36 @@ namespace OpenSim.Services.Connectors
178 catch (Exception e) 178 catch (Exception e)
179 { 179 {
180 // Maybe we're talking to an old inventory server. Try this other thing. 180 // Maybe we're talking to an old inventory server. Try this other thing.
181 m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetSystemFolders operation failed, {0} {1}. Trying RootFolders.", 181 m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetSystemFolders operation failed, {0} {1} (old sever?). Trying GetInventory.",
182 e.Source, e.Message); 182 e.Source, e.Message);
183 183
184 try 184 try
185 { 185 {
186 folders = SynchronousRestSessionObjectPoster<Guid, List<InventoryFolderBase>>.BeginPostObject( 186 InventoryCollection inventory = SynchronousRestSessionObjectPoster<Guid, InventoryCollection>.BeginPostObject(
187 "POST", m_ServerURI + "/RootFolders/", new Guid(userID), sessionID.ToString(), userID.ToString()); 187 "POST", m_ServerURI + "/GetInventory/", new Guid(userID), sessionID.ToString(), userID.ToString());
188 folders = inventory.Folders;
188 } 189 }
189 catch (Exception ex) 190 catch (Exception ex)
190 { 191 {
191 m_log.ErrorFormat("[INVENTORY CONNECTOR]: RootFolders operation also failed, {0} {1}. Give up.", 192 m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetInventory operation also failed, {0} {1}. Giving up.",
192 e.Source, ex.Message); 193 e.Source, ex.Message);
193 } 194 }
194 195
195 if ((folders != null) && (folders.Count > 0)) 196 if ((folders != null) && (folders.Count > 0))
196 { 197 {
197 dFolders[AssetType.Folder] = folders[0]; // Root folder is the first one 198 m_log.DebugFormat("[INVENTORY CONNECTOR]: Received entire inventory ({0} folders) for user {1}",
198 folders.RemoveAt(0); 199 folders.Count, userID);
199 foreach (InventoryFolderBase f in folders) 200 foreach (InventoryFolderBase f in folders)
200 { 201 {
201 if ((f.Type != (short)AssetType.Folder) && (f.Type != (short)AssetType.Unknown)) 202 if ((f.Type != (short)AssetType.Folder) && (f.Type != (short)AssetType.Unknown))
202 dFolders[(AssetType)f.Type] = f; 203 dFolders[(AssetType)f.Type] = f;
203 } 204 }
204 205
206 UUID rootFolderID = dFolders[AssetType.Animation].ParentID;
207 InventoryFolderBase rootFolder = new InventoryFolderBase(rootFolderID, new UUID(userID));
208 rootFolder = QueryFolder(userID, rootFolder, sessionID);
209 dFolders[AssetType.Folder] = rootFolder;
210 m_log.DebugFormat("[INVENTORY CONNECTOR]: {0} system folders for user {1}", dFolders.Count, userID);
205 return dFolders; 211 return dFolders;
206 } 212 }
207 } 213 }
@@ -223,51 +229,56 @@ namespace OpenSim.Services.Connectors
223 return SynchronousRestSessionObjectPoster<Guid, InventoryCollection>.BeginPostObject( 229 return SynchronousRestSessionObjectPoster<Guid, InventoryCollection>.BeginPostObject(
224 "POST", m_ServerURI + "/GetFolderContent/", folderID.Guid, sessionID.ToString(), userID.ToString()); 230 "POST", m_ServerURI + "/GetFolderContent/", folderID.Guid, sessionID.ToString(), userID.ToString());
225 } 231 }
232 catch (TimeoutException e)
233 {
234 m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderContent operation to {0} timed out {0} {1}.", m_ServerURI,
235 e.Source, e.Message);
236 }
226 catch (Exception e) 237 catch (Exception e)
227 { 238 {
228 // Maybe we're talking to an old inventory server. Try this other thing. 239 // Maybe we're talking to an old inventory server. Try this other thing.
229 m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderForType operation failed, {0} {1}. Trying RootFolders and GetItems.", 240 m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetFolderContent operation failed, {0} {1} (old server?). Trying GetInventory.",
230 e.Source, e.Message); 241 e.Source, e.Message);
231 242
243 InventoryCollection inventory;
232 List<InventoryFolderBase> folders = null; 244 List<InventoryFolderBase> folders = null;
233 try 245 try
234 { 246 {
235 folders = SynchronousRestSessionObjectPoster<Guid, List<InventoryFolderBase>>.BeginPostObject( 247 inventory = SynchronousRestSessionObjectPoster<Guid, InventoryCollection>.BeginPostObject(
236 "POST", m_ServerURI + "/RootFolders/", new Guid(userID), sessionID.ToString(), userID.ToString()); 248 "POST", m_ServerURI + "/GetInventory/", new Guid(userID), sessionID.ToString(), userID.ToString());
249 if (inventory != null)
250 folders = inventory.Folders;
237 } 251 }
238 catch (Exception ex) 252 catch (Exception ex)
239 { 253 {
240 m_log.ErrorFormat("[INVENTORY CONNECTOR]: RootFolders operation also failed, {0} {1}. Give up.", 254 m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetInventory operation also failed, {0} {1}. Giving up.",
241 e.Source, ex.Message); 255 e.Source, ex.Message);
256 return new InventoryCollection();
242 } 257 }
243 258
244 if ((folders != null) && (folders.Count > 0)) 259 if ((folders != null) && (folders.Count > 0))
245 { 260 {
246 folders = folders.FindAll(delegate (InventoryFolderBase f) { return f.ParentID == folderID ; }); 261 m_log.DebugFormat("[INVENTORY CONNECTOR]: Received entire inventory ({0} folders) for user {1}",
247 262 folders.Count, userID);
248 try
249 {
250 List<InventoryItemBase> items = SynchronousRestSessionObjectPoster<Guid, List<InventoryItemBase>>.BeginPostObject(
251 "POST", m_ServerURI + "/GetItems/", folderID.Guid, sessionID.ToString(), userID.ToString());
252 263
253 if (items != null) 264 folders = folders.FindAll(delegate(InventoryFolderBase f) { return f.ParentID == folderID; });
254 { 265 List<InventoryItemBase> items = inventory.Items;
255 InventoryCollection result = new InventoryCollection(); 266 if (items != null)
256 result.Folders = folders;
257 result.Items = items;
258 result.UserID = new UUID(userID);
259 return result;
260 }
261 }
262 catch (Exception ex)
263 { 267 {
264 m_log.ErrorFormat("[INVENTORY CONNECTOR]: QueryFolder and GetItems operation failed, {0} {1}. Give up.", 268 items = items.FindAll(delegate(InventoryItemBase i) { return i.Folder == folderID; });
265 e.Source, ex.Message);
266 } 269 }
270
271 inventory.Items = items;
272 inventory.Folders = folders;
273 return inventory;
267 } 274 }
268 } 275 }
269 276
270 return null; 277 InventoryCollection nullCollection = new InventoryCollection();
278 nullCollection.Folders = new List<InventoryFolderBase>();
279 nullCollection.Items = new List<InventoryItemBase>();
280 nullCollection.UserID = new UUID(userID);
281 return nullCollection;
271 } 282 }
272 283
273 public bool AddFolder(string userID, InventoryFolderBase folder, UUID sessionID) 284 public bool AddFolder(string userID, InventoryFolderBase folder, UUID sessionID)
@@ -302,6 +313,25 @@ namespace OpenSim.Services.Connectors
302 return false; 313 return false;
303 } 314 }
304 315
316 public bool DeleteFolders(string userID, List<UUID> folderIDs, UUID sessionID)
317 {
318 try
319 {
320 List<Guid> guids = new List<Guid>();
321 foreach (UUID u in folderIDs)
322 guids.Add(u.Guid);
323 return SynchronousRestSessionObjectPoster<List<Guid>, bool>.BeginPostObject(
324 "POST", m_ServerURI + "/DeleteFolders/", guids, sessionID.ToString(), userID);
325 }
326 catch (Exception e)
327 {
328 m_log.ErrorFormat("[INVENTORY CONNECTOR]: Delete inventory folders operation failed, {0} {1}",
329 e.Source, e.Message);
330 }
331
332 return false;
333 }
334
305 public bool MoveFolder(string userID, InventoryFolderBase folder, UUID sessionID) 335 public bool MoveFolder(string userID, InventoryFolderBase folder, UUID sessionID)
306 { 336 {
307 try 337 try
@@ -334,6 +364,23 @@ namespace OpenSim.Services.Connectors
334 return false; 364 return false;
335 } 365 }
336 366
367 public List<InventoryItemBase> GetFolderItems(string userID, UUID folderID, UUID sessionID)
368 {
369 try
370 {
371 InventoryFolderBase folder = new InventoryFolderBase(folderID, new UUID(userID));
372 return SynchronousRestSessionObjectPoster<InventoryFolderBase, List<InventoryItemBase>>.BeginPostObject(
373 "POST", m_ServerURI + "/GetItems/", folder, sessionID.ToString(), userID);
374 }
375 catch (Exception e)
376 {
377 m_log.ErrorFormat("[INVENTORY CONNECTOR]: Get folder items operation failed, {0} {1}",
378 e.Source, e.Message);
379 }
380
381 return null;
382 }
383
337 public bool AddItem(string userID, InventoryItemBase item, UUID sessionID) 384 public bool AddItem(string userID, InventoryItemBase item, UUID sessionID)
338 { 385 {
339 try 386 try
@@ -366,12 +413,72 @@ namespace OpenSim.Services.Connectors
366 return false; 413 return false;
367 } 414 }
368 415
369 public bool DeleteItem(string userID, InventoryItemBase item, UUID sessionID) 416 /**
417 * MoveItems Async group
418 */
419
420 delegate void MoveItemsDelegate(string userID, List<InventoryItemBase> items, UUID sessionID);
421
422 private void MoveItemsAsync(string userID, List<InventoryItemBase> items, UUID sessionID)
370 { 423 {
424 if (items == null)
425 {
426 m_log.WarnFormat("[INVENTORY CONNECTOR]: request to move items got a null list.");
427 return;
428 }
429
371 try 430 try
372 { 431 {
373 return SynchronousRestSessionObjectPoster<InventoryItemBase, bool>.BeginPostObject( 432 //SynchronousRestSessionObjectPoster<List<InventoryItemBase>, bool>.BeginPostObject(
374 "POST", m_ServerURI + "/DeleteItem/", item, sessionID.ToString(), item.Owner.ToString()); 433 // "POST", m_ServerURI + "/MoveItems/", items, sessionID.ToString(), userID.ToString());
434
435 //// Success
436 //return;
437 string uri = m_ServerURI + "/inventory/" + userID;
438 if (SynchronousRestObjectRequester.
439 MakeRequest<List<InventoryItemBase>, bool>("PUT", uri, items))
440 m_log.DebugFormat("[INVENTORY CONNECTOR]: move {0} items poster succeeded {1}", items.Count, uri);
441 else
442 m_log.DebugFormat("[INVENTORY CONNECTOR]: move {0} items poster failed {1}", items.Count, uri); ;
443
444 return;
445
446 }
447 catch (Exception e)
448 {
449 m_log.ErrorFormat("[INVENTORY CONNECTOR]: Move inventory items operation failed, {0} {1} (old server?). Trying slow way.",
450 e.Source, e.Message);
451 }
452
453 foreach (InventoryItemBase item in items)
454 {
455 InventoryItemBase itm = this.QueryItem(userID, item, sessionID);
456 itm.Name = item.Name;
457 itm.Folder = item.Folder;
458 this.UpdateItem(userID, itm, sessionID);
459 }
460 }
461
462 private void MoveItemsCompleted(IAsyncResult iar)
463 {
464 }
465
466 public bool MoveItems(string userID, List<InventoryItemBase> items, UUID sessionID)
467 {
468 MoveItemsDelegate d = MoveItemsAsync;
469 d.BeginInvoke(userID, items, sessionID, MoveItemsCompleted, d);
470 return true;
471 }
472
473 public bool DeleteItems(string userID, List<UUID> items, UUID sessionID)
474 {
475 try
476 {
477 List<Guid> guids = new List<Guid>();
478 foreach (UUID u in items)
479 guids.Add(u.Guid);
480 return SynchronousRestSessionObjectPoster<List<Guid>, bool>.BeginPostObject(
481 "POST", m_ServerURI + "/DeleteItem/", guids, sessionID.ToString(), userID);
375 } 482 }
376 catch (Exception e) 483 catch (Exception e)
377 { 484 {
@@ -398,12 +505,12 @@ namespace OpenSim.Services.Connectors
398 return null; 505 return null;
399 } 506 }
400 507
401 public InventoryFolderBase QueryFolder(string userID, InventoryFolderBase item, UUID sessionID) 508 public InventoryFolderBase QueryFolder(string userID, InventoryFolderBase folder, UUID sessionID)
402 { 509 {
403 try 510 try
404 { 511 {
405 return SynchronousRestSessionObjectPoster<InventoryFolderBase, InventoryFolderBase>.BeginPostObject( 512 return SynchronousRestSessionObjectPoster<InventoryFolderBase, InventoryFolderBase>.BeginPostObject(
406 "POST", m_ServerURI + "/QueryFolder/", item, sessionID.ToString(), item.Owner.ToString()); 513 "POST", m_ServerURI + "/QueryFolder/", folder, sessionID.ToString(), userID);
407 } 514 }
408 catch (Exception e) 515 catch (Exception e)
409 { 516 {
diff --git a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs
index 5cbd307..a7aa138 100644
--- a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs
@@ -136,6 +136,12 @@ namespace OpenSim.Services.Connectors
136 return false; 136 return false;
137 } 137 }
138 138
139 public bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
140 {
141 return false;
142 }
143
144
139 public bool PurgeFolder(InventoryFolderBase folder) 145 public bool PurgeFolder(InventoryFolderBase folder)
140 { 146 {
141 return false; 147 return false;
@@ -151,7 +157,12 @@ namespace OpenSim.Services.Connectors
151 return false; 157 return false;
152 } 158 }
153 159
154 public bool DeleteItem(InventoryItemBase item) 160 public bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
161 {
162 return false;
163 }
164
165 public bool DeleteItems(UUID owner, List<UUID> itemIDs)
155 { 166 {
156 return false; 167 return false;
157 } 168 }
diff --git a/OpenSim/Services/Interfaces/IInventoryService.cs b/OpenSim/Services/Interfaces/IInventoryService.cs
index a89a238..c775090 100644
--- a/OpenSim/Services/Interfaces/IInventoryService.cs
+++ b/OpenSim/Services/Interfaces/IInventoryService.cs
@@ -122,6 +122,14 @@ namespace OpenSim.Services.Interfaces
122 bool MoveFolder(InventoryFolderBase folder); 122 bool MoveFolder(InventoryFolderBase folder);
123 123
124 /// <summary> 124 /// <summary>
125 /// Delete an item from the user's inventory
126 /// </summary>
127 /// <param name="item"></param>
128 /// <returns>true if the item was successfully deleted</returns>
129 //bool DeleteItem(InventoryItemBase item);
130 bool DeleteFolders(UUID userID, List<UUID> folderIDs);
131
132 /// <summary>
125 /// Purge an inventory folder of all its items and subfolders. 133 /// Purge an inventory folder of all its items and subfolders.
126 /// </summary> 134 /// </summary>
127 /// <param name="folder"></param> 135 /// <param name="folder"></param>
@@ -142,12 +150,15 @@ namespace OpenSim.Services.Interfaces
142 /// <returns>true if the item was successfully updated</returns> 150 /// <returns>true if the item was successfully updated</returns>
143 bool UpdateItem(InventoryItemBase item); 151 bool UpdateItem(InventoryItemBase item);
144 152
153 bool MoveItems(UUID ownerID, List<InventoryItemBase> items);
154
145 /// <summary> 155 /// <summary>
146 /// Delete an item from the user's inventory 156 /// Delete an item from the user's inventory
147 /// </summary> 157 /// </summary>
148 /// <param name="item"></param> 158 /// <param name="item"></param>
149 /// <returns>true if the item was successfully deleted</returns> 159 /// <returns>true if the item was successfully deleted</returns>
150 bool DeleteItem(InventoryItemBase item); 160 //bool DeleteItem(InventoryItemBase item);
161 bool DeleteItems(UUID userID, List<UUID> itemIDs);
151 162
152 /// <summary> 163 /// <summary>
153 /// Get an item, given by its UUID 164 /// Get an item, given by its UUID
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs
index 65c2d96..19b1fd8 100644
--- a/OpenSim/Services/InventoryService/InventoryService.cs
+++ b/OpenSim/Services/InventoryService/InventoryService.cs
@@ -235,8 +235,6 @@ namespace OpenSim.Services.InventoryService
235 235
236 public InventoryCollection GetFolderContent(UUID userID, UUID folderID) 236 public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
237 { 237 {
238 m_log.Info("[INVENTORY SERVICE]: Processing request for folder " + folderID);
239
240 // Uncomment me to simulate a slow responding inventory server 238 // Uncomment me to simulate a slow responding inventory server
241 //Thread.Sleep(16000); 239 //Thread.Sleep(16000);
242 240
@@ -249,7 +247,7 @@ namespace OpenSim.Services.InventoryService
249 invCollection.Folders = folders; 247 invCollection.Folders = folders;
250 invCollection.Items = items; 248 invCollection.Items = items;
251 249
252 m_log.DebugFormat("[INVENTORY SERVICE]: Found {0} items and {1} folders", items.Count, folders.Count); 250 m_log.DebugFormat("[INVENTORY SERVICE]: Found {0} items and {1} folders in folder {2}", items.Count, folders.Count, folderID);
253 251
254 return invCollection; 252 return invCollection;
255 } 253 }
@@ -386,13 +384,33 @@ namespace OpenSim.Services.InventoryService
386 return true; 384 return true;
387 } 385 }
388 386
387 public virtual bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
388 {
389 m_log.InfoFormat(
390 "[INVENTORY SERVICE]: Moving {0} items from user {1}", items.Count, ownerID);
391
392 InventoryItemBase itm = null;
393 foreach (InventoryItemBase item in items)
394 {
395 itm = GetInventoryItem(item.ID);
396 itm.Folder = item.Folder;
397 if ((item.Name != null) && !item.Name.Equals(string.Empty))
398 itm.Name = item.Name;
399 m_Database.updateInventoryItem(itm);
400 }
401
402 return true;
403 }
404
389 // See IInventoryServices 405 // See IInventoryServices
390 public virtual bool DeleteItem(InventoryItemBase item) 406 public virtual bool DeleteItems(UUID owner, List<UUID> itemIDs)
391 { 407 {
392 m_log.InfoFormat( 408 m_log.InfoFormat(
393 "[INVENTORY SERVICE]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder); 409 "[INVENTORY SERVICE]: Deleting {0} items from user {1}", itemIDs.Count, owner);
394 410
395 m_Database.deleteInventoryItem(item.ID); 411 // uhh.....
412 foreach (UUID uuid in itemIDs)
413 m_Database.deleteInventoryItem(uuid);
396 414
397 // FIXME: Should return false on failure 415 // FIXME: Should return false on failure
398 return true; 416 return true;
@@ -400,22 +418,34 @@ namespace OpenSim.Services.InventoryService
400 418
401 public virtual InventoryItemBase GetItem(InventoryItemBase item) 419 public virtual InventoryItemBase GetItem(InventoryItemBase item)
402 { 420 {
403 InventoryItemBase result = m_Database.queryInventoryItem(item.ID); 421 InventoryItemBase result = m_Database.getInventoryItem(item.ID);
404 if (result != null) 422 if (result != null)
405 return result; 423 return result;
406 424 m_log.DebugFormat("[INVENTORY SERVICE]: GetItem failed to find item {0}", item.ID);
407 return null; 425 return null;
408 } 426 }
409 427
410 public virtual InventoryFolderBase GetFolder(InventoryFolderBase item) 428 public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder)
411 { 429 {
412 InventoryFolderBase result = m_Database.queryInventoryFolder(item.ID); 430 InventoryFolderBase result = m_Database.getInventoryFolder(folder.ID);
413 if (result != null) 431 if (result != null)
414 return result; 432 return result;
415 433
434 m_log.DebugFormat("[INVENTORY SERVICE]: GetFolder failed to find folder {0}", folder.ID);
416 return null; 435 return null;
417 } 436 }
418 437
438 public virtual bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
439 {
440 foreach (UUID id in folderIDs)
441 {
442 InventoryFolderBase folder = new InventoryFolderBase(id, ownerID);
443 PurgeFolder(folder);
444 m_Database.deleteInventoryFolder(id);
445 }
446 return true;
447 }
448
419 /// <summary> 449 /// <summary>
420 /// Purge a folder of all items items and subfolders. 450 /// Purge a folder of all items items and subfolders.
421 /// 451 ///
@@ -439,10 +469,12 @@ namespace OpenSim.Services.InventoryService
439 469
440 List<InventoryItemBase> items = GetFolderItems(folder.Owner, folder.ID); 470 List<InventoryItemBase> items = GetFolderItems(folder.Owner, folder.ID);
441 471
472 List<UUID> uuids = new List<UUID>();
442 foreach (InventoryItemBase item in items) 473 foreach (InventoryItemBase item in items)
443 { 474 {
444 DeleteItem(item); 475 uuids.Add(item.ID);
445 } 476 }
477 DeleteItems(folder.Owner, uuids);
446 478
447 // FIXME: Should return false on failure 479 // FIXME: Should return false on failure
448 return true; 480 return true;