aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs19
-rw-r--r--OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs96
-rw-r--r--OpenSim/Framework/Communications/Tests/LoginServiceTests.cs129
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs4
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs68
-rw-r--r--OpenSim/Framework/UserProfileData.cs11
6 files changed, 256 insertions, 71 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 10aff42..8ee1b1a 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -49,16 +49,24 @@ namespace OpenSim.Framework.Communications.Cache
49 IClientAPI client, UUID folderID, bool fetchFolders, bool fetchItems); 49 IClientAPI client, UUID folderID, bool fetchFolders, bool fetchItems);
50 50
51 public delegate void OnItemReceivedDelegate(UUID itemID); 51 public delegate void OnItemReceivedDelegate(UUID itemID);
52 public delegate void OnInventoryReceivedDelegate(UUID userID);
52 53
53 /// <summary> 54 /// <summary>
54 /// Stores user profile and inventory data received from backend services for a particular user. 55 /// Stores user profile and inventory data received from backend services for a particular user.
55 /// </summary> 56 /// </summary>
56 public class CachedUserInfo 57 public class CachedUserInfo
57 { 58 {
59 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
60
61 //// <value>
62 /// Fired when a particular item has been received from the inventory service
63 /// </value>
58 public event OnItemReceivedDelegate OnItemReceived; 64 public event OnItemReceivedDelegate OnItemReceived;
59 65
60 private static readonly ILog m_log 66 /// <value>
61 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 67 /// Fired once the entire inventory has been received for the user
68 /// </value>
69 public event OnInventoryReceivedDelegate OnInventoryReceived;
62 70
63 /// <summary> 71 /// <summary>
64 /// The comms manager holds references to services (user, grid, inventory, etc.) 72 /// The comms manager holds references to services (user, grid, inventory, etc.)
@@ -133,7 +141,9 @@ namespace OpenSim.Framework.Communications.Cache
133 UUID parentFolderId = folder.ParentID; 141 UUID parentFolderId = folder.ParentID;
134 142
135 if (dictionary.ContainsKey(parentFolderId)) 143 if (dictionary.ContainsKey(parentFolderId))
144 {
136 dictionary[parentFolderId].Add(folder); 145 dictionary[parentFolderId].Add(folder);
146 }
137 else 147 else
138 { 148 {
139 IList<InventoryFolderImpl> folders = new List<InventoryFolderImpl>(); 149 IList<InventoryFolderImpl> folders = new List<InventoryFolderImpl>();
@@ -299,6 +309,9 @@ namespace OpenSim.Framework.Communications.Cache
299 request.Execute(); 309 request.Execute();
300 } 310 }
301 } 311 }
312
313 if (OnInventoryReceived != null)
314 OnInventoryReceived(UserProfile.ID);
302 } 315 }
303 316
304 /// <summary> 317 /// <summary>
diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
index 0402883..fe88cf5 100644
--- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
+++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
@@ -43,6 +43,18 @@ namespace OpenSim.Framework.Communications.Tests
43 [TestFixture] 43 [TestFixture]
44 public class UserProfileCacheServiceTests 44 public class UserProfileCacheServiceTests
45 { 45 {
46 /// <value>Used by tests to indicate whether an async operation timed out</value>
47 private bool timedOut;
48
49 private void InventoryReceived(UUID userId)
50 {
51 lock (this)
52 {
53 timedOut = false;
54 Monitor.PulseAll(this);
55 }
56 }
57
46 [Test] 58 [Test]
47 public void TestGetUserDetails() 59 public void TestGetUserDetails()
48 { 60 {
@@ -118,14 +130,15 @@ namespace OpenSim.Framework.Communications.Tests
118 TestHelper.InMethod(); 130 TestHelper.InMethod();
119 131
120 Scene myScene = SceneSetupHelpers.SetupScene("inventory"); 132 Scene myScene = SceneSetupHelpers.SetupScene("inventory");
121 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); 133
122 for (int i = 0 ; i < 50 ; i++) 134 timedOut = true;
123 { 135 lock (this)
124 if (userInfo.HasReceivedInventory == true) 136 {
125 break; 137 UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived);
126 Thread.Sleep(200); 138 Monitor.Wait(this, 60000);
127 } 139 }
128 Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); 140
141 Assert.That(timedOut, Is.False, "Timed out");
129 } 142 }
130 143
131 [Test] 144 [Test]
@@ -134,14 +147,13 @@ namespace OpenSim.Framework.Communications.Tests
134 TestHelper.InMethod(); 147 TestHelper.InMethod();
135 148
136 Scene myScene = SceneSetupHelpers.SetupScene("inventory"); 149 Scene myScene = SceneSetupHelpers.SetupScene("inventory");
137 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); 150 CachedUserInfo userInfo;
138 for (int i = 0 ; i < 50 ; i++) 151
139 { 152 lock (this)
140 if (userInfo.HasReceivedInventory == true) 153 {
141 break; 154 userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived);
142 Thread.Sleep(200); 155 Monitor.Wait(this, 60000);
143 } 156 }
144 Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)");
145 157
146 UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011"); 158 UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011");
147 Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Null); 159 Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Null);
@@ -156,14 +168,13 @@ namespace OpenSim.Framework.Communications.Tests
156 TestHelper.InMethod(); 168 TestHelper.InMethod();
157 169
158 Scene myScene = SceneSetupHelpers.SetupScene("inventory"); 170 Scene myScene = SceneSetupHelpers.SetupScene("inventory");
159 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); 171 CachedUserInfo userInfo;
160 for (int i = 0 ; i < 50 ; i++) 172
161 { 173 lock (this)
162 if (userInfo.HasReceivedInventory == true) 174 {
163 break; 175 userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived);
164 Thread.Sleep(200); 176 Monitor.Wait(this, 60000);
165 } 177 }
166 Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)");
167 178
168 UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010"); 179 UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010");
169 Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.False); 180 Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.False);
@@ -192,14 +203,13 @@ namespace OpenSim.Framework.Communications.Tests
192 TestHelper.InMethod(); 203 TestHelper.InMethod();
193 204
194 Scene myScene = SceneSetupHelpers.SetupScene("inventory"); 205 Scene myScene = SceneSetupHelpers.SetupScene("inventory");
195 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); 206 CachedUserInfo userInfo;
196 for (int i = 0 ; i < 50 ; i++) 207
197 { 208 lock (this)
198 if (userInfo.HasReceivedInventory == true) 209 {
199 break; 210 userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived);
200 Thread.Sleep(200); 211 Monitor.Wait(this, 60000);
201 } 212 }
202 Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)");
203 213
204 UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); 214 UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
205 InventoryFolderImpl rootFolder = userInfo.RootFolder; 215 InventoryFolderImpl rootFolder = userInfo.RootFolder;
@@ -258,14 +268,13 @@ namespace OpenSim.Framework.Communications.Tests
258 TestHelper.InMethod(); 268 TestHelper.InMethod();
259 269
260 Scene myScene = SceneSetupHelpers.SetupScene("inventory"); 270 Scene myScene = SceneSetupHelpers.SetupScene("inventory");
261 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); 271 CachedUserInfo userInfo;
262 for (int i = 0 ; i < 50 ; i++) 272
263 { 273 lock (this)
264 if (userInfo.HasReceivedInventory == true) 274 {
265 break; 275 userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived);
266 Thread.Sleep(200); 276 Monitor.Wait(this, 60000);
267 } 277 }
268 Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)");
269 278
270 UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000020"); 279 UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000020");
271 UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000021"); 280 UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000021");
@@ -299,14 +308,13 @@ namespace OpenSim.Framework.Communications.Tests
299 //log4net.Config.XmlConfigurator.Configure(); 308 //log4net.Config.XmlConfigurator.Configure();
300 309
301 Scene myScene = SceneSetupHelpers.SetupScene("inventory"); 310 Scene myScene = SceneSetupHelpers.SetupScene("inventory");
302 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); 311 CachedUserInfo userInfo;
303 for (int i = 0 ; i < 50 ; i++) 312
304 { 313 lock (this)
305 if (userInfo.HasReceivedInventory == true) 314 {
306 break; 315 userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived);
307 Thread.Sleep(200); 316 Monitor.Wait(this, 60000);
308 } 317 }
309 Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)");
310 318
311 UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000070"); 319 UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000070");
312 InventoryFolderImpl rootFolder = userInfo.RootFolder; 320 InventoryFolderImpl rootFolder = userInfo.RootFolder;
@@ -323,4 +331,4 @@ namespace OpenSim.Framework.Communications.Tests
323 Assert.That(myScene.InventoryService.QueryFolder(myFolder), Is.Null); 331 Assert.That(myScene.InventoryService.QueryFolder(myFolder), Is.Null);
324 } 332 }
325 } 333 }
326} 334} \ No newline at end of file
diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
index 9e181f3..b1b7809 100644
--- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
+++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
@@ -447,4 +447,133 @@ namespace OpenSim.Framework.Communications.Tests
447 #endregion 447 #endregion
448 } 448 }
449 } 449 }
450
451 class TestInventoryService : IInventoryService
452 {
453 public TestInventoryService()
454 {
455 }
456
457 /// <summary>
458 /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/>
459 /// </summary>
460 /// <param name="userId"></param>
461 /// <returns></returns>
462 public bool CreateUserInventory(UUID userId)
463 {
464 return false;
465 }
466
467 /// <summary>
468 /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/>
469 /// </summary>
470 /// <param name="userId"></param>
471 /// <returns></returns>
472 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
473 {
474 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
475 InventoryFolderBase folder = new InventoryFolderBase();
476 folder.ID = UUID.Random();
477 folder.Owner = userId;
478 folders.Add(folder);
479 return folders;
480 }
481
482 /// <summary>
483 /// Returns a list of all the active gestures in a user's inventory.
484 /// </summary>
485 /// <param name="userId">
486 /// The <see cref="UUID"/> of the user
487 /// </param>
488 /// <returns>
489 /// A flat list of the gesture items.
490 /// </returns>
491 public List<InventoryItemBase> GetActiveGestures(UUID userId)
492 {
493 return null;
494 }
495
496 public InventoryCollection GetUserInventory(UUID userID)
497 {
498 return null;
499 }
500
501 public void GetUserInventory(UUID userID, OpenSim.Services.Interfaces.InventoryReceiptCallback callback)
502 {
503 }
504
505 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
506 {
507 return null;
508 }
509
510 public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
511 {
512 return null;
513 }
514
515 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
516 {
517 return null;
518 }
519
520 public bool AddFolder(InventoryFolderBase folder)
521 {
522 return false;
523 }
524
525 public bool UpdateFolder(InventoryFolderBase folder)
526 {
527 return false;
528 }
529
530 public bool MoveFolder(InventoryFolderBase folder)
531 {
532 return false;
533 }
534
535 public bool PurgeFolder(InventoryFolderBase folder)
536 {
537 return false;
538 }
539
540 public bool AddItem(InventoryItemBase item)
541 {
542 return false;
543 }
544
545 public bool UpdateItem(InventoryItemBase item)
546 {
547 return false;
548 }
549
550 public bool DeleteItem(InventoryItemBase item)
551 {
552 return false;
553 }
554
555 public InventoryItemBase QueryItem(InventoryItemBase item)
556 {
557 return null;
558 }
559
560 public InventoryFolderBase QueryFolder(InventoryFolderBase folder)
561 {
562 return null;
563 }
564
565 public bool HasInventoryForUser(UUID userID)
566 {
567 return false;
568 }
569
570 public InventoryFolderBase GetRootFolder(UUID userID)
571 {
572 InventoryFolderBase root = new InventoryFolderBase();
573 root.ID = UUID.Random();
574 root.Owner = userID;
575 root.ParentID = UUID.Zero;
576 return root;
577 }
578 }
450} 579}
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index b9044eb..58174a0 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -694,11 +694,11 @@ namespace OpenSim.Framework.Communications
694 // local service (standalone) 694 // local service (standalone)
695 m_log.Debug("[USERSTORAGE]: using IInventoryService to create user's inventory"); 695 m_log.Debug("[USERSTORAGE]: using IInventoryService to create user's inventory");
696 m_InventoryService.CreateUserInventory(userProf.ID); 696 m_InventoryService.CreateUserInventory(userProf.ID);
697 InventoryFolderBase rootfolder = m_InventoryService.RequestRootFolder(userProf.ID); 697 InventoryFolderBase rootfolder = m_InventoryService.GetRootFolder(userProf.ID);
698 if (rootfolder != null) 698 if (rootfolder != null)
699 userProf.RootInventoryFolderID = rootfolder.ID; 699 userProf.RootInventoryFolderID = rootfolder.ID;
700 } 700 }
701 else 701 else if (m_commsManager.InterServiceInventoryService != null)
702 { 702 {
703 // used by the user server 703 // used by the user server
704 m_log.Debug("[USERSTORAGE]: using m_commsManager.InterServiceInventoryService to create user's inventory"); 704 m_log.Debug("[USERSTORAGE]: using m_commsManager.InterServiceInventoryService to create user's inventory");
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index d2193ca..2a97528 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -76,7 +76,7 @@ namespace OpenSim.Framework.Servers
76 protected string m_startupDirectory = Environment.CurrentDirectory; 76 protected string m_startupDirectory = Environment.CurrentDirectory;
77 77
78 /// <summary> 78 /// <summary>
79 /// Server version information. Usually VersionInfo + information about svn revision, operating system, etc. 79 /// Server version information. Usually VersionInfo + information about git commit, operating system, etc.
80 /// </summary> 80 /// </summary>
81 protected string m_version; 81 protected string m_version;
82 82
@@ -422,6 +422,16 @@ namespace OpenSim.Framework.Servers
422 { 422 {
423 string buildVersion = string.Empty; 423 string buildVersion = string.Empty;
424 424
425 // Add commit hash and date information if available
426 // The commit hash and date are stored in a file bin/.version
427 // This file can automatically created by a post
428 // commit script in the opensim git master repository or
429 // by issuing the follwoing command from the top level
430 // directory of the opensim repository
431 // git log -n 1 --pretty="format:%h: %ci" >bin/.version
432 // For the full git commit hash use %H instead of %h
433 //
434 // The subversion information is deprecated and will be removed at a later date
425 // Add subversion revision information if available 435 // Add subversion revision information if available
426 // Try file "svn_revision" in the current directory first, then the .svn info. 436 // Try file "svn_revision" in the current directory first, then the .svn info.
427 // This allows to make the revision available in simulators not running from the source tree. 437 // This allows to make the revision available in simulators not running from the source tree.
@@ -429,39 +439,53 @@ namespace OpenSim.Framework.Servers
429 // elsewhere as well 439 // elsewhere as well
430 string svnRevisionFileName = "svn_revision"; 440 string svnRevisionFileName = "svn_revision";
431 string svnFileName = ".svn/entries"; 441 string svnFileName = ".svn/entries";
442 string gitCommitFileName = ".version";
432 string inputLine; 443 string inputLine;
433 int strcmp; 444 int strcmp;
434 445
435 if (File.Exists(svnRevisionFileName)) 446 if (File.Exists( gitCommitFileName))
436 { 447 {
437 StreamReader RevisionFile = File.OpenText(svnRevisionFileName); 448 StreamReader CommitFile = File.OpenText(gitCommitFileName);
438 buildVersion = RevisionFile.ReadLine(); 449 buildVersion = Environment.NewLine + "git# " + CommitFile.ReadLine();
439 buildVersion.Trim(); 450 CommitFile.Close();
440 RevisionFile.Close(); 451 m_version += buildVersion ?? "";
441 } 452 }
442 453
443 if (string.IsNullOrEmpty(buildVersion) && File.Exists(svnFileName)) 454 // Remove the else logic when subversion mirror is no longer used
455 else
444 { 456 {
445 StreamReader EntriesFile = File.OpenText(svnFileName); 457 if (File.Exists(svnRevisionFileName))
446 inputLine = EntriesFile.ReadLine();
447 while (inputLine != null)
448 { 458 {
449 // using the dir svn revision at the top of entries file 459 StreamReader RevisionFile = File.OpenText(svnRevisionFileName);
450 strcmp = String.Compare(inputLine, "dir"); 460 buildVersion = RevisionFile.ReadLine();
451 if (strcmp == 0) 461 buildVersion.Trim();
452 { 462 RevisionFile.Close();
453 buildVersion = EntriesFile.ReadLine(); 463
454 break; 464 }
455 } 465
456 else 466 if (string.IsNullOrEmpty(buildVersion) && File.Exists(svnFileName))
467 {
468 StreamReader EntriesFile = File.OpenText(svnFileName);
469 inputLine = EntriesFile.ReadLine();
470 while (inputLine != null)
457 { 471 {
458 inputLine = EntriesFile.ReadLine(); 472 // using the dir svn revision at the top of entries file
473 strcmp = String.Compare(inputLine, "dir");
474 if (strcmp == 0)
475 {
476 buildVersion = EntriesFile.ReadLine();
477 break;
478 }
479 else
480 {
481 inputLine = EntriesFile.ReadLine();
482 }
459 } 483 }
484 EntriesFile.Close();
460 } 485 }
461 EntriesFile.Close();
462 }
463 486
464 m_version += string.IsNullOrEmpty(buildVersion) ? " " : ("." + buildVersion + " ").Substring(0, 6); 487 m_version += string.IsNullOrEmpty(buildVersion) ? " " : ("." + buildVersion + " ").Substring(0, 6);
488 }
465 } 489 }
466 490
467 protected void CreatePIDFile(string path) 491 protected void CreatePIDFile(string path)
diff --git a/OpenSim/Framework/UserProfileData.cs b/OpenSim/Framework/UserProfileData.cs
index b226bba..f51a199 100644
--- a/OpenSim/Framework/UserProfileData.cs
+++ b/OpenSim/Framework/UserProfileData.cs
@@ -114,6 +114,11 @@ namespace OpenSim.Framework
114 /// </summary> 114 /// </summary>
115 private uint m_profileWantDoMask; // Profile window "I want to" mask 115 private uint m_profileWantDoMask; // Profile window "I want to" mask
116 116
117 /// <summary>
118 /// The profile url for an avatar
119 /// </summary>
120 private string m_profileUrl;
121
117 private UUID m_rootInventoryFolderId; 122 private UUID m_rootInventoryFolderId;
118 123
119 /// <summary> 124 /// <summary>
@@ -349,6 +354,12 @@ namespace OpenSim.Framework
349 set { m_profileFirstText = value; } 354 set { m_profileFirstText = value; }
350 } 355 }
351 356
357 public string ProfileUrl
358 {
359 get { return m_profileUrl; }
360 set { m_profileUrl = value; }
361 }
362
352 public UUID Image 363 public UUID Image
353 { 364 {
354 get { return m_profileImage; } 365 get { return m_profileImage; }