aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorMelanie2010-04-30 11:47:24 +0100
committerMelanie2010-04-30 11:47:24 +0100
commit4cc06ff993a298c7912613ef377c2dc3ff65715f (patch)
tree5b7bb486651a9b540d826d3e8b937d95b485a808 /OpenSim/Region/CoreModules
parentFix link security issue (diff)
parentSimplified RemoteXInventoryServiceConnector and HGBroker (2) by a lot. (diff)
downloadopensim-SC_OLD-4cc06ff993a298c7912613ef377c2dc3ff65715f.zip
opensim-SC_OLD-4cc06ff993a298c7912613ef377c2dc3ff65715f.tar.gz
opensim-SC_OLD-4cc06ff993a298c7912613ef377c2dc3ff65715f.tar.bz2
opensim-SC_OLD-4cc06ff993a298c7912613ef377c2dc3ff65715f.tar.xz
Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs471
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs90
2 files changed, 282 insertions, 279 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs
index 22aac02..3509161 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs
@@ -41,7 +41,7 @@ using OpenMetaverse;
41 41
42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory 42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
43{ 43{
44 public class HGInventoryBroker2 : BaseInventoryConnector, INonSharedRegionModule, IInventoryService 44 public class HGInventoryBroker2 : INonSharedRegionModule, IInventoryService
45 { 45 {
46 private static readonly ILog m_log = 46 private static readonly ILog m_log =
47 LogManager.GetLogger( 47 LogManager.GetLogger(
@@ -54,8 +54,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
54 private static ISessionAuthInventoryService m_HGService; // obsolete 54 private static ISessionAuthInventoryService m_HGService; // obsolete
55 private Dictionary<string, IInventoryService> m_connectors = new Dictionary<string, IInventoryService>(); 55 private Dictionary<string, IInventoryService> m_connectors = new Dictionary<string, IInventoryService>();
56 56
57 // A cache of userIDs --> ServiceURLs, for HGBroker only
58 protected Dictionary<UUID, string> m_InventoryURLs;
57 59
58 private Scene m_Scene; 60 private Scene m_Scene;
61 private List<Scene> m_Scenes = new List<Scene>();
62
59 private IUserAccountService m_UserAccountService; 63 private IUserAccountService m_UserAccountService;
60 64
61 public Type ReplaceableInterface 65 public Type ReplaceableInterface
@@ -124,8 +128,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
124 return; 128 return;
125 } 129 }
126 130
127 Init(source);
128
129 m_Enabled = true; 131 m_Enabled = true;
130 m_log.Info("[HG INVENTORY CONNECTOR]: HG inventory broker enabled"); 132 m_log.Info("[HG INVENTORY CONNECTOR]: HG inventory broker enabled");
131 } 133 }
@@ -148,18 +150,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
148 return; 150 return;
149 151
150 m_Scene = scene; 152 m_Scene = scene;
153 m_Scenes.Add(scene);
151 m_UserAccountService = m_Scene.UserAccountService; 154 m_UserAccountService = m_Scene.UserAccountService;
152 155
153 scene.RegisterModuleInterface<IInventoryService>(this); 156 scene.RegisterModuleInterface<IInventoryService>(this);
154 m_cache.AddRegion(scene); 157
158 scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
159 scene.EventManager.OnClientClosed += OnClientClosed;
160
155 } 161 }
156 162
157 public void RemoveRegion(Scene scene) 163 public void RemoveRegion(Scene scene)
158 { 164 {
159 if (!m_Enabled) 165 if (!m_Enabled)
160 return; 166 return;
161 167
162 m_cache.RemoveRegion(scene); 168 m_Scenes.Remove(scene);
163 } 169 }
164 170
165 public void RegionLoaded(Scene scene) 171 public void RegionLoaded(Scene scene)
@@ -171,282 +177,302 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
171 177
172 } 178 }
173 179
180 #region Cache
181
182 void OnMakeRootAgent(ScenePresence presence)
183 {
184 if (!m_InventoryURLs.ContainsKey(presence.UUID))
185 CacheInventoryServiceURL(presence.Scene, presence.UUID);
186 }
187
188 void OnClientClosed(UUID clientID, Scene scene)
189 {
190 if (m_InventoryURLs.ContainsKey(clientID)) // if it's in cache
191 {
192 ScenePresence sp = null;
193 foreach (Scene s in m_Scenes)
194 {
195 s.TryGetScenePresence(clientID, out sp);
196 if ((sp != null) && !sp.IsChildAgent && (s != scene))
197 {
198 m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping inventoryURL in cache",
199 scene.RegionInfo.RegionName, clientID);
200 return;
201 }
202 }
203
204 m_log.DebugFormat(
205 "[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping inventory URL",
206 scene.RegionInfo.RegionName, clientID);
207 DropInventoryServiceURL(clientID);
208 }
209 }
210
211 /// <summary>
212 /// Gets the user's inventory URL from its serviceURLs, if the user is foreign,
213 /// and sticks it in the cache
214 /// </summary>
215 /// <param name="userID"></param>
216 private void CacheInventoryServiceURL(Scene scene, UUID userID)
217 {
218 if (scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, userID) == null)
219 {
220 // The user does not have a local account; let's cache its service URL
221 string inventoryURL = string.Empty;
222 ScenePresence sp = null;
223 scene.TryGetScenePresence(userID, out sp);
224 if (sp != null)
225 {
226 AgentCircuitData aCircuit = scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
227 if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI"))
228 {
229 inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString();
230 if (inventoryURL != null && inventoryURL != string.Empty)
231 {
232 inventoryURL = inventoryURL.Trim(new char[] { '/' });
233 m_InventoryURLs.Add(userID, inventoryURL);
234 }
235 }
236 }
237 }
238 }
239
240 private void DropInventoryServiceURL(UUID userID)
241 {
242 lock (m_InventoryURLs)
243 if (m_InventoryURLs.ContainsKey(userID))
244 m_InventoryURLs.Remove(userID);
245 }
246
247 public string GetInventoryServiceURL(UUID userID)
248 {
249 if (m_InventoryURLs.ContainsKey(userID))
250 return m_InventoryURLs[userID];
251
252 return null;
253 }
254 #endregion
174 255
175 #region IInventoryService 256 #region IInventoryService
176 257
177 public override bool CreateUserInventory(UUID userID) 258 public bool CreateUserInventory(UUID userID)
178 { 259 {
179 return m_LocalGridInventoryService.CreateUserInventory(userID); 260 return m_LocalGridInventoryService.CreateUserInventory(userID);
180 } 261 }
181 262
182 public override List<InventoryFolderBase> GetInventorySkeleton(UUID userId) 263 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
183 { 264 {
184 return m_LocalGridInventoryService.GetInventorySkeleton(userId); 265 return m_LocalGridInventoryService.GetInventorySkeleton(userId);
185 } 266 }
186 267
187 public override InventoryCollection GetUserInventory(UUID userID) 268 public InventoryCollection GetUserInventory(UUID userID)
188 { 269 {
189 return null; 270 return null;
190 } 271 }
191 272
192 public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback) 273 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
193 { 274 {
194 } 275 }
195 276
196 // Inherited. See base 277 public InventoryFolderBase GetRootFolder(UUID userID)
197 //public override InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
198 //{
199 // if (IsLocalGridUser(userID))
200 // return m_GridService.GetFolderForType(userID, type);
201 // else
202 // {
203 // UUID sessionID = GetSessionID(userID);
204 // string uri = GetUserInventoryURI(userID) + "/" + userID.ToString();
205 // // !!!!!!
206 // return null;
207 // //return m_HGService.GetFolderForType(uri, sessionID, type);
208 // }
209 //}
210
211 public override InventoryCollection GetFolderContent(UUID userID, UUID folderID)
212 { 278 {
213 m_log.Debug("[HGInventory]: GetFolderContent " + folderID); 279 m_log.DebugFormat("[HGInventory]: GetRootFolder for {0}", userID);
214 string url = string.Empty;
215 280
216 string invURL = m_cache.GetInventoryServiceURL(userID); 281 string invURL = GetInventoryServiceURL(userID);
217 282
218 if (invURL == null) // not there, forward to local inventory connector to resolve 283 if (invURL == null) // not there, forward to local inventory connector to resolve
219 return m_LocalGridInventoryService.GetFolderContent(userID, folderID); 284 return m_LocalGridInventoryService.GetRootFolder(userID);
220
221 IInventoryService connector = GetConnector(url);
222 return connector.GetFolderContent(userID, folderID);
223
224 //if (StringToUrlAndUserID(id, out url, out userID))
225 //{
226 // ISessionAuthInventoryService connector = GetConnector(url);
227 // return connector.GetFolderContent(userID, folderID, sessionID);
228 //}
229 285
230 //return null; 286 IInventoryService connector = GetConnector(invURL);
231
232 //////////
233 287
234 //string uri = string.Empty; 288 return connector.GetRootFolder(userID);
235 //if (!IsForeignUser(userID, out uri))
236 // return m_GridService.GetFolderContent(userID, folderID);
237 //else
238 //{
239 // UUID sessionID = GetSessionID(userID);
240 // uri = uri + "/" + userID.ToString();
241 // return m_HGService.GetFolderContent(uri, folderID, sessionID);
242 //}
243 } 289 }
244 290
245 public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) 291 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
246 { 292 {
247 string uri = string.Empty; 293 m_log.DebugFormat("[HGInventory]: GetFolderForType {0} type {1}", userID, type);
248 if (!IsForeignUser(userID, out uri)) 294
249 { 295 string invURL = GetInventoryServiceURL(userID);
250 // This is not pretty, but it will have to do for now 296
251 if (m_LocalGridInventoryService is BaseInventoryConnector) 297 if (invURL == null) // not there, forward to local inventory connector to resolve
252 { 298 return m_LocalGridInventoryService.GetFolderForType(userID, type);
253 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetSystemsFolders redirected to RemoteInventoryServiceConnector module"); 299
254 return ((BaseInventoryConnector)m_LocalGridInventoryService).GetSystemFolders(userID); 300 IInventoryService connector = GetConnector(invURL);
255 } 301
256 else 302 return connector.GetFolderForType(userID, type);
257 {
258 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetSystemsFolders redirected to GetSystemFoldersLocal");
259 return GetSystemFoldersLocal(userID);
260 }
261 }
262 else
263 {
264 UUID sessionID = GetSessionID(userID);
265 uri = uri + "/" + userID.ToString();
266 return m_HGService.GetSystemFolders(uri, sessionID);
267 }
268 } 303 }
269 304
270 private Dictionary<AssetType, InventoryFolderBase> GetSystemFoldersLocal(UUID userID) 305 public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
271 { 306 {
272 InventoryFolderBase root = m_LocalGridInventoryService.GetRootFolder(userID); 307 m_log.Debug("[HGInventory]: GetFolderContent " + folderID);
273 if (root != null)
274 {
275 InventoryCollection content = m_LocalGridInventoryService.GetFolderContent(userID, root.ID);
276 if (content != null)
277 {
278 Dictionary<AssetType, InventoryFolderBase> folders = new Dictionary<AssetType, InventoryFolderBase>();
279 foreach (InventoryFolderBase folder in content.Folders)
280 {
281 //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: scanning folder type {0}", (AssetType)folder.Type);
282 if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown))
283 folders[(AssetType)folder.Type] = folder;
284 }
285 // Put the root folder there, as type Folder
286 folders[AssetType.Folder] = root;
287 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: System folders count for {0}: {1}", userID, folders.Count);
288 return folders;
289 }
290 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Root folder content not found for {0}", userID);
291 308
292 } 309 string invURL = GetInventoryServiceURL(userID);
293 310
294 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Root folder not found for {0}", userID); 311 if (invURL == null) // not there, forward to local inventory connector to resolve
312 return m_LocalGridInventoryService.GetFolderContent(userID, folderID);
313
314 IInventoryService connector = GetConnector(invURL);
315
316 return connector.GetFolderContent(userID, folderID);
295 317
296 return new Dictionary<AssetType, InventoryFolderBase>();
297 } 318 }
298 319
299 public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) 320 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
300 { 321 {
301 string uri = string.Empty; 322 m_log.Debug("[HGInventory]: GetFolderItems " + folderID);
302 if (!IsForeignUser(userID, out uri)) 323
324 string invURL = GetInventoryServiceURL(userID);
325
326 if (invURL == null) // not there, forward to local inventory connector to resolve
303 return m_LocalGridInventoryService.GetFolderItems(userID, folderID); 327 return m_LocalGridInventoryService.GetFolderItems(userID, folderID);
304 else 328
305 { 329 IInventoryService connector = GetConnector(invURL);
306 UUID sessionID = GetSessionID(userID); 330
307 uri = uri + "/" + userID.ToString(); 331 return connector.GetFolderItems(userID, folderID);
308 return m_HGService.GetFolderItems(uri, folderID, sessionID); 332
309 }
310 } 333 }
311 334
312 public override bool AddFolder(InventoryFolderBase folder) 335 public bool AddFolder(InventoryFolderBase folder)
313 { 336 {
314 if (folder == null) 337 if (folder == null)
315 return false; 338 return false;
316 339
317 string uri = string.Empty; 340 m_log.Debug("[HGInventory]: AddFolder " + folder.ID);
318 if (!IsForeignUser(folder.Owner, out uri)) 341
342 string invURL = GetInventoryServiceURL(folder.Owner);
343
344 if (invURL == null) // not there, forward to local inventory connector to resolve
319 return m_LocalGridInventoryService.AddFolder(folder); 345 return m_LocalGridInventoryService.AddFolder(folder);
320 else 346
321 { 347 IInventoryService connector = GetConnector(invURL);
322 UUID sessionID = GetSessionID(folder.Owner); 348
323 uri = uri + "/" + folder.Owner.ToString(); 349 return connector.AddFolder(folder);
324 return m_HGService.AddFolder(uri, folder, sessionID);
325 }
326 } 350 }
327 351
328 public override bool UpdateFolder(InventoryFolderBase folder) 352 public bool UpdateFolder(InventoryFolderBase folder)
329 { 353 {
330 if (folder == null) 354 if (folder == null)
331 return false; 355 return false;
332 356
333 string uri = string.Empty; 357 m_log.Debug("[HGInventory]: UpdateFolder " + folder.ID);
334 if (!IsForeignUser(folder.Owner, out uri)) 358
359 string invURL = GetInventoryServiceURL(folder.Owner);
360
361 if (invURL == null) // not there, forward to local inventory connector to resolve
335 return m_LocalGridInventoryService.UpdateFolder(folder); 362 return m_LocalGridInventoryService.UpdateFolder(folder);
336 else 363
337 { 364 IInventoryService connector = GetConnector(invURL);
338 UUID sessionID = GetSessionID(folder.Owner); 365
339 uri = uri + "/" + folder.Owner.ToString(); 366 return connector.UpdateFolder(folder);
340 return m_HGService.UpdateFolder(uri, folder, sessionID);
341 }
342 } 367 }
343 368
344 public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs) 369 public bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
345 { 370 {
346 if (folderIDs == null) 371 if (folderIDs == null)
347 return false; 372 return false;
348 if (folderIDs.Count == 0) 373 if (folderIDs.Count == 0)
349 return false; 374 return false;
350 375
351 string uri = string.Empty; 376 m_log.Debug("[HGInventory]: DeleteFolders for " + ownerID);
352 if (!IsForeignUser(ownerID, out uri)) 377
378 string invURL = GetInventoryServiceURL(ownerID);
379
380 if (invURL == null) // not there, forward to local inventory connector to resolve
353 return m_LocalGridInventoryService.DeleteFolders(ownerID, folderIDs); 381 return m_LocalGridInventoryService.DeleteFolders(ownerID, folderIDs);
354 else 382
355 { 383 IInventoryService connector = GetConnector(invURL);
356 UUID sessionID = GetSessionID(ownerID); 384
357 uri = uri + "/" + ownerID.ToString(); 385 return connector.DeleteFolders(ownerID, folderIDs);
358 return m_HGService.DeleteFolders(uri, folderIDs, sessionID);
359 }
360 } 386 }
361 387
362 public override bool MoveFolder(InventoryFolderBase folder) 388 public bool MoveFolder(InventoryFolderBase folder)
363 { 389 {
364 if (folder == null) 390 if (folder == null)
365 return false; 391 return false;
366 392
367 string uri = string.Empty; 393 m_log.Debug("[HGInventory]: MoveFolder for " + folder.Owner);
368 if (!IsForeignUser(folder.Owner, out uri)) 394
395 string invURL = GetInventoryServiceURL(folder.Owner);
396
397 if (invURL == null) // not there, forward to local inventory connector to resolve
369 return m_LocalGridInventoryService.MoveFolder(folder); 398 return m_LocalGridInventoryService.MoveFolder(folder);
370 else 399
371 { 400 IInventoryService connector = GetConnector(invURL);
372 UUID sessionID = GetSessionID(folder.Owner); 401
373 uri = uri + "/" + folder.Owner.ToString(); 402 return connector.MoveFolder(folder);
374 return m_HGService.MoveFolder(uri, folder, sessionID);
375 }
376 } 403 }
377 404
378 public override bool PurgeFolder(InventoryFolderBase folder) 405 public bool PurgeFolder(InventoryFolderBase folder)
379 { 406 {
380 if (folder == null) 407 if (folder == null)
381 return false; 408 return false;
382 409
383 string uri = string.Empty; 410 m_log.Debug("[HGInventory]: PurgeFolder for " + folder.Owner);
384 if (!IsForeignUser(folder.Owner, out uri)) 411
412 string invURL = GetInventoryServiceURL(folder.Owner);
413
414 if (invURL == null) // not there, forward to local inventory connector to resolve
385 return m_LocalGridInventoryService.PurgeFolder(folder); 415 return m_LocalGridInventoryService.PurgeFolder(folder);
386 else
387 {
388 UUID sessionID = GetSessionID(folder.Owner);
389 uri = uri + "/" + folder.Owner.ToString();
390 return m_HGService.PurgeFolder(uri, folder, sessionID);
391 }
392 }
393 416
394 // public bool AddItem(InventoryItemBase item) inherited 417 IInventoryService connector = GetConnector(invURL);
395 // Uses AddItemPlain
396 418
397 protected override bool AddItemPlain(InventoryItemBase item) 419 return connector.PurgeFolder(folder);
420 }
421
422 public bool AddItem(InventoryItemBase item)
398 { 423 {
399 if (item == null) 424 if (item == null)
400 return false; 425 return false;
401 426
402 string uri = string.Empty; 427 m_log.Debug("[HGInventory]: AddItem " + item.ID);
403 if (!IsForeignUser(item.Owner, out uri)) 428
404 { 429 string invURL = GetInventoryServiceURL(item.Owner);
430
431 if (invURL == null) // not there, forward to local inventory connector to resolve
405 return m_LocalGridInventoryService.AddItem(item); 432 return m_LocalGridInventoryService.AddItem(item);
406 } 433
407 else 434 IInventoryService connector = GetConnector(invURL);
408 { 435
409 UUID sessionID = GetSessionID(item.Owner); 436 return connector.AddItem(item);
410 uri = uri + "/" + item.Owner.ToString();
411 return m_HGService.AddItem(uri, item, sessionID);
412 }
413 } 437 }
414 438
415 public override bool UpdateItem(InventoryItemBase item) 439 public bool UpdateItem(InventoryItemBase item)
416 { 440 {
417 if (item == null) 441 if (item == null)
418 return false; 442 return false;
419 443
420 string uri = string.Empty; 444 m_log.Debug("[HGInventory]: UpdateItem " + item.ID);
421 if (!IsForeignUser(item.Owner, out uri)) 445
446 string invURL = GetInventoryServiceURL(item.Owner);
447
448 if (invURL == null) // not there, forward to local inventory connector to resolve
422 return m_LocalGridInventoryService.UpdateItem(item); 449 return m_LocalGridInventoryService.UpdateItem(item);
423 else 450
424 { 451 IInventoryService connector = GetConnector(invURL);
425 UUID sessionID = GetSessionID(item.Owner); 452
426 uri = uri + "/" + item.Owner.ToString(); 453 return connector.UpdateItem(item);
427 return m_HGService.UpdateItem(uri, item, sessionID);
428 }
429 } 454 }
430 455
431 public override bool MoveItems(UUID ownerID, List<InventoryItemBase> items) 456 public bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
432 { 457 {
433 if (items == null) 458 if (items == null)
434 return false; 459 return false;
435 if (items.Count == 0) 460 if (items.Count == 0)
436 return true; 461 return true;
437 462
438 string uri = string.Empty; 463 m_log.Debug("[HGInventory]: MoveItems for " + ownerID);
439 if (!IsForeignUser(ownerID, out uri)) 464
465 string invURL = GetInventoryServiceURL(ownerID);
466
467 if (invURL == null) // not there, forward to local inventory connector to resolve
440 return m_LocalGridInventoryService.MoveItems(ownerID, items); 468 return m_LocalGridInventoryService.MoveItems(ownerID, items);
441 else 469
442 { 470 IInventoryService connector = GetConnector(invURL);
443 UUID sessionID = GetSessionID(ownerID); 471
444 uri = uri + "/" + ownerID.ToString(); 472 return connector.MoveItems(ownerID, items);
445 return m_HGService.MoveItems(uri, items, sessionID);
446 }
447 } 473 }
448 474
449 public override bool DeleteItems(UUID ownerID, List<UUID> itemIDs) 475 public bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
450 { 476 {
451 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID); 477 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID);
452 478
@@ -455,70 +481,73 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
455 if (itemIDs.Count == 0) 481 if (itemIDs.Count == 0)
456 return true; 482 return true;
457 483
458 string uri = string.Empty; 484 m_log.Debug("[HGInventory]: DeleteItems for " + ownerID);
459 if (!IsForeignUser(ownerID, out uri)) 485
486 string invURL = GetInventoryServiceURL(ownerID);
487
488 if (invURL == null) // not there, forward to local inventory connector to resolve
460 return m_LocalGridInventoryService.DeleteItems(ownerID, itemIDs); 489 return m_LocalGridInventoryService.DeleteItems(ownerID, itemIDs);
461 else 490
462 { 491 IInventoryService connector = GetConnector(invURL);
463 UUID sessionID = GetSessionID(ownerID); 492
464 uri = uri + "/" + ownerID.ToString(); 493 return connector.DeleteItems(ownerID, itemIDs);
465 return m_HGService.DeleteItems(uri, itemIDs, sessionID);
466 }
467 } 494 }
468 495
469 public override InventoryItemBase GetItem(InventoryItemBase item) 496 public InventoryItemBase GetItem(InventoryItemBase item)
470 { 497 {
471 if (item == null) 498 if (item == null)
472 return null; 499 return null;
473 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetItem {0} for user {1}", item.ID, item.Owner); 500 m_log.Debug("[HGInventory]: GetItem " + item.ID);
474 string uri = string.Empty; 501
475 if (!IsForeignUser(item.Owner, out uri)) 502 string invURL = GetInventoryServiceURL(item.Owner);
503
504 if (invURL == null) // not there, forward to local inventory connector to resolve
476 return m_LocalGridInventoryService.GetItem(item); 505 return m_LocalGridInventoryService.GetItem(item);
477 else 506
478 { 507 IInventoryService connector = GetConnector(invURL);
479 UUID sessionID = GetSessionID(item.Owner); 508
480 uri = uri + "/" + item.Owner.ToString(); 509 return connector.GetItem(item);
481 return m_HGService.QueryItem(uri, item, sessionID);
482 }
483 } 510 }
484 511
485 public override InventoryFolderBase GetFolder(InventoryFolderBase folder) 512 public InventoryFolderBase GetFolder(InventoryFolderBase folder)
486 { 513 {
487 if (folder == null) 514 if (folder == null)
488 return null; 515 return null;
489 516
490 string uri = string.Empty; 517 m_log.Debug("[HGInventory]: GetFolder " + folder.ID);
491 if (!IsForeignUser(folder.Owner, out uri)) 518
519 string invURL = GetInventoryServiceURL(folder.Owner);
520
521 if (invURL == null) // not there, forward to local inventory connector to resolve
492 return m_LocalGridInventoryService.GetFolder(folder); 522 return m_LocalGridInventoryService.GetFolder(folder);
493 else 523
494 { 524 IInventoryService connector = GetConnector(invURL);
495 UUID sessionID = GetSessionID(folder.Owner); 525
496 uri = uri + "/" + folder.Owner.ToString(); 526 return connector.GetFolder(folder);
497 return m_HGService.QueryFolder(uri, folder, sessionID);
498 }
499 } 527 }
500 528
501 public override bool HasInventoryForUser(UUID userID) 529 public bool HasInventoryForUser(UUID userID)
502 { 530 {
503 return false; 531 return false;
504 } 532 }
505 533
506 public override List<InventoryItemBase> GetActiveGestures(UUID userId) 534 public List<InventoryItemBase> GetActiveGestures(UUID userId)
507 { 535 {
508 return new List<InventoryItemBase>(); 536 return new List<InventoryItemBase>();
509 } 537 }
510 538
511 public override int GetAssetPermissions(UUID userID, UUID assetID) 539 public int GetAssetPermissions(UUID userID, UUID assetID)
512 { 540 {
513 string uri = string.Empty; 541 m_log.Debug("[HGInventory]: GetAssetPermissions " + assetID);
514 if (!IsForeignUser(userID, out uri)) 542
543 string invURL = GetInventoryServiceURL(userID);
544
545 if (invURL == null) // not there, forward to local inventory connector to resolve
515 return m_LocalGridInventoryService.GetAssetPermissions(userID, assetID); 546 return m_LocalGridInventoryService.GetAssetPermissions(userID, assetID);
516 else 547
517 { 548 IInventoryService connector = GetConnector(invURL);
518 UUID sessionID = GetSessionID(userID); 549
519 uri = uri + "/" + userID.ToString(); 550 return connector.GetAssetPermissions(userID, assetID);
520 return m_HGService.GetAssetPermissions(uri, assetID, sessionID);
521 }
522 } 551 }
523 552
524 #endregion 553 #endregion
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
index 96d0c1c..ac9e792 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
@@ -41,7 +41,7 @@ using OpenMetaverse;
41 41
42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory 42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
43{ 43{
44 public class RemoteXInventoryServicesConnector : BaseInventoryConnector, ISharedRegionModule, IInventoryService 44 public class RemoteXInventoryServicesConnector : ISharedRegionModule, IInventoryService
45 { 45 {
46 private static readonly ILog m_log = 46 private static readonly ILog m_log =
47 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -75,10 +75,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
75 Init(source); 75 Init(source);
76 } 76 }
77 77
78 protected override void Init(IConfigSource source) 78 protected void Init(IConfigSource source)
79 { 79 {
80 m_RemoteConnector = new XInventoryServicesConnector(source); 80 m_RemoteConnector = new XInventoryServicesConnector(source);
81 base.Init(source);
82 } 81 }
83 82
84 83
@@ -122,7 +121,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
122 } 121 }
123 122
124 scene.RegisterModuleInterface<IInventoryService>(this); 123 scene.RegisterModuleInterface<IInventoryService>(this);
125 m_cache.AddRegion(scene);
126 } 124 }
127 125
128 public void RemoveRegion(Scene scene) 126 public void RemoveRegion(Scene scene)
@@ -130,7 +128,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
130 if (!m_Enabled) 128 if (!m_Enabled)
131 return; 129 return;
132 130
133 m_cache.RemoveRegion(scene);
134 } 131 }
135 132
136 public void RegionLoaded(Scene scene) 133 public void RegionLoaded(Scene scene)
@@ -146,71 +143,51 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
146 143
147 #region IInventoryService 144 #region IInventoryService
148 145
149 public override bool CreateUserInventory(UUID user) 146 public bool CreateUserInventory(UUID user)
150 { 147 {
151 return false; 148 return false;
152 } 149 }
153 150
154 public override List<InventoryFolderBase> GetInventorySkeleton(UUID userId) 151 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
155 { 152 {
156 return new List<InventoryFolderBase>(); 153 return new List<InventoryFolderBase>();
157 } 154 }
158 155
159 public override InventoryCollection GetUserInventory(UUID userID) 156 public InventoryCollection GetUserInventory(UUID userID)
160 { 157 {
161 return null; 158 return null;
162 } 159 }
163 160
164 public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback) 161 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
165 { 162 {
166 try 163 }
167 {
168 m_RemoteConnector.GetUserInventory(userID, callback);
169 }
170 catch (Exception e)
171 {
172 if (StatsManager.SimExtraStats != null)
173 StatsManager.SimExtraStats.AddInventoryServiceRetrievalFailure();
174
175 m_log.ErrorFormat("[XINVENTORY CONNECTOR]: Request inventory operation failed, {0} {1}",
176 e.Source, e.Message);
177 }
178 164
165 public InventoryFolderBase GetRootFolder(UUID userID)
166 {
167 return m_RemoteConnector.GetRootFolder(userID);
179 } 168 }
180 169
181 // inherited. See base class 170 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
182 // public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) 171 {
172 return m_RemoteConnector.GetFolderForType(userID, type);
173 }
183 174
184 public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) 175 public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID)
185 { 176 {
186 return m_RemoteConnector.GetSystemFolders(userID); 177 return m_RemoteConnector.GetSystemFolders(userID);
187 } 178 }
188 179
189 public override InventoryCollection GetFolderContent(UUID userID, UUID folderID) 180 public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
190 { 181 {
191 m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolderContent {0}", folderID); 182 return m_RemoteConnector.GetFolderContent(userID, folderID);
192 try
193 {
194 return m_RemoteConnector.GetFolderContent(userID, folderID);
195 }
196 catch (Exception e)
197 {
198 m_log.ErrorFormat("[XINVENTORY CONNECTOR]: GetFolderContent operation failed, {0} {1}",
199 e.Source, e.Message);
200 }
201 InventoryCollection nullCollection = new InventoryCollection();
202 nullCollection.Folders = new List<InventoryFolderBase>();
203 nullCollection.Items = new List<InventoryItemBase>();
204 nullCollection.UserID = userID;
205 return nullCollection;
206 } 183 }
207 184
208 public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) 185 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
209 { 186 {
210 return m_RemoteConnector.GetFolderItems(userID, folderID); 187 return m_RemoteConnector.GetFolderItems(userID, folderID);
211 } 188 }
212 189
213 public override bool AddFolder(InventoryFolderBase folder) 190 public bool AddFolder(InventoryFolderBase folder)
214 { 191 {
215 if (folder == null) 192 if (folder == null)
216 return false; 193 return false;
@@ -218,7 +195,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
218 return m_RemoteConnector.AddFolder(folder); 195 return m_RemoteConnector.AddFolder(folder);
219 } 196 }
220 197
221 public override bool UpdateFolder(InventoryFolderBase folder) 198 public bool UpdateFolder(InventoryFolderBase folder)
222 { 199 {
223 if (folder == null) 200 if (folder == null)
224 return false; 201 return false;
@@ -226,7 +203,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
226 return m_RemoteConnector.UpdateFolder(folder); 203 return m_RemoteConnector.UpdateFolder(folder);
227 } 204 }
228 205
229 public override bool MoveFolder(InventoryFolderBase folder) 206 public bool MoveFolder(InventoryFolderBase folder)
230 { 207 {
231 if (folder == null) 208 if (folder == null)
232 return false; 209 return false;
@@ -234,7 +211,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
234 return m_RemoteConnector.MoveFolder(folder); 211 return m_RemoteConnector.MoveFolder(folder);
235 } 212 }
236 213
237 public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs) 214 public bool DeleteFolders(UUID ownerID, List<UUID> folderIDs)
238 { 215 {
239 if (folderIDs == null) 216 if (folderIDs == null)
240 return false; 217 return false;
@@ -245,7 +222,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
245 } 222 }
246 223
247 224
248 public override bool PurgeFolder(InventoryFolderBase folder) 225 public bool PurgeFolder(InventoryFolderBase folder)
249 { 226 {
250 if (folder == null) 227 if (folder == null)
251 return false; 228 return false;
@@ -253,10 +230,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
253 return m_RemoteConnector.PurgeFolder(folder); 230 return m_RemoteConnector.PurgeFolder(folder);
254 } 231 }
255 232
256 // public bool AddItem(InventoryItemBase item) inherited 233 public bool AddItem(InventoryItemBase item)
257 // Uses AddItemPlain
258
259 protected override bool AddItemPlain(InventoryItemBase item)
260 { 234 {
261 if (item == null) 235 if (item == null)
262 return false; 236 return false;
@@ -264,7 +238,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
264 return m_RemoteConnector.AddItem(item); 238 return m_RemoteConnector.AddItem(item);
265 } 239 }
266 240
267 public override bool UpdateItem(InventoryItemBase item) 241 public bool UpdateItem(InventoryItemBase item)
268 { 242 {
269 if (item == null) 243 if (item == null)
270 return false; 244 return false;
@@ -272,7 +246,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
272 return m_RemoteConnector.UpdateItem(item); 246 return m_RemoteConnector.UpdateItem(item);
273 } 247 }
274 248
275 public override bool MoveItems(UUID ownerID, List<InventoryItemBase> items) 249 public bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
276 { 250 {
277 if (items == null) 251 if (items == null)
278 return false; 252 return false;
@@ -281,7 +255,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
281 } 255 }
282 256
283 257
284 public override bool DeleteItems(UUID ownerID, List<UUID> itemIDs) 258 public bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
285 { 259 {
286 if (itemIDs == null) 260 if (itemIDs == null)
287 return false; 261 return false;
@@ -291,7 +265,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
291 return m_RemoteConnector.DeleteItems(ownerID, itemIDs); 265 return m_RemoteConnector.DeleteItems(ownerID, itemIDs);
292 } 266 }
293 267
294 public override InventoryItemBase GetItem(InventoryItemBase item) 268 public InventoryItemBase GetItem(InventoryItemBase item)
295 { 269 {
296 if (item == null) 270 if (item == null)
297 return null; 271 return null;
@@ -299,7 +273,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
299 return m_RemoteConnector.GetItem(item); 273 return m_RemoteConnector.GetItem(item);
300 } 274 }
301 275
302 public override InventoryFolderBase GetFolder(InventoryFolderBase folder) 276 public InventoryFolderBase GetFolder(InventoryFolderBase folder)
303 { 277 {
304 m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID); 278 m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID);
305 if (folder == null) 279 if (folder == null)
@@ -308,17 +282,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
308 return m_RemoteConnector.GetFolder(folder); 282 return m_RemoteConnector.GetFolder(folder);
309 } 283 }
310 284
311 public override bool HasInventoryForUser(UUID userID) 285 public bool HasInventoryForUser(UUID userID)
312 { 286 {
313 return false; 287 return false;
314 } 288 }
315 289
316 public override List<InventoryItemBase> GetActiveGestures(UUID userId) 290 public List<InventoryItemBase> GetActiveGestures(UUID userId)
317 { 291 {
318 return new List<InventoryItemBase>(); 292 return new List<InventoryItemBase>();
319 } 293 }
320 294
321 public override int GetAssetPermissions(UUID userID, UUID assetID) 295 public int GetAssetPermissions(UUID userID, UUID assetID)
322 { 296 {
323 return m_RemoteConnector.GetAssetPermissions(userID, assetID); 297 return m_RemoteConnector.GetAssetPermissions(userID, assetID);
324 } 298 }