aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2010-01-29 19:33:50 -0800
committerDiva Canto2010-01-29 19:33:50 -0800
commit81a6f9a5152f0445c9b48229fa4cd74effed5d0f (patch)
treefa8f749156b91aef03737a85c1845116aa1137ba /OpenSim
parent* HGGridConnector is no longer necessary. (diff)
downloadopensim-SC_OLD-81a6f9a5152f0445c9b48229fa4cd74effed5d0f.zip
opensim-SC_OLD-81a6f9a5152f0445c9b48229fa4cd74effed5d0f.tar.gz
opensim-SC_OLD-81a6f9a5152f0445c9b48229fa4cd74effed5d0f.tar.bz2
opensim-SC_OLD-81a6f9a5152f0445c9b48229fa4cd74effed5d0f.tar.xz
On the way to making HG inventory work. Inventory can now be accessed again. Assets are still broken.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs176
1 files changed, 66 insertions, 110 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 0c5097a..b6718a8 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -50,25 +50,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
50 private bool m_Enabled = false; 50 private bool m_Enabled = false;
51 private bool m_Initialized = false; 51 private bool m_Initialized = false;
52 private Scene m_Scene; 52 private Scene m_Scene;
53 private IUserAccountService m_UserAccountService; // This should change to IUserProfileService 53 private IUserAccountService m_UserAccountService;
54 54
55 private IInventoryService m_GridService; 55 private IInventoryService m_GridService;
56 private ISessionAuthInventoryService m_HGService; 56 private ISessionAuthInventoryService m_HGService;
57 57
58 private string m_LocalGridInventoryURI = string.Empty;
59
60 private string LocalGridInventory
61 {
62 get
63 {
64 return string.Empty;
65 // REFACTORING PROBLEM
66 //if (m_LocalGridInventoryURI == null || m_LocalGridInventoryURI == "")
67 // m_LocalGridInventoryURI = m_Scene.CommsManager.NetworkServersInfo.InventoryURL;
68 //return m_LocalGridInventoryURI;
69 }
70 }
71
72 public Type ReplaceableInterface 58 public Type ReplaceableInterface
73 { 59 {
74 get { return null; } 60 get { return null; }
@@ -133,8 +119,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
133 return; 119 return;
134 } 120 }
135 121
136 m_LocalGridInventoryURI = inventoryConfig.GetString("InventoryServerURI", string.Empty);
137
138 Init(source); 122 Init(source);
139 123
140 m_Enabled = true; 124 m_Enabled = true;
@@ -199,22 +183,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
199 183
200 public override InventoryCollection GetUserInventory(UUID userID) 184 public override InventoryCollection GetUserInventory(UUID userID)
201 { 185 {
202 if (IsLocalGridUser(userID)) 186 return null;
203 return m_GridService.GetUserInventory(userID);
204 else
205 return null;
206 } 187 }
207 188
208 public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback) 189 public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
209 { 190 {
210 if (IsLocalGridUser(userID))
211 m_GridService.GetUserInventory(userID, callback);
212 else
213 {
214 UUID sessionID = GetSessionID(userID);
215 string uri = GetUserInventoryURI(userID) + "/" + userID.ToString();
216 m_HGService.GetUserInventory(uri, sessionID, callback);
217 }
218 } 191 }
219 192
220 // Inherited. See base 193 // Inherited. See base
@@ -234,19 +207,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
234 207
235 public override InventoryCollection GetFolderContent(UUID userID, UUID folderID) 208 public override InventoryCollection GetFolderContent(UUID userID, UUID folderID)
236 { 209 {
237 if (IsLocalGridUser(userID)) 210 string uri = string.Empty;
211 if (!IsForeignUser(userID, out uri))
238 return m_GridService.GetFolderContent(userID, folderID); 212 return m_GridService.GetFolderContent(userID, folderID);
239 else 213 else
240 { 214 {
241 UUID sessionID = GetSessionID(userID); 215 UUID sessionID = GetSessionID(userID);
242 string uri = GetUserInventoryURI(userID) + "/" + userID.ToString(); 216 uri = uri + "/" + userID.ToString();
243 return m_HGService.GetFolderContent(uri, folderID, sessionID); 217 return m_HGService.GetFolderContent(uri, folderID, sessionID);
244 } 218 }
245 } 219 }
246 220
247 public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) 221 public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID)
248 { 222 {
249 if (IsLocalGridUser(userID)) 223 string uri = string.Empty;
224 if (!IsForeignUser(userID, out uri))
250 { 225 {
251 // This is not pretty, but it will have to do for now 226 // This is not pretty, but it will have to do for now
252 if (m_GridService is BaseInventoryConnector) 227 if (m_GridService is BaseInventoryConnector)
@@ -263,7 +238,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
263 else 238 else
264 { 239 {
265 UUID sessionID = GetSessionID(userID); 240 UUID sessionID = GetSessionID(userID);
266 string uri = GetUserInventoryURI(userID) + "/" + userID.ToString(); 241 uri = uri + "/" + userID.ToString();
267 return m_HGService.GetSystemFolders(uri, sessionID); 242 return m_HGService.GetSystemFolders(uri, sessionID);
268 } 243 }
269 } 244 }
@@ -299,12 +274,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
299 274
300 public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) 275 public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
301 { 276 {
302 if (IsLocalGridUser(userID)) 277 string uri = string.Empty;
278 if (!IsForeignUser(userID, out uri))
303 return m_GridService.GetFolderItems(userID, folderID); 279 return m_GridService.GetFolderItems(userID, folderID);
304 else 280 else
305 { 281 {
306 UUID sessionID = GetSessionID(userID); 282 UUID sessionID = GetSessionID(userID);
307 string uri = GetUserInventoryURI(userID) + "/" + userID; 283 uri = uri + "/" + userID.ToString();
308 return m_HGService.GetFolderItems(uri, folderID, sessionID); 284 return m_HGService.GetFolderItems(uri, folderID, sessionID);
309 } 285 }
310 } 286 }
@@ -314,12 +290,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
314 if (folder == null) 290 if (folder == null)
315 return false; 291 return false;
316 292
317 if (IsLocalGridUser(folder.Owner)) 293 string uri = string.Empty;
294 if (!IsForeignUser(folder.Owner, out uri))
318 return m_GridService.AddFolder(folder); 295 return m_GridService.AddFolder(folder);
319 else 296 else
320 { 297 {
321 UUID sessionID = GetSessionID(folder.Owner); 298 UUID sessionID = GetSessionID(folder.Owner);
322 string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); 299 uri = uri + "/" + folder.Owner.ToString();
323 return m_HGService.AddFolder(uri, folder, sessionID); 300 return m_HGService.AddFolder(uri, folder, sessionID);
324 } 301 }
325 } 302 }
@@ -329,12 +306,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
329 if (folder == null) 306 if (folder == null)
330 return false; 307 return false;
331 308
332 if (IsLocalGridUser(folder.Owner)) 309 string uri = string.Empty;
310 if (!IsForeignUser(folder.Owner, out uri))
333 return m_GridService.UpdateFolder(folder); 311 return m_GridService.UpdateFolder(folder);
334 else 312 else
335 { 313 {
336 UUID sessionID = GetSessionID(folder.Owner); 314 UUID sessionID = GetSessionID(folder.Owner);
337 string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); 315 uri = uri + "/" + folder.Owner.ToString();
338 return m_HGService.UpdateFolder(uri, folder, sessionID); 316 return m_HGService.UpdateFolder(uri, folder, sessionID);
339 } 317 }
340 } 318 }
@@ -346,12 +324,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
346 if (folderIDs.Count == 0) 324 if (folderIDs.Count == 0)
347 return false; 325 return false;
348 326
349 if (IsLocalGridUser(ownerID)) 327 string uri = string.Empty;
328 if (!IsForeignUser(ownerID, out uri))
350 return m_GridService.DeleteFolders(ownerID, folderIDs); 329 return m_GridService.DeleteFolders(ownerID, folderIDs);
351 else 330 else
352 { 331 {
353 UUID sessionID = GetSessionID(ownerID); 332 UUID sessionID = GetSessionID(ownerID);
354 string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString(); 333 uri = uri + "/" + ownerID.ToString();
355 return m_HGService.DeleteFolders(uri, folderIDs, sessionID); 334 return m_HGService.DeleteFolders(uri, folderIDs, sessionID);
356 } 335 }
357 } 336 }
@@ -361,12 +340,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
361 if (folder == null) 340 if (folder == null)
362 return false; 341 return false;
363 342
364 if (IsLocalGridUser(folder.Owner)) 343 string uri = string.Empty;
344 if (!IsForeignUser(folder.Owner, out uri))
365 return m_GridService.MoveFolder(folder); 345 return m_GridService.MoveFolder(folder);
366 else 346 else
367 { 347 {
368 UUID sessionID = GetSessionID(folder.Owner); 348 UUID sessionID = GetSessionID(folder.Owner);
369 string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); 349 uri = uri + "/" + folder.Owner.ToString();
370 return m_HGService.MoveFolder(uri, folder, sessionID); 350 return m_HGService.MoveFolder(uri, folder, sessionID);
371 } 351 }
372 } 352 }
@@ -376,12 +356,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
376 if (folder == null) 356 if (folder == null)
377 return false; 357 return false;
378 358
379 if (IsLocalGridUser(folder.Owner)) 359 string uri = string.Empty;
360 if (!IsForeignUser(folder.Owner, out uri))
380 return m_GridService.PurgeFolder(folder); 361 return m_GridService.PurgeFolder(folder);
381 else 362 else
382 { 363 {
383 UUID sessionID = GetSessionID(folder.Owner); 364 UUID sessionID = GetSessionID(folder.Owner);
384 string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); 365 uri = uri + "/" + folder.Owner.ToString();
385 return m_HGService.PurgeFolder(uri, folder, sessionID); 366 return m_HGService.PurgeFolder(uri, folder, sessionID);
386 } 367 }
387 } 368 }
@@ -394,14 +375,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
394 if (item == null) 375 if (item == null)
395 return false; 376 return false;
396 377
397 if (IsLocalGridUser(item.Owner)) 378 string uri = string.Empty;
379 if (!IsForeignUser(item.Owner, out uri))
398 { 380 {
399 return m_GridService.AddItem(item); 381 return m_GridService.AddItem(item);
400 } 382 }
401 else 383 else
402 { 384 {
403 UUID sessionID = GetSessionID(item.Owner); 385 UUID sessionID = GetSessionID(item.Owner);
404 string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); 386 uri = uri + "/" + item.Owner.ToString();
405 return m_HGService.AddItem(uri, item, sessionID); 387 return m_HGService.AddItem(uri, item, sessionID);
406 } 388 }
407 } 389 }
@@ -411,12 +393,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
411 if (item == null) 393 if (item == null)
412 return false; 394 return false;
413 395
414 if (IsLocalGridUser(item.Owner)) 396 string uri = string.Empty;
397 if (!IsForeignUser(item.Owner, out uri))
415 return m_GridService.UpdateItem(item); 398 return m_GridService.UpdateItem(item);
416 else 399 else
417 { 400 {
418 UUID sessionID = GetSessionID(item.Owner); 401 UUID sessionID = GetSessionID(item.Owner);
419 string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); 402 uri = uri + "/" + item.Owner.ToString();
420 return m_HGService.UpdateItem(uri, item, sessionID); 403 return m_HGService.UpdateItem(uri, item, sessionID);
421 } 404 }
422 } 405 }
@@ -428,12 +411,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
428 if (items.Count == 0) 411 if (items.Count == 0)
429 return true; 412 return true;
430 413
431 if (IsLocalGridUser(ownerID)) 414 string uri = string.Empty;
415 if (!IsForeignUser(ownerID, out uri))
432 return m_GridService.MoveItems(ownerID, items); 416 return m_GridService.MoveItems(ownerID, items);
433 else 417 else
434 { 418 {
435 UUID sessionID = GetSessionID(ownerID); 419 UUID sessionID = GetSessionID(ownerID);
436 string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString(); 420 uri = uri + "/" + ownerID.ToString();
437 return m_HGService.MoveItems(uri, items, sessionID); 421 return m_HGService.MoveItems(uri, items, sessionID);
438 } 422 }
439 } 423 }
@@ -447,12 +431,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
447 if (itemIDs.Count == 0) 431 if (itemIDs.Count == 0)
448 return true; 432 return true;
449 433
450 if (IsLocalGridUser(ownerID)) 434 string uri = string.Empty;
435 if (!IsForeignUser(ownerID, out uri))
451 return m_GridService.DeleteItems(ownerID, itemIDs); 436 return m_GridService.DeleteItems(ownerID, itemIDs);
452 else 437 else
453 { 438 {
454 UUID sessionID = GetSessionID(ownerID); 439 UUID sessionID = GetSessionID(ownerID);
455 string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString(); 440 uri = uri + "/" + ownerID.ToString();
456 return m_HGService.DeleteItems(uri, itemIDs, sessionID); 441 return m_HGService.DeleteItems(uri, itemIDs, sessionID);
457 } 442 }
458 } 443 }
@@ -462,12 +447,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
462 if (item == null) 447 if (item == null)
463 return null; 448 return null;
464 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetItem {0} for user {1}", item.ID, item.Owner); 449 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetItem {0} for user {1}", item.ID, item.Owner);
465 if (IsLocalGridUser(item.Owner)) 450 string uri = string.Empty;
451 if (!IsForeignUser(item.Owner, out uri))
466 return m_GridService.GetItem(item); 452 return m_GridService.GetItem(item);
467 else 453 else
468 { 454 {
469 UUID sessionID = GetSessionID(item.Owner); 455 UUID sessionID = GetSessionID(item.Owner);
470 string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); 456 uri = uri + "/" + item.Owner.ToString();
471 return m_HGService.QueryItem(uri, item, sessionID); 457 return m_HGService.QueryItem(uri, item, sessionID);
472 } 458 }
473 } 459 }
@@ -477,12 +463,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
477 if (folder == null) 463 if (folder == null)
478 return null; 464 return null;
479 465
480 if (IsLocalGridUser(folder.Owner)) 466 string uri = string.Empty;
467 if (!IsForeignUser(folder.Owner, out uri))
481 return m_GridService.GetFolder(folder); 468 return m_GridService.GetFolder(folder);
482 else 469 else
483 { 470 {
484 UUID sessionID = GetSessionID(folder.Owner); 471 UUID sessionID = GetSessionID(folder.Owner);
485 string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); 472 uri = uri + "/" + folder.Owner.ToString();
486 return m_HGService.QueryFolder(uri, folder, sessionID); 473 return m_HGService.QueryFolder(uri, folder, sessionID);
487 } 474 }
488 } 475 }
@@ -499,12 +486,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
499 486
500 public override int GetAssetPermissions(UUID userID, UUID assetID) 487 public override int GetAssetPermissions(UUID userID, UUID assetID)
501 { 488 {
502 if (IsLocalGridUser(userID)) 489 string uri = string.Empty;
490 if (!IsForeignUser(userID, out uri))
503 return m_GridService.GetAssetPermissions(userID, assetID); 491 return m_GridService.GetAssetPermissions(userID, assetID);
504 else 492 else
505 { 493 {
506 UUID sessionID = GetSessionID(userID); 494 UUID sessionID = GetSessionID(userID);
507 string uri = GetUserInventoryURI(userID) + "/" + userID.ToString(); 495 uri = uri + "/" + userID.ToString();
508 return m_HGService.GetAssetPermissions(uri, assetID, sessionID); 496 return m_HGService.GetAssetPermissions(uri, assetID, sessionID);
509 } 497 }
510 } 498 }
@@ -523,59 +511,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
523 return UUID.Zero; 511 return UUID.Zero;
524 } 512 }
525 513
526 private bool IsLocalGridUser(UUID userID) 514 private bool IsForeignUser(UUID userID, out string inventoryURL)
527 { 515 {
528 return true; 516 inventoryURL = string.Empty;
529 517 UserAccount account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID);
530 // REFACTORING PROBLEM. This needs to be rewritten 518 if (account == null) // foreign user
531 519 {
532 //if (m_UserAccountService == null) 520 ScenePresence sp = null;
533 //{ 521 m_Scene.TryGetAvatar(userID, out sp);
534 // m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, no user account service. Returning false."); 522 if (sp != null)
535 // return false; 523 {
536 //} 524 AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode);
537 525 if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI"))
538 //UserAccount uinfo = m_UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID); 526 {
539 //if (uinfo == null) 527 inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString();
540 //{ 528 inventoryURL = inventoryURL.Trim(new char[] { '/' });
541 // m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, no account for user {0}. Returning false.", userID); 529 return true;
542 // return false; 530 }
543 //} 531 }
544 532 }
545 //if ((uinfo.UserProfile.UserInventoryURI == null) || (uinfo.UserProfile.UserInventoryURI == "")) 533 return false;
546 // // this happens in standalone profiles, apparently
547 // return true;
548
549 //string userInventoryServerURI = Util.ServerURI(uinfo.UserProfile.UserInventoryURI);
550
551 //string uri = LocalGridInventory.TrimEnd('/');
552
553 //if ((userInventoryServerURI == uri) || (userInventoryServerURI == ""))
554 //{
555 // return true;
556 //}
557 //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: user {0} is foreign({1} - {2})", userID, userInventoryServerURI, uri);
558 //return false;
559 }
560
561 private string GetUserInventoryURI(UUID userID)
562 {
563 string invURI = LocalGridInventory;
564 // REFACTORING PROBLEM!!! This needs to be rewritten
565
566 //CachedUserInfo uinfo = m_UserAccountService.GetUserDetails(userID);
567 //if ((uinfo == null) || (uinfo.UserProfile == null))
568 // return invURI;
569
570 //string userInventoryServerURI = Util.ServerURI(uinfo.UserProfile.UserInventoryURI);
571
572 //if ((userInventoryServerURI != null) &&
573 // (userInventoryServerURI != ""))
574 // invURI = userInventoryServerURI;
575
576 return invURI;
577 } 534 }
578 535
579
580 } 536 }
581} 537}