From 0c47f8e7ab1a1c28de218a3338143038ccaaa4a4 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 10 Aug 2009 16:02:09 -0700 Subject: Changed RequestRootFolder to GetRootFolder --- OpenSim/Framework/Communications/Tests/LoginServiceTests.cs | 2 +- OpenSim/Framework/Communications/UserManagerBase.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs index 47e0293..373d7cf 100644 --- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs @@ -552,7 +552,7 @@ namespace OpenSim.Framework.Communications.Tests return false; } - public InventoryFolderBase RequestRootFolder(UUID userID) + public InventoryFolderBase GetRootFolder(UUID userID) { InventoryFolderBase root = new InventoryFolderBase(); root.ID = UUID.Random(); diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index bd5d0e3..58174a0 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -694,7 +694,7 @@ namespace OpenSim.Framework.Communications // local service (standalone) m_log.Debug("[USERSTORAGE]: using IInventoryService to create user's inventory"); m_InventoryService.CreateUserInventory(userProf.ID); - InventoryFolderBase rootfolder = m_InventoryService.RequestRootFolder(userProf.ID); + InventoryFolderBase rootfolder = m_InventoryService.GetRootFolder(userProf.ID); if (rootfolder != null) userProf.RootInventoryFolderID = rootfolder.ID; } -- cgit v1.1 From cdcbc48534f19afe7cbdeb6c690e6b7d9f2ff099 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 10 Aug 2009 20:31:51 -0700 Subject: Added two new methods to IIventoryService -- GetFolderForType and GetFolderContent. Some meat to it, but not completed. None of this code is called anywhere yet. --- OpenSim/Framework/Communications/Tests/LoginServiceTests.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs index 373d7cf..17a3393 100644 --- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs @@ -497,6 +497,16 @@ namespace OpenSim.Framework.Communications.Tests { } + public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) + { + return null; + } + + public InventoryCollection GetFolderContent(UUID userID, UUID folderID) + { + return null; + } + public List GetFolderItems(UUID userID, UUID folderID) { return null; -- cgit v1.1 From 226c082ed417f4a5f2295595e45eca2fcb1e42c9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 11 Aug 2009 16:45:16 +0100 Subject: Establish CachedUserInfo.OnInventoryReceived event so that region/test inventory code can be written with the async inventory fetch --- .../Communications/Cache/CachedUserInfo.cs | 19 ++++- .../Tests/Cache/UserProfileCacheServiceTests.cs | 96 ++++++++++++---------- 2 files changed, 68 insertions(+), 47 deletions(-) (limited to 'OpenSim/Framework') 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 IClientAPI client, UUID folderID, bool fetchFolders, bool fetchItems); public delegate void OnItemReceivedDelegate(UUID itemID); + public delegate void OnInventoryReceivedDelegate(UUID userID); /// /// Stores user profile and inventory data received from backend services for a particular user. /// public class CachedUserInfo - { + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + //// + /// Fired when a particular item has been received from the inventory service + /// public event OnItemReceivedDelegate OnItemReceived; - private static readonly ILog m_log - = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// + /// Fired once the entire inventory has been received for the user + /// + public event OnInventoryReceivedDelegate OnInventoryReceived; /// /// The comms manager holds references to services (user, grid, inventory, etc.) @@ -133,7 +141,9 @@ namespace OpenSim.Framework.Communications.Cache UUID parentFolderId = folder.ParentID; if (dictionary.ContainsKey(parentFolderId)) + { dictionary[parentFolderId].Add(folder); + } else { IList folders = new List(); @@ -299,6 +309,9 @@ namespace OpenSim.Framework.Communications.Cache request.Execute(); } } + + if (OnInventoryReceived != null) + OnInventoryReceived(UserProfile.ID); } /// 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 [TestFixture] public class UserProfileCacheServiceTests { + /// Used by tests to indicate whether an async operation timed out + private bool timedOut; + + private void InventoryReceived(UUID userId) + { + lock (this) + { + timedOut = false; + Monitor.PulseAll(this); + } + } + [Test] public void TestGetUserDetails() { @@ -118,14 +130,15 @@ namespace OpenSim.Framework.Communications.Tests TestHelper.InMethod(); Scene myScene = SceneSetupHelpers.SetupScene("inventory"); - CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); - for (int i = 0 ; i < 50 ; i++) - { - if (userInfo.HasReceivedInventory == true) - break; - Thread.Sleep(200); - } - Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); + + timedOut = true; + lock (this) + { + UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); + Monitor.Wait(this, 60000); + } + + Assert.That(timedOut, Is.False, "Timed out"); } [Test] @@ -134,14 +147,13 @@ namespace OpenSim.Framework.Communications.Tests TestHelper.InMethod(); Scene myScene = SceneSetupHelpers.SetupScene("inventory"); - CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); - for (int i = 0 ; i < 50 ; i++) - { - if (userInfo.HasReceivedInventory == true) - break; - Thread.Sleep(200); + CachedUserInfo userInfo; + + lock (this) + { + userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); + Monitor.Wait(this, 60000); } - Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011"); Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Null); @@ -156,14 +168,13 @@ namespace OpenSim.Framework.Communications.Tests TestHelper.InMethod(); Scene myScene = SceneSetupHelpers.SetupScene("inventory"); - CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); - for (int i = 0 ; i < 50 ; i++) - { - if (userInfo.HasReceivedInventory == true) - break; - Thread.Sleep(200); + CachedUserInfo userInfo; + + lock (this) + { + userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); + Monitor.Wait(this, 60000); } - Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010"); Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.False); @@ -192,14 +203,13 @@ namespace OpenSim.Framework.Communications.Tests TestHelper.InMethod(); Scene myScene = SceneSetupHelpers.SetupScene("inventory"); - CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); - for (int i = 0 ; i < 50 ; i++) - { - if (userInfo.HasReceivedInventory == true) - break; - Thread.Sleep(200); + CachedUserInfo userInfo; + + lock (this) + { + userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); + Monitor.Wait(this, 60000); } - Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); InventoryFolderImpl rootFolder = userInfo.RootFolder; @@ -258,14 +268,13 @@ namespace OpenSim.Framework.Communications.Tests TestHelper.InMethod(); Scene myScene = SceneSetupHelpers.SetupScene("inventory"); - CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); - for (int i = 0 ; i < 50 ; i++) - { - if (userInfo.HasReceivedInventory == true) - break; - Thread.Sleep(200); + CachedUserInfo userInfo; + + lock (this) + { + userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); + Monitor.Wait(this, 60000); } - Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000020"); UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000021"); @@ -299,14 +308,13 @@ namespace OpenSim.Framework.Communications.Tests //log4net.Config.XmlConfigurator.Configure(); Scene myScene = SceneSetupHelpers.SetupScene("inventory"); - CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); - for (int i = 0 ; i < 50 ; i++) - { - if (userInfo.HasReceivedInventory == true) - break; - Thread.Sleep(200); + CachedUserInfo userInfo; + + lock (this) + { + userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); + Monitor.Wait(this, 60000); } - Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000070"); InventoryFolderImpl rootFolder = userInfo.RootFolder; @@ -323,4 +331,4 @@ namespace OpenSim.Framework.Communications.Tests Assert.That(myScene.InventoryService.QueryFolder(myFolder), Is.Null); } } -} +} \ No newline at end of file -- cgit v1.1 From bb64906a9cc891d9cc439bd2eda6ebf726364ca0 Mon Sep 17 00:00:00 2001 From: Chris Down Date: Mon, 10 Aug 2009 15:14:29 +0100 Subject: Enable the console show version command and the viewer about command, to show the last git commit hash together with the conmit date and time. The data is retrieved form a file bin/.version This file can be generated automatically using the post commit script by adding the following to the script: git log -n 1 --pretty="format:%h: %ci" > bin/.version This command can also be run manually to create the bin/.version file. This command genrates a short form of the commit hash and a date and time of the commit in ISO8601 format. If a full commit hash is required then change %h to %H The logic that is used to extract the deprecated svn revision is still included. It will be removed at a future date --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 68 +++++++++++++++++--------- 1 file changed, 46 insertions(+), 22 deletions(-) (limited to 'OpenSim/Framework') 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 protected string m_startupDirectory = Environment.CurrentDirectory; /// - /// Server version information. Usually VersionInfo + information about svn revision, operating system, etc. + /// Server version information. Usually VersionInfo + information about git commit, operating system, etc. /// protected string m_version; @@ -422,6 +422,16 @@ namespace OpenSim.Framework.Servers { string buildVersion = string.Empty; + // Add commit hash and date information if available + // The commit hash and date are stored in a file bin/.version + // This file can automatically created by a post + // commit script in the opensim git master repository or + // by issuing the follwoing command from the top level + // directory of the opensim repository + // git log -n 1 --pretty="format:%h: %ci" >bin/.version + // For the full git commit hash use %H instead of %h + // + // The subversion information is deprecated and will be removed at a later date // Add subversion revision information if available // Try file "svn_revision" in the current directory first, then the .svn info. // This allows to make the revision available in simulators not running from the source tree. @@ -429,39 +439,53 @@ namespace OpenSim.Framework.Servers // elsewhere as well string svnRevisionFileName = "svn_revision"; string svnFileName = ".svn/entries"; + string gitCommitFileName = ".version"; string inputLine; int strcmp; - if (File.Exists(svnRevisionFileName)) + if (File.Exists( gitCommitFileName)) { - StreamReader RevisionFile = File.OpenText(svnRevisionFileName); - buildVersion = RevisionFile.ReadLine(); - buildVersion.Trim(); - RevisionFile.Close(); + StreamReader CommitFile = File.OpenText(gitCommitFileName); + buildVersion = Environment.NewLine + "git# " + CommitFile.ReadLine(); + CommitFile.Close(); + m_version += buildVersion ?? ""; } - if (string.IsNullOrEmpty(buildVersion) && File.Exists(svnFileName)) + // Remove the else logic when subversion mirror is no longer used + else { - StreamReader EntriesFile = File.OpenText(svnFileName); - inputLine = EntriesFile.ReadLine(); - while (inputLine != null) + if (File.Exists(svnRevisionFileName)) { - // using the dir svn revision at the top of entries file - strcmp = String.Compare(inputLine, "dir"); - if (strcmp == 0) - { - buildVersion = EntriesFile.ReadLine(); - break; - } - else + StreamReader RevisionFile = File.OpenText(svnRevisionFileName); + buildVersion = RevisionFile.ReadLine(); + buildVersion.Trim(); + RevisionFile.Close(); + + } + + if (string.IsNullOrEmpty(buildVersion) && File.Exists(svnFileName)) + { + StreamReader EntriesFile = File.OpenText(svnFileName); + inputLine = EntriesFile.ReadLine(); + while (inputLine != null) { - inputLine = EntriesFile.ReadLine(); + // using the dir svn revision at the top of entries file + strcmp = String.Compare(inputLine, "dir"); + if (strcmp == 0) + { + buildVersion = EntriesFile.ReadLine(); + break; + } + else + { + inputLine = EntriesFile.ReadLine(); + } } + EntriesFile.Close(); } - EntriesFile.Close(); - } - m_version += string.IsNullOrEmpty(buildVersion) ? " " : ("." + buildVersion + " ").Substring(0, 6); + m_version += string.IsNullOrEmpty(buildVersion) ? " " : ("." + buildVersion + " ").Substring(0, 6); + } } protected void CreatePIDFile(string path) -- cgit v1.1 From 655438a59db45fca149d9827d60babe01ea82212 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 11 Aug 2009 17:29:15 +0100 Subject: Apply http://opensimulator.org/mantis/view.php?id=1448 Store and retrieve user profile url at runtime Not yet persisted Thanks Fly-Man --- OpenSim/Framework/UserProfileData.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'OpenSim/Framework') 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 /// private uint m_profileWantDoMask; // Profile window "I want to" mask + /// + /// The profile url for an avatar + /// + private string m_profileUrl; + private UUID m_rootInventoryFolderId; /// @@ -349,6 +354,12 @@ namespace OpenSim.Framework set { m_profileFirstText = value; } } + public string ProfileUrl + { + get { return m_profileUrl; } + set { m_profileUrl = value; } + } + public UUID Image { get { return m_profileImage; } -- cgit v1.1 From bd7ff803fe189ffd730599350429d9b9d41582be Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 11 Aug 2009 14:31:45 -0700 Subject: Re-adding a conditional in UserManager that was removed with arthusv's commit. Changing new inventory ops to POST. --- OpenSim/Framework/Communications/UserManagerBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 7ad6bbf..58174a0 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -698,7 +698,7 @@ namespace OpenSim.Framework.Communications if (rootfolder != null) userProf.RootInventoryFolderID = rootfolder.ID; } - else + else if (m_commsManager.InterServiceInventoryService != null) { // used by the user server m_log.Debug("[USERSTORAGE]: using m_commsManager.InterServiceInventoryService to create user's inventory"); -- cgit v1.1