aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Clients/InventoryClient.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/Clients/InventoryClient.cs78
1 files changed, 78 insertions, 0 deletions
diff --git a/OpenSim/Framework/Communications/Clients/InventoryClient.cs b/OpenSim/Framework/Communications/Clients/InventoryClient.cs
new file mode 100644
index 0000000..8fe4268
--- /dev/null
+++ b/OpenSim/Framework/Communications/Clients/InventoryClient.cs
@@ -0,0 +1,78 @@
1/**
2 * Copyright (c), Contributors. All rights reserved.
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * * Neither the name of the Organizations nor the names of Individual
14 * Contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
20 * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
22 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
25 * OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 */
28
29using System;
30using OpenSim.Framework.Servers;
31
32using OpenMetaverse;
33
34namespace OpenSim.Framework.Communications.Clients
35{
36 public class InventoryClient
37 {
38 private string ServerURL;
39
40 public InventoryClient(string url)
41 {
42 ServerURL = url;
43 }
44
45 public void GetInventoryItemAsync(InventoryItemBase item, ReturnResponse<InventoryItemBase> callBack)
46 {
47 System.Console.WriteLine("[HGrid] GetInventory from " + ServerURL);
48 try
49 {
50 RestSessionObjectPosterResponse<InventoryItemBase, InventoryItemBase> requester
51 = new RestSessionObjectPosterResponse<InventoryItemBase, InventoryItemBase>();
52 requester.ResponseCallback = callBack;
53
54 requester.BeginPostObject(ServerURL + "/GetItem/", item, string.Empty, string.Empty);
55 }
56 catch (Exception e)
57 {
58 System.Console.WriteLine("[HGrid]: Exception posting to inventory: " + e);
59 }
60 }
61
62 public InventoryItemBase GetInventoryItem(InventoryItemBase item)
63 {
64 System.Console.WriteLine("[HGrid] GetInventory " + item.ID + " from " + ServerURL);
65 try
66 {
67 item = SynchronousRestSessionObjectPoster<Guid, InventoryItemBase>.BeginPostObject("POST", ServerURL + "/GetItem/", item.ID.Guid, "", "");
68 return item;
69 }
70 catch (Exception e)
71 {
72 System.Console.WriteLine("[HGrid]: Exception posting to inventory: " + e);
73 }
74 return null;
75 }
76
77 }
78}