diff options
author | Jeff Ames | 2008-11-25 16:00:55 +0000 |
---|---|---|
committer | Jeff Ames | 2008-11-25 16:00:55 +0000 |
commit | 518a8b9f2ac09a5060e2e59c913dfbe7faf397ef (patch) | |
tree | 8b3e39fbd54452e031873d31ff099e7db064cdee /OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneInventoryService.cs | |
parent | * minor: eliminate mono compiler warnings (diff) | |
download | opensim-SC-518a8b9f2ac09a5060e2e59c913dfbe7faf397ef.zip opensim-SC-518a8b9f2ac09a5060e2e59c913dfbe7faf397ef.tar.gz opensim-SC-518a8b9f2ac09a5060e2e59c913dfbe7faf397ef.tar.bz2 opensim-SC-518a8b9f2ac09a5060e2e59c913dfbe7faf397ef.tar.xz |
Update svn properties.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneInventoryService.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneInventoryService.cs | 630 |
1 files changed, 315 insertions, 315 deletions
diff --git a/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneInventoryService.cs b/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneInventoryService.cs index 7eeece9..bfdbcfc 100644 --- a/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneInventoryService.cs +++ b/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneInventoryService.cs | |||
@@ -1,316 +1,316 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (c) 2008, Contributors. All rights reserved. | 2 | * Copyright (c) 2008, Contributors. All rights reserved. |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without modification, | 5 | * Redistribution and use in source and binary forms, with or without modification, |
6 | * are permitted provided that the following conditions are met: | 6 | * are permitted provided that the following conditions are met: |
7 | * | 7 | * |
8 | * * Redistributions of source code must retain the above copyright notice, | 8 | * * Redistributions of source code must retain the above copyright notice, |
9 | * this list of conditions and the following disclaimer. | 9 | * this list of conditions and the following disclaimer. |
10 | * * Redistributions in binary form must reproduce the above copyright notice, | 10 | * * Redistributions in binary form must reproduce the above copyright notice, |
11 | * this list of conditions and the following disclaimer in the documentation | 11 | * this list of conditions and the following disclaimer in the documentation |
12 | * and/or other materials provided with the distribution. | 12 | * and/or other materials provided with the distribution. |
13 | * * Neither the name of the Organizations nor the names of Individual | 13 | * * Neither the name of the Organizations nor the names of Individual |
14 | * Contributors may be used to endorse or promote products derived from | 14 | * Contributors may be used to endorse or promote products derived from |
15 | * this software without specific prior written permission. | 15 | * this software without specific prior written permission. |
16 | * | 16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | 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 | 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 | 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, | 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 | 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 | 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 | 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 | 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. | 25 | * OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Net; | 31 | using System.Net; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | 33 | ||
34 | using log4net; | 34 | using log4net; |
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | 36 | ||
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | 38 | ||
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Framework.Communications; | 40 | using OpenSim.Framework.Communications; |
41 | using OpenSim.Framework.Communications.Cache; | 41 | using OpenSim.Framework.Communications.Cache; |
42 | using OpenSim.Framework.Servers; | 42 | using OpenSim.Framework.Servers; |
43 | using OpenSim.Region.Environment.Interfaces; | 43 | using OpenSim.Region.Environment.Interfaces; |
44 | using OpenSim.Region.Environment.Scenes; | 44 | using OpenSim.Region.Environment.Scenes; |
45 | 45 | ||
46 | namespace OpenSim.Region.Environment.Modules.Hypergrid | 46 | namespace OpenSim.Region.Environment.Modules.Hypergrid |
47 | { | 47 | { |
48 | public class HGStandaloneInventoryService : IRegionModule | 48 | public class HGStandaloneInventoryService : IRegionModule |
49 | { | 49 | { |
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | private static bool initialized = false; | 51 | private static bool initialized = false; |
52 | private static bool enabled = false; | 52 | private static bool enabled = false; |
53 | 53 | ||
54 | Scene m_scene; | 54 | Scene m_scene; |
55 | //InventoryService m_inventoryService; | 55 | //InventoryService m_inventoryService; |
56 | 56 | ||
57 | #region IRegionModule interface | 57 | #region IRegionModule interface |
58 | 58 | ||
59 | public void Initialise(Scene scene, IConfigSource config) | 59 | public void Initialise(Scene scene, IConfigSource config) |
60 | { | 60 | { |
61 | if (!initialized) | 61 | if (!initialized) |
62 | { | 62 | { |
63 | initialized = true; | 63 | initialized = true; |
64 | m_scene = scene; | 64 | m_scene = scene; |
65 | 65 | ||
66 | // This module is only on for standalones | 66 | // This module is only on for standalones |
67 | enabled = !config.Configs["Startup"].GetBoolean("gridmode", true) && config.Configs["Startup"].GetBoolean("hypergrid", false); | 67 | enabled = !config.Configs["Startup"].GetBoolean("gridmode", true) && config.Configs["Startup"].GetBoolean("hypergrid", false); |
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
71 | public void PostInitialise() | 71 | public void PostInitialise() |
72 | { | 72 | { |
73 | if (enabled) | 73 | if (enabled) |
74 | { | 74 | { |
75 | m_log.Info("[HGStandaloneInvService]: Starting..."); | 75 | m_log.Info("[HGStandaloneInvService]: Starting..."); |
76 | //m_inventoryService = new InventoryService(m_scene); | 76 | //m_inventoryService = new InventoryService(m_scene); |
77 | new InventoryService(m_scene); | 77 | new InventoryService(m_scene); |
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
81 | public void Close() | 81 | public void Close() |
82 | { | 82 | { |
83 | } | 83 | } |
84 | 84 | ||
85 | public string Name | 85 | public string Name |
86 | { | 86 | { |
87 | get { return "HGStandaloneInventoryService"; } | 87 | get { return "HGStandaloneInventoryService"; } |
88 | } | 88 | } |
89 | 89 | ||
90 | public bool IsSharedModule | 90 | public bool IsSharedModule |
91 | { | 91 | { |
92 | get { return true; } | 92 | get { return true; } |
93 | } | 93 | } |
94 | 94 | ||
95 | #endregion | 95 | #endregion |
96 | 96 | ||
97 | } | 97 | } |
98 | 98 | ||
99 | public class InventoryService | 99 | public class InventoryService |
100 | { | 100 | { |
101 | private InventoryServiceBase m_inventoryService; | 101 | private InventoryServiceBase m_inventoryService; |
102 | private IUserService m_userService; | 102 | private IUserService m_userService; |
103 | private bool m_doLookup = false; | 103 | private bool m_doLookup = false; |
104 | 104 | ||
105 | public bool DoLookup | 105 | public bool DoLookup |
106 | { | 106 | { |
107 | get { return m_doLookup; } | 107 | get { return m_doLookup; } |
108 | set { m_doLookup = value; } | 108 | set { m_doLookup = value; } |
109 | } | 109 | } |
110 | private static readonly ILog m_log | 110 | private static readonly ILog m_log |
111 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 111 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
112 | 112 | ||
113 | public InventoryService(Scene m_scene) | 113 | public InventoryService(Scene m_scene) |
114 | { | 114 | { |
115 | m_inventoryService = (InventoryServiceBase)m_scene.CommsManager.SecureInventoryService; | 115 | m_inventoryService = (InventoryServiceBase)m_scene.CommsManager.SecureInventoryService; |
116 | m_userService = m_scene.CommsManager.UserService; | 116 | m_userService = m_scene.CommsManager.UserService; |
117 | AddHttpHandlers(m_scene); | 117 | AddHttpHandlers(m_scene); |
118 | 118 | ||
119 | } | 119 | } |
120 | 120 | ||
121 | protected void AddHttpHandlers(Scene m_scene) | 121 | protected void AddHttpHandlers(Scene m_scene) |
122 | { | 122 | { |
123 | m_scene.AddStreamHandler( | 123 | m_scene.AddStreamHandler( |
124 | new RestDeserialiseSecureHandler<Guid, InventoryCollection>( | 124 | new RestDeserialiseSecureHandler<Guid, InventoryCollection>( |
125 | "POST", "/GetInventory/", GetUserInventory, CheckAuthSession)); | 125 | "POST", "/GetInventory/", GetUserInventory, CheckAuthSession)); |
126 | 126 | ||
127 | m_scene.AddStreamHandler( | 127 | m_scene.AddStreamHandler( |
128 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | 128 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( |
129 | "POST", "/NewFolder/", m_inventoryService.AddFolder, CheckAuthSession)); | 129 | "POST", "/NewFolder/", m_inventoryService.AddFolder, CheckAuthSession)); |
130 | 130 | ||
131 | m_scene.AddStreamHandler( | 131 | m_scene.AddStreamHandler( |
132 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | 132 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( |
133 | "POST", "/UpdateFolder/", m_inventoryService.UpdateFolder, CheckAuthSession)); | 133 | "POST", "/UpdateFolder/", m_inventoryService.UpdateFolder, CheckAuthSession)); |
134 | 134 | ||
135 | m_scene.AddStreamHandler( | 135 | m_scene.AddStreamHandler( |
136 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | 136 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( |
137 | "POST", "/MoveFolder/", m_inventoryService.MoveFolder, CheckAuthSession)); | 137 | "POST", "/MoveFolder/", m_inventoryService.MoveFolder, CheckAuthSession)); |
138 | 138 | ||
139 | m_scene.AddStreamHandler( | 139 | m_scene.AddStreamHandler( |
140 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | 140 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( |
141 | "POST", "/PurgeFolder/", m_inventoryService.PurgeFolder, CheckAuthSession)); | 141 | "POST", "/PurgeFolder/", m_inventoryService.PurgeFolder, CheckAuthSession)); |
142 | 142 | ||
143 | m_scene.AddStreamHandler( | 143 | m_scene.AddStreamHandler( |
144 | new RestDeserialiseSecureHandler<InventoryItemBase, bool>( | 144 | new RestDeserialiseSecureHandler<InventoryItemBase, bool>( |
145 | "POST", "/NewItem/", m_inventoryService.AddItem, CheckAuthSession)); | 145 | "POST", "/NewItem/", m_inventoryService.AddItem, CheckAuthSession)); |
146 | 146 | ||
147 | m_scene.AddStreamHandler( | 147 | m_scene.AddStreamHandler( |
148 | new RestDeserialiseSecureHandler<InventoryItemBase, bool>( | 148 | new RestDeserialiseSecureHandler<InventoryItemBase, bool>( |
149 | "POST", "/DeleteItem/", m_inventoryService.DeleteItem, CheckAuthSession)); | 149 | "POST", "/DeleteItem/", m_inventoryService.DeleteItem, CheckAuthSession)); |
150 | 150 | ||
151 | //// WARNING: Root folders no longer just delivers the root and immediate child folders (e.g | 151 | //// WARNING: Root folders no longer just delivers the root and immediate child folders (e.g |
152 | //// system folders such as Objects, Textures), but it now returns the entire inventory skeleton. | 152 | //// system folders such as Objects, Textures), but it now returns the entire inventory skeleton. |
153 | //// It would have been better to rename this request, but complexities in the BaseHttpServer | 153 | //// It would have been better to rename this request, but complexities in the BaseHttpServer |
154 | //// (e.g. any http request not found is automatically treated as an xmlrpc request) make it easier | 154 | //// (e.g. any http request not found is automatically treated as an xmlrpc request) make it easier |
155 | //// to do this for now. | 155 | //// to do this for now. |
156 | //m_scene.AddStreamHandler( | 156 | //m_scene.AddStreamHandler( |
157 | // new RestDeserialiseTrustedHandler<Guid, List<InventoryFolderBase>> | 157 | // new RestDeserialiseTrustedHandler<Guid, List<InventoryFolderBase>> |
158 | // ("POST", "/RootFolders/", GetInventorySkeleton, CheckTrustSource)); | 158 | // ("POST", "/RootFolders/", GetInventorySkeleton, CheckTrustSource)); |
159 | 159 | ||
160 | //// for persistent active gestures | 160 | //// for persistent active gestures |
161 | //m_scene.AddStreamHandler( | 161 | //m_scene.AddStreamHandler( |
162 | // new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>> | 162 | // new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>> |
163 | // ("POST", "/ActiveGestures/", GetActiveGestures, CheckTrustSource)); | 163 | // ("POST", "/ActiveGestures/", GetActiveGestures, CheckTrustSource)); |
164 | } | 164 | } |
165 | 165 | ||
166 | 166 | ||
167 | ///// <summary> | 167 | ///// <summary> |
168 | ///// Check that the source of an inventory request is one that we trust. | 168 | ///// Check that the source of an inventory request is one that we trust. |
169 | ///// </summary> | 169 | ///// </summary> |
170 | ///// <param name="peer"></param> | 170 | ///// <param name="peer"></param> |
171 | ///// <returns></returns> | 171 | ///// <returns></returns> |
172 | //public bool CheckTrustSource(IPEndPoint peer) | 172 | //public bool CheckTrustSource(IPEndPoint peer) |
173 | //{ | 173 | //{ |
174 | // if (m_doLookup) | 174 | // if (m_doLookup) |
175 | // { | 175 | // { |
176 | // m_log.InfoFormat("[GRID AGENT INVENTORY]: Checking trusted source {0}", peer); | 176 | // m_log.InfoFormat("[GRID AGENT INVENTORY]: Checking trusted source {0}", peer); |
177 | // UriBuilder ub = new UriBuilder(m_userserver_url); | 177 | // UriBuilder ub = new UriBuilder(m_userserver_url); |
178 | // IPAddress[] uaddrs = Dns.GetHostAddresses(ub.Host); | 178 | // IPAddress[] uaddrs = Dns.GetHostAddresses(ub.Host); |
179 | // foreach (IPAddress uaddr in uaddrs) | 179 | // foreach (IPAddress uaddr in uaddrs) |
180 | // { | 180 | // { |
181 | // if (uaddr.Equals(peer.Address)) | 181 | // if (uaddr.Equals(peer.Address)) |
182 | // { | 182 | // { |
183 | // return true; | 183 | // return true; |
184 | // } | 184 | // } |
185 | // } | 185 | // } |
186 | 186 | ||
187 | // m_log.WarnFormat( | 187 | // m_log.WarnFormat( |
188 | // "[GRID AGENT INVENTORY]: Rejecting request since source {0} was not in the list of trusted sources", | 188 | // "[GRID AGENT INVENTORY]: Rejecting request since source {0} was not in the list of trusted sources", |
189 | // peer); | 189 | // peer); |
190 | 190 | ||
191 | // return false; | 191 | // return false; |
192 | // } | 192 | // } |
193 | // else | 193 | // else |
194 | // { | 194 | // { |
195 | // return true; | 195 | // return true; |
196 | // } | 196 | // } |
197 | //} | 197 | //} |
198 | 198 | ||
199 | /// <summary> | 199 | /// <summary> |
200 | /// Check that the source of an inventory request for a particular agent is a current session belonging to | 200 | /// Check that the source of an inventory request for a particular agent is a current session belonging to |
201 | /// that agent. | 201 | /// that agent. |
202 | /// </summary> | 202 | /// </summary> |
203 | /// <param name="session_id"></param> | 203 | /// <param name="session_id"></param> |
204 | /// <param name="avatar_id"></param> | 204 | /// <param name="avatar_id"></param> |
205 | /// <returns></returns> | 205 | /// <returns></returns> |
206 | public bool CheckAuthSession(string session_id, string avatar_id) | 206 | public bool CheckAuthSession(string session_id, string avatar_id) |
207 | { | 207 | { |
208 | if (m_doLookup) | 208 | if (m_doLookup) |
209 | { | 209 | { |
210 | m_log.InfoFormat("[HGStandaloneInvService]: checking authed session {0} {1}", session_id, avatar_id); | 210 | m_log.InfoFormat("[HGStandaloneInvService]: checking authed session {0} {1}", session_id, avatar_id); |
211 | UUID userID = UUID.Zero; | 211 | UUID userID = UUID.Zero; |
212 | UUID sessionID = UUID.Zero; | 212 | UUID sessionID = UUID.Zero; |
213 | UUID.TryParse(avatar_id, out userID); | 213 | UUID.TryParse(avatar_id, out userID); |
214 | UUID.TryParse(session_id, out sessionID); | 214 | UUID.TryParse(session_id, out sessionID); |
215 | if (userID.Equals(UUID.Zero) || sessionID.Equals(UUID.Zero)) | 215 | if (userID.Equals(UUID.Zero) || sessionID.Equals(UUID.Zero)) |
216 | { | 216 | { |
217 | m_log.Info("[HGStandaloneInvService]: Invalid user or session id " + avatar_id + "; " + session_id); | 217 | m_log.Info("[HGStandaloneInvService]: Invalid user or session id " + avatar_id + "; " + session_id); |
218 | return false; | 218 | return false; |
219 | } | 219 | } |
220 | UserProfileData userProfile = m_userService.GetUserProfile(userID); | 220 | UserProfileData userProfile = m_userService.GetUserProfile(userID); |
221 | if (userProfile != null && userProfile.CurrentAgent != null && | 221 | if (userProfile != null && userProfile.CurrentAgent != null && |
222 | userProfile.CurrentAgent.SessionID == sessionID) | 222 | userProfile.CurrentAgent.SessionID == sessionID) |
223 | { | 223 | { |
224 | m_log.Info("[HGStandaloneInvService]: user is logged in and session is valid. Authorizing access."); | 224 | m_log.Info("[HGStandaloneInvService]: user is logged in and session is valid. Authorizing access."); |
225 | return true; | 225 | return true; |
226 | } | 226 | } |
227 | 227 | ||
228 | m_log.Warn("[HGStandaloneInvService]: unknown user or session_id, request rejected"); | 228 | m_log.Warn("[HGStandaloneInvService]: unknown user or session_id, request rejected"); |
229 | return false; | 229 | return false; |
230 | } | 230 | } |
231 | else | 231 | else |
232 | { | 232 | { |
233 | return true; | 233 | return true; |
234 | } | 234 | } |
235 | } | 235 | } |
236 | 236 | ||
237 | 237 | ||
238 | /// <summary> | 238 | /// <summary> |
239 | /// Return a user's entire inventory | 239 | /// Return a user's entire inventory |
240 | /// </summary> | 240 | /// </summary> |
241 | /// <param name="rawUserID"></param> | 241 | /// <param name="rawUserID"></param> |
242 | /// <returns>The user's inventory. If an inventory cannot be found then an empty collection is returned.</returns> | 242 | /// <returns>The user's inventory. If an inventory cannot be found then an empty collection is returned.</returns> |
243 | public InventoryCollection GetUserInventory(Guid rawUserID) | 243 | public InventoryCollection GetUserInventory(Guid rawUserID) |
244 | { | 244 | { |
245 | UUID userID = new UUID(rawUserID); | 245 | UUID userID = new UUID(rawUserID); |
246 | 246 | ||
247 | m_log.Info("[HGStandaloneInvService]: Processing request for inventory of " + userID); | 247 | m_log.Info("[HGStandaloneInvService]: Processing request for inventory of " + userID); |
248 | 248 | ||
249 | // Uncomment me to simulate a slow responding inventory server | 249 | // Uncomment me to simulate a slow responding inventory server |
250 | //Thread.Sleep(16000); | 250 | //Thread.Sleep(16000); |
251 | 251 | ||
252 | InventoryCollection invCollection = new InventoryCollection(); | 252 | InventoryCollection invCollection = new InventoryCollection(); |
253 | 253 | ||
254 | List<InventoryFolderBase> allFolders = ((InventoryServiceBase)m_inventoryService).GetInventorySkeleton(userID); | 254 | List<InventoryFolderBase> allFolders = ((InventoryServiceBase)m_inventoryService).GetInventorySkeleton(userID); |
255 | 255 | ||
256 | if (null == allFolders) | 256 | if (null == allFolders) |
257 | { | 257 | { |
258 | m_log.WarnFormat("[HGStandaloneInvService]: No inventory found for user {0}", rawUserID); | 258 | m_log.WarnFormat("[HGStandaloneInvService]: No inventory found for user {0}", rawUserID); |
259 | 259 | ||
260 | return invCollection; | 260 | return invCollection; |
261 | } | 261 | } |
262 | 262 | ||
263 | List<InventoryItemBase> allItems = new List<InventoryItemBase>(); | 263 | List<InventoryItemBase> allItems = new List<InventoryItemBase>(); |
264 | 264 | ||
265 | foreach (InventoryFolderBase folder in allFolders) | 265 | foreach (InventoryFolderBase folder in allFolders) |
266 | { | 266 | { |
267 | List<InventoryItemBase> items = ((InventoryServiceBase)m_inventoryService).RequestFolderItems(folder.ID); | 267 | List<InventoryItemBase> items = ((InventoryServiceBase)m_inventoryService).RequestFolderItems(folder.ID); |
268 | 268 | ||
269 | if (items != null) | 269 | if (items != null) |
270 | { | 270 | { |
271 | allItems.InsertRange(0, items); | 271 | allItems.InsertRange(0, items); |
272 | } | 272 | } |
273 | } | 273 | } |
274 | 274 | ||
275 | invCollection.UserID = userID; | 275 | invCollection.UserID = userID; |
276 | invCollection.Folders = allFolders; | 276 | invCollection.Folders = allFolders; |
277 | invCollection.Items = allItems; | 277 | invCollection.Items = allItems; |
278 | 278 | ||
279 | // foreach (InventoryFolderBase folder in invCollection.Folders) | 279 | // foreach (InventoryFolderBase folder in invCollection.Folders) |
280 | // { | 280 | // { |
281 | // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID); | 281 | // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID); |
282 | // } | 282 | // } |
283 | // | 283 | // |
284 | // foreach (InventoryItemBase item in invCollection.Items) | 284 | // foreach (InventoryItemBase item in invCollection.Items) |
285 | // { | 285 | // { |
286 | // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder); | 286 | // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder); |
287 | // } | 287 | // } |
288 | 288 | ||
289 | m_log.InfoFormat( | 289 | m_log.InfoFormat( |
290 | "[HGStandaloneInvService]: Sending back inventory response to user {0} containing {1} folders and {2} items", | 290 | "[HGStandaloneInvService]: Sending back inventory response to user {0} containing {1} folders and {2} items", |
291 | invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count); | 291 | invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count); |
292 | 292 | ||
293 | return invCollection; | 293 | return invCollection; |
294 | } | 294 | } |
295 | 295 | ||
296 | /// <summary> | 296 | /// <summary> |
297 | /// Guid to UUID wrapper for same name IInventoryServices method | 297 | /// Guid to UUID wrapper for same name IInventoryServices method |
298 | /// </summary> | 298 | /// </summary> |
299 | /// <param name="rawUserID"></param> | 299 | /// <param name="rawUserID"></param> |
300 | /// <returns></returns> | 300 | /// <returns></returns> |
301 | public List<InventoryFolderBase> GetInventorySkeleton(Guid rawUserID) | 301 | public List<InventoryFolderBase> GetInventorySkeleton(Guid rawUserID) |
302 | { | 302 | { |
303 | UUID userID = new UUID(rawUserID); | 303 | UUID userID = new UUID(rawUserID); |
304 | return ((InventoryServiceBase)m_inventoryService).GetInventorySkeleton(userID); | 304 | return ((InventoryServiceBase)m_inventoryService).GetInventorySkeleton(userID); |
305 | } | 305 | } |
306 | 306 | ||
307 | public List<InventoryItemBase> GetActiveGestures(Guid rawUserID) | 307 | public List<InventoryItemBase> GetActiveGestures(Guid rawUserID) |
308 | { | 308 | { |
309 | UUID userID = new UUID(rawUserID); | 309 | UUID userID = new UUID(rawUserID); |
310 | 310 | ||
311 | m_log.InfoFormat("[HGStandaloneInvService]: fetching active gestures for user {0}", userID); | 311 | m_log.InfoFormat("[HGStandaloneInvService]: fetching active gestures for user {0}", userID); |
312 | 312 | ||
313 | return ((InventoryServiceBase)m_inventoryService).GetActiveGestures(userID); | 313 | return ((InventoryServiceBase)m_inventoryService).GetActiveGestures(userID); |
314 | } | 314 | } |
315 | } | 315 | } |
316 | } | 316 | } |