aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Communications')
-rw-r--r--OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs549
-rw-r--r--OpenSim/Region/Communications/Local/LocalInventoryService.cs110
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs343
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs351
4 files changed, 0 insertions, 1353 deletions
diff --git a/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs b/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs
deleted file mode 100644
index c1a1aa6..0000000
--- a/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs
+++ /dev/null
@@ -1,549 +0,0 @@
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 OpenSimulator 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;
29using System.Collections.Generic;
30using System.Net;
31using System.Reflection;
32using log4net;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Communications.Cache;
37using OpenSim.Framework.Servers;
38using OpenSim.Framework.Servers.HttpServer;
39using OpenSim.Framework.Statistics;
40using OpenSim.Region.Communications.Local;
41
42namespace OpenSim.Region.Communications.Hypergrid
43{
44 public class HGInventoryServiceClient : LocalInventoryService, ISecureInventoryService
45 {
46 private static readonly ILog m_log
47 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48
49 private string _inventoryServerUrl;
50 //private Uri m_Uri;
51 private UserProfileCacheService m_userProfileCache;
52 private bool m_gridmode = false;
53
54 private Dictionary<UUID, InventoryReceiptCallback> m_RequestingInventory
55 = new Dictionary<UUID, InventoryReceiptCallback>();
56
57 public UserProfileCacheService UserProfileCache
58 {
59 set { m_userProfileCache = value; }
60 }
61
62 public HGInventoryServiceClient(string inventoryServerUrl, UserProfileCacheService userProfileCacheService, bool gridmode)
63 {
64 _inventoryServerUrl = HGNetworkServersInfo.ServerURI(inventoryServerUrl);
65 //m_Uri = new Uri(_inventoryServerUrl);
66 //m_userProfileCache = userProfileCacheService;
67 m_gridmode = gridmode;
68 }
69
70 #region ISecureInventoryService Members
71
72 public void RequestInventoryForUser(UUID userID, UUID session_id, InventoryReceiptCallback callback)
73 {
74 if (IsLocalStandaloneUser(userID))
75 {
76 base.RequestInventoryForUser(userID, callback);
77 return;
78 }
79
80 // grid/hypergrid mode
81 lock (m_RequestingInventory)
82 {
83 if (!m_RequestingInventory.ContainsKey(userID))
84 {
85 m_RequestingInventory.Add(userID, callback);
86 }
87 else
88 {
89 m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: RequestInventoryForUser() - could not find user profile for {0}", userID);
90 return;
91 }
92 }
93 string invServer = GetUserInventoryURI(userID);
94 m_log.InfoFormat(
95 "[HGrid INVENTORY SERVICE]: Requesting inventory from {0}/GetInventory/ for user {1} ({2})",
96 /*_inventoryServerUrl*/ invServer, userID, userID.Guid);
97
98 try
99 {
100
101 //RestSessionObjectPosterResponse<Guid, InventoryCollection> requester
102 // = new RestSessionObjectPosterResponse<Guid, InventoryCollection>();
103 //requester.ResponseCallback = InventoryResponse;
104
105 //requester.BeginPostObject(invServer + "/GetInventory/", userID.Guid, session_id.ToString(), userID.ToString());
106 GetInventoryDelegate d = GetInventoryAsync;
107 d.BeginInvoke(invServer, userID, session_id, GetInventoryCompleted, d);
108
109 }
110 catch (WebException e)
111 {
112 if (StatsManager.SimExtraStats != null)
113 StatsManager.SimExtraStats.AddInventoryServiceRetrievalFailure();
114
115 m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Request inventory operation failed, {0} {1}",
116 e.Source, e.Message);
117
118 // Well, let's synthesize one
119 InventoryCollection icol = new InventoryCollection();
120 icol.UserID = userID;
121 icol.Items = new List<InventoryItemBase>();
122 icol.Folders = new List<InventoryFolderBase>();
123 InventoryFolderBase rootFolder = new InventoryFolderBase();
124 rootFolder.ID = UUID.Random();
125 rootFolder.Owner = userID;
126 icol.Folders.Add(rootFolder);
127 InventoryResponse(icol);
128 }
129 }
130
131 private delegate InventoryCollection GetInventoryDelegate(string url, UUID userID, UUID sessionID);
132
133 protected InventoryCollection GetInventoryAsync(string url, UUID userID, UUID sessionID)
134 {
135 InventoryCollection icol = null;
136 try
137 {
138 icol = SynchronousRestSessionObjectPoster<Guid, InventoryCollection>.BeginPostObject("POST", url + "/GetInventory/",
139 userID.Guid, sessionID.ToString(), userID.ToString());
140
141 }
142 catch (Exception e)
143 {
144 m_log.Debug("[HGrid]: Exception getting users inventory: " + e.Message);
145 }
146 if (icol == null)
147 {
148 // Well, let's synthesize one
149 icol = new InventoryCollection();
150 icol.UserID = userID;
151 icol.Items = new List<InventoryItemBase>();
152 icol.Folders = new List<InventoryFolderBase>();
153 InventoryFolderBase rootFolder = new InventoryFolderBase();
154 rootFolder.ID = UUID.Random();
155 rootFolder.Owner = userID;
156 icol.Folders.Add(rootFolder);
157 }
158
159 return icol;
160 }
161
162 private void GetInventoryCompleted(IAsyncResult iar)
163 {
164 GetInventoryDelegate icon = (GetInventoryDelegate)iar.AsyncState;
165 InventoryCollection icol = icon.EndInvoke(iar);
166 InventoryResponse(icol);
167 }
168
169 /// <summary>
170 /// Add a new folder to the user's inventory
171 /// </summary>
172 /// <param name="folder"></param>
173 /// <returns>true if the folder was successfully added</returns>
174 public bool AddFolder(InventoryFolderBase folder, UUID session_id)
175 {
176 if (IsLocalStandaloneUser(folder.Owner))
177 {
178 return base.AddFolder(folder);
179 }
180
181 try
182 {
183 string invServ = GetUserInventoryURI(folder.Owner);
184
185 return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject(
186 "POST", invServ + "/NewFolder/", folder, session_id.ToString(), folder.Owner.ToString());
187 }
188 catch (WebException e)
189 {
190 m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Add new inventory folder operation failed, {0} {1}",
191 e.Source, e.Message);
192 }
193
194 return false;
195
196 }
197
198 /// <summary>
199 /// Update a folder in the user's inventory
200 /// </summary>
201 /// <param name="folder"></param>
202 /// <returns>true if the folder was successfully updated</returns>
203 public bool UpdateFolder(InventoryFolderBase folder, UUID session_id)
204 {
205 if (IsLocalStandaloneUser(folder.Owner))
206 {
207 return base.UpdateFolder(folder);
208 }
209 try
210 {
211 string invServ = GetUserInventoryURI(folder.Owner);
212
213 return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject(
214 "POST", invServ + "/UpdateFolder/", folder, session_id.ToString(), folder.Owner.ToString());
215 }
216 catch (WebException e)
217 {
218 m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Update inventory folder operation failed, {0} {1}",
219 e.Source, e.Message);
220 }
221
222 return false;
223
224 }
225
226 /// <summary>
227 /// Move an inventory folder to a new location
228 /// </summary>
229 /// <param name="folder">A folder containing the details of the new location</param>
230 /// <returns>true if the folder was successfully moved</returns>
231 public bool MoveFolder(InventoryFolderBase folder, UUID session_id)
232 {
233 if (IsLocalStandaloneUser(folder.Owner))
234 {
235 return base.MoveFolder(folder);
236 }
237
238 try
239 {
240 string invServ = GetUserInventoryURI(folder.Owner);
241
242 return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject(
243 "POST", invServ + "/MoveFolder/", folder, session_id.ToString(), folder.Owner.ToString());
244 }
245 catch (WebException e)
246 {
247 m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}",
248 e.Source, e.Message);
249 }
250
251 return false;
252 }
253
254 /// <summary>
255 /// Purge an inventory folder of all its items and subfolders.
256 /// </summary>
257 /// <param name="folder"></param>
258 /// <returns>true if the folder was successfully purged</returns>
259 public bool PurgeFolder(InventoryFolderBase folder, UUID session_id)
260 {
261 if (IsLocalStandaloneUser(folder.Owner))
262 {
263 return base.PurgeFolder(folder);
264 }
265
266 try
267 {
268 string invServ = GetUserInventoryURI(folder.Owner);
269
270 return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject(
271 "POST", invServ + "/PurgeFolder/", folder, session_id.ToString(), folder.Owner.ToString());
272 }
273 catch (WebException e)
274 {
275 m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}",
276 e.Source, e.Message);
277 }
278
279 return false;
280 }
281
282 /// <summary>
283 /// Add a new item to the user's inventory
284 /// </summary>
285 /// <param name="item"></param>
286 /// <returns>true if the item was successfully added</returns>
287 public bool AddItem(InventoryItemBase item, UUID session_id)
288 {
289 if (IsLocalStandaloneUser(item.Owner))
290 {
291 return base.AddItem(item);
292 }
293
294 try
295 {
296 string invServ = GetUserInventoryURI(item.Owner);
297
298 return SynchronousRestSessionObjectPoster<InventoryItemBase, bool>.BeginPostObject(
299 "POST", invServ + "/NewItem/", item, session_id.ToString(), item.Owner.ToString());
300 }
301 catch (WebException e)
302 {
303 m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Add new inventory item operation failed, {0} {1}",
304 e.Source, e.Message);
305 }
306
307 return false;
308 }
309
310 /// <summary>
311 /// Update an item in the user's inventory
312 /// </summary>
313 /// <param name="item"></param>
314 /// <returns>true if the item was successfully updated</returns>
315 public bool UpdateItem(InventoryItemBase item, UUID session_id)
316 {
317 if (IsLocalStandaloneUser(item.Owner))
318 {
319 return base.UpdateItem(item);
320 }
321
322 try
323 {
324 string invServ = GetUserInventoryURI(item.Owner);
325 return SynchronousRestSessionObjectPoster<InventoryItemBase, bool>.BeginPostObject(
326 "POST", invServ + "/NewItem/", item, session_id.ToString(), item.Owner.ToString());
327 }
328 catch (WebException e)
329 {
330 m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Update new inventory item operation failed, {0} {1}",
331 e.Source, e.Message);
332 }
333
334 return false;
335 }
336
337 /// <summary>
338 /// Delete an item from the user's inventory
339 /// </summary>
340 /// <param name="item"></param>
341 /// <returns>true if the item was successfully deleted</returns>
342 public bool DeleteItem(InventoryItemBase item, UUID session_id)
343 {
344 if (IsLocalStandaloneUser(item.Owner))
345 {
346 return base.DeleteItem(item);
347 }
348
349 try
350 {
351 string invServ = GetUserInventoryURI(item.Owner);
352
353 return SynchronousRestSessionObjectPoster<InventoryItemBase, bool>.BeginPostObject(
354 "POST", invServ + "/DeleteItem/", item, session_id.ToString(), item.Owner.ToString());
355 }
356 catch (WebException e)
357 {
358 m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Delete inventory item operation failed, {0} {1}",
359 e.Source, e.Message);
360 }
361
362 return false;
363 }
364
365 public InventoryItemBase QueryItem(InventoryItemBase item, UUID session_id)
366 {
367 if (IsLocalStandaloneUser(item.Owner))
368 {
369 return base.QueryItem(item);
370 }
371
372 try
373 {
374 string invServ = GetUserInventoryURI(item.Owner);
375
376 return SynchronousRestSessionObjectPoster<InventoryItemBase, InventoryItemBase>.BeginPostObject(
377 "POST", invServ + "/QueryItem/", item, session_id.ToString(), item.Owner.ToString());
378 }
379 catch (WebException e)
380 {
381 m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Query inventory item operation failed, {0} {1}",
382 e.Source, e.Message);
383 }
384
385 return null;
386 }
387
388 public InventoryFolderBase QueryFolder(InventoryFolderBase item, UUID session_id)
389 {
390 if (IsLocalStandaloneUser(item.Owner))
391 {
392 return base.QueryFolder(item);
393 }
394
395 try
396 {
397 string invServ = GetUserInventoryURI(item.Owner);
398
399 return SynchronousRestSessionObjectPoster<InventoryFolderBase, InventoryFolderBase>.BeginPostObject(
400 "POST", invServ + "/QueryFolder/", item, session_id.ToString(), item.Owner.ToString());
401 }
402 catch (WebException e)
403 {
404 m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Query inventory item operation failed, {0} {1}",
405 e.Source, e.Message);
406 }
407
408 return null;
409 }
410 #endregion
411
412 #region Methods common to ISecureInventoryService and IInventoryService
413
414 /// <summary>
415 /// Does the given user have an inventory structure?
416 /// </summary>
417 /// <param name="userID"></param>
418 /// <returns></returns>
419 public override bool HasInventoryForUser(UUID userID)
420 {
421 if (IsLocalStandaloneUser(userID))
422 {
423 return base.HasInventoryForUser(userID);
424 }
425 return false;
426 }
427
428 /// <summary>
429 /// Retrieve the root inventory folder for the given user.
430 /// </summary>
431 /// <param name="userID"></param>
432 /// <returns>null if no root folder was found</returns>
433 public override InventoryFolderBase RequestRootFolder(UUID userID)
434 {
435 if (IsLocalStandaloneUser(userID))
436 {
437 return base.RequestRootFolder(userID);
438 }
439
440 return null;
441 }
442
443 #endregion
444
445
446 /// <summary>
447 /// Callback used by the inventory server GetInventory request
448 /// </summary>
449 /// <param name="userID"></param>
450 private void InventoryResponse(InventoryCollection response)
451 {
452 UUID userID = response.UserID;
453 InventoryReceiptCallback callback = null;
454 lock (m_RequestingInventory)
455 {
456 if (m_RequestingInventory.ContainsKey(userID))
457 {
458 m_log.InfoFormat("[HGrid INVENTORY SERVICE]: " +
459 "Received inventory response for user {0} containing {1} folders and {2} items",
460 userID, response.Folders.Count, response.Items.Count);
461 callback = m_RequestingInventory[userID];
462 m_RequestingInventory.Remove(userID);
463 }
464 else
465 {
466 m_log.WarnFormat(
467 "[HGrid INVENTORY SERVICE]: " +
468 "Received inventory response for {0} for which we do not have a record of requesting!",
469 userID);
470 return;
471 }
472 }
473
474 InventoryFolderImpl rootFolder = null;
475
476 ICollection<InventoryFolderImpl> folders = new List<InventoryFolderImpl>();
477 ICollection<InventoryItemBase> items = new List<InventoryItemBase>();
478
479 foreach (InventoryFolderBase folder in response.Folders)
480 {
481 if (folder.ParentID == UUID.Zero)
482 {
483 rootFolder = new InventoryFolderImpl(folder);
484 folders.Add(rootFolder);
485
486 break;
487 }
488 }
489
490 if (rootFolder != null)
491 {
492 foreach (InventoryFolderBase folder in response.Folders)
493 {
494 if (folder.ID != rootFolder.ID)
495 {
496 folders.Add(new InventoryFolderImpl(folder));
497 }
498 }
499
500 foreach (InventoryItemBase item in response.Items)
501 {
502 items.Add(item);
503 }
504 }
505 else
506 {
507 m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Did not get back an inventory containing a root folder for user {0}", userID);
508 }
509
510 callback(folders, items);
511
512 }
513
514 private bool IsLocalStandaloneUser(UUID userID)
515 {
516 if (m_userProfileCache == null)
517 return false;
518
519 CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(userID);
520 if (uinfo == null)
521 return true;
522
523 string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI);
524
525 if ((!m_gridmode) && ((userInventoryServerURI == _inventoryServerUrl)) || (userInventoryServerURI == ""))
526 {
527 return true;
528 }
529 return false;
530 }
531
532 private string GetUserInventoryURI(UUID userID)
533 {
534 string invURI = _inventoryServerUrl;
535
536 CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(userID);
537 if ((uinfo == null) || (uinfo.UserProfile == null))
538 return invURI;
539
540 string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI);
541
542 if ((userInventoryServerURI != null) &&
543 (userInventoryServerURI != ""))
544 invURI = userInventoryServerURI;
545 return invURI;
546 }
547
548 }
549}
diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs
deleted file mode 100644
index 3712fb9..0000000
--- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs
+++ /dev/null
@@ -1,110 +0,0 @@
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 OpenSimulator 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 System.Reflection;
30using log4net;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Framework.Communications;
34using OpenSim.Framework.Communications.Cache;
35
36namespace OpenSim.Region.Communications.Local
37{
38 /// <summary>
39 /// An implementation of user inventory where the inventory is held locally (e.g. when OpenSim is
40 /// operating in standalone mode.
41 /// </summary>
42 public class LocalInventoryService : InventoryServiceBase
43 {
44 private static readonly ILog m_log
45 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46
47 public override void RequestInventoryForUser(UUID userID, InventoryReceiptCallback callback)
48 {
49 m_log.InfoFormat("[LOCAL INVENTORY SERVICE]: Requesting inventory for user {0}", userID);
50
51 List<InventoryFolderImpl> folders = new List<InventoryFolderImpl>();
52 List<InventoryItemBase> items = new List<InventoryItemBase>();
53
54 List<InventoryFolderBase> skeletonFolders = GetInventorySkeleton(userID);
55
56 if (skeletonFolders != null)
57 {
58
59 InventoryFolderImpl rootFolder = null;
60
61 // Need to retrieve the root folder on the first pass
62 foreach (InventoryFolderBase folder in skeletonFolders)
63 {
64 if (folder.ParentID == UUID.Zero)
65 {
66 rootFolder = new InventoryFolderImpl(folder);
67 folders.Add(rootFolder);
68 items.AddRange(RequestFolderItems(rootFolder.ID));
69 break; // Only 1 root folder per user
70 }
71 }
72
73 if (rootFolder != null)
74 {
75 foreach (InventoryFolderBase folder in skeletonFolders)
76 {
77 if (folder.ID != rootFolder.ID)
78 {
79 folders.Add(new InventoryFolderImpl(folder));
80 items.AddRange(RequestFolderItems(folder.ID));
81 }
82 }
83 }
84
85 m_log.InfoFormat(
86 "[LOCAL INVENTORY SERVICE]: Received inventory response for user {0} containing {1} folders and {2} items",
87 userID, folders.Count, items.Count);
88 }
89 else
90 {
91 m_log.WarnFormat("[LOCAL INVENTORY SERVICE]: User {0} inventory not available", userID);
92 }
93
94 callback(folders, items);
95 }
96
97 public override bool HasInventoryForUser(UUID userID)
98 {
99 InventoryFolderBase root = RequestRootFolder(userID);
100 if (root == null)
101 {
102 return false;
103 }
104 else
105 {
106 return true;
107 }
108 }
109 }
110}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
deleted file mode 100644
index 364799a..0000000
--- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
+++ /dev/null
@@ -1,343 +0,0 @@
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 OpenSimulator 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;
29using System.Collections.Generic;
30using System.Net;
31using System.Reflection;
32using log4net;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Communications.Cache;
37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Framework.Statistics;
39
40namespace OpenSim.Region.Communications.OGS1
41{
42 public class OGS1InventoryService : IInventoryServices
43 {
44 private static readonly ILog m_log
45 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46
47 private string _inventoryServerUrl;
48 private Uri m_Uri;
49 private Dictionary<UUID, InventoryReceiptCallback> m_RequestingInventory
50 = new Dictionary<UUID, InventoryReceiptCallback>();
51
52 public OGS1InventoryService(string inventoryServerUrl)
53 {
54 _inventoryServerUrl = inventoryServerUrl;
55 m_Uri = new Uri(_inventoryServerUrl);
56 }
57
58 #region IInventoryServices Members
59
60 public string Host
61 {
62 get { return m_Uri.Host; }
63 }
64
65 /// <summary>
66 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
67 /// </summary>
68 /// <param name="userID"></param>
69 /// <param name="callback"></param>
70 public void RequestInventoryForUser(UUID userID, InventoryReceiptCallback callback)
71 {
72 if (!m_RequestingInventory.ContainsKey(userID))
73 {
74 m_RequestingInventory.Add(userID, callback);
75
76 try
77 {
78 m_log.InfoFormat(
79 "[OGS1 INVENTORY SERVICE]: Requesting inventory from {0}/GetInventory/ for user {1}",
80 _inventoryServerUrl, userID);
81
82 RestObjectPosterResponse<InventoryCollection> requester
83 = new RestObjectPosterResponse<InventoryCollection>();
84 requester.ResponseCallback = InventoryResponse;
85
86 requester.BeginPostObject<Guid>(_inventoryServerUrl + "/GetInventory/", userID.Guid);
87 }
88 catch (WebException e)
89 {
90 if (StatsManager.SimExtraStats != null)
91 StatsManager.SimExtraStats.AddInventoryServiceRetrievalFailure();
92
93 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Request inventory operation failed, {0} {1}",
94 e.Source, e.Message);
95 }
96 }
97 else
98 {
99 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: RequestInventoryForUser() - could you not find user profile for {0}", userID);
100 }
101 }
102
103 /// <summary>
104 /// Callback used by the inventory server GetInventory request
105 /// </summary>
106 /// <param name="userID"></param>
107 private void InventoryResponse(InventoryCollection response)
108 {
109 UUID userID = response.UserID;
110 if (m_RequestingInventory.ContainsKey(userID))
111 {
112 m_log.InfoFormat("[OGS1 INVENTORY SERVICE]: " +
113 "Received inventory response for user {0} containing {1} folders and {2} items",
114 userID, response.Folders.Count, response.Items.Count);
115
116 InventoryFolderImpl rootFolder = null;
117 InventoryReceiptCallback callback = m_RequestingInventory[userID];
118
119 ICollection<InventoryFolderImpl> folders = new List<InventoryFolderImpl>();
120 ICollection<InventoryItemBase> items = new List<InventoryItemBase>();
121
122 foreach (InventoryFolderBase folder in response.Folders)
123 {
124 if (folder.ParentID == UUID.Zero)
125 {
126 rootFolder = new InventoryFolderImpl(folder);
127 folders.Add(rootFolder);
128
129 break;
130 }
131 }
132
133 if (rootFolder != null)
134 {
135 foreach (InventoryFolderBase folder in response.Folders)
136 {
137 if (folder.ID != rootFolder.ID)
138 {
139 folders.Add(new InventoryFolderImpl(folder));
140 }
141 }
142
143 foreach (InventoryItemBase item in response.Items)
144 {
145 items.Add(item);
146 }
147 }
148 else
149 {
150 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Did not get back an inventory containing a root folder for user {0}", userID);
151 }
152
153 callback(folders, items);
154
155 m_RequestingInventory.Remove(userID);
156 }
157 else
158 {
159 m_log.WarnFormat(
160 "[OGS1 INVENTORY SERVICE]: " +
161 "Received inventory response for {0} for which we do not have a record of requesting!",
162 userID);
163 }
164 }
165
166 /// <summary>
167 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
168 /// </summary>
169 public bool AddFolder(InventoryFolderBase folder)
170 {
171 try
172 {
173 return SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>(
174 "POST", _inventoryServerUrl + "/NewFolder/", folder);
175 }
176 catch (WebException e)
177 {
178 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory folder operation failed, {0} {1}",
179 e.Source, e.Message);
180 }
181
182 return false;
183 }
184
185 /// <summary>
186 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
187 /// </summary>
188 /// <param name="folder"></param>
189 public bool UpdateFolder(InventoryFolderBase folder)
190 {
191 try
192 {
193 return SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>(
194 "POST", _inventoryServerUrl + "/UpdateFolder/", folder);
195 }
196 catch (WebException e)
197 {
198 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Update inventory folder operation failed, {0} {1}",
199 e.Source, e.Message);
200 }
201
202 return false;
203 }
204
205 /// <summary>
206 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
207 /// </summary>
208 /// <param name="folder"></param>
209 public bool MoveFolder(InventoryFolderBase folder)
210 {
211 try
212 {
213 return SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>(
214 "POST", _inventoryServerUrl + "/MoveFolder/", folder);
215 }
216 catch (WebException e)
217 {
218 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}",
219 e.Source, e.Message);
220 }
221
222 return false;
223 }
224
225 /// <summary>
226 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
227 /// </summary>
228 public bool PurgeFolder(InventoryFolderBase folder)
229 {
230 try
231 {
232 return SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>(
233 "POST", _inventoryServerUrl + "/PurgeFolder/", folder);
234 }
235 catch (WebException e)
236 {
237 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}",
238 e.Source, e.Message);
239 }
240
241 return false;
242 }
243
244 /// <summary>
245 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
246 /// </summary>
247 public bool AddItem(InventoryItemBase item)
248 {
249 try
250 {
251 return SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
252 "POST", _inventoryServerUrl + "/NewItem/", item);
253 }
254 catch (WebException e)
255 {
256 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory item operation failed, {0} {1}",
257 e.Source, e.Message);
258 }
259
260 return false;
261 }
262
263 // TODO: this is a temporary workaround, the UpdateInventoryItem method need to be implemented
264 public bool UpdateItem(InventoryItemBase item)
265 {
266 try
267 {
268 return SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
269 "POST", _inventoryServerUrl + "/NewItem/", item);
270 }
271 catch (WebException e)
272 {
273 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Update new inventory item operation failed, {0} {1}",
274 e.Source, e.Message);
275 }
276
277 return false;
278 }
279
280 /// <summary>
281 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
282 /// </summary>
283 public bool DeleteItem(InventoryItemBase item)
284 {
285 try
286 {
287 return SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>(
288 "POST", _inventoryServerUrl + "/DeleteItem/", item);
289 }
290 catch (WebException e)
291 {
292 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Delete inventory item operation failed, {0} {1}",
293 e.Source, e.Message);
294 }
295
296 return false;
297 }
298
299 public InventoryItemBase QueryItem(InventoryItemBase item)
300 {
301 try
302 {
303 return SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, InventoryItemBase>(
304 "POST", _inventoryServerUrl + "/QueryItem/", item);
305 }
306 catch (WebException e)
307 {
308 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Query inventory item operation failed, {0} {1}",
309 e.Source, e.Message);
310 }
311
312 return null;
313 }
314
315 public InventoryFolderBase QueryFolder(InventoryFolderBase item)
316 {
317 try
318 {
319 return SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, InventoryFolderBase>(
320 "POST", _inventoryServerUrl + "/QueryFolder/", item);
321 }
322 catch (WebException e)
323 {
324 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Query inventory item operation failed, {0} {1}",
325 e.Source, e.Message);
326 }
327
328 return null;
329 }
330
331 public bool HasInventoryForUser(UUID userID)
332 {
333 return false;
334 }
335
336 public InventoryFolderBase RequestRootFolder(UUID userID)
337 {
338 return null;
339 }
340
341 #endregion
342 }
343}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs
deleted file mode 100644
index 1290a01..0000000
--- a/OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs
+++ /dev/null
@@ -1,351 +0,0 @@
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 OpenSimulator 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;
29using System.Collections.Generic;
30using System.Net;
31using System.Reflection;
32using log4net;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Communications.Cache;
37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Framework.Statistics;
39
40namespace OpenSim.Region.Communications.OGS1
41{
42 public class OGS1SecureInventoryService : ISecureInventoryService
43 {
44 private static readonly ILog m_log
45 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46
47 private string _inventoryServerUrl;
48 private Uri m_Uri;
49 private Dictionary<UUID, InventoryReceiptCallback> m_RequestingInventory
50 = new Dictionary<UUID, InventoryReceiptCallback>();
51
52 public OGS1SecureInventoryService(string inventoryServerUrl)
53 {
54 _inventoryServerUrl = inventoryServerUrl;
55 m_Uri = new Uri(_inventoryServerUrl);
56 }
57
58 #region IInventoryServices Members
59
60 public string Host
61 {
62 get { return m_Uri.Host; }
63 }
64
65 /// <summary>
66 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
67 /// </summary>
68 /// <param name="userID"></param>
69 /// <param name="callback"></param>
70 public void RequestInventoryForUser(UUID userID, UUID session_id, InventoryReceiptCallback callback)
71 {
72 lock (m_RequestingInventory)
73 {
74 if (!m_RequestingInventory.ContainsKey(userID))
75 m_RequestingInventory.Add(userID, callback);
76 else
77 {
78 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: RequestInventoryForUser() - could you not find user profile for {0}", userID);
79 return;
80 }
81 }
82
83 try
84 {
85 m_log.InfoFormat(
86 "[OGS1 INVENTORY SERVICE]: Requesting inventory from {0}/GetInventory/ for user {1}",
87 _inventoryServerUrl, userID);
88
89 RestSessionObjectPosterResponse<Guid, InventoryCollection> requester
90 = new RestSessionObjectPosterResponse<Guid, InventoryCollection>();
91 requester.ResponseCallback = InventoryResponse;
92
93 requester.BeginPostObject(_inventoryServerUrl + "/GetInventory/", userID.Guid, session_id.ToString(), userID.ToString());
94 }
95 catch (WebException e)
96 {
97 if (StatsManager.SimExtraStats != null)
98 StatsManager.SimExtraStats.AddInventoryServiceRetrievalFailure();
99
100 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Request inventory operation failed, {0} {1}",
101 e.Source, e.Message);
102 }
103 }
104
105 /// <summary>
106 /// Callback used by the inventory server GetInventory request
107 /// </summary>
108 /// <param name="userID"></param>
109 private void InventoryResponse(InventoryCollection response)
110 {
111 UUID userID = response.UserID;
112 InventoryReceiptCallback callback = null;
113 lock (m_RequestingInventory)
114 {
115 if (m_RequestingInventory.ContainsKey(userID))
116 {
117 callback = m_RequestingInventory[userID];
118 m_RequestingInventory.Remove(userID);
119 }
120 else
121 {
122 m_log.WarnFormat(
123 "[OGS1 INVENTORY SERVICE]: " +
124 "Received inventory response for {0} for which we do not have a record of requesting!",
125 userID);
126 return;
127 }
128 }
129
130 m_log.InfoFormat("[OGS1 INVENTORY SERVICE]: " +
131 "Received inventory response for user {0} containing {1} folders and {2} items",
132 userID, response.Folders.Count, response.Items.Count);
133
134 InventoryFolderImpl rootFolder = null;
135
136 ICollection<InventoryFolderImpl> folders = new List<InventoryFolderImpl>();
137 ICollection<InventoryItemBase> items = new List<InventoryItemBase>();
138
139 foreach (InventoryFolderBase folder in response.Folders)
140 {
141 if (folder.ParentID == UUID.Zero)
142 {
143 rootFolder = new InventoryFolderImpl(folder);
144 folders.Add(rootFolder);
145
146 break;
147 }
148 }
149
150 if (rootFolder != null)
151 {
152 foreach (InventoryFolderBase folder in response.Folders)
153 {
154 if (folder.ID != rootFolder.ID)
155 {
156 folders.Add(new InventoryFolderImpl(folder));
157 }
158 }
159
160 foreach (InventoryItemBase item in response.Items)
161 {
162 items.Add(item);
163 }
164 }
165 else
166 {
167 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Did not get back an inventory containing a root folder for user {0}", userID);
168 }
169
170 callback(folders, items);
171
172 }
173
174 /// <summary>
175 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
176 /// </summary>
177 public bool AddFolder(InventoryFolderBase folder, UUID session_id)
178 {
179 try
180 {
181 return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject(
182 "POST", _inventoryServerUrl + "/NewFolder/", folder, session_id.ToString(), folder.Owner.ToString());
183 }
184 catch (WebException e)
185 {
186 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory folder operation failed, {0} {1}",
187 e.Source, e.Message);
188 }
189
190 return false;
191 }
192
193 /// <summary>
194 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
195 /// </summary>
196 /// <param name="folder"></param>
197 public bool UpdateFolder(InventoryFolderBase folder, UUID session_id)
198 {
199 try
200 {
201 return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject(
202 "POST", _inventoryServerUrl + "/UpdateFolder/", folder, session_id.ToString(), folder.Owner.ToString());
203 }
204 catch (WebException e)
205 {
206 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Update inventory folder operation failed, {0} {1}",
207 e.Source, e.Message);
208 }
209
210 return false;
211 }
212
213 /// <summary>
214 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
215 /// </summary>
216 /// <param name="folder"></param>
217 public bool MoveFolder(InventoryFolderBase folder, UUID session_id)
218 {
219 try
220 {
221 return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject(
222 "POST", _inventoryServerUrl + "/MoveFolder/", folder, session_id.ToString(), folder.Owner.ToString());
223 }
224 catch (WebException e)
225 {
226 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}",
227 e.Source, e.Message);
228 }
229
230 return false;
231 }
232
233 /// <summary>
234 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
235 /// </summary>
236 public bool PurgeFolder(InventoryFolderBase folder, UUID session_id)
237 {
238 try
239 {
240 return SynchronousRestSessionObjectPoster<InventoryFolderBase, bool>.BeginPostObject(
241 "POST", _inventoryServerUrl + "/PurgeFolder/", folder, session_id.ToString(), folder.Owner.ToString());
242 }
243 catch (WebException e)
244 {
245 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}",
246 e.Source, e.Message);
247 }
248
249 return false;
250 }
251
252 /// <summary>
253 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
254 /// </summary>
255 public bool AddItem(InventoryItemBase item, UUID session_id)
256 {
257 try
258 {
259 return SynchronousRestSessionObjectPoster<InventoryItemBase, bool>.BeginPostObject(
260 "POST", _inventoryServerUrl + "/NewItem/", item, session_id.ToString(), item.Owner.ToString());
261 }
262 catch (WebException e)
263 {
264 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory item operation failed, {0} {1}",
265 e.Source, e.Message);
266 }
267
268 return false;
269 }
270
271 // TODO: this is a temporary workaround, the UpdateInventoryItem method need to be implemented
272 public bool UpdateItem(InventoryItemBase item, UUID session_id)
273 {
274 try
275 {
276 return SynchronousRestSessionObjectPoster<InventoryItemBase, bool>.BeginPostObject(
277 "POST", _inventoryServerUrl + "/NewItem/", item, session_id.ToString(), item.Owner.ToString());
278 }
279 catch (WebException e)
280 {
281 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Update new inventory item operation failed, {0} {1}",
282 e.Source, e.Message);
283 }
284
285 return false;
286 }
287
288 /// <summary>
289 /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
290 /// </summary>
291 public bool DeleteItem(InventoryItemBase item, UUID session_id)
292 {
293 try
294 {
295 return SynchronousRestSessionObjectPoster<InventoryItemBase, bool>.BeginPostObject(
296 "POST", _inventoryServerUrl + "/DeleteItem/", item, session_id.ToString(), item.Owner.ToString());
297 }
298 catch (WebException e)
299 {
300 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Delete inventory item operation failed, {0} {1}",
301 e.Source, e.Message);
302 }
303
304 return false;
305 }
306
307 public InventoryItemBase QueryItem(InventoryItemBase item, UUID session_id)
308 {
309 try
310 {
311 return SynchronousRestSessionObjectPoster<InventoryItemBase, InventoryItemBase>.BeginPostObject(
312 "POST", _inventoryServerUrl + "/QueryItem/", item, session_id.ToString(), item.Owner.ToString());
313 }
314 catch (WebException e)
315 {
316 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Query inventory item operation failed, {0} {1}",
317 e.Source, e.Message);
318 }
319
320 return null;
321 }
322
323 public InventoryFolderBase QueryFolder(InventoryFolderBase item, UUID session_id)
324 {
325 try
326 {
327 return SynchronousRestSessionObjectPoster<InventoryFolderBase, InventoryFolderBase>.BeginPostObject(
328 "POST", _inventoryServerUrl + "/QueryFolder/", item, session_id.ToString(), item.Owner.ToString());
329 }
330 catch (WebException e)
331 {
332 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Query inventory item operation failed, {0} {1}",
333 e.Source, e.Message);
334 }
335
336 return null;
337 }
338
339 public bool HasInventoryForUser(UUID userID)
340 {
341 return false;
342 }
343
344 public InventoryFolderBase RequestRootFolder(UUID userID)
345 {
346 return null;
347 }
348
349 #endregion
350 }
351}