From fb890e543f1684e0c01f7a57f312ab1d7140cdc0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 21 Mar 2011 05:52:29 +0100 Subject: Don't send a windlight profile to clients if windlight is not set for that region. This should restore normal day and night cycles for regions without WL settings. --- OpenSim/Region/CoreModules/LightShare/LightShareModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs index 00b0aa9..2de8d7a 100644 --- a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs +++ b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs @@ -148,7 +148,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare public void SendProfileToClient(ScenePresence presence) { IClientAPI client = presence.ControllingClient; - if (m_enableWindlight) + if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid) { if (presence.IsChildAgent == false) { @@ -165,7 +165,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare public void SendProfileToClient(ScenePresence presence, RegionLightShareData wl) { IClientAPI client = presence.ControllingClient; - if (m_enableWindlight) + if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid) { if (presence.IsChildAgent == false) { -- cgit v1.1 From d3a20a1e9257ecec417e219ebaf079370015f06d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 21 Mar 2011 21:37:06 +0000 Subject: On initial region registration, if the user chooses the option to make the region part of an existing estate, then list the existing region names. --- OpenSim/Data/MSSQL/MSSQLEstateData.cs | 17 +++++++++ OpenSim/Data/MySQL/MySQLEstateData.cs | 40 ++++++++++++++++++++++ OpenSim/Data/SQLite/SQLiteEstateData.cs | 32 +++++++++++++++++ OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs | 33 ++++++++++++++++++ OpenSim/Region/Application/OpenSimBase.cs | 13 ++++++- .../Framework/Interfaces/IEstateDataService.cs | 14 ++++++++ .../Framework/Interfaces/IEstateDataStore.cs | 14 ++++++++ .../Connectors/Simulation/EstateDataService.cs | 10 ++++++ 8 files changed, 172 insertions(+), 1 deletion(-) diff --git a/OpenSim/Data/MSSQL/MSSQLEstateData.cs b/OpenSim/Data/MSSQL/MSSQLEstateData.cs index e9a0935..92a8d80 100644 --- a/OpenSim/Data/MSSQL/MSSQLEstateData.cs +++ b/OpenSim/Data/MSSQL/MSSQLEstateData.cs @@ -350,26 +350,43 @@ namespace OpenSim.Data.MSSQL public EstateSettings LoadEstateSettings(int estateID) { + // TODO: Implementation! return new EstateSettings(); } + + public List LoadEstateSettingsAll() + { + // TODO: Implementation! + return new List(); + } public List GetEstates(string search) { + // TODO: Implementation! + return new List(); + } + + public List GetEstatesAll() + { + // TODO: Implementation! return new List(); } public bool LinkRegion(UUID regionID, int estateID) { + // TODO: Implementation! return false; } public List GetRegions(int estateID) { + // TODO: Implementation! return new List(); } public bool DeleteEstate(int estateID) { + // TODO: Implementation! return false; } #endregion diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs index de72a6a..6d72e82 100644 --- a/OpenSim/Data/MySQL/MySQLEstateData.cs +++ b/OpenSim/Data/MySQL/MySQLEstateData.cs @@ -413,6 +413,46 @@ namespace OpenSim.Data.MySQL return DoLoad(cmd, UUID.Zero, false); } } + + public List LoadEstateSettingsAll() + { + List allEstateSettings = new List(); + + List allEstateIds = GetEstatesAll(); + + foreach (int estateId in allEstateIds) + allEstateSettings.Add(LoadEstateSettings(estateId)); + + return allEstateSettings; + } + + public List GetEstatesAll() + { + List result = new List(); + + using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) + { + dbcon.Open(); + + using (MySqlCommand cmd = dbcon.CreateCommand()) + { + cmd.CommandText = "select estateID from estate_settings"; + + using (IDataReader reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + result.Add(Convert.ToInt32(reader["EstateID"])); + } + reader.Close(); + } + } + + dbcon.Close(); + } + + return result; + } public List GetEstates(string search) { diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs index 63252aa..6afc540 100644 --- a/OpenSim/Data/SQLite/SQLiteEstateData.cs +++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs @@ -357,6 +357,17 @@ namespace OpenSim.Data.SQLite return DoLoad(cmd, UUID.Zero, false); } + + public List LoadEstateSettingsAll() + { + List estateSettings = new List(); + + List estateIds = GetEstatesAll(); + foreach (int estateId in estateIds) + estateSettings.Add(LoadEstateSettings(estateId)); + + return estateSettings; + } public List GetEstates(string search) { @@ -379,6 +390,27 @@ namespace OpenSim.Data.SQLite return result; } + + public List GetEstatesAll() + { + List result = new List(); + + string sql = "select EstateID from estate_settings"; + + SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); + + cmd.CommandText = sql; + + IDataReader r = cmd.ExecuteReader(); + + while (r.Read()) + { + result.Add(Convert.ToInt32(r["EstateID"])); + } + r.Close(); + + return result; + } public bool LinkRegion(UUID regionID, int estateID) { diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs index 547ea6b..ad28c00 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs @@ -100,6 +100,17 @@ namespace OpenSim.Data.SQLiteLegacy return DoLoad(cmd, regionID, create); } + + public List LoadEstateSettingsAll() + { + List estateSettings = new List(); + + List estateIds = GetEstatesAll(); + foreach (int estateId in estateIds) + estateSettings.Add(LoadEstateSettings(estateId)); + + return estateSettings; + } private EstateSettings DoLoad(SqliteCommand cmd, UUID regionID, bool create) { @@ -369,6 +380,28 @@ namespace OpenSim.Data.SQLiteLegacy return result; } + + public List GetEstatesAll() + { + List result = new List(); + + string sql = "select EstateID from estate_settings"; + + SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); + + cmd.CommandText = sql; + + IDataReader r = cmd.ExecuteReader(); + + while (r.Read()) + { + result.Add(Convert.ToInt32(r["EstateID"])); + } + r.Close(); + + return result; + } + public bool LinkRegion(UUID regionID, int estateID) { SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index e950613..f804cb7 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -828,7 +828,18 @@ namespace OpenSim } else { - response = MainConsole.Instance.CmdPrompt("Estate name to join", "None"); + List estates = estateDataService.LoadEstateSettingsAll(); + + List estateNames = new List(); + foreach (EstateSettings estate in estates) + estateNames.Add(estate.EstateName); + + response + = MainConsole.Instance.CmdPrompt( + string.Format( + "Name of estate to join. Existing estate names are ({0})", string.Join(", ", estateNames.ToArray())), + "None"); + if (response == "None") continue; diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs index 95c9659..12ed9e3 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs @@ -36,8 +36,22 @@ namespace OpenSim.Region.Framework.Interfaces { EstateSettings LoadEstateSettings(UUID regionID, bool create); EstateSettings LoadEstateSettings(int estateID); + + /// + /// Load/Get all estate settings. + /// + /// An empty list if no estates were found. + List LoadEstateSettingsAll(); + void StoreEstateSettings(EstateSettings es); List GetEstates(string search); + + /// + /// Get the IDs of all estates. + /// + /// An empty list if no estates were found. + List GetEstatesAll(); + bool LinkRegion(UUID regionID, int estateID); List GetRegions(int estateID); bool DeleteEstate(int estateID); diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs index 87c7a05..d78ad78 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs @@ -37,8 +37,22 @@ namespace OpenSim.Region.Framework.Interfaces EstateSettings LoadEstateSettings(UUID regionID, bool create); EstateSettings LoadEstateSettings(int estateID); + + /// + /// Load/Get all estate settings. + /// + /// An empty list if no estates were found. + List LoadEstateSettingsAll(); + void StoreEstateSettings(EstateSettings es); List GetEstates(string search); + + /// + /// Get the IDs of all estates. + /// + /// An empty list if no estates were found. + List GetEstatesAll(); + bool LinkRegion(UUID regionID, int estateID); List GetRegions(int estateID); bool DeleteEstate(int estateID); diff --git a/OpenSim/Services/Connectors/Simulation/EstateDataService.cs b/OpenSim/Services/Connectors/Simulation/EstateDataService.cs index b6df5a2..d0588bf 100644 --- a/OpenSim/Services/Connectors/Simulation/EstateDataService.cs +++ b/OpenSim/Services/Connectors/Simulation/EstateDataService.cs @@ -90,6 +90,11 @@ namespace OpenSim.Services.Connectors { return m_database.LoadEstateSettings(estateID); } + + public List LoadEstateSettingsAll() + { + return m_database.LoadEstateSettingsAll(); + } public void StoreEstateSettings(EstateSettings es) { @@ -100,6 +105,11 @@ namespace OpenSim.Services.Connectors { return m_database.GetEstates(search); } + + public List GetEstatesAll() + { + return m_database.GetEstatesAll(); + } public bool LinkRegion(UUID regionID, int estateID) { -- cgit v1.1 From 793bfb5a663879296789efa8350df0e9cabb2148 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 21 Mar 2011 22:25:20 +0000 Subject: add method doc to IEstateDataService and IEstateDataStore interfaces --- .../Framework/Interfaces/IEstateDataService.cs | 44 +++++++++++++++++++- .../Framework/Interfaces/IEstateDataStore.cs | 48 +++++++++++++++++++++- 2 files changed, 90 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs index 12ed9e3..55adef1 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs @@ -34,7 +34,19 @@ namespace OpenSim.Region.Framework.Interfaces { public interface IEstateDataService { + /// + /// Load estate settings for a region. + /// + /// + /// If true, then an estate is created if one is not found. This is used in migration. + /// EstateSettings LoadEstateSettings(UUID regionID, bool create); + + /// + /// Load estate settings for an estate ID. + /// + /// + /// EstateSettings LoadEstateSettings(int estateID); /// @@ -43,7 +55,19 @@ namespace OpenSim.Region.Framework.Interfaces /// An empty list if no estates were found. List LoadEstateSettingsAll(); + /// + /// Store estate settings. + /// + /// + /// This is also called by EstateSettings.Save() + /// void StoreEstateSettings(EstateSettings es); + + /// + /// Get estate IDs. + /// + /// Name of estate to search for. This is the exact name, no parttern matching is done. + /// List GetEstates(string search); /// @@ -52,8 +76,26 @@ namespace OpenSim.Region.Framework.Interfaces /// An empty list if no estates were found. List GetEstatesAll(); + /// + /// Link a region to an estate. + /// + /// + /// + /// true if the link succeeded, false otherwise bool LinkRegion(UUID regionID, int estateID); + + /// + /// Get the UUIDs of all the regions in an estate. + /// + /// + /// List GetRegions(int estateID); + + /// + /// Delete an estate + /// + /// + /// true if the delete succeeded, false otherwise bool DeleteEstate(int estateID); } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs index d78ad78..4974d5d 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs @@ -33,9 +33,25 @@ namespace OpenSim.Region.Framework.Interfaces { public interface IEstateDataStore { + /// + /// Initialise the data store. + /// + /// void Initialise(string connectstring); + /// + /// Load estate settings for a region. + /// + /// + /// If true, then an estate is created if one is not found. This is used in migration. + /// EstateSettings LoadEstateSettings(UUID regionID, bool create); + + /// + /// Load estate settings for an estate ID. + /// + /// + /// EstateSettings LoadEstateSettings(int estateID); /// @@ -44,7 +60,19 @@ namespace OpenSim.Region.Framework.Interfaces /// An empty list if no estates were found. List LoadEstateSettingsAll(); + /// + /// Store estate settings. + /// + /// + /// This is also called by EstateSettings.Save() + /// void StoreEstateSettings(EstateSettings es); + + /// + /// Get estate IDs. + /// + /// Name of estate to search for. This is the exact name, no parttern matching is done. + /// List GetEstates(string search); /// @@ -53,8 +81,26 @@ namespace OpenSim.Region.Framework.Interfaces /// An empty list if no estates were found. List GetEstatesAll(); + /// + /// Link a region to an estate. + /// + /// + /// + /// true if the link succeeded, false otherwise bool LinkRegion(UUID regionID, int estateID); + + /// + /// Get the UUIDs of all the regions in an estate. + /// + /// + /// List GetRegions(int estateID); + + /// + /// Delete an estate + /// + /// + /// true if the delete succeeded, false otherwise bool DeleteEstate(int estateID); } -} +} \ No newline at end of file -- cgit v1.1 From 2d1f0d224c355e92997643cf849b8e9774dddbad Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 21 Mar 2011 22:27:16 +0000 Subject: minor: slightly adjust previous method doc. --- OpenSim/Region/Framework/Interfaces/IEstateDataService.cs | 2 +- OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs index 55adef1..38c10a6 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs @@ -38,7 +38,7 @@ namespace OpenSim.Region.Framework.Interfaces /// Load estate settings for a region. /// /// - /// If true, then an estate is created if one is not found. This is used in migration. + /// If true, then an estate is created if one is not found. /// EstateSettings LoadEstateSettings(UUID regionID, bool create); diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs index 4974d5d..c82661d 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateDataStore.cs @@ -43,7 +43,7 @@ namespace OpenSim.Region.Framework.Interfaces /// Load estate settings for a region. /// /// - /// If true, then an estate is created if one is not found. This is used in migration. + /// If true, then an estate is created if one is not found. /// EstateSettings LoadEstateSettings(UUID regionID, bool create); -- cgit v1.1 From ee7cfc2854aba3572d5342b8c1bfd5bf4ea93841 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 21 Mar 2011 22:47:02 +0000 Subject: refactor: use EstateDataService property directly instead of loading it into a local variable --- OpenSim/Region/Application/OpenSimBase.cs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index f804cb7..eae3686 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -798,12 +798,8 @@ namespace OpenSim /// public void PopulateRegionEstateInfo(RegionInfo regInfo) { - IEstateDataService estateDataService = EstateDataService; - - if (estateDataService != null) - { - regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, false); - } + if (EstateDataService != null) + regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, false); if (regInfo.EstateSettings.EstateID == 0) // No record at all { @@ -814,7 +810,7 @@ namespace OpenSim if (response == "no") { // Create a new estate - regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, true); + regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, true); regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); @@ -828,7 +824,7 @@ namespace OpenSim } else { - List estates = estateDataService.LoadEstateSettingsAll(); + List estates = EstateDataService.LoadEstateSettingsAll(); List estateNames = new List(); foreach (EstateSettings estate in estates) @@ -843,7 +839,7 @@ namespace OpenSim if (response == "None") continue; - List estateIDs = estateDataService.GetEstates(response); + List estateIDs = EstateDataService.GetEstates(response); if (estateIDs.Count < 1) { MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again"); @@ -852,9 +848,9 @@ namespace OpenSim int estateID = estateIDs[0]; - regInfo.EstateSettings = estateDataService.LoadEstateSettings(estateID); + regInfo.EstateSettings = EstateDataService.LoadEstateSettings(estateID); - if (estateDataService.LinkRegion(regInfo.RegionID, estateID)) + if (EstateDataService.LinkRegion(regInfo.RegionID, estateID)) break; MainConsole.Instance.Output("Joining the estate failed. Please try again."); @@ -863,7 +859,6 @@ namespace OpenSim } } } - public class OpenSimConfigSource { -- cgit v1.1 From 060a53b896d338309458861161eb0b9e621d4171 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 21 Mar 2011 22:57:20 +0000 Subject: On initial opensim setup, don't ask the user whether they want to join an existing opensim estate when there aren't any. Proceed directly to estate setup instead. --- OpenSim/Region/Application/OpenSimBase.cs | 102 ++++++++++++++++++------------ 1 file changed, 63 insertions(+), 39 deletions(-) diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index eae3686..81a10e3 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -793,6 +793,25 @@ namespace OpenSim } /// + /// Create an estate with an initial region. + /// + /// + public void CreateEstate(RegionInfo regInfo) + { + // Create a new estate + regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, true); + + regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); + + // FIXME: Later on, the scene constructor will reload the estate settings no matter what. + // Therefore, we need to do an initial save here otherwise the new estate name will be reset + // back to the default. The reloading of estate settings by scene could be eliminated if it + // knows that the passed in settings in RegionInfo are already valid. Also, it might be + // possible to eliminate some additional later saves made by callers of this method. + regInfo.EstateSettings.Save(); + } + + /// /// Load the estate information for the provided RegionInfo object. /// /// @@ -804,56 +823,61 @@ namespace OpenSim if (regInfo.EstateSettings.EstateID == 0) // No record at all { MainConsole.Instance.Output("Your region is not part of an estate."); + + List estates = EstateDataService.LoadEstateSettingsAll(); + while (true) { - string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List() { "yes", "no" }); - if (response == "no") - { - // Create a new estate - regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, true); - - regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); + if (estates.Count == 0) + { + MainConsole.Instance.Output( + "There aren't any existing estates. You will need to create a new one for this region."); - // FIXME: Later on, the scene constructor will reload the estate settings no matter what. - // Therefore, we need to do an initial save here otherwise the new estate name will be reset - // back to the default. The reloading of estate settings by scene could be eliminated if it - // knows that the passed in settings in RegionInfo are already valid. Also, it might be - // possible to eliminate some additional later saves made by callers of this method. - regInfo.EstateSettings.Save(); + CreateEstate(regInfo); break; } else { - List estates = EstateDataService.LoadEstateSettingsAll(); - - List estateNames = new List(); - foreach (EstateSettings estate in estates) - estateNames.Add(estate.EstateName); - - response + string response = MainConsole.Instance.CmdPrompt( - string.Format( - "Name of estate to join. Existing estate names are ({0})", string.Join(", ", estateNames.ToArray())), - "None"); + "Do you wish to join an existing estate (yes/no)?", "no", new List() { "yes", "no" }); - if (response == "None") - continue; - - List estateIDs = EstateDataService.GetEstates(response); - if (estateIDs.Count < 1) + if (response == "no") { - MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again"); - continue; - } - - int estateID = estateIDs[0]; - - regInfo.EstateSettings = EstateDataService.LoadEstateSettings(estateID); - - if (EstateDataService.LinkRegion(regInfo.RegionID, estateID)) + CreateEstate(regInfo); break; - - MainConsole.Instance.Output("Joining the estate failed. Please try again."); + } + else + { + List estateNames = new List(); + foreach (EstateSettings estate in estates) + estateNames.Add(estate.EstateName); + + response + = MainConsole.Instance.CmdPrompt( + string.Format( + "Name of estate to join. Existing estate names are ({0})", string.Join(", ", estateNames.ToArray())), + "None"); + + if (response == "None") + continue; + + List estateIDs = EstateDataService.GetEstates(response); + if (estateIDs.Count < 1) + { + MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again"); + continue; + } + + int estateID = estateIDs[0]; + + regInfo.EstateSettings = EstateDataService.LoadEstateSettings(estateID); + + if (EstateDataService.LinkRegion(regInfo.RegionID, estateID)) + break; + + MainConsole.Instance.Output("Joining the estate failed. Please try again."); + } } } } -- cgit v1.1 From 3382de4d8bcfce0c3f8e2e63ee63ed2428322461 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 21 Mar 2011 23:16:57 +0000 Subject: In initial setup, stop a user being able to create a new estate with the same name as an existing estate. --- OpenSim/Region/Application/OpenSimBase.cs | 45 +++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 81a10e3..3f5e35e 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -795,20 +795,34 @@ namespace OpenSim /// /// Create an estate with an initial region. /// + /// + /// This method doesn't allow an estate to be created with the same name as existing estates. + /// /// - public void CreateEstate(RegionInfo regInfo) + /// A list of estate names that already exist. + /// true if the estate was created, false otherwise + public bool CreateEstate(RegionInfo regInfo, List existingNames) { // Create a new estate regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, true); + string newName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); - regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); + if (existingNames.Contains(newName)) + { + MainConsole.Instance.OutputFormat("An estate named {0} already exists. Please try again.", newName); + return false; + } + + regInfo.EstateSettings.EstateName = newName; // FIXME: Later on, the scene constructor will reload the estate settings no matter what. // Therefore, we need to do an initial save here otherwise the new estate name will be reset // back to the default. The reloading of estate settings by scene could be eliminated if it // knows that the passed in settings in RegionInfo are already valid. Also, it might be // possible to eliminate some additional later saves made by callers of this method. - regInfo.EstateSettings.Save(); + regInfo.EstateSettings.Save(); + + return true; } /// @@ -825,16 +839,21 @@ namespace OpenSim MainConsole.Instance.Output("Your region is not part of an estate."); List estates = EstateDataService.LoadEstateSettingsAll(); + List estateNames = new List(); + foreach (EstateSettings estate in estates) + estateNames.Add(estate.EstateName); while (true) { if (estates.Count == 0) { MainConsole.Instance.Output( - "There aren't any existing estates. You will need to create a new one for this region."); + "No existing estates found. You must create a new one for this region."); - CreateEstate(regInfo); - break; + if (CreateEstate(regInfo, estateNames)) + break; + else + continue; } else { @@ -844,15 +863,13 @@ namespace OpenSim if (response == "no") { - CreateEstate(regInfo); - break; + if (CreateEstate(regInfo, estateNames)) + break; + else + continue; } else - { - List estateNames = new List(); - foreach (EstateSettings estate in estates) - estateNames.Add(estate.EstateName); - + { response = MainConsole.Instance.CmdPrompt( string.Format( @@ -865,7 +882,7 @@ namespace OpenSim List estateIDs = EstateDataService.GetEstates(response); if (estateIDs.Count < 1) { - MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again"); + MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again."); continue; } -- cgit v1.1 From 7acade00b9b34403e63656d5e2efc94322342653 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 21 Mar 2011 23:26:35 +0000 Subject: On initial setup, include estate and regions names in questions to make it clearer what they relate to. --- OpenSim/Region/Application/OpenSimBase.cs | 10 ++++++---- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 3f5e35e..6405811 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -836,7 +836,7 @@ namespace OpenSim if (regInfo.EstateSettings.EstateID == 0) // No record at all { - MainConsole.Instance.Output("Your region is not part of an estate."); + MainConsole.Instance.OutputFormat("Region {0} is not part of an estate.", regInfo.RegionName); List estates = EstateDataService.LoadEstateSettingsAll(); List estateNames = new List(); @@ -847,8 +847,7 @@ namespace OpenSim { if (estates.Count == 0) { - MainConsole.Instance.Output( - "No existing estates found. You must create a new one for this region."); + MainConsole.Instance.Output("No existing estates found. You must create a new one."); if (CreateEstate(regInfo, estateNames)) break; @@ -859,7 +858,10 @@ namespace OpenSim { string response = MainConsole.Instance.CmdPrompt( - "Do you wish to join an existing estate (yes/no)?", "no", new List() { "yes", "no" }); + string.Format( + "Do you wish to join region {0} to an existing estate (yes/no)?", regInfo.RegionName), + "no", + new List() { "yes", "no" }); if (response == "no") { diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 1a6a70b..4d2519d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1109,7 +1109,7 @@ namespace OpenSim.Region.Framework.Scenes // while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) { - MainConsole.Instance.Output("The current estate has no owner set."); + MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", m_regInfo.EstateSettings.EstateName); List excluded = new List(new char[1]{' '}); string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded); string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded); -- cgit v1.1 From 97d46648cdde5d8237d1241f3dc47fc455b35d33 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Tue, 22 Mar 2011 16:42:12 -0400 Subject: More SQLite work. --- bin/Mono.Data.Sqlite.dll.config | 4 ++++ bin/libsqlite3.so.0 | Bin 871398 -> 0 bytes bin/libsqlite3_32.so | Bin 0 -> 635852 bytes bin/libsqlite3_64.so | Bin 0 -> 783200 bytes prebuild.xml | 4 ++-- 5 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 bin/Mono.Data.Sqlite.dll.config delete mode 100755 bin/libsqlite3.so.0 create mode 100755 bin/libsqlite3_32.so create mode 100755 bin/libsqlite3_64.so diff --git a/bin/Mono.Data.Sqlite.dll.config b/bin/Mono.Data.Sqlite.dll.config new file mode 100644 index 0000000..456461e --- /dev/null +++ b/bin/Mono.Data.Sqlite.dll.config @@ -0,0 +1,4 @@ + + + + diff --git a/bin/libsqlite3.so.0 b/bin/libsqlite3.so.0 deleted file mode 100755 index 0512d8a..0000000 Binary files a/bin/libsqlite3.so.0 and /dev/null differ diff --git a/bin/libsqlite3_32.so b/bin/libsqlite3_32.so new file mode 100755 index 0000000..171ffcd Binary files /dev/null and b/bin/libsqlite3_32.so differ diff --git a/bin/libsqlite3_64.so b/bin/libsqlite3_64.so new file mode 100755 index 0000000..2646a9c Binary files /dev/null and b/bin/libsqlite3_64.so differ diff --git a/prebuild.xml b/prebuild.xml index b31812d..910cb31 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -2156,8 +2156,8 @@ - - + + -- cgit v1.1 From be878795aa67acb486113eb4d9cdf7154f4d8408 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Tue, 22 Mar 2011 17:36:01 -0400 Subject: Typo fix --- bin/Mono.Data.Sqlite.dll.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/Mono.Data.Sqlite.dll.config b/bin/Mono.Data.Sqlite.dll.config index 456461e..de0c17d 100644 --- a/bin/Mono.Data.Sqlite.dll.config +++ b/bin/Mono.Data.Sqlite.dll.config @@ -1,4 +1,4 @@ - + -- cgit v1.1 From b34743e5fe6b0783caa62c014ff86e2ec76c8184 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 22 Mar 2011 23:47:36 +0000 Subject: Add an initial confidence-building TestAddObject() for prim counts. --- .../CoreModules/World/Land/LandManagementModule.cs | 29 +++++---- .../CoreModules/World/Land/PrimCountModule.cs | 23 +++++-- .../World/Land/Tests/PrimCountModuleTests.cs | 75 ++++++++++++++++++++++ OpenSim/Region/Framework/Scenes/SceneGraph.cs | 13 ++-- prebuild.xml | 1 + 5 files changed, 116 insertions(+), 25 deletions(-) create mode 100644 OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 98ba8c3..514be4f 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -306,6 +306,9 @@ namespace OpenSim.Region.CoreModules.World.Land /// The parcel created. protected ILandObject CreateDefaultParcel() { +// m_log.DebugFormat( +// "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); + ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; @@ -579,7 +582,7 @@ namespace OpenSim.Region.CoreModules.World.Land } else { - m_log.WarnFormat("[LAND]: Invalid local land ID {0}", landLocalID); + m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Invalid local land ID {0}", landLocalID); } } @@ -630,7 +633,7 @@ namespace OpenSim.Region.CoreModules.World.Land { if (m_landIDList[x, y] == local_id) { - m_log.WarnFormat("[LAND]: Not removing land object {0}; still being used at {1}, {2}", + m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Not removing land object {0}; still being used at {1}, {2}", local_id, x, y); return; //throw new Exception("Could not remove land object. Still being used at " + x + ", " + y); @@ -1198,7 +1201,7 @@ namespace OpenSim.Region.CoreModules.World.Land } else { - m_log.WarnFormat("[PARCEL]: Invalid land object {0} passed for parcel object owner request", local_id); + m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Invalid land object {0} passed for parcel object owner request", local_id); } } @@ -1426,7 +1429,7 @@ namespace OpenSim.Region.CoreModules.World.Land { IClientAPI client; if (! m_scene.TryGetClient(agentID, out client)) { - m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString()); + m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to retrieve IClientAPI for {0}", agentID); return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); } @@ -1475,7 +1478,7 @@ namespace OpenSim.Region.CoreModules.World.Land } else { - m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID); + m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to find parcelID {0}", parcelID); } return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); } @@ -1533,17 +1536,17 @@ namespace OpenSim.Region.CoreModules.World.Land } catch (LLSD.LLSDParseException e) { - m_log.ErrorFormat("[LAND] Fetch error: {0}", e.Message); - m_log.ErrorFormat("[LAND] ... in request {0}", request); + m_log.ErrorFormat("[LAND MANAGEMENT MODULE]: Fetch error: {0}", e.Message); + m_log.ErrorFormat("[LAND MANAGEMENT MODULE]: ... in request {0}", request); } - catch(InvalidCastException) + catch (InvalidCastException) { - m_log.ErrorFormat("[LAND] Wrong type in request {0}", request); + m_log.ErrorFormat("[LAND MANAGEMENT MODULE]: Wrong type in request {0}", request); } LLSDRemoteParcelResponse response = new LLSDRemoteParcelResponse(); response.parcel_id = parcelID; - m_log.DebugFormat("[LAND] got parcelID {0}", parcelID); + m_log.DebugFormat("[LAND MANAGEMENT MODULE]: Got parcelID {0}", parcelID); return LLSDHelpers.SerialiseLLSDReply(response); } @@ -1564,7 +1567,7 @@ namespace OpenSim.Region.CoreModules.World.Land ExtendedLandData extLandData = new ExtendedLandData(); Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle, out extLandData.X, out extLandData.Y); - m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}", + m_log.DebugFormat("[LAND MANAGEMENT MODULE]: Got parcelinfo request for regionHandle {0}, x/y {1}/{2}", extLandData.RegionHandle, extLandData.X, extLandData.Y); // for this region or for somewhere else? @@ -1605,7 +1608,7 @@ namespace OpenSim.Region.CoreModules.World.Land info = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); } // we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark. - m_log.DebugFormat("[LAND] got parcelinfo for parcel {0} in region {1}; sending...", + m_log.DebugFormat("[LAND MANAGEMENT MODULE]: got parcelinfo for parcel {0} in region {1}; sending...", data.LandData.Name, data.RegionHandle); // HACK for now RegionInfo r = new RegionInfo(); @@ -1616,7 +1619,7 @@ namespace OpenSim.Region.CoreModules.World.Land remoteClient.SendParcelInfo(r, data.LandData, parcelID, data.X, data.Y); } else - m_log.Debug("[LAND] got no parcelinfo; not sending"); + m_log.Debug("[LAND MANAGEMENT MODULE]: got no parcelinfo; not sending"); } public void setParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime) diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 34ef67f..c71264c 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -51,8 +51,8 @@ namespace OpenSim.Region.CoreModules.World.Land public class PrimCountModule : IPrimCountModule, INonSharedRegionModule { - private static readonly ILog m_log = - LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = +// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_Scene; private Dictionary m_PrimCounts = @@ -64,10 +64,16 @@ namespace OpenSim.Region.CoreModules.World.Land private Dictionary m_ParcelCounts = new Dictionary(); - // For now, a simple simwide taint to get this up. Later parcel based - // taint to allow recounting a parcel if only ownership has changed - // without recounting the whole sim. + + /// + /// For now, a simple simwide taint to get this up. Later parcel based + /// taint to allow recounting a parcel if only ownership has changed + /// without recounting the whole sim. + /// + /// We start out tainted so that the first get call resets the various prim counts. + /// private bool m_Tainted = true; + private Object m_TaintLock = new Object(); public Type ReplaceableInterface @@ -156,6 +162,8 @@ namespace OpenSim.Region.CoreModules.World.Land // NOTE: Call under Taint Lock private void AddObject(SceneObjectGroup obj) { +// m_log.DebugFormat("[PRIM COUNT MODULE]: Adding object {0} to prim count", obj.Name); + if (obj.IsAttachment) return; if (((obj.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0)) @@ -299,18 +307,21 @@ namespace OpenSim.Region.CoreModules.World.Land // NOTE: This method MUST be called while holding the taint lock! private void Recount() { +// m_log.DebugFormat("[PRIM COUNT MODULE]: Recounting prims on {0}", m_Scene.RegionInfo.RegionName); + m_OwnerMap.Clear(); m_SimwideCounts.Clear(); m_ParcelCounts.Clear(); List land = m_Scene.LandChannel.AllParcels(); - + foreach (ILandObject l in land) { LandData landData = l.LandData; m_OwnerMap[landData.GlobalID] = landData.OwnerID; m_SimwideCounts[landData.OwnerID] = 0; +// m_log.DebugFormat("[PRIM COUNT MODULE]: Adding parcel count for {0}", landData.GlobalID); m_ParcelCounts[landData.GlobalID] = new ParcelCounts(); } diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs new file mode 100644 index 0000000..402965f --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -0,0 +1,75 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Reflection; +using log4net.Config; +using NUnit.Framework; +using OpenMetaverse; +using OpenMetaverse.Assets; +using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; +using OpenSim.Tests.Common.Setup; + +namespace OpenSim.Region.CoreModules.World.Land.Tests +{ + [TestFixture] + public class PrimCountModuleTests + { + [Test] + public void TestAddObject() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + PrimCountModule pcm = new PrimCountModule(); + LandManagementModule lmm = new LandManagementModule(); + Scene scene = SceneSetupHelpers.SetupScene(); + SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm); + + ILandObject lo = new LandObject(UUID.Zero, false, scene); + lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); + lmm.AddLandObject(lo); + //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); + + string objName = "obj1"; + UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); + + SceneObjectPart part + = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) + { Name = objName, UUID = objUuid }; + + scene.AddNewSceneObject(new SceneObjectGroup(part), false); + + Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1)); + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 734ba22..eca2786 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -627,7 +627,7 @@ namespace OpenSim.Region.Framework.Scenes if (!Entities.Remove(agentID)) { m_log.WarnFormat( - "[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list", + "[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list", agentID); } @@ -650,7 +650,7 @@ namespace OpenSim.Region.Framework.Scenes } else { - m_log.WarnFormat("[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID); + m_log.WarnFormat("[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID); } } } @@ -1079,7 +1079,8 @@ namespace OpenSim.Region.Framework.Scenes catch (Exception e) { // Catch it and move on. This includes situations where splist has inconsistent info - m_log.WarnFormat("[SCENE]: Problem processing action in ForEachSOG: ", e.ToString()); + m_log.WarnFormat( + "[SCENEGRAPH]: Problem processing action in ForEachSOG: {0} {1}", e.Message, e.StackTrace); } } } @@ -1103,8 +1104,8 @@ namespace OpenSim.Region.Framework.Scenes } catch (Exception e) { - m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); - m_log.Info("[BUG] Stack Trace: " + e.StackTrace); + m_log.Info("[SCENEGRAPH]: Error in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); + m_log.Info("[SCENEGRAPH]: Stack Trace: " + e.StackTrace); } }); Parallel.ForEach(GetScenePresences(), protectedAction); @@ -1119,7 +1120,7 @@ namespace OpenSim.Region.Framework.Scenes } catch (Exception e) { - m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); + m_log.Error("[SCENEGRAPH]: Error in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString()); } } } diff --git a/prebuild.xml b/prebuild.xml index 910cb31..d564341 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -2927,6 +2927,7 @@ + -- cgit v1.1 From 9c979dd0fc468ec5b15bb9b3db2eae55db53c0bc Mon Sep 17 00:00:00 2001 From: Marck Date: Wed, 23 Mar 2011 08:35:39 +0100 Subject: Fix a typo in the SQLite DLL config and amend the instructions for running on Linux. Under Linux (and probably also under OSX), the operating system must be able to find the new SQLite DLL in the library search path. --- README.txt | 2 +- bin/Mono.Data.Sqlite.dll.config | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.txt b/README.txt index 391a659..8d925b5 100644 --- a/README.txt +++ b/README.txt @@ -44,7 +44,7 @@ for more information. To run OpenSim, from the unpacked distribution type: * cd bin - * mono OpenSim.exe + * LD_LIBRARY_PATH=. mono OpenSim.exe Now see the "Configuring OpenSim" section diff --git a/bin/Mono.Data.Sqlite.dll.config b/bin/Mono.Data.Sqlite.dll.config index de0c17d..0c5e941 100644 --- a/bin/Mono.Data.Sqlite.dll.config +++ b/bin/Mono.Data.Sqlite.dll.config @@ -1,4 +1,4 @@ - + -- cgit v1.1 From d011896341d09ce6c10a801264e663b6a19f0b48 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Mar 2011 21:50:56 +0000 Subject: Add generic EventManager.OnObjectAddedToScene and get PrimCountModule to listen for that rather than EventManager.OnParcelPrimCountAdd OnParcelPrimCountAdd had the wrong semantics for the PrimCountModule - it was invoked for every entity in the scene, not just new ones, which would screw up the untainted count. Extend automated test for this scenario. --- .../CoreModules/World/Land/LandManagementModule.cs | 4 +++ .../CoreModules/World/Land/PrimCountModule.cs | 10 ++++++-- .../World/Land/Tests/PrimCountModuleTests.cs | 2 ++ OpenSim/Region/Framework/Scenes/EventManager.cs | 30 ++++++++++++++++++++++ OpenSim/Region/Framework/Scenes/Scene.cs | 18 ++++++++++--- 5 files changed, 59 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 514be4f..4d887a8 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -854,6 +854,10 @@ namespace OpenSim.Region.CoreModules.World.Land public void EventManagerOnParcelPrimCountUpdate() { +// m_log.DebugFormat( +// "[LAND MANAGEMENT MODULE]: Triggered EventManagerOnParcelPrimCountUpdate() for {0}", +// m_scene.RegionInfo.RegionName); + ResetAllLandPrimCounts(); EntityBase[] entities = m_scene.Entities.GetEntities(); foreach (EntityBase obj in entities) diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index c71264c..5371aaf 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -89,8 +89,7 @@ namespace OpenSim.Region.CoreModules.World.Land { m_Scene = scene; - m_Scene.EventManager.OnParcelPrimCountAdd += - OnParcelPrimCountAdd; + m_Scene.EventManager.OnObjectAddedToScene += OnParcelPrimCountAdd; m_Scene.EventManager.OnObjectBeingRemovedFromScene += OnObjectBeingRemovedFromScene; m_Scene.EventManager.OnParcelPrimCountTainted += @@ -116,6 +115,7 @@ namespace OpenSim.Region.CoreModules.World.Land private void OnParcelPrimCountAdd(SceneObjectGroup obj) { + Console.WriteLine("WIBBLE"); // If we're tainted already, don't bother to add. The next // access will cause a recount anyway lock (m_TaintLock) @@ -172,6 +172,10 @@ namespace OpenSim.Region.CoreModules.World.Land Vector3 pos = obj.AbsolutePosition; ILandObject landObject = m_Scene.LandChannel.GetLandObject(pos.X, pos.Y); LandData landData = landObject.LandData; + +// m_log.DebugFormat( +// "[PRIM COUNT MODULE]: Object {0} is owned by {1} over land owned by {2}", +// obj.Name, obj.OwnerID, landData.OwnerID); ParcelCounts parcelCounts; if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts)) @@ -228,6 +232,8 @@ namespace OpenSim.Region.CoreModules.World.Land public int GetOwnerCount(UUID parcelID) { +// m_log.DebugFormat("[PRIM COUNT MODULE]: GetOwnerCount for {0}", parcelID); + lock (m_TaintLock) { if (m_Tainted) diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 402965f..fd332ed 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -67,6 +67,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) { Name = objName, UUID = objUuid }; + Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0)); + scene.AddNewSceneObject(new SceneObjectGroup(part), false); Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1)); diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index c321a15..fd62535 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -242,7 +242,15 @@ namespace OpenSim.Region.Framework.Scenes public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID); public event EstateToolsSunUpdate OnEstateToolsSunUpdate; + + /// + /// Triggered when an object is added to the scene. + /// + public event Action OnObjectAddedToScene; + /// + /// Triggered when an object is removed from the scene. + /// public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene; @@ -345,6 +353,7 @@ namespace OpenSim.Region.Framework.Scenes public delegate void Attach(uint localID, UUID itemID, UUID avatarID); public event Attach OnAttach; + /// /// Called immediately after an object is loaded from storage. /// @@ -800,6 +809,27 @@ namespace OpenSim.Region.Framework.Scenes } } + public void TriggerObjectAddedToScene(SceneObjectGroup obj) + { + Action handler = OnObjectAddedToScene; + if (handler != null) + { + foreach (Action d in handler.GetInvocationList()) + { + try + { + d(obj); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerObjectAddedToScene failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } + } + public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) { ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4d2519d..d407a6f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1956,8 +1956,14 @@ namespace OpenSim.Region.Framework.Scenes /// If false, it is left to the caller to schedule the update /// public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) - { - return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates); + { + if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates)) + { + EventManager.TriggerObjectAddedToScene(sceneObject); + return true; + } + + return false; } /// @@ -1974,7 +1980,13 @@ namespace OpenSim.Region.Framework.Scenes public bool AddNewSceneObject( SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) { - return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel); + if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel)) + { + EventManager.TriggerObjectAddedToScene(sceneObject); + return true; + } + + return false; } /// -- cgit v1.1 From 67cafbd33aeb1038f22aa775cbde96b4c89dd770 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Mar 2011 21:54:02 +0000 Subject: remove a rogue Console.WriteLine() from the last commit. --- OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 5371aaf..46c7eed 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -115,7 +115,6 @@ namespace OpenSim.Region.CoreModules.World.Land private void OnParcelPrimCountAdd(SceneObjectGroup obj) { - Console.WriteLine("WIBBLE"); // If we're tainted already, don't bother to add. The next // access will cause a recount anyway lock (m_TaintLock) -- cgit v1.1 From 08c3cd6b369e2bb8dfa08709c2ffddaea4cdbaa5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Mar 2011 22:04:14 +0000 Subject: Add method doc to the Get*() methods on PrimCountModule --- .../CoreModules/World/Land/PrimCountModule.cs | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 46c7eed..ae85798 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -229,6 +229,12 @@ namespace OpenSim.Region.CoreModules.World.Land return primCounts; } + + /// + /// Get the number of prims on the parcel that are owned by the parcel owner. + /// + /// + /// public int GetOwnerCount(UUID parcelID) { // m_log.DebugFormat("[PRIM COUNT MODULE]: GetOwnerCount for {0}", parcelID); @@ -245,6 +251,11 @@ namespace OpenSim.Region.CoreModules.World.Land return 0; } + /// + /// Get the number of prims on the parcel that have been set to the group that owns the parcel. + /// + /// + /// public int GetGroupCount(UUID parcelID) { lock (m_TaintLock) @@ -259,6 +270,11 @@ namespace OpenSim.Region.CoreModules.World.Land return 0; } + /// + /// Get the number of prims on the parcel that are not owned by the parcel owner or set to the parcel group. + /// + /// + /// public int GetOthersCount(UUID parcelID) { lock (m_TaintLock) @@ -273,6 +289,11 @@ namespace OpenSim.Region.CoreModules.World.Land return 0; } + /// + /// Get the number of prims that are in the entire simulator for the owner of this parcel. + /// + /// + /// public int GetSimulatorCount(UUID parcelID) { lock (m_TaintLock) @@ -291,6 +312,12 @@ namespace OpenSim.Region.CoreModules.World.Land return 0; } + /// + /// Get the number of prims that a particular user owns on this parcel. + /// + /// + /// + /// public int GetUserCount(UUID parcelID, UUID userID) { lock (m_TaintLock) -- cgit v1.1 From 654aa7abeb497e024c87e2ef8d610ba3ca512c3e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Mar 2011 22:12:20 +0000 Subject: Extend simple PCM add object test to check all counts --- .../CoreModules/World/Land/Tests/PrimCountModuleTests.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index fd332ed..88c814e 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -55,6 +55,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Scene scene = SceneSetupHelpers.SetupScene(); SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm); + UUID dummyUserId = new UUID("99999999-9999-9999-9999-999999999999"); ILandObject lo = new LandObject(UUID.Zero, false, scene); lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); lmm.AddLandObject(lo); @@ -68,10 +69,20 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests { Name = objName, UUID = objUuid }; Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, UUID.Zero), Is.EqualTo(0)); + Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); + Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(0)); scene.AddNewSceneObject(new SceneObjectGroup(part), false); Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1)); + Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, UUID.Zero), Is.EqualTo(1)); + Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); + Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(1)); } } } \ No newline at end of file -- cgit v1.1 From f1f4985ab6fc98daf2263f72397fe7db79b20ecd Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Mar 2011 22:14:04 +0000 Subject: user a non UUID.Zero user in pcm test to avoid any special treatment of UUID.Zero --- .../Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 88c814e..639d781 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -55,8 +55,9 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Scene scene = SceneSetupHelpers.SetupScene(); SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm); + UUID userId = new UUID("00000000-0000-0000-0000-000000000010"); UUID dummyUserId = new UUID("99999999-9999-9999-9999-999999999999"); - ILandObject lo = new LandObject(UUID.Zero, false, scene); + ILandObject lo = new LandObject(userId, false, scene); lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); lmm.AddLandObject(lo); //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); @@ -65,13 +66,13 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); SceneObjectPart part - = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) + = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) { Name = objName, UUID = objUuid }; Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0)); Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, UUID.Zero), Is.EqualTo(0)); + Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(0)); Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(0)); @@ -80,7 +81,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1)); Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, UUID.Zero), Is.EqualTo(1)); + Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(1)); Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(1)); } -- cgit v1.1 From 88673c86a4b9cde729c62fbdc92b8c9076c54230 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Mar 2011 22:17:47 +0000 Subject: use a 3 part object for the pcm test rather than a 1 part, for improved test coverage --- .../World/Land/Tests/PrimCountModuleTests.cs | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 639d781..8c1b6a3 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -61,13 +61,17 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); lmm.AddLandObject(lo); //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); - - string objName = "obj1"; - UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); - - SceneObjectPart part + + SceneObjectPart part1 = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) - { Name = objName, UUID = objUuid }; + { Name = "obj1", UUID = new UUID("00000000-0000-0000-0000-000000000001") }; + SceneObjectGroup sog = new SceneObjectGroup(part1); + sog.AddPart( + new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) + { Name = "obj2", UUID = new UUID("00000000-0000-0000-0000-000000000002") }); + sog.AddPart( + new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) + { Name = "obj3", UUID = new UUID("00000000-0000-0000-0000-000000000003") }); Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0)); Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); @@ -76,14 +80,14 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(0)); - scene.AddNewSceneObject(new SceneObjectGroup(part), false); + scene.AddNewSceneObject(sog, false); - Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1)); + Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(3)); Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(1)); + Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(3)); Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); - Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(1)); + Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(3)); } } } \ No newline at end of file -- cgit v1.1 From de88227bc486788197b3a7c842c8b60f82b0a29b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Mar 2011 22:29:27 +0000 Subject: refactor: simplify part of AddSceneObject() test setup by moving sog construction into SceneSetupHelpers.CreateSceneObject() --- .../World/Land/Tests/PrimCountModuleTests.cs | 11 +------- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 32 ++++++++++++++++++++++ 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 8c1b6a3..72f74fa 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -62,16 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests lmm.AddLandObject(lo); //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); - SceneObjectPart part1 - = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) - { Name = "obj1", UUID = new UUID("00000000-0000-0000-0000-000000000001") }; - SceneObjectGroup sog = new SceneObjectGroup(part1); - sog.AddPart( - new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) - { Name = "obj2", UUID = new UUID("00000000-0000-0000-0000-000000000002") }); - sog.AddPart( - new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) - { Name = "obj3", UUID = new UUID("00000000-0000-0000-0000-000000000003") }); + SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, userId); Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0)); Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index aa4b285..b7b7383 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -465,5 +465,37 @@ namespace OpenSim.Tests.Common.Setup return part; } + + /// + /// Create a scene object but do not add it to the scene. + /// + /// + /// UUID always starts at 00000000-0000-0000-0000-000000000001 + /// + /// The number of parts that should be in the scene object + /// + /// + public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId) + { + SceneObjectPart rootPart + = new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) + { Name = "part1", UUID = new UUID("00000000-0000-0000-0000-000000000001") }; + SceneObjectGroup sog = new SceneObjectGroup(rootPart); + + if (parts > 1) + { + for (int i = 2; i <= parts; i++) + { + sog.AddPart( + new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) + { + Name = string.Format("obj{0}", i), + UUID = new UUID(string.Format("00000000-0000-0000-0000-{0:D12}", i)) + }); + } + } + + return sog; + } } } -- cgit v1.1 From d5c7ae5c6b55ae794f630ae55a100b19eef2362c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Mar 2011 22:40:23 +0000 Subject: refactor common sop setup parts into a single method --- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 40 ++++++++++++++----------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index b7b7383..87b6389 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -454,9 +454,7 @@ namespace OpenSim.Tests.Common.Setup /// public static SceneObjectPart AddSceneObject(Scene scene, string name) { - SceneObjectPart part - = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); - part.Name = name; + SceneObjectPart part = CreateSceneObjectPart(name, UUID.Random(), UUID.Zero); //part.UpdatePrimFlags(false, false, true); //part.ObjectFlags |= (uint)PrimFlags.Phantom; @@ -467,6 +465,20 @@ namespace OpenSim.Tests.Common.Setup } /// + /// Create a scene object part. + /// + /// + /// + /// + /// + public static SceneObjectPart CreateSceneObjectPart(string name, UUID id, UUID ownerId) + { + return new SceneObjectPart( + ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) + { Name = name, UUID = id }; + } + + /// /// Create a scene object but do not add it to the scene. /// /// @@ -477,25 +489,19 @@ namespace OpenSim.Tests.Common.Setup /// public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId) { - SceneObjectPart rootPart - = new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) - { Name = "part1", UUID = new UUID("00000000-0000-0000-0000-000000000001") }; - SceneObjectGroup sog = new SceneObjectGroup(rootPart); + SceneObjectGroup sog + = new SceneObjectGroup( + CreateSceneObjectPart("part1", new UUID("00000000-0000-0000-0000-000000000001"), ownerId)); if (parts > 1) - { for (int i = 2; i <= parts; i++) - { sog.AddPart( - new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) - { - Name = string.Format("obj{0}", i), - UUID = new UUID(string.Format("00000000-0000-0000-0000-{0:D12}", i)) - }); - } - } + CreateSceneObjectPart( + string.Format("obj{0}", i), + new UUID(string.Format("00000000-0000-0000-0000-{0:D12}", i)), + ownerId)); return sog; } } -} +} \ No newline at end of file -- cgit v1.1 From ebbe3afaf15fa07f4a8d1c2db8795065b852ec8d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Mar 2011 23:14:55 +0000 Subject: Add PrimCountModuleTests.TestRemoveOwnerObject(). Also adds SceneSetupHelpers methods to easily create sogs with different part UUIDs --- .../World/Land/Tests/PrimCountModuleTests.cs | 39 +++++++++++++++++++++- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 27 ++++++++++++--- 2 files changed, 60 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 72f74fa..e6b8627 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -44,8 +44,11 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests [TestFixture] public class PrimCountModuleTests { + /// + /// Test count after a parcel owner owned object is added. + /// [Test] - public void TestAddObject() + public void TestAddOwnerObject() { TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); @@ -80,5 +83,39 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(3)); } + + /// + /// Test count after a parcel owner owned object is removed. + /// + [Test] + public void TestRemoveOwnerObject() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + PrimCountModule pcm = new PrimCountModule(); + LandManagementModule lmm = new LandManagementModule(); + Scene scene = SceneSetupHelpers.SetupScene(); + SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm); + + UUID userId = new UUID("00000000-0000-0000-0000-000000000010"); + UUID dummyUserId = new UUID("99999999-9999-9999-9999-999999999999"); + ILandObject lo = new LandObject(userId, false, scene); + lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); + lmm.AddLandObject(lo); + //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); + + scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, userId, 0x1), false); + SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, userId, 0x10); + scene.AddNewSceneObject(sogToDelete, false); + scene.DeleteSceneObject(sogToDelete, false); + + Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1)); + Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(1)); + Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); + Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(1)); + } } } \ No newline at end of file diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 87b6389..57850c1 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -488,20 +488,37 @@ namespace OpenSim.Tests.Common.Setup /// /// public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId) - { + { + return CreateSceneObject(parts, ownerId, 0x1); + } + + /// + /// Create a scene object but do not add it to the scene. + /// + /// The number of parts that should be in the scene object + /// + /// + /// The hexadecimal last part of the UUID for parts created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}" + /// will be given to the root part, and incremented for each part thereafter. + /// + /// + public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId, int uuidTail) + { + string rawSogId = string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail); + SceneObjectGroup sog = new SceneObjectGroup( - CreateSceneObjectPart("part1", new UUID("00000000-0000-0000-0000-000000000001"), ownerId)); + CreateSceneObjectPart("part0", new UUID(rawSogId), ownerId)); if (parts > 1) - for (int i = 2; i <= parts; i++) + for (int i = 1; i < parts; i++) sog.AddPart( CreateSceneObjectPart( string.Format("obj{0}", i), - new UUID(string.Format("00000000-0000-0000-0000-{0:D12}", i)), + new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail + i)), ownerId)); return sog; - } + } } } \ No newline at end of file -- cgit v1.1 From f001aab8aa5f3ceebe259ff89673c7757b16c637 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Mar 2011 23:19:15 +0000 Subject: extend TestAddOwnerObject() to add a second object --- .../World/Land/Tests/PrimCountModuleTests.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index e6b8627..a0e7e4c 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -58,15 +58,13 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Scene scene = SceneSetupHelpers.SetupScene(); SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm); - UUID userId = new UUID("00000000-0000-0000-0000-000000000010"); + UUID userId = new UUID("00000000-0000-0000-0000-100000000000"); UUID dummyUserId = new UUID("99999999-9999-9999-9999-999999999999"); ILandObject lo = new LandObject(userId, false, scene); lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); lmm.AddLandObject(lo); //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); - - SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, userId); - + Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0)); Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); @@ -74,6 +72,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(0)); + SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, userId, 0x01); scene.AddNewSceneObject(sog, false); Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(3)); @@ -82,6 +81,17 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(3)); Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(3)); + + // Add a second object and retest + SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, userId, 0x10); + scene.AddNewSceneObject(sog2, false); + + Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(5)); + Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(5)); + Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); + Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(5)); } /// -- cgit v1.1 From eaa37d15f26adda05cbcc44404b586551d86e983 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 23 Mar 2011 23:28:10 +0000 Subject: factor out common test setup code in PCM tests --- .../World/Land/Tests/PrimCountModuleTests.cs | 110 ++++++++++----------- 1 file changed, 53 insertions(+), 57 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index a0e7e4c..45e579e 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -44,6 +44,26 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests [TestFixture] public class PrimCountModuleTests { + protected UUID m_userId = new UUID("00000000-0000-0000-0000-100000000000"); + protected UUID m_dummyUserId = new UUID("99999999-9999-9999-9999-999999999999"); + protected TestScene m_scene; + protected PrimCountModule m_pcm; + protected ILandObject m_lo; + + [SetUp] + public void SetUp() + { + m_pcm = new PrimCountModule(); + LandManagementModule lmm = new LandManagementModule(); + m_scene = SceneSetupHelpers.SetupScene(); + SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm); + + m_lo = new LandObject(m_userId, false, m_scene); + m_lo.SetLandBitmap(m_lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); + lmm.AddLandObject(m_lo); + //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); + } + /// /// Test count after a parcel owner owned object is added. /// @@ -51,47 +71,35 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests public void TestAddOwnerObject() { TestHelper.InMethod(); -// log4net.Config.XmlConfigurator.Configure(); - - PrimCountModule pcm = new PrimCountModule(); - LandManagementModule lmm = new LandManagementModule(); - Scene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm); - - UUID userId = new UUID("00000000-0000-0000-0000-100000000000"); - UUID dummyUserId = new UUID("99999999-9999-9999-9999-999999999999"); - ILandObject lo = new LandObject(userId, false, scene); - lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); - lmm.AddLandObject(lo); - //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); +// log4net.Config.XmlConfigurator.Configure(); - Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(0)); - Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); - Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(0)); + Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); + Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); - SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, userId, 0x01); - scene.AddNewSceneObject(sog, false); + SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); + m_scene.AddNewSceneObject(sog, false); - Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(3)); - Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(3)); - Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); - Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(3)); + Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(3)); + Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(3)); + Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); + Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(3)); // Add a second object and retest - SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, userId, 0x10); - scene.AddNewSceneObject(sog2, false); + SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, 0x10); + m_scene.AddNewSceneObject(sog2, false); - Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(5)); - Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(5)); - Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); - Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(5)); + Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(5)); + Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(5)); + Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); + Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(5)); } /// @@ -103,29 +111,17 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - PrimCountModule pcm = new PrimCountModule(); - LandManagementModule lmm = new LandManagementModule(); - Scene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm); - - UUID userId = new UUID("00000000-0000-0000-0000-000000000010"); - UUID dummyUserId = new UUID("99999999-9999-9999-9999-999999999999"); - ILandObject lo = new LandObject(userId, false, scene); - lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); - lmm.AddLandObject(lo); - //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); - - scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, userId, 0x1), false); - SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, userId, 0x10); - scene.AddNewSceneObject(sogToDelete, false); - scene.DeleteSceneObject(sogToDelete, false); + m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, 0x1), false); + SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x10); + m_scene.AddNewSceneObject(sogToDelete, false); + m_scene.DeleteSceneObject(sogToDelete, false); - Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1)); - Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(1)); - Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0)); - Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(1)); + Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(1)); + Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); + Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(1)); + Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); + Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(1)); } } } \ No newline at end of file -- cgit v1.1 From 7f5019b0f23959ca049f87b596bc2bd47725eb0d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 25 Mar 2011 21:47:54 +0000 Subject: Add ILandObject.IPrimCounts for the new prim count module. Not functional yet, but tests now act against this object rather than interrogating the module directly --- .../CoreModules/World/Land/LandManagementModule.cs | 12 ++++- .../Region/CoreModules/World/Land/LandObject.cs | 4 +- .../CoreModules/World/Land/PrimCountModule.cs | 2 + .../World/Land/Tests/PrimCountModuleTests.cs | 60 ++++++++++++---------- OpenSim/Region/Framework/Interfaces/ILandObject.cs | 5 ++ 5 files changed, 52 insertions(+), 31 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 4d887a8..d0727d9 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -72,6 +72,7 @@ namespace OpenSim.Region.CoreModules.World.Land protected Commander m_commander = new Commander("land"); protected IUserManagement m_userManager; + protected IPrimCountModule m_primCountModule; // Minimum for parcels to work is 64m even if we don't actually use them. #pragma warning disable 0429 @@ -147,6 +148,7 @@ namespace OpenSim.Region.CoreModules.World.Land public void RegionLoaded(Scene scene) { m_userManager = m_scene.RequestModuleInterface(); + m_primCountModule = m_scene.RequestModuleInterface(); } public void RemoveRegion(Scene scene) @@ -309,10 +311,11 @@ namespace OpenSim.Region.CoreModules.World.Land // m_log.DebugFormat( // "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); - ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); + ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); + return AddLandObject(fullSimParcel); } @@ -593,6 +596,11 @@ namespace OpenSim.Region.CoreModules.World.Land public ILandObject AddLandObject(ILandObject land) { ILandObject new_land = land.Copy(); + + // Only now can we add the prim counts to the land object - we rely on the global ID which is generated + // as a random UUID inside LandData initialization + if (m_primCountModule != null) + new_land.PrimCounts = m_primCountModule.GetPrimCounts(new_land.LandData.GlobalID); lock (m_landList) { @@ -1368,7 +1376,7 @@ namespace OpenSim.Region.CoreModules.World.Land { ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); new_land.LandData = data.Copy(); - new_land.SetLandBitmapFromByteArray(); + new_land.SetLandBitmapFromByteArray(); AddLandObject(new_land); } diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 46c15ed..749bb3d 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.World.Land private int m_lastSeqId = 0; - protected LandData m_landData = new LandData(); + protected LandData m_landData = new LandData(); protected Scene m_scene; protected List primsOverMe = new List(); protected Dictionary m_listTransactions = new Dictionary(); @@ -79,6 +79,8 @@ namespace OpenSim.Region.CoreModules.World.Land set { m_landData = value; } } + + public IPrimCounts PrimCounts { get; set; } public UUID RegionUUID { diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index ae85798..9fd347e 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -88,6 +88,8 @@ namespace OpenSim.Region.CoreModules.World.Land public void AddRegion(Scene scene) { m_Scene = scene; + + m_Scene.RegisterModuleInterface(this); m_Scene.EventManager.OnObjectAddedToScene += OnParcelPrimCountAdd; m_Scene.EventManager.OnObjectBeingRemovedFromScene += diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index 45e579e..c9d393f 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -58,9 +58,9 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests m_scene = SceneSetupHelpers.SetupScene(); SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm); - m_lo = new LandObject(m_userId, false, m_scene); - m_lo.SetLandBitmap(m_lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); - lmm.AddLandObject(m_lo); + ILandObject lo = new LandObject(m_userId, false, m_scene); + lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); + m_lo = lmm.AddLandObject(lo); //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID); } @@ -72,34 +72,36 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests { TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - - Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(0)); - Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); - Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); + + IPrimCounts pc = m_lo.PrimCounts; + + Assert.That(pc.Owner, Is.EqualTo(0)); + Assert.That(pc.Group, Is.EqualTo(0)); + Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Users[m_userId], Is.EqualTo(0)); + Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); + Assert.That(pc.Simulator, Is.EqualTo(0)); SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); m_scene.AddNewSceneObject(sog, false); - Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(3)); - Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(3)); - Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); - Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(3)); + Assert.That(pc.Owner, Is.EqualTo(3)); + Assert.That(pc.Group, Is.EqualTo(0)); + Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Users[m_userId], Is.EqualTo(3)); + Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); + Assert.That(pc.Simulator, Is.EqualTo(3)); // Add a second object and retest SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, 0x10); m_scene.AddNewSceneObject(sog2, false); - Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(5)); - Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(5)); - Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); - Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(5)); + Assert.That(pc.Owner, Is.EqualTo(5)); + Assert.That(pc.Group, Is.EqualTo(0)); + Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Users[m_userId], Is.EqualTo(5)); + Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); + Assert.That(pc.Simulator, Is.EqualTo(5)); } /// @@ -111,17 +113,19 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests TestHelper.InMethod(); // log4net.Config.XmlConfigurator.Configure(); + IPrimCounts pc = m_lo.PrimCounts; + m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, 0x1), false); SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x10); m_scene.AddNewSceneObject(sogToDelete, false); m_scene.DeleteSceneObject(sogToDelete, false); - Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(1)); - Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0)); - Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(1)); - Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0)); - Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(1)); + Assert.That(pc.Owner, Is.EqualTo(1)); + Assert.That(pc.Group, Is.EqualTo(0)); + Assert.That(pc.Others, Is.EqualTo(0)); + Assert.That(pc.Users[m_userId], Is.EqualTo(1)); + Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); + Assert.That(pc.Simulator, Is.EqualTo(1)); } } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Interfaces/ILandObject.cs b/OpenSim/Region/Framework/Interfaces/ILandObject.cs index eeb9d3a..9c0abde 100644 --- a/OpenSim/Region/Framework/Interfaces/ILandObject.cs +++ b/OpenSim/Region/Framework/Interfaces/ILandObject.cs @@ -46,6 +46,11 @@ namespace OpenSim.Region.Framework.Interfaces UUID RegionUUID { get; } /// + /// Prim counts for this land object. + /// + IPrimCounts PrimCounts { get; set; } + + /// /// The start point for the land object. This is the western-most point as one scans land working from /// north to south. /// -- cgit v1.1 From ea72745d43c2c6eced8329801ff8765746be7ddd Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 25 Mar 2011 23:18:47 +0000 Subject: Log the xml/ini regions config files that opensim loads from, and the regions that it loaded from them This will show up with the lines [REGION LOADER FILE SYSTEM]: Loading config files from ./Regions, etc. --- .../Filesystem/RegionLoaderFileSystem.cs | 24 ++++++++++++++++++---- prebuild.xml | 1 + 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs index 63e09ae..7cbd5ed 100644 --- a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs +++ b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs @@ -25,15 +25,19 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using log4net; using System; using System.Collections.Generic; using System.IO; +using System.Reflection; using Nini.Config; namespace OpenSim.Framework.RegionLoader.Filesystem { public class RegionLoaderFileSystem : IRegionLoader { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private IConfigSource m_configSource; public void SetIniConfigSource(IConfigSource configSource) @@ -63,36 +67,48 @@ namespace OpenSim.Framework.RegionLoader.Filesystem string[] configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); string[] iniFiles = Directory.GetFiles(regionConfigPath, "*.ini"); + // Create an empty Regions.ini if there are no existing config files. if (configFiles.Length == 0 && iniFiles.Length == 0) - { + { new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "Regions.ini"), false, m_configSource); iniFiles = Directory.GetFiles(regionConfigPath, "*.ini"); } + + m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config files from {0}", regionConfigPath); List regionInfos = new List(); int i = 0; foreach (string file in iniFiles) { + m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file); + IConfigSource source = new IniConfigSource(file); foreach (IConfig config in source.Configs) - { - //m_log.Info("[REGIONLOADERFILESYSTEM]: Creating RegionInfo for " + config.Name); + { RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Name); regionInfos.Add(regionInfo); + + m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded region {0}", regionInfo.RegionName); + i++; } } foreach (string file in configFiles) { + m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file); + RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource); regionInfos.Add(regionInfo); + + m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded region {0}", regionInfo.RegionName); + i++; } return regionInfos.ToArray(); } } -} +} \ No newline at end of file diff --git a/prebuild.xml b/prebuild.xml index d564341..fac3f20 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -402,6 +402,7 @@ + -- cgit v1.1 From 3a55d59b45dc0cbff938f0101bb6338bd8949e86 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 25 Mar 2011 23:29:06 +0000 Subject: in region web loader, print out url that config is being loaded from (this wasn't being done anywhere). --- OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs index 0ec4af5..de4898a 100644 --- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs +++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs @@ -66,9 +66,9 @@ namespace OpenSim.Framework.RegionLoader.Web { HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url); webRequest.Timeout = 30000; //30 Second Timeout - m_log.Debug("[WEBLOADER]: Sending Download Request..."); + m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url); HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse(); - m_log.Debug("[WEBLOADER]: Downloading Region Information From Remote Server..."); + m_log.Debug("[WEBLOADER]: Downloading region information..."); StreamReader reader = new StreamReader(webResponse.GetResponseStream()); string xmlSource = String.Empty; string tempStr = reader.ReadLine(); -- cgit v1.1 From d8e1c380e67512e0476b2a7b7441ae3acbb4606f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 25 Mar 2011 23:36:58 +0000 Subject: minor: make it clearer in the log where we're loading region config files and not the regions themselves --- .../LoadRegions/LoadRegionsPlugin.cs | 28 ++++++++++------------ .../Filesystem/RegionLoaderFileSystem.cs | 4 ++-- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs index f37c399..e26c1d2 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs @@ -68,7 +68,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions public void Initialise() { - m_log.Error("[LOADREGIONS]: " + Name + " cannot be default-initialized!"); + m_log.Error("[LOAD REGIONS PLUGIN]: " + Name + " cannot be default-initialized!"); throw new PluginNotInitialisedException(Name); } @@ -85,41 +85,39 @@ namespace OpenSim.ApplicationPlugins.LoadRegions IRegionLoader regionLoader; if (m_openSim.ConfigSource.Source.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem") { - m_log.Info("[LOADREGIONS]: Loading region configurations from filesystem"); + m_log.Info("[LOAD REGIONS PLUGIN]: Loading region configurations from filesystem"); regionLoader = new RegionLoaderFileSystem(); } else { - m_log.Info("[LOADREGIONSPLUGIN]: Loading region configurations from web"); + m_log.Info("[LOAD REGIONS PLUGIN]: Loading region configurations from web"); regionLoader = new RegionLoaderWebServer(); } - m_log.Info("[LOADREGIONSPLUGIN]: Loading region configurations..."); - regionLoader.SetIniConfigSource(m_openSim.ConfigSource.Source); RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); - m_log.Info("[LOADREGIONSPLUGIN]: Loading specific shared modules..."); - m_log.Info("[LOADREGIONSPLUGIN]: DynamicTextureModule..."); + m_log.Info("[LOAD REGIONS PLUGIN]: Loading specific shared modules..."); + m_log.Info("[LOAD REGIONS PLUGIN]: DynamicTextureModule..."); m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule()); - m_log.Info("[LOADREGIONSPLUGIN]: LoadImageURLModule..."); + m_log.Info("[LOAD REGIONS PLUGIN]: LoadImageURLModule..."); m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule()); - m_log.Info("[LOADREGIONSPLUGIN]: XMLRPCModule..."); + m_log.Info("[LOAD REGIONS PLUGIN]: XMLRPCModule..."); m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule()); // m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule..."); // m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule()); - m_log.Info("[LOADREGIONSPLUGIN]: Done."); + m_log.Info("[LOAD REGIONS PLUGIN]: Done."); if (!CheckRegionsForSanity(regionsToLoad)) { - m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations"); + m_log.Error("[LOAD REGIONS PLUGIN]: Halting startup due to conflicts in region configurations"); Environment.Exit(1); } for (int i = 0; i < regionsToLoad.Length; i++) { IScene scene; - m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + + m_log.Debug("[LOAD REGIONS PLUGIN]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + Thread.CurrentThread.ManagedThreadId.ToString() + ")"); @@ -164,7 +162,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions if (regions[i].RegionID == regions[j].RegionID) { m_log.ErrorFormat( - "[LOADREGIONS]: Regions {0} and {1} have the same UUID {2}", + "[LOAD REGIONS PLUGIN]: Regions {0} and {1} have the same UUID {2}", regions[i].RegionName, regions[j].RegionName, regions[i].RegionID); return false; } @@ -172,14 +170,14 @@ namespace OpenSim.ApplicationPlugins.LoadRegions regions[i].RegionLocX == regions[j].RegionLocX && regions[i].RegionLocY == regions[j].RegionLocY) { m_log.ErrorFormat( - "[LOADREGIONS]: Regions {0} and {1} have the same grid location ({2}, {3})", + "[LOAD REGIONS PLUGIN]: Regions {0} and {1} have the same grid location ({2}, {3})", regions[i].RegionName, regions[j].RegionName, regions[i].RegionLocX, regions[i].RegionLocY); return false; } else if (regions[i].InternalEndPoint.Port == regions[j].InternalEndPoint.Port) { m_log.ErrorFormat( - "[LOADREGIONS]: Regions {0} and {1} have the same internal IP port {2}", + "[LOAD REGIONS PLUGIN]: Regions {0} and {1} have the same internal IP port {2}", regions[i].RegionName, regions[j].RegionName, regions[i].InternalEndPoint.Port); return false; } diff --git a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs index 7cbd5ed..0aae4ff 100644 --- a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs +++ b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs @@ -90,7 +90,7 @@ namespace OpenSim.Framework.RegionLoader.Filesystem RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Name); regionInfos.Add(regionInfo); - m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded region {0}", regionInfo.RegionName); + m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded config for region {0}", regionInfo.RegionName); i++; } @@ -103,7 +103,7 @@ namespace OpenSim.Framework.RegionLoader.Filesystem RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource); regionInfos.Add(regionInfo); - m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded region {0}", regionInfo.RegionName); + m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded config for region {0}", regionInfo.RegionName); i++; } -- cgit v1.1 From f30bf429c274c9d6d0cfc99513820f759ca94d3e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 26 Mar 2011 00:42:48 +0000 Subject: refactor: rename SOG collections in SceneGraph to make it clearer that they are indexing each part's UUID, not just the root part. --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 60 +++++++++++++-------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index eca2786..345ed7a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -89,8 +89,8 @@ namespace OpenSim.Region.Framework.Scenes protected internal PhysicsScene _PhyScene; - protected internal Dictionary SceneObjectGroupsByLocalID = new Dictionary(); - protected internal Dictionary SceneObjectGroupsByFullID = new Dictionary(); + protected internal Dictionary SceneObjectGroupsByLocalPartID = new Dictionary(); + protected internal Dictionary SceneObjectGroupsByFullPartID = new Dictionary(); private Object m_updateLock = new Object(); @@ -131,10 +131,10 @@ namespace OpenSim.Region.Framework.Scenes m_scenePresenceArray = newlist; } - lock (SceneObjectGroupsByFullID) - SceneObjectGroupsByFullID.Clear(); - lock (SceneObjectGroupsByLocalID) - SceneObjectGroupsByLocalID.Clear(); + lock (SceneObjectGroupsByFullPartID) + SceneObjectGroupsByFullPartID.Clear(); + lock (SceneObjectGroupsByLocalPartID) + SceneObjectGroupsByLocalPartID.Clear(); Entities.Clear(); } @@ -384,18 +384,18 @@ namespace OpenSim.Region.Framework.Scenes if (OnObjectCreate != null) OnObjectCreate(sceneObject); - lock (SceneObjectGroupsByFullID) + lock (SceneObjectGroupsByFullPartID) { - SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; + SceneObjectGroupsByFullPartID[sceneObject.UUID] = sceneObject; foreach (SceneObjectPart part in children) - SceneObjectGroupsByFullID[part.UUID] = sceneObject; + SceneObjectGroupsByFullPartID[part.UUID] = sceneObject; } - lock (SceneObjectGroupsByLocalID) + lock (SceneObjectGroupsByLocalPartID) { - SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; + SceneObjectGroupsByLocalPartID[sceneObject.LocalId] = sceneObject; foreach (SceneObjectPart part in children) - SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; + SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject; } return true; @@ -427,20 +427,20 @@ namespace OpenSim.Region.Framework.Scenes if (OnObjectRemove != null) OnObjectRemove(Entities[uuid]); - lock (SceneObjectGroupsByFullID) + lock (SceneObjectGroupsByFullPartID) { SceneObjectPart[] parts = grp.Parts; for (int i = 0; i < parts.Length; i++) - SceneObjectGroupsByFullID.Remove(parts[i].UUID); - SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); + SceneObjectGroupsByFullPartID.Remove(parts[i].UUID); + SceneObjectGroupsByFullPartID.Remove(grp.RootPart.UUID); } - lock (SceneObjectGroupsByLocalID) + lock (SceneObjectGroupsByLocalPartID) { SceneObjectPart[] parts = grp.Parts; for (int i = 0; i < parts.Length; i++) - SceneObjectGroupsByLocalID.Remove(parts[i].LocalId); - SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); + SceneObjectGroupsByLocalPartID.Remove(parts[i].LocalId); + SceneObjectGroupsByLocalPartID.Remove(grp.RootPart.LocalId); } return Entities.Remove(uuid); @@ -854,14 +854,14 @@ namespace OpenSim.Region.Framework.Scenes //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); SceneObjectGroup sog; - lock (SceneObjectGroupsByLocalID) - SceneObjectGroupsByLocalID.TryGetValue(localID, out sog); + lock (SceneObjectGroupsByLocalPartID) + SceneObjectGroupsByLocalPartID.TryGetValue(localID, out sog); if (sog != null) { if (sog.HasChildPrim(localID)) return sog; - SceneObjectGroupsByLocalID.Remove(localID); + SceneObjectGroupsByLocalPartID.Remove(localID); } EntityBase[] entityList = GetEntities(); @@ -873,8 +873,8 @@ namespace OpenSim.Region.Framework.Scenes sog = (SceneObjectGroup)ent; if (sog.HasChildPrim(localID)) { - lock (SceneObjectGroupsByLocalID) - SceneObjectGroupsByLocalID[localID] = sog; + lock (SceneObjectGroupsByLocalPartID) + SceneObjectGroupsByLocalPartID[localID] = sog; return sog; } } @@ -891,16 +891,16 @@ namespace OpenSim.Region.Framework.Scenes private SceneObjectGroup GetGroupByPrim(UUID fullID) { SceneObjectGroup sog; - lock (SceneObjectGroupsByFullID) - SceneObjectGroupsByFullID.TryGetValue(fullID, out sog); + lock (SceneObjectGroupsByFullPartID) + SceneObjectGroupsByFullPartID.TryGetValue(fullID, out sog); if (sog != null) { if (sog.ContainsPart(fullID)) return sog; - lock (SceneObjectGroupsByFullID) - SceneObjectGroupsByFullID.Remove(fullID); + lock (SceneObjectGroupsByFullPartID) + SceneObjectGroupsByFullPartID.Remove(fullID); } EntityBase[] entityList = GetEntities(); @@ -911,8 +911,8 @@ namespace OpenSim.Region.Framework.Scenes sog = (SceneObjectGroup)ent; if (sog.HasChildPrim(fullID)) { - lock (SceneObjectGroupsByFullID) - SceneObjectGroupsByFullID[fullID] = sog; + lock (SceneObjectGroupsByFullPartID) + SceneObjectGroupsByFullPartID[fullID] = sog; return sog; } } @@ -1069,7 +1069,7 @@ namespace OpenSim.Region.Framework.Scenes /// protected internal void ForEachSOG(Action action) { - List objlist = new List(SceneObjectGroupsByFullID.Values); + List objlist = new List(SceneObjectGroupsByFullPartID.Values); foreach (SceneObjectGroup obj in objlist) { try -- cgit v1.1 From 26d16567e1e2bf28a3eafce6d3acf8d9646aaf84 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 26 Mar 2011 00:53:19 +0000 Subject: Make SceneGraph.ForEachSOG() execute once for each SOG, not once for each prim (e.g. a SOG with 3 prims would have the action executed three times). To do this, a new SceneObjectGroupsByFullID index in SceneGraph which just index's prims by their root part UUID, in order to avoid the inefficiency of filtering existing lists. Existing callers to SceneGraph.ForEachSOG() did not fail due to the multiple per SOG action executions - they were probably just much less efficient. Code suggests that no callers expected ForEachSOG() to execute actions on sog multiple times --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 30 ++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 345ed7a..1621398 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -88,9 +88,21 @@ namespace OpenSim.Region.Framework.Scenes protected internal object m_syncRoot = new object(); protected internal PhysicsScene _PhyScene; - - protected internal Dictionary SceneObjectGroupsByLocalPartID = new Dictionary(); + + /// + /// Index the SceneObjectGroup for each part by the root part's UUID. + /// + protected internal Dictionary SceneObjectGroupsByFullID = new Dictionary(); + + /// + /// Index the SceneObjectGroup for each part by that part's UUID. + /// protected internal Dictionary SceneObjectGroupsByFullPartID = new Dictionary(); + + /// + /// Index the SceneObjectGroup for each part by that part's local ID. + /// + protected internal Dictionary SceneObjectGroupsByLocalPartID = new Dictionary(); private Object m_updateLock = new Object(); @@ -131,6 +143,8 @@ namespace OpenSim.Region.Framework.Scenes m_scenePresenceArray = newlist; } + lock (SceneObjectGroupsByFullID) + SceneObjectGroupsByFullID.Clear(); lock (SceneObjectGroupsByFullPartID) SceneObjectGroupsByFullPartID.Clear(); lock (SceneObjectGroupsByLocalPartID) @@ -384,6 +398,9 @@ namespace OpenSim.Region.Framework.Scenes if (OnObjectCreate != null) OnObjectCreate(sceneObject); + lock (SceneObjectGroupsByFullID) + SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; + lock (SceneObjectGroupsByFullPartID) { SceneObjectGroupsByFullPartID[sceneObject.UUID] = sceneObject; @@ -426,6 +443,9 @@ namespace OpenSim.Region.Framework.Scenes if (OnObjectRemove != null) OnObjectRemove(Entities[uuid]); + + lock (SceneObjectGroupsByFullID) + SceneObjectGroupsByFullID.Remove(grp.UUID); lock (SceneObjectGroupsByFullPartID) { @@ -1064,12 +1084,13 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Performs action on all scene object groups. + /// Performs action once on all scene object groups. /// /// protected internal void ForEachSOG(Action action) { - List objlist = new List(SceneObjectGroupsByFullPartID.Values); + // FIXME: Need to lock here, really. + List objlist = new List(SceneObjectGroupsByFullID.Values); foreach (SceneObjectGroup obj in objlist) { try @@ -1084,7 +1105,6 @@ namespace OpenSim.Region.Framework.Scenes } } } - /// /// Performs action on all scene presences. This can ultimately run the actions in parallel but -- cgit v1.1 From f2d2470c256486df585705313a7fdfdf3d344c1f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 26 Mar 2011 02:24:32 +0000 Subject: When an object is duplicated, add it to the full/local id SOG indexes as well as Entities --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 30 ++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 1621398..60855b2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -363,6 +363,10 @@ namespace OpenSim.Region.Framework.Scenes if (Entities.ContainsKey(sceneObject.UUID)) return false; + +// m_log.DebugFormat( +// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", +// sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName); SceneObjectPart[] children = sceneObject.Parts; @@ -1798,7 +1802,10 @@ namespace OpenSim.Region.Framework.Scenes /// public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) { - //m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID); +// m_log.DebugFormat( +// "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", +// originalPrimID, offset, AgentID); + SceneObjectGroup original = GetGroupByPrim(originalPrimID); if (original != null) { @@ -1829,7 +1836,28 @@ namespace OpenSim.Region.Framework.Scenes copy.RootPart.SalePrice = 10; } + // FIXME: This section needs to be refactored so that it just calls AddSceneObject() Entities.Add(copy); + + lock (SceneObjectGroupsByFullID) + SceneObjectGroupsByFullID[copy.UUID] = copy; + + SceneObjectPart[] children = copy.Parts; + + lock (SceneObjectGroupsByFullPartID) + { + SceneObjectGroupsByFullPartID[copy.UUID] = copy; + foreach (SceneObjectPart part in children) + SceneObjectGroupsByFullPartID[part.UUID] = copy; + } + + lock (SceneObjectGroupsByLocalPartID) + { + SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; + foreach (SceneObjectPart part in children) + SceneObjectGroupsByLocalPartID[copy.LocalId] = copy; + } + // PROBABLE END OF FIXME // Since we copy from a source group that is in selected // state, but the copy is shown deselected in the viewer, -- cgit v1.1 From 482686daab055d4d2d878b238059b442e64122f4 Mon Sep 17 00:00:00 2001 From: SignpostMarv Martin Date: Tue, 15 Mar 2011 10:29:24 +0000 Subject: WebkeyAuthenticationService is now no longer a stub! Signed-off-by: SignpostMarv Martin --- .../WebkeyAuthenticationService.cs | 40 +++++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs index d1a5b0f..a072958 100644 --- a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs @@ -31,6 +31,9 @@ using OpenSim.Services.Interfaces; using log4net; using Nini.Config; using System.Reflection; +using OpenSim.Data; +using OpenSim.Framework; +using OpenSim.Framework.Console; namespace OpenSim.Services.AuthenticationService { @@ -43,17 +46,44 @@ namespace OpenSim.Services.AuthenticationService public class WebkeyAuthenticationService : AuthenticationServiceBase, IAuthenticationService { -// private static readonly ILog m_log = -// LogManager.GetLogger( -// MethodBase.GetCurrentMethod().DeclaringType); - + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + public WebkeyAuthenticationService(IConfigSource config) : - base(config) + base(config) { } public string Authenticate(UUID principalID, string password, int lifetime) { + m_log.InfoFormat("[Authenticate]: Trying a web key authenticate"); + if (new UUID(password) == UUID.Zero) + { + m_log.InfoFormat("[Authenticate]: NULL_KEY is not a valid web_login_key"); + } + else + { + AuthenticationData data = m_Database.Get(principalID); + if (data != null && data.Data != null) + { + if (data.Data.ContainsKey("webLoginKey")) + { + m_log.InfoFormat("[Authenticate]: Trying a web key authentication"); + string key = data.Data["webLoginKey"].ToString(); + m_log.DebugFormat("[WEB LOGIN AUTH]: got {0} for key in db vs {1}", key, password); + if (key == password) + { + data.Data["webLoginKey"] = UUID.Zero.ToString(); + m_Database.Store(data); + return GetToken(principalID, lifetime); + } + }else{ + m_log.InfoFormat("[Authenticate]: no col webLoginKey in passwd.db"); + } + } + m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID); + } return String.Empty; } } -- cgit v1.1 From af3956348fc58613948889e5f85030a454684970 Mon Sep 17 00:00:00 2001 From: SignpostMarv Martin Date: Tue, 15 Mar 2011 10:29:42 +0000 Subject: Adding a combined auth service, allowing users to login with either web login or password Signed-off-by: SignpostMarv Martin --- .../WebkeyOrPasswordAuthenticationService.cs | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs diff --git a/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs new file mode 100644 index 0000000..0f2fd93 --- /dev/null +++ b/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using OpenMetaverse; +using OpenSim.Services.Interfaces; +using log4net; +using Nini.Config; +using System.Reflection; +using OpenSim.Data; +using OpenSim.Framework; +using OpenSim.Framework.Console; + +namespace OpenSim.Services.AuthenticationService +{ + public class WebkeyOrPasswordAuthenticationService : AuthenticationServiceBase, IAuthenticationService + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + public WebkeyOrPasswordAuthenticationService(IConfigSource config) + : base(config) + { + } + + public string Authenticate(UUID principalID, string password, int lifetime) + { + AuthenticationData data = m_Database.Get(principalID); + if (data != null && data.Data != null) + { + if (data.Data.ContainsKey("webLoginKey")) + { + m_log.InfoFormat("[Authenticate]: Trying a web key authentication"); + if (new UUID(password) == UUID.Zero) + { + m_log.InfoFormat("[Authenticate]: NULL_KEY is not a valid web_login_key"); + } + else + { + string key = data.Data["webLoginKey"].ToString(); + m_log.DebugFormat("[WEB LOGIN AUTH]: got {0} for key in db vs {1}", key, password); + if (key == password) + { + data.Data["webLoginKey"] = UUID.Zero.ToString(); + m_Database.Store(data); + return GetToken(principalID, lifetime); + } + } + } + if (data.Data.ContainsKey("passwordHash") && data.Data.ContainsKey("passwordSalt")) + { + m_log.InfoFormat("[Authenticate]: Trying a password authentication"); + string hashed = Util.Md5Hash(password + ":" + data.Data["passwordSalt"].ToString()); + m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString()); + if (data.Data["passwordHash"].ToString() == hashed) + { + return GetToken(principalID, lifetime); + } + } + m_log.DebugFormat("[AUTH SERVICE]: Both password and webLoginKey-based login failed for PrincipalID {0}", principalID); + } + else + { + m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID); + } + return string.Empty; + } + } +} -- cgit v1.1 From 6153c4597322ccef6bdb7662b6461faa260b13ea Mon Sep 17 00:00:00 2001 From: SignpostMarv Martin Date: Tue, 15 Mar 2011 10:29:51 +0000 Subject: LLLoginHandlers now supports both password & web login Signed-off-by: SignpostMarv Martin --- OpenSim/Server/Handlers/Login/LLLoginHandlers.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs index 48f5f99..8048f86 100644 --- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs +++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs @@ -74,12 +74,23 @@ namespace OpenSim.Server.Handlers.Login if (requestData != null) { if (requestData.ContainsKey("first") && requestData["first"] != null && - requestData.ContainsKey("last") && requestData["last"] != null && - requestData.ContainsKey("passwd") && requestData["passwd"] != null) + requestData.ContainsKey("last") && requestData["last"] != null && ( + (requestData.ContainsKey("passwd") && requestData["passwd"] != null) || + (!requestData.ContainsKey("passwd") && requestData.ContainsKey("web_login_key") && requestData["web_login_key"] != null && requestData["web_login_key"].ToString() != UUID.Zero.ToString()) + )) { string first = requestData["first"].ToString(); string last = requestData["last"].ToString(); - string passwd = requestData["passwd"].ToString(); + string passwd = null; + if (requestData.ContainsKey("passwd")) + { + passwd = requestData["passwd"].ToString(); + } + else if (requestData.ContainsKey("web_login_key")) + { + passwd = "$1$" + requestData["web_login_key"].ToString(); + m_log.InfoFormat("[LOGIN]: XMLRPC Login Req key {0}", passwd); + } string startLocation = string.Empty; UUID scopeID = UUID.Zero; if (requestData["scope_id"] != null) @@ -103,7 +114,7 @@ namespace OpenSim.Server.Handlers.Login string id0 = "Unknown"; if (requestData.Contains("id0") && requestData["id0"] != null) id0 = requestData["id0"].ToString(); - + //m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); LoginResponse reply = null; -- cgit v1.1 From 0e808950fbb54271d478d29669bf035949731114 Mon Sep 17 00:00:00 2001 From: SignpostMarv Martin Date: Mon, 21 Mar 2011 14:47:10 +0000 Subject: InfoFormat > DebugFormat Signed-off-by: SignpostMarv Martin --- OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs index a072958..5924026 100644 --- a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs @@ -79,7 +79,7 @@ namespace OpenSim.Services.AuthenticationService return GetToken(principalID, lifetime); } }else{ - m_log.InfoFormat("[Authenticate]: no col webLoginKey in passwd.db"); + m_log.DebugFormat("[Authenticate]: no col webLoginKey in passwd.db"); } } m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID); -- cgit v1.1 From 3bc859a834c50634281df3d52166fc68d7c3c3ba Mon Sep 17 00:00:00 2001 From: SignpostMarv Martin Date: Mon, 21 Mar 2011 15:42:57 +0000 Subject: Making combined auth service re-use the existing auth services instead of duplicating code Signed-off-by: SignpostMarv Martin --- .../WebkeyOrPasswordAuthenticationService.cs | 40 ++++++++++------------ 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs index 0f2fd93..b8bb090 100644 --- a/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs @@ -8,58 +8,56 @@ using System.Reflection; using OpenSim.Data; using OpenSim.Framework; using OpenSim.Framework.Console; +using OpenSim.Server.Base; namespace OpenSim.Services.AuthenticationService { public class WebkeyOrPasswordAuthenticationService : AuthenticationServiceBase, IAuthenticationService { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private IConfigSource config; public WebkeyOrPasswordAuthenticationService(IConfigSource config) : base(config) { + this.config = config; } public string Authenticate(UUID principalID, string password, int lifetime) { AuthenticationData data = m_Database.Get(principalID); + IAuthenticationService svc; + Object[] args = new Object[] { config }; + string result = String.Empty; if (data != null && data.Data != null) { if (data.Data.ContainsKey("webLoginKey")) { - m_log.InfoFormat("[Authenticate]: Trying a web key authentication"); - if (new UUID(password) == UUID.Zero) + svc = ServerUtils.LoadPlugin("OpenSim.Services.AuthenticationService.dll", "WebkeyAuthenticationService", args); + result = svc.Authenticate(principalID, password, lifetime); + if (result == String.Empty) { - m_log.InfoFormat("[Authenticate]: NULL_KEY is not a valid web_login_key"); - } - else - { - string key = data.Data["webLoginKey"].ToString(); - m_log.DebugFormat("[WEB LOGIN AUTH]: got {0} for key in db vs {1}", key, password); - if (key == password) - { - data.Data["webLoginKey"] = UUID.Zero.ToString(); - m_Database.Store(data); - return GetToken(principalID, lifetime); - } + m_log.DebugFormat("[Authenticate]: Web Login failed for PrincipalID {0}", principalID); } } if (data.Data.ContainsKey("passwordHash") && data.Data.ContainsKey("passwordSalt")) { - m_log.InfoFormat("[Authenticate]: Trying a password authentication"); - string hashed = Util.Md5Hash(password + ":" + data.Data["passwordSalt"].ToString()); - m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString()); - if (data.Data["passwordHash"].ToString() == hashed) + svc = ServerUtils.LoadPlugin("OpenSim.Services.AuthenticationService.dll", "PasswordAuthenticationService", args); + result = svc.Authenticate(principalID, password, lifetime); + if (result == String.Empty) { - return GetToken(principalID, lifetime); + m_log.DebugFormat("[Authenticate]: Password login failed for PrincipalID {0}", principalID); } } - m_log.DebugFormat("[AUTH SERVICE]: Both password and webLoginKey-based login failed for PrincipalID {0}", principalID); + if (result == string.Empty) + { + m_log.DebugFormat("[AUTH SERVICE]: Both password and webLoginKey-based login failed for PrincipalID {0}", principalID); + } } else { m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID); } - return string.Empty; + return result; } } } -- cgit v1.1 From e93531e1240348f18abb4ef88a0def227026e8f3 Mon Sep 17 00:00:00 2001 From: SignpostMarv Martin Date: Thu, 24 Mar 2011 16:21:12 +0000 Subject: Fixing bug that occurs when using web login- the result was not checked --- .../AuthenticationService/WebkeyOrPasswordAuthenticationService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs index b8bb090..3a47e97 100644 --- a/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs @@ -39,7 +39,7 @@ namespace OpenSim.Services.AuthenticationService m_log.DebugFormat("[Authenticate]: Web Login failed for PrincipalID {0}", principalID); } } - if (data.Data.ContainsKey("passwordHash") && data.Data.ContainsKey("passwordSalt")) + if (result == string.Empty && data.Data.ContainsKey("passwordHash") && data.Data.ContainsKey("passwordSalt")) { svc = ServerUtils.LoadPlugin("OpenSim.Services.AuthenticationService.dll", "PasswordAuthenticationService", args); result = svc.Authenticate(principalID, password, lifetime); -- cgit v1.1 From 3f4be42a87f77d5da7e6cafd4fb98ff6a502636d Mon Sep 17 00:00:00 2001 From: SignpostMarv Martin Date: Thu, 24 Mar 2011 16:46:21 +0000 Subject: Altering log feedback --- .../WebkeyAuthenticationService.cs | 23 +++++++++++----------- .../WebkeyOrPasswordAuthenticationService.cs | 8 +++++--- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs index 5924026..2344c0e 100644 --- a/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/WebkeyAuthenticationService.cs @@ -57,10 +57,9 @@ namespace OpenSim.Services.AuthenticationService public string Authenticate(UUID principalID, string password, int lifetime) { - m_log.InfoFormat("[Authenticate]: Trying a web key authenticate"); if (new UUID(password) == UUID.Zero) { - m_log.InfoFormat("[Authenticate]: NULL_KEY is not a valid web_login_key"); + m_log.DebugFormat("[AUTH SERVICE]: UUID.Zero is not a valid web_login_key on PrincipalID {0}", principalID); } else { @@ -69,17 +68,19 @@ namespace OpenSim.Services.AuthenticationService { if (data.Data.ContainsKey("webLoginKey")) { - m_log.InfoFormat("[Authenticate]: Trying a web key authentication"); string key = data.Data["webLoginKey"].ToString(); - m_log.DebugFormat("[WEB LOGIN AUTH]: got {0} for key in db vs {1}", key, password); - if (key == password) - { - data.Data["webLoginKey"] = UUID.Zero.ToString(); - m_Database.Store(data); - return GetToken(principalID, lifetime); - } + if (key == password) + { + data.Data["webLoginKey"] = UUID.Zero.ToString(); + m_Database.Store(data); + return GetToken(principalID, lifetime); + } + else + { + m_log.DebugFormat("[AUTH SERVICE]: web login auth failed, got PrincipalID {0} gave {1} instead of {2}", principalID, password, key); + } }else{ - m_log.DebugFormat("[Authenticate]: no col webLoginKey in passwd.db"); + m_log.DebugFormat("[AUTH SERVICE]: no col webLoginKey in passwd.db"); } } m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID); diff --git a/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs index 3a47e97..c315ef2 100644 --- a/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs @@ -32,25 +32,27 @@ namespace OpenSim.Services.AuthenticationService { if (data.Data.ContainsKey("webLoginKey")) { + m_log.DebugFormat("[AUTH SERVICE]: Attempting web key authentication for PrincipalID {0}", principalID); svc = ServerUtils.LoadPlugin("OpenSim.Services.AuthenticationService.dll", "WebkeyAuthenticationService", args); result = svc.Authenticate(principalID, password, lifetime); if (result == String.Empty) { - m_log.DebugFormat("[Authenticate]: Web Login failed for PrincipalID {0}", principalID); + m_log.DebugFormat("[AUTH SERVICE]: Web Login failed for PrincipalID {0}", principalID); } } if (result == string.Empty && data.Data.ContainsKey("passwordHash") && data.Data.ContainsKey("passwordSalt")) { + m_log.DebugFormat("[AUTH SERVICE]: Attempting password authentication for PrincipalID {0}", principalID); svc = ServerUtils.LoadPlugin("OpenSim.Services.AuthenticationService.dll", "PasswordAuthenticationService", args); result = svc.Authenticate(principalID, password, lifetime); if (result == String.Empty) { - m_log.DebugFormat("[Authenticate]: Password login failed for PrincipalID {0}", principalID); + m_log.DebugFormat("[AUTH SERVICE]: Password login failed for PrincipalID {0}", principalID); } } if (result == string.Empty) { - m_log.DebugFormat("[AUTH SERVICE]: Both password and webLoginKey-based login failed for PrincipalID {0}", principalID); + m_log.DebugFormat("[AUTH SERVICE]: Both password and webLoginKey-based authentication failed for PrincipalID {0}", principalID); } } else -- cgit v1.1 From 361b3e7ab8313b89475bc644fdcd348e071b951a Mon Sep 17 00:00:00 2001 From: SignpostMarv Martin Date: Thu, 24 Mar 2011 17:04:29 +0000 Subject: Removing hard-coded plugin loading in favour of direct class instantiation --- .../WebkeyOrPasswordAuthenticationService.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs index c315ef2..15dc5be 100644 --- a/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs @@ -16,25 +16,25 @@ namespace OpenSim.Services.AuthenticationService { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IConfigSource config; + private Dictionary svc_checks; public WebkeyOrPasswordAuthenticationService(IConfigSource config) : base(config) { this.config = config; + svc_checks["web_login_key"] = new WebkeyAuthenticationService(config); + svc_checks["password"] = new PasswordAuthenticationService(config); } public string Authenticate(UUID principalID, string password, int lifetime) { AuthenticationData data = m_Database.Get(principalID); - IAuthenticationService svc; - Object[] args = new Object[] { config }; string result = String.Empty; if (data != null && data.Data != null) { if (data.Data.ContainsKey("webLoginKey")) { m_log.DebugFormat("[AUTH SERVICE]: Attempting web key authentication for PrincipalID {0}", principalID); - svc = ServerUtils.LoadPlugin("OpenSim.Services.AuthenticationService.dll", "WebkeyAuthenticationService", args); - result = svc.Authenticate(principalID, password, lifetime); + result = svc_checks["web_login_key"].Authenticate(principalID, password, lifetime); if (result == String.Empty) { m_log.DebugFormat("[AUTH SERVICE]: Web Login failed for PrincipalID {0}", principalID); @@ -43,8 +43,7 @@ namespace OpenSim.Services.AuthenticationService if (result == string.Empty && data.Data.ContainsKey("passwordHash") && data.Data.ContainsKey("passwordSalt")) { m_log.DebugFormat("[AUTH SERVICE]: Attempting password authentication for PrincipalID {0}", principalID); - svc = ServerUtils.LoadPlugin("OpenSim.Services.AuthenticationService.dll", "PasswordAuthenticationService", args); - result = svc.Authenticate(principalID, password, lifetime); + result = svc_checks["password"].Authenticate(principalID, password, lifetime); if (result == String.Empty) { m_log.DebugFormat("[AUTH SERVICE]: Password login failed for PrincipalID {0}", principalID); -- cgit v1.1 From de0730a54ca8b2ede0727212bfc2474c0eff979f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 26 Mar 2011 02:42:50 +0000 Subject: Add OpenSim.Server.Base reference in prebuild.xml. Initialize svc_checks dictionary in WebkeyOrPasswordAuthenticationService, which was what was causing the load failure. --- .../AuthenticationService/WebkeyOrPasswordAuthenticationService.cs | 5 ++++- prebuild.xml | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs index 15dc5be..bcfd03d 100644 --- a/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs @@ -15,8 +15,11 @@ namespace OpenSim.Services.AuthenticationService public class WebkeyOrPasswordAuthenticationService : AuthenticationServiceBase, IAuthenticationService { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private IConfigSource config; - private Dictionary svc_checks; + private Dictionary svc_checks + = new Dictionary(); + public WebkeyOrPasswordAuthenticationService(IConfigSource config) : base(config) { diff --git a/prebuild.xml b/prebuild.xml index fac3f20..c818908 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1059,6 +1059,7 @@ + -- cgit v1.1 From 83f48c26d62b148c11776af6d4947fc2397a675d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 26 Mar 2011 02:43:41 +0000 Subject: add header file --- .../WebkeyOrPasswordAuthenticationService.cs | 29 +++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs index bcfd03d..00056a6 100644 --- a/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs @@ -1,4 +1,31 @@ -using System; +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; using System.Collections.Generic; using OpenMetaverse; using OpenSim.Services.Interfaces; -- cgit v1.1 From 797128a6ad89ea4944074f99db0a30ad7a5e7a3d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 26 Mar 2011 02:44:46 +0000 Subject: Rename some member fields to standard m_ OpenSim code convention --- .../WebkeyOrPasswordAuthenticationService.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs index 00056a6..3590e12 100644 --- a/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/WebkeyOrPasswordAuthenticationService.cs @@ -43,16 +43,16 @@ namespace OpenSim.Services.AuthenticationService { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private IConfigSource config; - private Dictionary svc_checks + private IConfigSource m_config; + private Dictionary m_svcChecks = new Dictionary(); public WebkeyOrPasswordAuthenticationService(IConfigSource config) : base(config) { - this.config = config; - svc_checks["web_login_key"] = new WebkeyAuthenticationService(config); - svc_checks["password"] = new PasswordAuthenticationService(config); + this.m_config = config; + m_svcChecks["web_login_key"] = new WebkeyAuthenticationService(config); + m_svcChecks["password"] = new PasswordAuthenticationService(config); } public string Authenticate(UUID principalID, string password, int lifetime) @@ -64,7 +64,7 @@ namespace OpenSim.Services.AuthenticationService if (data.Data.ContainsKey("webLoginKey")) { m_log.DebugFormat("[AUTH SERVICE]: Attempting web key authentication for PrincipalID {0}", principalID); - result = svc_checks["web_login_key"].Authenticate(principalID, password, lifetime); + result = m_svcChecks["web_login_key"].Authenticate(principalID, password, lifetime); if (result == String.Empty) { m_log.DebugFormat("[AUTH SERVICE]: Web Login failed for PrincipalID {0}", principalID); @@ -73,7 +73,7 @@ namespace OpenSim.Services.AuthenticationService if (result == string.Empty && data.Data.ContainsKey("passwordHash") && data.Data.ContainsKey("passwordSalt")) { m_log.DebugFormat("[AUTH SERVICE]: Attempting password authentication for PrincipalID {0}", principalID); - result = svc_checks["password"].Authenticate(principalID, password, lifetime); + result = m_svcChecks["password"].Authenticate(principalID, password, lifetime); if (result == String.Empty) { m_log.DebugFormat("[AUTH SERVICE]: Password login failed for PrincipalID {0}", principalID); @@ -91,4 +91,4 @@ namespace OpenSim.Services.AuthenticationService return result; } } -} +} \ No newline at end of file -- cgit v1.1 From 435d72f10651b8c468aa40e866053672c991b210 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 26 Mar 2011 02:46:00 +0000 Subject: Add SignpostMarv to contributors --- CONTRIBUTORS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index a0af1ca..ef00c19 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -117,6 +117,7 @@ what it is today. * SachaMagne * Salahzar Stenvaag * sempuki +* SignpostMarv * Snoopy * Strawberry Fride * tglion -- cgit v1.1