diff options
Diffstat (limited to 'OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs')
-rw-r--r-- | OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs index 0f75a09..9b3d878 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs | |||
@@ -41,11 +41,11 @@ namespace OpenSim.Region.Communications.OGS1 | |||
41 | { | 41 | { |
42 | public class OGS1InventoryService : IInventoryServices | 42 | public class OGS1InventoryService : IInventoryServices |
43 | { | 43 | { |
44 | private static readonly ILog m_log | 44 | private static readonly ILog m_log |
45 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 46 | ||
47 | private string _inventoryServerUrl; | 47 | private string _inventoryServerUrl; |
48 | private Dictionary<LLUUID, InventoryReceiptCallback> m_RequestingInventory | 48 | private Dictionary<LLUUID, InventoryReceiptCallback> m_RequestingInventory |
49 | = new Dictionary<LLUUID, InventoryReceiptCallback>(); | 49 | = new Dictionary<LLUUID, InventoryReceiptCallback>(); |
50 | 50 | ||
51 | public OGS1InventoryService(string inventoryServerUrl) | 51 | public OGS1InventoryService(string inventoryServerUrl) |
@@ -65,26 +65,26 @@ namespace OpenSim.Region.Communications.OGS1 | |||
65 | if (!m_RequestingInventory.ContainsKey(userID)) | 65 | if (!m_RequestingInventory.ContainsKey(userID)) |
66 | { | 66 | { |
67 | m_RequestingInventory.Add(userID, callback); | 67 | m_RequestingInventory.Add(userID, callback); |
68 | 68 | ||
69 | try | 69 | try |
70 | { | 70 | { |
71 | m_log.InfoFormat( | 71 | m_log.InfoFormat( |
72 | "[OGS1 INVENTORY SERVICE]: Requesting inventory from {0}/GetInventory/ for user {1}", | 72 | "[OGS1 INVENTORY SERVICE]: Requesting inventory from {0}/GetInventory/ for user {1}", |
73 | _inventoryServerUrl, userID); | 73 | _inventoryServerUrl, userID); |
74 | 74 | ||
75 | RestObjectPosterResponse<InventoryCollection> requester | 75 | RestObjectPosterResponse<InventoryCollection> requester |
76 | = new RestObjectPosterResponse<InventoryCollection>(); | 76 | = new RestObjectPosterResponse<InventoryCollection>(); |
77 | requester.ResponseCallback = InventoryResponse; | 77 | requester.ResponseCallback = InventoryResponse; |
78 | 78 | ||
79 | requester.BeginPostObject<Guid>(_inventoryServerUrl + "/GetInventory/", userID.UUID); | 79 | requester.BeginPostObject<Guid>(_inventoryServerUrl + "/GetInventory/", userID.UUID); |
80 | } | 80 | } |
81 | catch (WebException e) | 81 | catch (WebException e) |
82 | { | 82 | { |
83 | if (StatsManager.SimExtraStats != null) | 83 | if (StatsManager.SimExtraStats != null) |
84 | StatsManager.SimExtraStats.AddInventoryServiceRetrievalFailure(); | 84 | StatsManager.SimExtraStats.AddInventoryServiceRetrievalFailure(); |
85 | 85 | ||
86 | m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Request inventory operation failed, {0} {1}", | 86 | m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Request inventory operation failed, {0} {1}", |
87 | e.Source, e.Message); | 87 | e.Source, e.Message); |
88 | } | 88 | } |
89 | } | 89 | } |
90 | else | 90 | else |
@@ -92,11 +92,11 @@ namespace OpenSim.Region.Communications.OGS1 | |||
92 | m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: RequestInventoryForUser() - could you not find user profile for {0}", userID); | 92 | m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: RequestInventoryForUser() - could you not find user profile for {0}", userID); |
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | /// <summary> | 96 | /// <summary> |
97 | /// Callback used by the inventory server GetInventory request | 97 | /// Callback used by the inventory server GetInventory request |
98 | /// </summary> | 98 | /// </summary> |
99 | /// <param name="userID"></param> | 99 | /// <param name="userID"></param> |
100 | private void InventoryResponse(InventoryCollection response) | 100 | private void InventoryResponse(InventoryCollection response) |
101 | { | 101 | { |
102 | LLUUID userID = response.UserID; | 102 | LLUUID userID = response.UserID; |
@@ -108,17 +108,17 @@ namespace OpenSim.Region.Communications.OGS1 | |||
108 | 108 | ||
109 | InventoryFolderImpl rootFolder = null; | 109 | InventoryFolderImpl rootFolder = null; |
110 | InventoryReceiptCallback callback = m_RequestingInventory[userID]; | 110 | InventoryReceiptCallback callback = m_RequestingInventory[userID]; |
111 | 111 | ||
112 | ICollection<InventoryFolderImpl> folders = new List<InventoryFolderImpl>(); | 112 | ICollection<InventoryFolderImpl> folders = new List<InventoryFolderImpl>(); |
113 | ICollection<InventoryItemBase> items = new List<InventoryItemBase>(); | 113 | ICollection<InventoryItemBase> items = new List<InventoryItemBase>(); |
114 | 114 | ||
115 | foreach (InventoryFolderBase folder in response.Folders) | 115 | foreach (InventoryFolderBase folder in response.Folders) |
116 | { | 116 | { |
117 | if (folder.ParentID == LLUUID.Zero) | 117 | if (folder.ParentID == LLUUID.Zero) |
118 | { | 118 | { |
119 | rootFolder = new InventoryFolderImpl(folder); | 119 | rootFolder = new InventoryFolderImpl(folder); |
120 | folders.Add(rootFolder); | 120 | folders.Add(rootFolder); |
121 | 121 | ||
122 | break; | 122 | break; |
123 | } | 123 | } |
124 | } | 124 | } |
@@ -142,9 +142,9 @@ namespace OpenSim.Region.Communications.OGS1 | |||
142 | { | 142 | { |
143 | m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Did not get back an inventory containing a root folder for user {0}", userID); | 143 | m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Did not get back an inventory containing a root folder for user {0}", userID); |
144 | } | 144 | } |
145 | 145 | ||
146 | callback(folders, items); | 146 | callback(folders, items); |
147 | 147 | ||
148 | m_RequestingInventory.Remove(userID); | 148 | m_RequestingInventory.Remove(userID); |
149 | } | 149 | } |
150 | else | 150 | else |
@@ -158,7 +158,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
158 | 158 | ||
159 | /// <summary> | 159 | /// <summary> |
160 | /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> | 160 | /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> |
161 | /// </summary> | 161 | /// </summary> |
162 | public bool AddFolder(InventoryFolderBase folder) | 162 | public bool AddFolder(InventoryFolderBase folder) |
163 | { | 163 | { |
164 | try | 164 | try |
@@ -168,68 +168,68 @@ namespace OpenSim.Region.Communications.OGS1 | |||
168 | } | 168 | } |
169 | catch (WebException e) | 169 | catch (WebException e) |
170 | { | 170 | { |
171 | m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory folder operation failed, {0} {1}", | 171 | m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory folder operation failed, {0} {1}", |
172 | e.Source, e.Message); | 172 | e.Source, e.Message); |
173 | } | 173 | } |
174 | 174 | ||
175 | return false; | 175 | return false; |
176 | } | 176 | } |
177 | 177 | ||
178 | /// <summary> | 178 | /// <summary> |
179 | /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> | 179 | /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> |
180 | /// </summary> | 180 | /// </summary> |
181 | /// <param name="folder"></param> | 181 | /// <param name="folder"></param> |
182 | public bool MoveFolder(InventoryFolderBase folder) | 182 | public bool MoveFolder(InventoryFolderBase folder) |
183 | { | 183 | { |
184 | try | 184 | try |
185 | { | 185 | { |
186 | return SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>( | 186 | return SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>( |
187 | "POST", _inventoryServerUrl + "/MoveFolder/", folder); | 187 | "POST", _inventoryServerUrl + "/MoveFolder/", folder); |
188 | } | 188 | } |
189 | catch (WebException e) | 189 | catch (WebException e) |
190 | { | 190 | { |
191 | m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}", | 191 | m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}", |
192 | e.Source, e.Message); | 192 | e.Source, e.Message); |
193 | } | 193 | } |
194 | 194 | ||
195 | return false; | 195 | return false; |
196 | } | 196 | } |
197 | 197 | ||
198 | /// <summary> | 198 | /// <summary> |
199 | /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> | 199 | /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> |
200 | /// </summary> | 200 | /// </summary> |
201 | public bool PurgeFolder(InventoryFolderBase folder) | 201 | public bool PurgeFolder(InventoryFolderBase folder) |
202 | { | 202 | { |
203 | try | 203 | try |
204 | { | 204 | { |
205 | return SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>( | 205 | return SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, bool>( |
206 | "POST", _inventoryServerUrl + "/PurgeFolder/", folder); | 206 | "POST", _inventoryServerUrl + "/PurgeFolder/", folder); |
207 | } | 207 | } |
208 | catch (WebException e) | 208 | catch (WebException e) |
209 | { | 209 | { |
210 | m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}", | 210 | m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Move inventory folder operation failed, {0} {1}", |
211 | e.Source, e.Message); | 211 | e.Source, e.Message); |
212 | } | 212 | } |
213 | 213 | ||
214 | return false; | 214 | return false; |
215 | } | 215 | } |
216 | 216 | ||
217 | /// <summary> | 217 | /// <summary> |
218 | /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> | 218 | /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> |
219 | /// </summary> | 219 | /// </summary> |
220 | public bool AddItem(InventoryItemBase item) | 220 | public bool AddItem(InventoryItemBase item) |
221 | { | 221 | { |
222 | try | 222 | try |
223 | { | 223 | { |
224 | return SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>( | 224 | return SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>( |
225 | "POST", _inventoryServerUrl + "/NewItem/", item); | 225 | "POST", _inventoryServerUrl + "/NewItem/", item); |
226 | } | 226 | } |
227 | catch (WebException e) | 227 | catch (WebException e) |
228 | { | 228 | { |
229 | m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory item operation failed, {0} {1}", | 229 | m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Add new inventory item operation failed, {0} {1}", |
230 | e.Source, e.Message); | 230 | e.Source, e.Message); |
231 | } | 231 | } |
232 | 232 | ||
233 | return false; | 233 | return false; |
234 | } | 234 | } |
235 | 235 | ||
@@ -246,26 +246,26 @@ namespace OpenSim.Region.Communications.OGS1 | |||
246 | m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Update new inventory item operation failed, {0} {1}", | 246 | m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Update new inventory item operation failed, {0} {1}", |
247 | e.Source, e.Message); | 247 | e.Source, e.Message); |
248 | } | 248 | } |
249 | 249 | ||
250 | return false; | 250 | return false; |
251 | } | 251 | } |
252 | 252 | ||
253 | /// <summary> | 253 | /// <summary> |
254 | /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> | 254 | /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> |
255 | /// </summary> | 255 | /// </summary> |
256 | public bool DeleteItem(InventoryItemBase item) | 256 | public bool DeleteItem(InventoryItemBase item) |
257 | { | 257 | { |
258 | try | 258 | try |
259 | { | 259 | { |
260 | return SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>( | 260 | return SynchronousRestObjectPoster.BeginPostObject<InventoryItemBase, bool>( |
261 | "POST", _inventoryServerUrl + "/DeleteItem/", item); | 261 | "POST", _inventoryServerUrl + "/DeleteItem/", item); |
262 | } | 262 | } |
263 | catch (WebException e) | 263 | catch (WebException e) |
264 | { | 264 | { |
265 | m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Delete inventory item operation failed, {0} {1}", | 265 | m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Delete inventory item operation failed, {0} {1}", |
266 | e.Source, e.Message); | 266 | e.Source, e.Message); |
267 | } | 267 | } |
268 | 268 | ||
269 | return false; | 269 | return false; |
270 | } | 270 | } |
271 | 271 | ||
@@ -283,12 +283,12 @@ namespace OpenSim.Region.Communications.OGS1 | |||
283 | { | 283 | { |
284 | return false; | 284 | return false; |
285 | } | 285 | } |
286 | 286 | ||
287 | // See IInventoryServices | 287 | // See IInventoryServices |
288 | public List<InventoryFolderBase> GetInventorySkeleton(LLUUID userId) | 288 | public List<InventoryFolderBase> GetInventorySkeleton(LLUUID userId) |
289 | { | 289 | { |
290 | m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: The GetInventorySkeleton() method here should never be called!"); | 290 | m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: The GetInventorySkeleton() method here should never be called!"); |
291 | 291 | ||
292 | return new List<InventoryFolderBase>(); | 292 | return new List<InventoryFolderBase>(); |
293 | } | 293 | } |
294 | 294 | ||