From 613e6f07fcbe6f7c32938aca057f9890d2cda815 Mon Sep 17 00:00:00 2001 From: "dr scofield (aka dirk husemann)" Date: Wed, 12 Aug 2009 14:49:59 +0200 Subject: [PATCH 01/35] change 535cb0efc so that the default LLSD serialization format is llsd+xml instead of llsd+json --- the latter seems to break existing bots. this assumes that those bots that want llsd+json will properly signal that desire, if that is not the case, we need to revisit this. fixes mantis #3977. --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index c74eab1404..75c9310de0 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -964,8 +964,10 @@ namespace OpenSim.Framework.Servers.HttpServer } } - response.ContentType = "application/llsd+json"; - return Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(llsdResponse)); + // response.ContentType = "application/llsd+json"; + // return Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(llsdResponse)); + response.ContentType = "application/llsd+xml"; + return OSDParser.SerializeLLSDXmlBytes(llsdResponse); } /// From b3b506cba24f5c60afc2f4ed7a92e7a51e11eb4c Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 12 Aug 2009 09:31:33 -0700 Subject: [PATCH 02/35] Better test for dropping inventory cache and writing out debug messages. --- .../Inventory/InventoryCache.cs | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs index b4785f4139..3afaba5031 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs @@ -60,8 +60,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory // If not, go get them and place them in the cache Dictionary folders = GetSystemFolders(presence.UUID); - m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent, fetched system folders for {0} {1}: count {2}", - presence.Firstname, presence.Lastname, folders.Count); + m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}", + presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count); if (folders.Count > 0) lock (m_InventoryCache) m_InventoryCache.Add(presence.UUID, folders); @@ -69,25 +69,30 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory void OnClientClosed(UUID clientID, Scene scene) { - ScenePresence sp = null; - foreach (Scene s in m_Scenes) + if (m_InventoryCache.ContainsKey(clientID)) // if it's still in cache { - s.TryGetAvatar(clientID, out sp); - if ((sp != null) && !sp.IsChildAgent) + ScenePresence sp = null; + foreach (Scene s in m_Scenes) { - m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping system folders in cache", - scene.RegionInfo.RegionName, clientID); - return; + s.TryGetAvatar(clientID, out sp); + if ((sp != null) && !sp.IsChildAgent && (s != scene)) + { + m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping system folders in cache", + scene.RegionInfo.RegionName, clientID); + return; + } } + + // Drop system folders + lock (m_InventoryCache) + if (m_InventoryCache.ContainsKey(clientID)) + { + m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders", + scene.RegionInfo.RegionName, clientID); + + m_InventoryCache.Remove(clientID); + } } - - m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders", - scene.RegionInfo.RegionName, clientID); - // Drop system folders - lock (m_InventoryCache) - if (m_InventoryCache.ContainsKey(clientID)) - m_InventoryCache.Remove(clientID); - } public abstract Dictionary GetSystemFolders(UUID userID); From 41ad610f3e44d2c73451ab49b71e697259c8c965 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 12 Aug 2009 13:11:15 -0700 Subject: [PATCH 03/35] * Added two new packet handler implementations for inventory ops. This is starting to work! - but can't be activated incrementally, the flip needs to be global for all inventory ops. * Added a base inventory connector that does common processing of inventory among all reference connector implementations. E.g. AddItem requires additional processing before being forwarded to service. * Added if (m_Enabled) upon RemoveRegion --- OpenSim/Framework/InventoryFolderBase.cs | 19 ++ .../Inventory/BaseInventoryConnector.cs | 179 ++++++++++++++++++ .../Inventory/HGInventoryBroker.cs | 52 ++--- .../Inventory/InventoryCache.cs | 9 +- .../LocalInventoryServiceConnector.cs | 52 ++--- .../RemoteInventoryServiceConnector.cs | 52 ++--- .../Framework/Scenes/Scene.PacketHandlers.cs | 31 ++- OpenSim/Region/Framework/Scenes/Scene.cs | 6 +- 8 files changed, 323 insertions(+), 77 deletions(-) create mode 100644 OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs diff --git a/OpenSim/Framework/InventoryFolderBase.cs b/OpenSim/Framework/InventoryFolderBase.cs index e923f3912c..05f11a491c 100644 --- a/OpenSim/Framework/InventoryFolderBase.cs +++ b/OpenSim/Framework/InventoryFolderBase.cs @@ -68,5 +68,24 @@ namespace OpenSim.Framework get { return _version; } set { _version = value; } } + + public InventoryFolderBase() + { + } + + public InventoryFolderBase(UUID id) + { + ID = id; + } + + public InventoryFolderBase(UUID id, string name, UUID owner, short type, UUID parent, ushort version) + { + ID = id; + Name = name; + Owner = owner; + Type = type; + ParentID = parent; + Version = version; + } } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs new file mode 100644 index 0000000000..f2b736c67b --- /dev/null +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs @@ -0,0 +1,179 @@ +using System; +using System.Collections.Generic; + +using OpenMetaverse; +using Nini.Config; +using log4net; + +using OpenSim.Framework; +using OpenSim.Services.Interfaces; + + +namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory +{ + public abstract class BaseInventoryConnector : IInventoryService + { + protected InventoryCache m_cache; + + protected virtual void Init(IConfigSource source) + { + m_cache = new InventoryCache(); + m_cache.Init(source, this); + } + + /// + /// Create the entire inventory for a given user + /// + /// + /// + public abstract bool CreateUserInventory(UUID user); + + /// + /// Gets the skeleton of the inventory -- folders only + /// + /// + /// + public abstract List GetInventorySkeleton(UUID userId); + + /// + /// Synchronous inventory fetch. + /// + /// + /// + public abstract InventoryCollection GetUserInventory(UUID userID); + + /// + /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the + /// inventory has been received + /// + /// + /// + public abstract void GetUserInventory(UUID userID, InventoryReceiptCallback callback); + + /// + /// Retrieve the root inventory folder for the given user. + /// + /// + /// null if no root folder was found + public abstract InventoryFolderBase GetRootFolder(UUID userID); + + public abstract Dictionary GetSystemFolders(UUID userID); + + /// + /// Gets the user folder for the given folder-type + /// + /// + /// + /// + public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) + { + return m_cache.GetFolderForType(userID, type); + } + + /// + /// Gets everything (folders and items) inside a folder + /// + /// + /// + /// + public abstract InventoryCollection GetFolderContent(UUID userID, UUID folderID); + + /// + /// Gets the items inside a folder + /// + /// + /// + /// + public abstract List GetFolderItems(UUID userID, UUID folderID); + + /// + /// Add a new folder to the user's inventory + /// + /// + /// true if the folder was successfully added + public abstract bool AddFolder(InventoryFolderBase folder); + + /// + /// Update a folder in the user's inventory + /// + /// + /// true if the folder was successfully updated + public abstract bool UpdateFolder(InventoryFolderBase folder); + + /// + /// Move an inventory folder to a new location + /// + /// A folder containing the details of the new location + /// true if the folder was successfully moved + public abstract bool MoveFolder(InventoryFolderBase folder); + + /// + /// Purge an inventory folder of all its items and subfolders. + /// + /// + /// true if the folder was successfully purged + public abstract bool PurgeFolder(InventoryFolderBase folder); + + /// + /// Add a new item to the user's inventory. + /// If the given item has to parent folder, it tries to find the most + /// suitable folder for it. + /// + /// + /// true if the item was successfully added + public bool AddItem(InventoryItemBase item) + { + if (item.Folder == UUID.Zero) + { + InventoryFolderBase f = GetFolderForType(item.Owner, (AssetType)item.AssetType); + if (f != null) + item.Folder = f.ID; + else + { + f = GetRootFolder(item.Owner); + if (f != null) + item.Folder = f.ID; + else + return false; + } + } + + return AddItemPlain(item); + } + + protected abstract bool AddItemPlain(InventoryItemBase item); + + /// + /// Update an item in the user's inventory + /// + /// + /// true if the item was successfully updated + public abstract bool UpdateItem(InventoryItemBase item); + + /// + /// Delete an item from the user's inventory + /// + /// + /// true if the item was successfully deleted + public abstract bool DeleteItem(InventoryItemBase item); + + public abstract InventoryItemBase QueryItem(InventoryItemBase item); + + public abstract InventoryFolderBase QueryFolder(InventoryFolderBase folder); + + /// + /// Does the given user have an inventory structure? + /// + /// + /// + public abstract bool HasInventoryForUser(UUID userID); + + /// + /// Get the active gestures of the agent. + /// + /// + /// + public abstract List GetActiveGestures(UUID userId); + + } +} diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index d4168fe7f7..62b9bed67d 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -41,7 +41,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { - public class HGInventoryBroker : InventoryCache, ISharedRegionModule, IInventoryService + public class HGInventoryBroker : BaseInventoryConnector, ISharedRegionModule, IInventoryService { private static readonly ILog m_log = LogManager.GetLogger( @@ -138,7 +138,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { } - public override void AddRegion(Scene scene) + public void AddRegion(Scene scene) { if (!m_Enabled) return; @@ -156,12 +156,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } scene.RegisterModuleInterface(this); - base.AddRegion(scene); + m_cache.AddRegion(scene); } - public override void RemoveRegion(Scene scene) + public void RemoveRegion(Scene scene) { - base.RemoveRegion(scene); + if (!m_Enabled) + return; + + m_cache.RemoveRegion(scene); } public void RegionLoaded(Scene scene) @@ -175,17 +178,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory #region IInventoryService - public bool CreateUserInventory(UUID userID) + public override bool CreateUserInventory(UUID userID) { return m_GridService.CreateUserInventory(userID); } - public List GetInventorySkeleton(UUID userId) + public override List GetInventorySkeleton(UUID userId) { return m_GridService.GetInventorySkeleton(userId); } - public InventoryCollection GetUserInventory(UUID userID) + public override InventoryCollection GetUserInventory(UUID userID) { if (IsLocalGridUser(userID)) return m_GridService.GetUserInventory(userID); @@ -193,7 +196,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return null; } - public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) + public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback) { if (IsLocalGridUser(userID)) m_GridService.GetUserInventory(userID, callback); @@ -220,7 +223,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory // } //} - public InventoryCollection GetFolderContent(UUID userID, UUID folderID) + public override InventoryCollection GetFolderContent(UUID userID, UUID folderID) { if (IsLocalGridUser(userID)) return m_GridService.GetFolderContent(userID, folderID); @@ -271,12 +274,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return new Dictionary(); } - public List GetFolderItems(UUID userID, UUID folderID) + public override List GetFolderItems(UUID userID, UUID folderID) { return new List(); } - public bool AddFolder(InventoryFolderBase folder) + public override bool AddFolder(InventoryFolderBase folder) { if (folder == null) return false; @@ -291,7 +294,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public bool UpdateFolder(InventoryFolderBase folder) + public override bool UpdateFolder(InventoryFolderBase folder) { if (folder == null) return false; @@ -306,7 +309,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public bool MoveFolder(InventoryFolderBase folder) + public override bool MoveFolder(InventoryFolderBase folder) { if (folder == null) return false; @@ -321,7 +324,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public bool PurgeFolder(InventoryFolderBase folder) + public override bool PurgeFolder(InventoryFolderBase folder) { if (folder == null) return false; @@ -336,7 +339,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public bool AddItem(InventoryItemBase item) + // public bool AddItem(InventoryItemBase item) inherited + // Uses AddItemPlain + + protected override bool AddItemPlain(InventoryItemBase item) { if (item == null) return false; @@ -351,7 +357,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public bool UpdateItem(InventoryItemBase item) + public override bool UpdateItem(InventoryItemBase item) { if (item == null) return false; @@ -366,7 +372,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public bool DeleteItem(InventoryItemBase item) + public override bool DeleteItem(InventoryItemBase item) { if (item == null) return false; @@ -381,7 +387,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public InventoryItemBase QueryItem(InventoryItemBase item) + public override InventoryItemBase QueryItem(InventoryItemBase item) { if (item == null) return null; @@ -396,7 +402,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public InventoryFolderBase QueryFolder(InventoryFolderBase folder) + public override InventoryFolderBase QueryFolder(InventoryFolderBase folder) { if (folder == null) return null; @@ -411,17 +417,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public bool HasInventoryForUser(UUID userID) + public override bool HasInventoryForUser(UUID userID) { return false; } - public InventoryFolderBase GetRootFolder(UUID userID) + public override InventoryFolderBase GetRootFolder(UUID userID) { return null; } - public List GetActiveGestures(UUID userId) + public override List GetActiveGestures(UUID userId) { return new List(); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs index 3afaba5031..551a7ebf12 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs @@ -12,21 +12,23 @@ using log4net; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { - public abstract class InventoryCache + public class InventoryCache { private static readonly ILog m_log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); + protected BaseInventoryConnector m_Connector; protected List m_Scenes; // The cache proper protected Dictionary> m_InventoryCache; - protected virtual void Init(IConfigSource source) + public virtual void Init(IConfigSource source, BaseInventoryConnector connector) { m_Scenes = new List(); m_InventoryCache = new Dictionary>(); + m_Connector = connector; } public virtual void AddRegion(Scene scene) @@ -59,7 +61,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } // If not, go get them and place them in the cache - Dictionary folders = GetSystemFolders(presence.UUID); + Dictionary folders = m_Connector.GetSystemFolders(presence.UUID); m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}", presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count); if (folders.Count > 0) @@ -95,7 +97,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public abstract Dictionary GetSystemFolders(UUID userID); public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 98e30ced5b..6efe90344a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -41,7 +41,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { - public class LocalInventoryServicesConnector : InventoryCache, ISharedRegionModule, IInventoryService + public class LocalInventoryServicesConnector : BaseInventoryConnector, ISharedRegionModule, IInventoryService { private static readonly ILog m_log = LogManager.GetLogger( @@ -124,7 +124,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { } - public override void AddRegion(Scene scene) + public void AddRegion(Scene scene) { if (!m_Enabled) return; @@ -141,12 +141,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory // "[INVENTORY CONNECTOR]: Registering IInventoryService to scene {0}", scene.RegionInfo.RegionName); scene.RegisterModuleInterface(this); - base.AddRegion(scene); + m_cache.AddRegion(scene); } - public override void RemoveRegion(Scene scene) + public void RemoveRegion(Scene scene) { - base.RemoveRegion(scene); + if (!m_Enabled) + return; + + m_cache.RemoveRegion(scene); } public void RegionLoaded(Scene scene) @@ -160,22 +163,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory #region IInventoryService - public bool CreateUserInventory(UUID user) + public override bool CreateUserInventory(UUID user) { return m_InventoryService.CreateUserInventory(user); } - public List GetInventorySkeleton(UUID userId) + public override List GetInventorySkeleton(UUID userId) { return m_InventoryService.GetInventorySkeleton(userId); } - public InventoryCollection GetUserInventory(UUID id) + public override InventoryCollection GetUserInventory(UUID id) { return m_InventoryService.GetUserInventory(id); } - public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) + public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback) { m_InventoryService.GetUserInventory(userID, callback); } @@ -207,13 +210,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return new Dictionary(); } - public InventoryCollection GetFolderContent(UUID userID, UUID folderID) + public override InventoryCollection GetFolderContent(UUID userID, UUID folderID) { return m_InventoryService.GetFolderContent(userID, folderID); } - public List GetFolderItems(UUID userID, UUID folderID) + public override List GetFolderItems(UUID userID, UUID folderID) { return m_InventoryService.GetFolderItems(userID, folderID); } @@ -223,7 +226,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// /// /// true if the folder was successfully added - public bool AddFolder(InventoryFolderBase folder) + public override bool AddFolder(InventoryFolderBase folder) { return m_InventoryService.AddFolder(folder); } @@ -233,7 +236,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// /// /// true if the folder was successfully updated - public bool UpdateFolder(InventoryFolderBase folder) + public override bool UpdateFolder(InventoryFolderBase folder) { return m_InventoryService.UpdateFolder(folder); } @@ -243,7 +246,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// /// A folder containing the details of the new location /// true if the folder was successfully moved - public bool MoveFolder(InventoryFolderBase folder) + public override bool MoveFolder(InventoryFolderBase folder) { return m_InventoryService.MoveFolder(folder); } @@ -253,17 +256,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// /// /// true if the folder was successfully purged - public bool PurgeFolder(InventoryFolderBase folder) + public override bool PurgeFolder(InventoryFolderBase folder) { return m_InventoryService.PurgeFolder(folder); } /// - /// Add a new item to the user's inventory + /// Add a new item to the user's inventory, plain + /// Called by base class AddItem /// /// /// true if the item was successfully added - public bool AddItem(InventoryItemBase item) + protected override bool AddItemPlain(InventoryItemBase item) { return m_InventoryService.AddItem(item); } @@ -273,7 +277,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// /// /// true if the item was successfully updated - public bool UpdateItem(InventoryItemBase item) + public override bool UpdateItem(InventoryItemBase item) { return m_InventoryService.UpdateItem(item); } @@ -283,17 +287,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// /// /// true if the item was successfully deleted - public bool DeleteItem(InventoryItemBase item) + public override bool DeleteItem(InventoryItemBase item) { return m_InventoryService.DeleteItem(item); } - public InventoryItemBase QueryItem(InventoryItemBase item) + public override InventoryItemBase QueryItem(InventoryItemBase item) { return m_InventoryService.QueryItem(item); } - public InventoryFolderBase QueryFolder(InventoryFolderBase folder) + public override InventoryFolderBase QueryFolder(InventoryFolderBase folder) { return m_InventoryService.QueryFolder(folder); } @@ -303,7 +307,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// /// /// - public bool HasInventoryForUser(UUID userID) + public override bool HasInventoryForUser(UUID userID) { return m_InventoryService.HasInventoryForUser(userID); } @@ -313,12 +317,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory /// /// /// null if no root folder was found - public InventoryFolderBase GetRootFolder(UUID userID) + public override InventoryFolderBase GetRootFolder(UUID userID) { return m_InventoryService.GetRootFolder(userID); } - public List GetActiveGestures(UUID userId) + public override List GetActiveGestures(UUID userId) { return m_InventoryService.GetActiveGestures(userId); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs index dceda3821b..f87aab9f3a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs @@ -40,7 +40,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { - public class RemoteInventoryServicesConnector : InventoryCache, ISharedRegionModule, IInventoryService + public class RemoteInventoryServicesConnector : BaseInventoryConnector, ISharedRegionModule, IInventoryService { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory { } - public override void AddRegion(Scene scene) + public void AddRegion(Scene scene) { if (!m_Enabled) return; @@ -117,12 +117,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } scene.RegisterModuleInterface(this); - base.AddRegion(scene); + m_cache.AddRegion(scene); } - public override void RemoveRegion(Scene scene) + public void RemoveRegion(Scene scene) { - base.RemoveRegion(scene); + if (!m_Enabled) + return; + + m_cache.RemoveRegion(scene); } public void RegionLoaded(Scene scene) @@ -138,22 +141,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory #region IInventoryService - public bool CreateUserInventory(UUID user) + public override bool CreateUserInventory(UUID user) { return false; } - public List GetInventorySkeleton(UUID userId) + public override List GetInventorySkeleton(UUID userId) { return new List(); } - public InventoryCollection GetUserInventory(UUID userID) + public override InventoryCollection GetUserInventory(UUID userID) { return null; } - public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) + public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback) { UUID sessionID = GetSessionID(userID); try @@ -180,7 +183,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.GetSystemFolders(userID.ToString(), sessionID); } - public InventoryCollection GetFolderContent(UUID userID, UUID folderID) + public override InventoryCollection GetFolderContent(UUID userID, UUID folderID) { UUID sessionID = GetSessionID(userID); try @@ -199,12 +202,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return nullCollection; } - public List GetFolderItems(UUID userID, UUID folderID) + public override List GetFolderItems(UUID userID, UUID folderID) { return new List(); } - public bool AddFolder(InventoryFolderBase folder) + public override bool AddFolder(InventoryFolderBase folder) { if (folder == null) return false; @@ -213,7 +216,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.AddFolder(folder.Owner.ToString(), folder, sessionID); } - public bool UpdateFolder(InventoryFolderBase folder) + public override bool UpdateFolder(InventoryFolderBase folder) { if (folder == null) return false; @@ -222,7 +225,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.UpdateFolder(folder.Owner.ToString(), folder, sessionID); } - public bool MoveFolder(InventoryFolderBase folder) + public override bool MoveFolder(InventoryFolderBase folder) { if (folder == null) return false; @@ -231,7 +234,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.MoveFolder(folder.Owner.ToString(), folder, sessionID); } - public bool PurgeFolder(InventoryFolderBase folder) + public override bool PurgeFolder(InventoryFolderBase folder) { if (folder == null) return false; @@ -240,7 +243,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.PurgeFolder(folder.Owner.ToString(), folder, sessionID); } - public bool AddItem(InventoryItemBase item) + // public bool AddItem(InventoryItemBase item) inherited + // Uses AddItemPlain + + protected override bool AddItemPlain(InventoryItemBase item) { if (item == null) return false; @@ -249,7 +255,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.AddItem(item.Owner.ToString(), item, sessionID); } - public bool UpdateItem(InventoryItemBase item) + public override bool UpdateItem(InventoryItemBase item) { if (item == null) return false; @@ -258,7 +264,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.UpdateItem(item.Owner.ToString(), item, sessionID); } - public bool DeleteItem(InventoryItemBase item) + public override bool DeleteItem(InventoryItemBase item) { if (item == null) return false; @@ -267,7 +273,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.DeleteItem(item.Owner.ToString(), item, sessionID); } - public InventoryItemBase QueryItem(InventoryItemBase item) + public override InventoryItemBase QueryItem(InventoryItemBase item) { if (item == null) return null; @@ -276,7 +282,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.QueryItem(item.Owner.ToString(), item, sessionID); } - public InventoryFolderBase QueryFolder(InventoryFolderBase folder) + public override InventoryFolderBase QueryFolder(InventoryFolderBase folder) { if (folder == null) return null; @@ -285,17 +291,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.QueryFolder(folder.Owner.ToString(), folder, sessionID); } - public bool HasInventoryForUser(UUID userID) + public override bool HasInventoryForUser(UUID userID) { return false; } - public InventoryFolderBase GetRootFolder(UUID userID) + public override InventoryFolderBase GetRootFolder(UUID userID) { return null; } - public List GetActiveGestures(UUID userId) + public override List GetActiveGestures(UUID userId) { return new List(); } diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 9251aa680d..113918dbf3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -622,8 +622,26 @@ namespace OpenSim.Region.Framework.Scenes "[AGENT INVENTORY]: Failed to move folder {0} to {1} for user {2}", folderID, parentID, remoteClient.Name); } + } + + public void HandleMoveInventoryFolder2(IClientAPI remoteClient, UUID folderID, UUID parentID) + { + InventoryFolderBase folder = new InventoryFolderBase(folderID); + folder = InventoryService.QueryFolder(folder); + if (folder != null) + { + folder.ParentID = parentID; + if (!InventoryService.MoveFolder(folder)) + m_log.WarnFormat("[AGENT INVENTORY]: could not move folder {0}", folderID); + else + m_log.DebugFormat("[AGENT INVENTORY]: folder {0} moved to parent {1}", folderID, parentID); + } + else + { + m_log.WarnFormat("[AGENT INVENTORY]: request to move folder {0} but folder not found", folderID); + } } - + /// /// This should delete all the items and folders in the given directory. /// @@ -647,6 +665,17 @@ namespace OpenSim.Region.Framework.Scenes "[AGENT INVENTORY]: Failed to purge folder for user {0} {1}", remoteClient.Name, remoteClient.AgentId); } + } + + public void HandlePurgeInventoryDescendents2(IClientAPI remoteClient, UUID folderID) + { + InventoryFolderBase folder = new InventoryFolderBase(folderID); + + if (InventoryService.PurgeFolder(folder)) + m_log.DebugFormat("[AGENT INVENTORY]: folder {0} purged successfully", folderID); + else + m_log.WarnFormat("[AGENT INVENTORY]: could not purge folder {0}", folderID); } + } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7f1936e2eb..919075c1bd 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2019,12 +2019,13 @@ namespace OpenSim.Region.Framework.Scenes client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; client.OnObjectPermissions += HandleObjectPermissionsUpdate; + client.OnCreateNewInventoryItem += CreateNewInventoryItem; client.OnCreateNewInventoryFolder += HandleCreateInventoryFolder; client.OnUpdateInventoryFolder += HandleUpdateInventoryFolder; - client.OnMoveInventoryFolder += HandleMoveInventoryFolder; + client.OnMoveInventoryFolder += HandleMoveInventoryFolder; // 2; //!! client.OnFetchInventoryDescendents += HandleFetchInventoryDescendents; - client.OnPurgeInventoryDescendents += HandlePurgeInventoryDescendents; + client.OnPurgeInventoryDescendents += HandlePurgeInventoryDescendents; // 2; //!! client.OnFetchInventory += HandleFetchInventory; client.OnUpdateInventoryItem += UpdateInventoryItemAsset; client.OnCopyInventoryItem += CopyInventoryItem; @@ -2036,6 +2037,7 @@ namespace OpenSim.Region.Framework.Scenes client.OnRemoveTaskItem += RemoveTaskInventory; client.OnUpdateTaskInventory += UpdateTaskInventory; client.OnMoveTaskItem += ClientMoveTaskInventoryItem; + client.OnGrabObject += ProcessObjectGrab; client.OnDeGrabObject += ProcessObjectDeGrab; client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; From 50f29752f5888ac194a5146c475720c29ae3f172 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Thu, 13 Aug 2009 11:48:39 +0900 Subject: [PATCH 04/35] Formatting cleanup. Add copyright headers. --- .../Framework/Servers/BaseOpenSimServer.cs | 2 +- .../Inventory/BaseInventoryConnector.cs | 29 ++++++++++++++++++- .../Inventory/InventoryCache.cs | 29 ++++++++++++++++++- .../Tests/Common/Mock/TestInventoryService.cs | 29 ++++++++++++++++++- 4 files changed, 85 insertions(+), 4 deletions(-) diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 2a975284ed..7a244ff2ef 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -443,7 +443,7 @@ namespace OpenSim.Framework.Servers string inputLine; int strcmp; - if (File.Exists( gitCommitFileName)) + if (File.Exists(gitCommitFileName)) { StreamReader CommitFile = File.OpenText(gitCommitFileName); buildVersion = Environment.NewLine + "git# " + CommitFile.ReadLine(); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs index f2b736c67b..375faf59a3 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.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; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs index 551a7ebf12..c16e92e22a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.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 System.Reflection; diff --git a/OpenSim/Tests/Common/Mock/TestInventoryService.cs b/OpenSim/Tests/Common/Mock/TestInventoryService.cs index 0c1916442d..6635700e00 100644 --- a/OpenSim/Tests/Common/Mock/TestInventoryService.cs +++ b/OpenSim/Tests/Common/Mock/TestInventoryService.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 System.Text; using OpenSim.Framework; From b47e405420b316a2f68b3e6f4c5ed35dc713260e Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Wed, 12 Aug 2009 22:54:57 -0400 Subject: [PATCH 05/35] * minor: Comments --- OpenSim/Region/Application/Application.cs | 33 ++++++- .../Region/Application/ConfigurationLoader.cs | 45 ++++++++- .../Region/Application/IApplicationPlugin.cs | 12 +++ OpenSim/Region/Application/OpenSim.cs | 95 ++++++++++++++++++- 4 files changed, 181 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index ad157c611d..df8029046a 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -36,25 +36,47 @@ using OpenSim.Framework.Console; namespace OpenSim { + /// + /// Starting class for the OpenSimulator Region + /// public class Application { + /// + /// Text Console Logger + /// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// + /// Path to the main ini Configuration file + /// public static string iniFilePath = ""; + /// + /// Save Crashes in the bin/crashes folder. Configurable with m_crashDir + /// public static bool m_saveCrashDumps = false; + + /// + /// Directory to save crash reports to. Relative to bin/ + /// public static string m_crashDir = "crashes"; + /// + /// Instance of the OpenSim class. This could be OpenSim or OpenSimBackground depending on the configuration + /// protected static OpenSimBase m_sim = null; //could move our main function into OpenSimMain and kill this class public static void Main(string[] args) { - // First line + // First line, hook the appdomain to the crash reporter AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); + // Add the arguments supplied when running the application to the configuration ArgvConfigSource configSource = new ArgvConfigSource(args); + + // Configure Log4Net configSource.AddSwitch("Startup", "logconfig"); string logConfigFile = configSource.Configs["Startup"].GetString("logconfig", String.Empty); if (logConfigFile != String.Empty) @@ -69,6 +91,8 @@ namespace OpenSim m_log.Info("[OPENSIM MAIN]: configured log4net using default OpenSim.exe.config"); } + // Check if the system is compatible with OpenSimulator. + // Ensures that the minimum system requirements are met m_log.Info("Performing compatibility checks... "); string supported = String.Empty; if (Util.IsEnvironmentSupported(ref supported)) @@ -80,6 +104,7 @@ namespace OpenSim m_log.Warn("Environment is unsupported (" + supported + ")\n"); } + // Configure nIni aliases and localles Culture.SetCurrentCulture(); @@ -99,8 +124,13 @@ namespace OpenSim configSource.AddConfig("StandAlone"); configSource.AddConfig("Network"); + // Check if we're running in the background or not bool background = configSource.Configs["Startup"].GetBoolean("background", false); + + // Check if we're saving crashes m_saveCrashDumps = configSource.Configs["Startup"].GetBoolean("save_crashes", false); + + // load Crash directory config m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir); if (background) @@ -118,6 +148,7 @@ namespace OpenSim { try { + // Block thread here for input MainConsole.Instance.Prompt(); } catch (Exception e) diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs index 3a6524275d..c3e7b867bc 100644 --- a/OpenSim/Region/Application/ConfigurationLoader.cs +++ b/OpenSim/Region/Application/ConfigurationLoader.cs @@ -37,12 +37,32 @@ using OpenSim.Framework; namespace OpenSim { + /// + /// Loads the Configuration files into nIni + /// public class ConfigurationLoader { + /// + /// Various Config settings the region needs to start + /// Physics Engine, Mesh Engine, GridMode, PhysicsPrim allowed, Neighbor, + /// StorageDLL, Storage Connection String, Estate connection String, Client Stack + /// Standalone settings. + /// protected ConfigSettings m_configSettings; + + /// + /// A source of Configuration data + /// protected OpenSimConfigSource m_config; + + /// + /// Grid Service Information. This refers to classes and addresses of the grid service + /// protected NetworkServersInfo m_networkServersInfo; + /// + /// Console logger + /// private static readonly ILog m_log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); @@ -51,6 +71,13 @@ namespace OpenSim { } + /// + /// Loads the region configuration + /// + /// Parameters passed into the process when started + /// + /// + /// A configuration that gets passed to modules public OpenSimConfigSource LoadConfigSettings( IConfigSource argvSource, out ConfigSettings configSettings, out NetworkServersInfo networkInfo) @@ -169,15 +196,22 @@ namespace OpenSim return m_config; } + /// + /// Adds the included files as ini configuration files + /// + /// List of URL strings or filename strings private void AddIncludes(List sources) { + //loop over config sources foreach (IConfig config in m_config.Source.Configs) { + // Look for Include-* in the key name string[] keys = config.GetKeys(); foreach (string k in keys) { if (k.StartsWith("Include-")) { + // read the config file to be included. string file = config.GetString(k); if (IsUri(file)) { @@ -199,7 +233,11 @@ namespace OpenSim } } } - + /// + /// Check if we can convert the string to a URI + /// + /// String uri to the remote resource + /// true if we can convert the string to a Uri object bool IsUri(string file) { Uri configUri; @@ -253,7 +291,7 @@ namespace OpenSim /// /// Setup a default config values in case they aren't present in the ini file /// - /// + /// A Configuration source containing the default configuration private static IConfigSource DefaultConfig() { IConfigSource defaultConfig = new IniConfigSource(); @@ -322,6 +360,9 @@ namespace OpenSim return defaultConfig; } + /// + /// Read initial region settings from the ConfigSource + /// protected virtual void ReadConfigSettings() { IConfig startupConfig = m_config.Source.Configs["Startup"]; diff --git a/OpenSim/Region/Application/IApplicationPlugin.cs b/OpenSim/Region/Application/IApplicationPlugin.cs index 1e1dae04b2..6e6d48c51f 100644 --- a/OpenSim/Region/Application/IApplicationPlugin.cs +++ b/OpenSim/Region/Application/IApplicationPlugin.cs @@ -29,12 +29,24 @@ using OpenSim.Framework; namespace OpenSim { + /// + /// OpenSimulator Application Plugin framework interface + /// public interface IApplicationPlugin : IPlugin { + /// + /// Initialize the Plugin + /// + /// The Application instance void Initialise(OpenSimBase openSim); + + /// + /// Called when the application loading is completed + /// void PostInitialise(); } + public class ApplicationPluginInitialiser : PluginInitialiserBase { private OpenSimBase server; diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index aeb6f57b1d..390cfcd020 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -146,6 +146,9 @@ namespace OpenSim ChangeSelectedRegion("region", new string[] {"change", "region", "root"}); } + /// + /// Register standard set of region console commands + /// private void RegisterConsoleCommands() { m_console.Commands.AddCommand("region", false, "clear assets", @@ -332,6 +335,11 @@ namespace OpenSim base.ShutdownSpecific(); } + /// + /// Timer to run a specific text file as console commands. Configured in in the main ini file + /// + /// + /// private void RunAutoTimerScript(object sender, EventArgs e) { if (m_timedScript != "disabled") @@ -342,6 +350,11 @@ namespace OpenSim #region Console Commands + /// + /// Kicks users off the region + /// + /// + /// name of avatar to kick private void KickUserCommand(string module, string[] cmdparams) { if (cmdparams.Length < 4) @@ -401,6 +414,10 @@ namespace OpenSim } } + /// + /// Opens a file and uses it as input to the console command parser. + /// + /// name of file to use as input to the console private static void PrintFileToConsole(string fileName) { if (File.Exists(fileName)) @@ -419,12 +436,22 @@ namespace OpenSim m_log.Info("Not implemented."); } + /// + /// Force resending of all updates to all clients in active region(s) + /// + /// + /// private void HandleForceUpdate(string module, string[] args) { m_log.Info("Updating all clients"); m_sceneManager.ForceCurrentSceneClientUpdate(); } + /// + /// Edits the scale of a primative with the name specified + /// + /// + /// 0,1, name, x, y, z private void HandleEditScale(string module, string[] args) { if (args.Length == 6) @@ -437,6 +464,11 @@ namespace OpenSim } } + /// + /// Creates a new region based on the parameters specified. This will ask the user questions on the console + /// + /// + /// 0,1,region name, region XML file private void HandleCreateRegion(string module, string[] cmd) { if (cmd.Length < 4) @@ -473,16 +505,32 @@ namespace OpenSim } } + /// + /// Enable logins + /// + /// + /// private void HandleLoginEnable(string module, string[] cmd) { ProcessLogin(true); } + + /// + /// Disable logins + /// + /// + /// private void HandleLoginDisable(string module, string[] cmd) { ProcessLogin(false); } + /// + /// Log login status to the console + /// + /// + /// private void HandleLoginStatus(string module, string[] cmd) { if (m_commsManager.GridService.RegionLoginsEnabled == false) @@ -492,6 +540,12 @@ namespace OpenSim m_log.Info("[ Login ] Login are enabled"); } + + /// + /// Change and load configuration file data. + /// + /// + /// private void HandleConfig(string module, string[] cmd) { List args = new List(cmd); @@ -557,6 +611,12 @@ namespace OpenSim } } + + /// + /// Load, Unload, and list Region modules in use + /// + /// + /// private void HandleModules(string module, string[] cmd) { List args = new List(cmd); @@ -797,6 +857,11 @@ namespace OpenSim } // see BaseOpenSimServer + /// + /// Many commands list objects for debugging. Some of the types are listed here + /// + /// + /// public override void HandleShow(string mod, string[] cmd) { base.HandleShow(mod, cmd); @@ -902,6 +967,10 @@ namespace OpenSim } } + /// + /// print UDP Queue data for each client + /// + /// private string GetQueuesReport() { string report = String.Empty; @@ -1010,6 +1079,11 @@ namespace OpenSim m_commsManager.UserAdminService.ResetUserPassword(firstName, lastName, newPassword); } + /// + /// Use XML2 format to serialize data to a file + /// + /// + /// protected void SavePrimsXml2(string module, string[] cmdparams) { if (cmdparams.Length > 5) @@ -1022,6 +1096,11 @@ namespace OpenSim } } + /// + /// Use XML format to serialize data to a file + /// + /// + /// protected void SaveXml(string module, string[] cmdparams) { m_log.Error("[CONSOLE]: PLEASE NOTE, save-xml is DEPRECATED and may be REMOVED soon. If you are using this and there is some reason you can't use save-xml2, please file a mantis detailing the reason."); @@ -1036,6 +1115,11 @@ namespace OpenSim } } + /// + /// Loads data and region objects from XML format. + /// + /// + /// protected void LoadXml(string module, string[] cmdparams) { m_log.Error("[CONSOLE]: PLEASE NOTE, load-xml is DEPRECATED and may be REMOVED soon. If you are using this and there is some reason you can't use load-xml2, please file a mantis detailing the reason."); @@ -1079,7 +1163,11 @@ namespace OpenSim } } } - + /// + /// Serialize region data to XML2Format + /// + /// + /// protected void SaveXml2(string module, string[] cmdparams) { if (cmdparams.Length > 2) @@ -1092,6 +1180,11 @@ namespace OpenSim } } + /// + /// Load region data from Xml2Format + /// + /// + /// protected void LoadXml2(string module, string[] cmdparams) { if (cmdparams.Length > 2) From 18634e9dd8464ee7514587d0645e38f529f0bb3e Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Wed, 12 Aug 2009 23:18:00 -0400 Subject: [PATCH 06/35] minor: comments --- OpenSim/Client/Linden/LLClientStackModule.cs | 6 ++ OpenSim/Framework/ACL.cs | 19 ++++++ OpenSim/Framework/AgentCircuitData.cs | 68 ++++++++++++++++++++ OpenSim/Framework/AgentUpdateArgs.cs | 34 ++++++++++ 4 files changed, 127 insertions(+) diff --git a/OpenSim/Client/Linden/LLClientStackModule.cs b/OpenSim/Client/Linden/LLClientStackModule.cs index a9649894ea..f882d5d301 100644 --- a/OpenSim/Client/Linden/LLClientStackModule.cs +++ b/OpenSim/Client/Linden/LLClientStackModule.cs @@ -41,12 +41,18 @@ using OpenSim.Region.Framework.Interfaces; namespace OpenSim.Client.Linden { + /// + /// Linden UDP Stack Region Module + /// public class LLClientStackModule : INonSharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); #region IRegionModule Members + /// + /// Scene that contains the region's data + /// protected Scene m_scene; protected bool m_createClientStack = false; protected IClientNetworkServer m_clientServer; diff --git a/OpenSim/Framework/ACL.cs b/OpenSim/Framework/ACL.cs index 9d7827e752..3b1c0f0f63 100644 --- a/OpenSim/Framework/ACL.cs +++ b/OpenSim/Framework/ACL.cs @@ -46,6 +46,11 @@ namespace OpenSim.Framework private Dictionary Resources = new Dictionary(); private Dictionary Roles = new Dictionary(); + /// + /// Adds a new role + /// + /// + /// public ACL AddRole(Role role) { if (Roles.ContainsKey(role.Name)) @@ -56,6 +61,11 @@ namespace OpenSim.Framework return this; } + /// + /// Adds a new resource + /// + /// + /// public ACL AddResource(Resource resource) { Resources.Add(resource.Name, resource); @@ -63,6 +73,12 @@ namespace OpenSim.Framework return this; } + /// + /// Permision for user/roll on a resource + /// + /// + /// + /// public Permission HasPermission(string role, string resource) { if (!Roles.ContainsKey(role)) @@ -234,6 +250,9 @@ namespace OpenSim.Framework #region Tests + /// + /// ACL Test class + /// internal class ACLTester { public ACLTester() diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index c38f0c36f2..6472f317a2 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs @@ -32,26 +32,83 @@ using OpenMetaverse.StructuredData; namespace OpenSim.Framework { + /// + /// Circuit data for an agent. Connection information shared between + /// regions that accept UDP connections from a client + /// public class AgentCircuitData { + /// + /// Avatar Unique Agent Identifier + /// public UUID AgentID; + + /// + /// Avatar's Appearance + /// public AvatarAppearance Appearance; + + /// + /// Agent's root inventory folder + /// public UUID BaseFolder; + + /// + /// Base Caps path for user + /// public string CapsPath = String.Empty; + + /// + /// Seed caps for neighbor regions that the user can see into + /// public Dictionary ChildrenCapSeeds; + + /// + /// Root agent, or Child agent + /// public bool child; + + /// + /// Number given to the client when they log-in that they provide + /// as credentials to the UDP server + /// public uint circuitcode; + + /// + /// Agent's account first name + /// public string firstname; public UUID InventoryFolder; + + /// + /// Agent's account last name + /// public string lastname; + + /// + /// Random Unique GUID for this session. Client gets this at login and it's + /// only supposed to be disclosed over secure channels + /// public UUID SecureSessionID; + + /// + /// Non secure Session ID + /// public UUID SessionID; + + /// + /// Position the Agent's Avatar starts in the region + /// public Vector3 startpos; public AgentCircuitData() { } + /// + /// Create AgentCircuitData from a Serializable AgentCircuitData + /// + /// public AgentCircuitData(sAgentCircuitData cAgent) { AgentID = new UUID(cAgent.AgentID); @@ -68,6 +125,10 @@ namespace OpenSim.Framework ChildrenCapSeeds = cAgent.ChildrenCapSeeds; } + /// + /// Pack AgentCircuitData into an OSDMap for transmission over LLSD XML or LLSD json + /// + /// map of the agent circuit data public OSDMap PackAgentCircuitData() { OSDMap args = new OSDMap(); @@ -98,6 +159,10 @@ namespace OpenSim.Framework return args; } + /// + /// Unpack agent circuit data map into an AgentCiruitData object + /// + /// public void UnpackAgentCircuitData(OSDMap args) { if (args["agent_id"] != null) @@ -150,6 +215,9 @@ namespace OpenSim.Framework } } + /// + /// Serializable Agent Circuit Data + /// [Serializable] public class sAgentCircuitData { diff --git a/OpenSim/Framework/AgentUpdateArgs.cs b/OpenSim/Framework/AgentUpdateArgs.cs index a19795d655..7b9ec68966 100644 --- a/OpenSim/Framework/AgentUpdateArgs.cs +++ b/OpenSim/Framework/AgentUpdateArgs.cs @@ -30,18 +30,52 @@ using OpenMetaverse; namespace OpenSim.Framework { + /// + /// Client provided parameters for avatar movement + /// public class AgentUpdateArgs : EventArgs { + /// + /// Agent's unique ID + /// public UUID AgentID; + + /// + /// Rotation of the avatar's body + /// public Quaternion BodyRotation; + + /// + /// AT portion of the camera matrix + /// public Vector3 CameraAtAxis; + + /// + /// Position of the camera in the Scene + /// public Vector3 CameraCenter; public Vector3 CameraLeftAxis; public Vector3 CameraUpAxis; + + /// + /// Bitflag field for agent movement. Fly, forward, backward, turn left, turn right, go up, go down, Straffe, etc. + /// public uint ControlFlags; + + /// + /// Agent's client Draw distance setting + /// public float Far; public byte Flags; + + /// + /// Rotation of the avatar's head + /// public Quaternion HeadRotation; + + /// + /// Session Id + /// public UUID SessionID; public byte State; } From 0a85d1d767d5ab3b37a3a1a797be843d0b54780e Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Wed, 12 Aug 2009 23:34:12 -0400 Subject: [PATCH 07/35] minor:comments --- OpenSim/Framework/Animation.cs | 30 +++++++++++++++++++ OpenSim/Framework/AssetBase.cs | 29 +++++++++++++++++- OpenSim/Framework/AvatarAppearance.cs | 7 ++--- OpenSim/Framework/AvatarPickerAvatar.cs | 14 +++++++++ .../AvatarPickerReplyAgentDataArgs.cs | 10 +++++++ OpenSim/Framework/Culture.cs | 3 ++ OpenSim/Framework/LandData.cs | 3 ++ 7 files changed, 91 insertions(+), 5 deletions(-) diff --git a/OpenSim/Framework/Animation.cs b/OpenSim/Framework/Animation.cs index 9f865135ed..232f5a1893 100644 --- a/OpenSim/Framework/Animation.cs +++ b/OpenSim/Framework/Animation.cs @@ -31,10 +31,17 @@ using OpenMetaverse.StructuredData; namespace OpenSim.Framework { + /// + /// Information about an Animation + /// [Serializable] public class Animation { private UUID animID; + + /// + /// ID of Animation + /// public UUID AnimID { get { return animID; } @@ -49,6 +56,10 @@ namespace OpenSim.Framework } private UUID objectID; + + /// + /// Unique ID of object that is being animated + /// public UUID ObjectID { get { return objectID; } @@ -59,6 +70,12 @@ namespace OpenSim.Framework { } + /// + /// Creates an Animation based on the data + /// + /// UUID ID of animation + /// + /// ID of object to be animated public Animation(UUID animID, int sequenceNum, UUID objectID) { this.animID = animID; @@ -66,11 +83,20 @@ namespace OpenSim.Framework this.objectID = objectID; } + /// + /// Animation from OSDMap from LLSD XML or LLSD json + /// + /// public Animation(OSDMap args) { UnpackUpdateMessage(args); } + + /// + /// Pack this object up as an OSDMap for transferring via LLSD XML or LLSD json + /// + /// public OSDMap PackUpdateMessage() { OSDMap anim = new OSDMap(); @@ -80,6 +106,10 @@ namespace OpenSim.Framework return anim; } + /// + /// Fill object with data from OSDMap + /// + /// public void UnpackUpdateMessage(OSDMap args) { if (args["animation"] != null) diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs index 614670cc81..9679ff2512 100644 --- a/OpenSim/Framework/AssetBase.cs +++ b/OpenSim/Framework/AssetBase.cs @@ -31,10 +31,20 @@ using OpenMetaverse; namespace OpenSim.Framework { + /// + /// Asset class. All Assets are reference by this class or a class derived from this class + /// [Serializable] public class AssetBase { + /// + /// Data of the Asset + /// private byte[] m_data; + + /// + /// Meta Data of the Asset + /// private AssetMetadata m_metadata; public AssetBase() @@ -71,6 +81,9 @@ namespace OpenSim.Framework } + /// + /// Checks if this asset is a binary or text asset + /// public bool IsBinaryAsset { get @@ -102,12 +115,17 @@ namespace OpenSim.Framework set { m_data = value; } } + /// + /// Asset UUID + /// public UUID FullID { get { return m_metadata.FullID; } set { m_metadata.FullID = value; } } - + /// + /// Asset MetaData ID (transferring from UUID to string ID) + /// public string ID { get { return m_metadata.ID; } @@ -126,18 +144,27 @@ namespace OpenSim.Framework set { m_metadata.Description = value; } } + /// + /// (sbyte) AssetType enum + /// public sbyte Type { get { return m_metadata.Type; } set { m_metadata.Type = value; } } + /// + /// Is this a region only asset, or does this exist on the asset server also + /// public bool Local { get { return m_metadata.Local; } set { m_metadata.Local = value; } } + /// + /// Is this asset going to be saved to the asset database? + /// public bool Temporary { get { return m_metadata.Temporary; } diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 6a07bc962f..7270f32646 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -28,14 +28,13 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Runtime.Serialization; -using System.Security.Permissions; using OpenMetaverse; -using log4net; -using System.Reflection; namespace OpenSim.Framework { + /// + /// Contains the Avatar's Appearance and methods to manipulate the appearance. + /// public class AvatarAppearance { //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Framework/AvatarPickerAvatar.cs b/OpenSim/Framework/AvatarPickerAvatar.cs index 0e8602dd81..200c054b5f 100644 --- a/OpenSim/Framework/AvatarPickerAvatar.cs +++ b/OpenSim/Framework/AvatarPickerAvatar.cs @@ -29,10 +29,24 @@ using OpenMetaverse; namespace OpenSim.Framework { + /// + /// Avatar returned by the Avatar Picker request + /// public class AvatarPickerAvatar { + /// + /// Avatar's Unique ID + /// public UUID AvatarID; + + /// + /// Avatar's Account first name + /// public string firstName; + + /// + /// Avatar's Account last name + /// public string lastName; } } diff --git a/OpenSim/Framework/AvatarPickerReplyAgentDataArgs.cs b/OpenSim/Framework/AvatarPickerReplyAgentDataArgs.cs index 8fd21d710d..54835da929 100644 --- a/OpenSim/Framework/AvatarPickerReplyAgentDataArgs.cs +++ b/OpenSim/Framework/AvatarPickerReplyAgentDataArgs.cs @@ -30,9 +30,19 @@ using OpenMetaverse; namespace OpenSim.Framework { + /// + /// Args to return to a client that queries picker data + /// public class AvatarPickerReplyAgentDataArgs : EventArgs { + /// + /// Unique Agent ID + /// public UUID AgentID; + + /// + /// ID of query user submitted + /// public UUID QueryID; } } diff --git a/OpenSim/Framework/Culture.cs b/OpenSim/Framework/Culture.cs index c76841dc89..2066794671 100644 --- a/OpenSim/Framework/Culture.cs +++ b/OpenSim/Framework/Culture.cs @@ -45,6 +45,9 @@ namespace OpenSim.Framework get { return m_cultureInfo; } } + /// + /// Set Culture to en-US to make string processing of numbers simpler. + /// public static void SetCurrentCulture() { Thread.CurrentThread.CurrentCulture = m_cultureInfo; diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index d6afb9547a..94c0d3b1c1 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs @@ -31,6 +31,9 @@ using OpenMetaverse; namespace OpenSim.Framework { + /// + /// Details of a Parcel of land + /// public class LandData { private Vector3 _AABBMax = new Vector3(); From 1123a326ab703add89944b1e0c3a78be9bc95c45 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Thu, 13 Aug 2009 15:43:24 +0900 Subject: [PATCH 08/35] Formatting cleanup. Fix some compiler warnings. --- .../Hypergrid/HGCommunicationsGridMode.cs | 3 -- .../Region/Framework/Scenes/EventManager.cs | 2 +- .../Framework/Scenes/SceneObjectPart.cs | 49 +++++++++---------- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 10 ++-- 4 files changed, 28 insertions(+), 36 deletions(-) diff --git a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs index 99a4057b8a..381070ee82 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs @@ -40,9 +40,6 @@ namespace OpenSim.Region.Communications.Hypergrid { public class HGCommunicationsGridMode : CommunicationsManager // CommunicationsOGS1 { - private static readonly ILog m_log - = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - IHyperlink m_osw = null; public IHyperlink HGServices { diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 1d4d6d7708..7bbe045063 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -429,7 +429,7 @@ namespace OpenSim.Region.Framework.Scenes private RequestParcelPrimCountUpdate handlerRequestParcelPrimCountUpdate = null; private ParcelPrimCountTainted handlerParcelPrimCountTainted = null; private ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = null; - private ScriptTimerEvent handlerScriptTimerEvent = null; + // TODO: unused: private ScriptTimerEvent handlerScriptTimerEvent = null; private EstateToolsSunUpdate handlerEstateToolsSunUpdate = null; private ScriptColliding handlerCollidingStart = null; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 61dfa527f2..36468112b5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1098,30 +1098,29 @@ if (m_shape != null) { } } - private void handleTimerAccounting(uint localID, double interval) - { - if (localID == LocalId) - { - - float sec = (float)interval; - if (m_parentGroup != null) - { - if (sec == 0) - { - if (m_parentGroup.scriptScore + 0.001f >= float.MaxValue - 0.001) - m_parentGroup.scriptScore = 0; - - m_parentGroup.scriptScore += 0.001f; - return; - } - - if (m_parentGroup.scriptScore + (0.001f / sec) >= float.MaxValue - (0.001f / sec)) - m_parentGroup.scriptScore = 0; - m_parentGroup.scriptScore += (0.001f / sec); - } - - } - } + // TODO: unused: + // private void handleTimerAccounting(uint localID, double interval) + // { + // if (localID == LocalId) + // { + // float sec = (float)interval; + // if (m_parentGroup != null) + // { + // if (sec == 0) + // { + // if (m_parentGroup.scriptScore + 0.001f >= float.MaxValue - 0.001) + // m_parentGroup.scriptScore = 0; + // + // m_parentGroup.scriptScore += 0.001f; + // return; + // } + // + // if (m_parentGroup.scriptScore + (0.001f / sec) >= float.MaxValue - (0.001f / sec)) + // m_parentGroup.scriptScore = 0; + // m_parentGroup.scriptScore += (0.001f / sec); + // } + // } + // } #endregion Private Methods @@ -1248,7 +1247,6 @@ if (m_shape != null) { } } - /// /// hook to the physics scene to apply angular impulse /// This is sent up to the group, which then finds the root prim @@ -1809,7 +1807,6 @@ if (m_shape != null) { m_parentGroup.SetHoverHeight(0f, PIDHoverType.Ground, 0f); } - public virtual void OnGrab(Vector3 offsetPos, IClientAPI remoteClient) { } diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index e435ac1e8b..8fdc5a7572 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -304,12 +304,10 @@ namespace OpenSim.Region.Physics.OdePlugin public d.Vector3 xyz = new d.Vector3(128.1640f, 128.3079f, 25.7600f); public d.Vector3 hpr = new d.Vector3(125.5000f, -17.0000f, 0.0000f); - private uint heightmapWidth = m_regionWidth + 1; - private uint heightmapHeight = m_regionHeight + 1; - - private uint heightmapWidthSamples; - - private uint heightmapHeightSamples; + // TODO: unused: private uint heightmapWidth = m_regionWidth + 1; + // TODO: unused: private uint heightmapHeight = m_regionHeight + 1; + // TODO: unused: private uint heightmapWidthSamples; + // TODO: unused: private uint heightmapHeightSamples; private volatile int m_global_contactcount = 0; From 94dfe2a20d357cfd21a24f976f62d1f8a44dd43e Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 13 Aug 2009 13:05:27 +0100 Subject: [PATCH 09/35] Add a profile module interface for the client view to use --- OpenSim/Framework/IProfileModule.cs | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 OpenSim/Framework/IProfileModule.cs diff --git a/OpenSim/Framework/IProfileModule.cs b/OpenSim/Framework/IProfileModule.cs new file mode 100644 index 0000000000..f54810e791 --- /dev/null +++ b/OpenSim/Framework/IProfileModule.cs @@ -0,0 +1,37 @@ +/* + * 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.Collections; +using OpenMetaverse; + +namespace OpenSim.Framework +{ + public interface IProfileModule + { + Hashtable GetProfileData(UUID userID); + } +} From 0f3f2e1dc007f48dcccb27932923a8d586eedb5f Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 13 Aug 2009 13:19:12 +0100 Subject: [PATCH 10/35] Add reference to the profile module in the avatar profiles handler, plus an example of how to override legacy core data with data retrieved from the profile module --- .../CoreModules/Avatar/Profiles/AvatarProfilesModule.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs b/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs index d3324e431c..a6ace63f82 100644 --- a/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs @@ -41,6 +41,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profiles { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene; + private IProfileModule m_profileModule = null; public AvatarProfilesModule() { @@ -56,6 +57,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profiles public void PostInitialise() { + m_profileModule = scene.RequestModuleInterface(); } public void Close() @@ -108,6 +110,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Profiles charterMember = Utils.StringToBytes(profile.CustomType); } + if (m_profileModule != null) + { + Hashtable profileData = m_profileModule.GetProfileData(remoteClient.AgentId); + if (profileData["ProfileUrl"] != null) + profile.ProfileUrl = profileData["ProfileUrl"].ToString(); + } remoteClient.SendAvatarProperties(profile.ID, profile.AboutText, Util.ToDateTime(profile.Created).ToString("M/d/yyyy", CultureInfo.InvariantCulture), charterMember, profile.FirstLifeAboutText, (uint)(profile.UserFlags & 0xff), From 3669115d60f4e8fbd5032836b828f6ee40901c93 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 13 Aug 2009 13:25:33 +0100 Subject: [PATCH 11/35] Some small fixes --- .../Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs b/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs index a6ace63f82..0f5878873b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs @@ -26,6 +26,7 @@ */ using System; +using System.Collections; using System.Globalization; using System.Reflection; using log4net; @@ -57,7 +58,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Profiles public void PostInitialise() { - m_profileModule = scene.RequestModuleInterface(); + m_profileModule = m_scene.RequestModuleInterface(); } public void Close() From 5b325f1f544ba0154035109d1b98e40f54313ddf Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Thu, 13 Aug 2009 12:39:33 -0400 Subject: [PATCH 12/35] * minor: comments --- OpenSim/Framework/LandData.cs | 126 +++++++++++++++++++++++++++++++++- 1 file changed, 125 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index 94c0d3b1c1..a24af04374 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs @@ -83,6 +83,9 @@ namespace OpenSim.Framework private int _dwell = 0; private int _otherCleanTime = 0; + /// + /// Upper corner of the AABB for the parcel + /// public Vector3 AABBMax { get { return _AABBMax; @@ -91,7 +94,9 @@ namespace OpenSim.Framework _AABBMax = value; } } - + /// + /// Lower corner of the AABB for the parcel + /// public Vector3 AABBMin { get { return _AABBMin; @@ -101,6 +106,9 @@ namespace OpenSim.Framework } } + /// + /// Area in meters^2 the parcel contains + /// public int Area { get { return _area; @@ -110,6 +118,9 @@ namespace OpenSim.Framework } } + /// + /// ID of auction (3rd Party Integration) when parcel is being auctioned + /// public uint AuctionID { get { return _auctionID; @@ -119,6 +130,9 @@ namespace OpenSim.Framework } } + /// + /// UUID of authorized buyer of parcel. This is UUID.Zero if anyone can buy it. + /// public UUID AuthBuyerID { get { return _authBuyerID; @@ -128,6 +142,9 @@ namespace OpenSim.Framework } } + /// + /// Category of parcel. Used for classifying the parcel in classified listings + /// public ParcelCategory Category { get { return _category; @@ -137,6 +154,9 @@ namespace OpenSim.Framework } } + /// + /// Date that the current owner purchased or claimed the parcel + /// public int ClaimDate { get { return _claimDate; @@ -146,6 +166,9 @@ namespace OpenSim.Framework } } + /// + /// The last price that the parcel was sold at + /// public int ClaimPrice { get { return _claimPrice; @@ -155,6 +178,9 @@ namespace OpenSim.Framework } } + /// + /// Global ID for the parcel. (3rd Party Integration) + /// public UUID GlobalID { get { return _globalID; @@ -164,6 +190,9 @@ namespace OpenSim.Framework } } + /// + /// Unique ID of the Group that owns + /// public UUID GroupID { get { return _groupID; @@ -173,6 +202,9 @@ namespace OpenSim.Framework } } + /// + /// Number of SceneObjectPart that are owned by a Group + /// public int GroupPrims { get { return _groupPrims; @@ -182,6 +214,9 @@ namespace OpenSim.Framework } } + /// + /// Returns true if the Land Parcel is owned by a group + /// public bool IsGroupOwned { get { return _isGroupOwned; @@ -191,6 +226,9 @@ namespace OpenSim.Framework } } + /// + /// jp2 data for the image representative of the parcel in the parcel dialog + /// public byte[] Bitmap { get { return _bitmap; @@ -200,6 +238,9 @@ namespace OpenSim.Framework } } + /// + /// Parcel Description + /// public string Description { get { return _description; @@ -209,6 +250,9 @@ namespace OpenSim.Framework } } + /// + /// Parcel settings. Access flags, Fly, NoPush, Voice, Scripts allowed, etc. ParcelFlags + /// public uint Flags { get { return _flags; @@ -218,6 +262,10 @@ namespace OpenSim.Framework } } + /// + /// Determines if people are able to teleport where they please on the parcel or if they + /// get constrainted to a specific point on teleport within the parcel + /// public byte LandingType { get { return _landingType; @@ -227,6 +275,9 @@ namespace OpenSim.Framework } } + /// + /// Parcel Name + /// public string Name { get { return _name; @@ -236,6 +287,9 @@ namespace OpenSim.Framework } } + /// + /// Status of Parcel, Leased, Abandoned, For Sale + /// public ParcelStatus Status { get { return _status; @@ -245,6 +299,9 @@ namespace OpenSim.Framework } } + /// + /// Internal ID of the parcel. Sometimes the client will try to use this value + /// public int LocalID { get { return _localID; @@ -254,6 +311,9 @@ namespace OpenSim.Framework } } + /// + /// Determines if we scale the media based on the surface it's on + /// public byte MediaAutoScale { get { return _mediaAutoScale; @@ -263,6 +323,9 @@ namespace OpenSim.Framework } } + /// + /// Texture Guid to replace with the output of the media stream + /// public UUID MediaID { get { return _mediaID; @@ -272,6 +335,9 @@ namespace OpenSim.Framework } } + /// + /// URL to the media file to display + /// public string MediaURL { get { return _mediaURL; @@ -281,6 +347,9 @@ namespace OpenSim.Framework } } + /// + /// URL to the shoutcast music stream to play on the parcel + /// public string MusicURL { get { return _musicURL; @@ -290,6 +359,10 @@ namespace OpenSim.Framework } } + /// + /// Number of SceneObjectPart that are owned by users who do not own the parcel + /// and don't have the 'group. These are elegable for AutoReturn collection + /// public int OtherPrims { get { return _otherPrims; @@ -299,6 +372,10 @@ namespace OpenSim.Framework } } + /// + /// Owner Avatar or Group of the parcel. Naturally, all land masses must be + /// owned by someone + /// public UUID OwnerID { get { return _ownerID; @@ -308,6 +385,9 @@ namespace OpenSim.Framework } } + /// + /// Number of SceneObjectPart that are owned by the owner of the parcel + /// public int OwnerPrims { get { return _ownerPrims; @@ -317,6 +397,9 @@ namespace OpenSim.Framework } } + /// + /// List of access data for the parcel. User data, some bitflags, and a time + /// public List ParcelAccessList { get { return _parcelAccessList; @@ -326,6 +409,9 @@ namespace OpenSim.Framework } } + /// + /// How long in hours a Pass to the parcel is given + /// public float PassHours { get { return _passHours; @@ -335,6 +421,9 @@ namespace OpenSim.Framework } } + /// + /// Price to purchase a Pass to a restricted parcel + /// public int PassPrice { get { return _passPrice; @@ -344,6 +433,9 @@ namespace OpenSim.Framework } } + /// + /// When the parcel is being sold, this is the price to purchase the parcel + /// public int SalePrice { get { return _salePrice; @@ -353,6 +445,9 @@ namespace OpenSim.Framework } } + /// + /// Number of SceneObjectPart that are currently selected by avatar + /// public int SelectedPrims { get { return _selectedPrims; @@ -362,6 +457,9 @@ namespace OpenSim.Framework } } + /// + /// Number of meters^2 in the Simulator + /// public int SimwideArea { get { return _simwideArea; @@ -371,6 +469,9 @@ namespace OpenSim.Framework } } + /// + /// Number of SceneObjectPart in the Simulator + /// public int SimwidePrims { get { return _simwidePrims; @@ -380,6 +481,9 @@ namespace OpenSim.Framework } } + /// + /// ID of the snapshot used in the client parcel dialog of the parcel + /// public UUID SnapshotID { get { return _snapshotID; @@ -389,6 +493,10 @@ namespace OpenSim.Framework } } + /// + /// When teleporting is restricted to a certain point, this is the location + /// that the user will be redirected to + /// public Vector3 UserLocation { get { return _userLocation; @@ -398,6 +506,10 @@ namespace OpenSim.Framework } } + /// + /// When teleporting is restricted to a certain point, this is the rotation + /// that the user will be positioned + /// public Vector3 UserLookAt { get { return _userLookAt; @@ -407,6 +519,9 @@ namespace OpenSim.Framework } } + /// + /// Depreciated idea. Number of visitors ~= free money + /// public int Dwell { get { return _dwell; @@ -416,6 +531,10 @@ namespace OpenSim.Framework } } + /// + /// Number of minutes to return SceneObjectGroup that are owned by someone who doesn't own + /// the parcel and isn't set to the same 'group' as the parcel. + /// public int OtherCleanTime { get { return _otherCleanTime; @@ -425,11 +544,16 @@ namespace OpenSim.Framework } } + public LandData() { _globalID = UUID.Random(); } + /// + /// Make a new copy of the land data + /// + /// public LandData Copy() { LandData landData = new LandData(); From f5fc5226f8a4a55558d644fe4bc5b247cd817c04 Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Thu, 13 Aug 2009 18:10:09 -0400 Subject: [PATCH 13/35] * Adds two tests to OpenSim.Framework.Tests. *AgentCircuitData test to ensure that the Packing and unpacking method to and from OSD works as expected called, TestAgentCircuitDataOSDConversion. Also created a HistoricalAgentCircuitDataOSDConversion to ensure that any changes in the way the json wire format is parsed warns us via this test. --- .../Framework/Tests/AgentCircuitDataTest.cs | 339 ++++++++++++++++++ prebuild.xml | 1 + 2 files changed, 340 insertions(+) create mode 100644 OpenSim/Framework/Tests/AgentCircuitDataTest.cs diff --git a/OpenSim/Framework/Tests/AgentCircuitDataTest.cs b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs new file mode 100644 index 0000000000..0bf8f64f47 --- /dev/null +++ b/OpenSim/Framework/Tests/AgentCircuitDataTest.cs @@ -0,0 +1,339 @@ +/* + * 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.Collections.Generic; +using OpenMetaverse; +using OpenMetaverse.StructuredData; +using NUnit.Framework; + + +namespace OpenSim.Framework.Tests +{ + [TestFixture] + public class AgentCircuitDataTest + { + private UUID AgentId; + private AvatarAppearance AvAppearance; + private byte[] VisualParams; + private UUID BaseFolder; + private string CapsPath; + private Dictionary ChildrenCapsPaths; + private uint circuitcode = 0949030; + private string firstname; + private string lastname; + private UUID SecureSessionId; + private UUID SessionId; + private Vector3 StartPos; + + + [SetUp] + public void setup() + { + AgentId = UUID.Random(); + BaseFolder = UUID.Random(); + CapsPath = "http://www.opensimulator.org/Caps/Foo"; + ChildrenCapsPaths = new Dictionary(); + ChildrenCapsPaths.Add(ulong.MaxValue, "http://www.opensimulator.org/Caps/Foo2"); + firstname = "CoolAvatarTest"; + lastname = "test"; + StartPos = new Vector3(5,23,125); + + SecureSessionId = UUID.Random(); + SessionId = UUID.Random(); + + AvAppearance = new AvatarAppearance(AgentId); + AvAppearance.SetDefaultWearables(); + VisualParams = new byte[218]; + AvAppearance.SetDefaultParams(VisualParams); + + //body + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEIGHT] = 155; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_THICKNESS] = 00; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BODY_FAT] = 0; + + //Torso + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_TORSO_MUSCLES] = 48; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NECK_THICKNESS] = 43; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NECK_LENGTH] = 255; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SHOULDERS] = 94; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CHEST_MALE_NO_PECS] = 199; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_ARM_LENGTH] = 255; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HAND_SIZE] = 33; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_TORSO_LENGTH] = 240; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LOVE_HANDLES] = 0; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BELLY_SIZE] = 0; + + // legs + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LEG_MUSCLES] = 82; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LEG_LENGTH] = 255; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HIP_WIDTH] = 84; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HIP_LENGTH] = 166; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BUTT_SIZE] = 64; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SADDLEBAGS] = 89; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BOWED_LEGS] = 127; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_FOOT_SIZE] = 45; + + + // head + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEAD_SIZE] = 255; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SQUASH_STRETCH_HEAD] = 0; // head stretch + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEAD_SHAPE] = 155; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EGG_HEAD] = 127; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_POINTY_EARS] = 255; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HEAD_LENGTH] = 45; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_FACE_SHEAR] = 127; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_FOREHEAD_ANGLE] = 104; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BIG_BROW] = 94; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_PUFFY_UPPER_CHEEKS] = 0; // upper cheeks + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_DOUBLE_CHIN] = 122; // lower cheeks + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_HIGH_CHEEK_BONES] = 130; + + + + // eyes + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYE_SIZE] = 105; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_EYES] = 135; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYE_SPACING] = 184; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYELID_CORNER_UP] = 230; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYELID_INNER_CORNER_UP] = 120; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYE_DEPTH] = 158; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_UPPER_EYELID_FOLD] = 69; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BAGGY_EYES] = 38; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EYELASHES_LONG] = 127; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_POP_EYE] = 127; + + VisualParams[(int)AvatarAppearance.VPElement.EYES_EYE_COLOR] = 25; + VisualParams[(int)AvatarAppearance.VPElement.EYES_EYE_LIGHTNESS] = 127; + + // ears + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BIG_EARS] = 255; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_EARS_OUT] = 127; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_ATTACHED_EARLOBES] = 127; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_POINTY_EARS] = 255; + + // nose + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NOSE_BIG_OUT] = 79; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_NOSE] = 35; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BROAD_NOSTRILS] = 86; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LOW_SEPTUM_NOSE] = 112; // nostril division + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BULBOUS_NOSE] = 25; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_NOBLE_NOSE_BRIDGE] = 25; // upper bridge + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LOWER_BRIDGE_NOSE] = 25; // lower bridge + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_NOSE_BRIDGE] = 25; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_UPTURNED_NOSE_TIP] = 107; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_BULBOUS_NOSE_TIP] = 25; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CROOKED_NOSE] = 127; + + + // Mouth + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_WIDTH] = 122; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_TALL_LIPS] = 10; // lip fullness + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_THICKNESS] = 112; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_RATIO] = 137; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_MOUTH_HEIGHT] = 176; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_MOUTH_CORNER] = 140; // Sad --> happy + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_LIP_CLEFT_DEEP] = 84; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WIDE_LIP_CLEFT] = 84; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SHIFT_MOUTH] = 127; + + + // chin + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_WEAK_CHIN] = 119; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_SQUARE_JAW] = 5; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_DEEP_CHIN] = 132; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_JAW_ANGLE] = 153; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_JAW_JUT] = 100; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_JOWLS] = 38; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CLEFT_CHIN] = 89; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_CLEFT_CHIN_UPPER] = 89; + VisualParams[(int)AvatarAppearance.VPElement.SHAPE_DOUBLE_CHIN] = 0; + + + // hair color + VisualParams[(int)AvatarAppearance.VPElement.HAIR_WHITE_HAIR] = 0; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_RAINBOW_COLOR_39] = 0; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_BLONDE_HAIR] = 24; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_RED_HAIR] = 0; + + // hair style + VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_VOLUME] = 160; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_FRONT] = 153; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SIDES] = 153; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BACK] = 170; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BIG_FRONT] = 0; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BIG_TOP] = 117; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_BIG_BACK] = 170; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_FRONT_FRINGE] = 0; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_SIDE_FRINGE] = 142; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_BACK_FRINGE] = 0; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SIDES_FULL] = 146; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SWEEP] = 0; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SHEAR_FRONT] = 0; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SHEAR_BACK] = 0; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_TAPER_FRONT] = 0; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_TAPER_BACK] = 0; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_RUMPLED] = 0; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_PIGTAILS] = 0; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_PONYTAIL] = 0; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_SPIKED] = 0; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_TILT] = 0; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_PART_MIDDLE] = 0; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_PART_RIGHT] = 0; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_PART_LEFT] = 0; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_BANGS_PART_MIDDLE] = 155; + + //Eyebrows + VisualParams[(int)AvatarAppearance.VPElement.HAIR_EYEBROW_SIZE] = 20; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_EYEBROW_DENSITY] = 140; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_LOWER_EYEBROWS] = 200; // eyebrow height + VisualParams[(int)AvatarAppearance.VPElement.HAIR_ARCED_EYEBROWS] = 124; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_POINTY_EYEBROWS] = 65; + + //Facial hair + VisualParams[(int)AvatarAppearance.VPElement.HAIR_HAIR_THICKNESS] = 65; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_SIDEBURNS] = 235; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_MOUSTACHE] = 75; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_CHIN_CURTAINS] = 140; + VisualParams[(int)AvatarAppearance.VPElement.HAIR_SOULPATCH] = 0; + + AvAppearance.VisualParams = VisualParams; + + List wearbyte = new List(); + for (int i = 0; i < VisualParams.Length; i++) + { + wearbyte.Add(VisualParams[i]); + } + + + AvAppearance.SetAppearance(AvAppearance.Texture.GetBytes(), wearbyte); + } + + /// + /// Test to ensure that the serialization format is the same and the underlying types don't change without notice + /// oldSerialization is just a json serialization of the OSDMap packed for the AgentCircuitData. + /// The idea is that if the current json serializer cannot parse the old serialization, then the underlying types + /// have changed and are incompatible. + /// + [Test] + public void HistoricalAgentCircuitDataOSDConversion() + { + string oldSerialization = "{\"agent_id\":\"522675bd-8214-40c1-b3ca-9c7f7fd170be\",\"base_folder\":\"c40b5f5f-476f-496b-bd69-b5a539c434d8\",\"caps_path\":\"http://www.opensimulator.org/Caps/Foo\",\"children_seeds\":[{\"handle\":\"18446744073709551615\",\"seed\":\"http://www.opensimulator.org/Caps/Foo2\"}],\"child\":false,\"circuit_code\":\"949030\",\"first_name\":\"CoolAvatarTest\",\"last_name\":\"test\",\"inventory_folder\":\"c40b5f5f-476f-496b-bd69-b5a539c434d8\",\"secure_session_id\":\"1e608e2b-0ddb-41f6-be0f-926f61cd3e0a\",\"session_id\":\"aa06f798-9d70-4bdb-9bbf-012a02ee2baf\",\"start_pos\":\"<5, 23, 125>\"}"; + AgentCircuitData Agent1Data = new AgentCircuitData(); + Agent1Data.AgentID = new UUID("522675bd-8214-40c1-b3ca-9c7f7fd170be"); + Agent1Data.Appearance = AvAppearance; + Agent1Data.BaseFolder = new UUID("c40b5f5f-476f-496b-bd69-b5a539c434d8"); + Agent1Data.CapsPath = CapsPath; + Agent1Data.child = false; + Agent1Data.ChildrenCapSeeds = ChildrenCapsPaths; + Agent1Data.circuitcode = circuitcode; + Agent1Data.firstname = firstname; + Agent1Data.InventoryFolder = new UUID("c40b5f5f-476f-496b-bd69-b5a539c434d8"); + Agent1Data.lastname = lastname; + Agent1Data.SecureSessionID = new UUID("1e608e2b-0ddb-41f6-be0f-926f61cd3e0a"); + Agent1Data.SessionID = new UUID("aa06f798-9d70-4bdb-9bbf-012a02ee2baf"); + Agent1Data.startpos = StartPos; + + OSDMap map2 = (OSDMap)OSDParser.DeserializeJson(oldSerialization); + + + AgentCircuitData Agent2Data = new AgentCircuitData(); + Agent2Data.UnpackAgentCircuitData(map2); + + Assert.That((Agent1Data.AgentID == Agent2Data.AgentID)); + Assert.That((Agent1Data.BaseFolder == Agent2Data.BaseFolder)); + + Assert.That((Agent1Data.CapsPath == Agent2Data.CapsPath)); + Assert.That((Agent1Data.child == Agent2Data.child)); + Assert.That((Agent1Data.ChildrenCapSeeds.Count == Agent2Data.ChildrenCapSeeds.Count)); + Assert.That((Agent1Data.circuitcode == Agent2Data.circuitcode)); + Assert.That((Agent1Data.firstname == Agent2Data.firstname)); + Assert.That((Agent1Data.InventoryFolder == Agent2Data.InventoryFolder)); + Assert.That((Agent1Data.lastname == Agent2Data.lastname)); + Assert.That((Agent1Data.SecureSessionID == Agent2Data.SecureSessionID)); + Assert.That((Agent1Data.SessionID == Agent2Data.SessionID)); + Assert.That((Agent1Data.startpos == Agent2Data.startpos)); + /* + Enable this once VisualParams go in the packing method + for (int i=0;i<208;i++) + Assert.That((Agent1Data.Appearance.VisualParams[i] == Agent2Data.Appearance.VisualParams[i])); + */ + } + + /// + /// Test to ensure that the packing and unpacking methods work. + /// + [Test] + public void TestAgentCircuitDataOSDConversion() + { + AgentCircuitData Agent1Data = new AgentCircuitData(); + Agent1Data.AgentID = AgentId; + Agent1Data.Appearance = AvAppearance; + Agent1Data.BaseFolder = BaseFolder; + Agent1Data.CapsPath = CapsPath; + Agent1Data.child = false; + Agent1Data.ChildrenCapSeeds = ChildrenCapsPaths; + Agent1Data.circuitcode = circuitcode; + Agent1Data.firstname = firstname; + Agent1Data.InventoryFolder = BaseFolder; + Agent1Data.lastname = lastname; + Agent1Data.SecureSessionID = SecureSessionId; + Agent1Data.SessionID = SessionId; + Agent1Data.startpos = StartPos; + + + OSDMap map = Agent1Data.PackAgentCircuitData(); + string str = OSDParser.SerializeJsonString(map); + //System.Console.WriteLine(str); + OSDMap map2 = (OSDMap)OSDParser.DeserializeJson(str); + + + AgentCircuitData Agent2Data = new AgentCircuitData(); + Agent2Data.UnpackAgentCircuitData(map2); + + Assert.That((Agent1Data.AgentID == Agent2Data.AgentID)); + Assert.That((Agent1Data.BaseFolder == Agent2Data.BaseFolder)); + + Assert.That((Agent1Data.CapsPath == Agent2Data.CapsPath)); + Assert.That((Agent1Data.child == Agent2Data.child)); + Assert.That((Agent1Data.ChildrenCapSeeds.Count == Agent2Data.ChildrenCapSeeds.Count)); + Assert.That((Agent1Data.circuitcode == Agent2Data.circuitcode)); + Assert.That((Agent1Data.firstname == Agent2Data.firstname)); + Assert.That((Agent1Data.InventoryFolder == Agent2Data.InventoryFolder)); + Assert.That((Agent1Data.lastname == Agent2Data.lastname)); + Assert.That((Agent1Data.SecureSessionID == Agent2Data.SecureSessionID)); + Assert.That((Agent1Data.SessionID == Agent2Data.SessionID)); + Assert.That((Agent1Data.startpos == Agent2Data.startpos)); + + /* + Enable this once VisualParams go in the packing method + for (int i = 0; i < 208; i++) + Assert.That((Agent1Data.Appearance.VisualParams[i] == Agent2Data.Appearance.VisualParams[i])); + */ + + + } + } +} diff --git a/prebuild.xml b/prebuild.xml index fbe1a9789f..bd94c379a2 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -3472,6 +3472,7 @@ + From 73b0cf492d3e5027e7fc1ccc203612bdb136510e Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 14 Aug 2009 01:35:14 +0100 Subject: [PATCH 14/35] Add some extra info to script load messages --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 3ef5ae863e..76218c88cc 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -729,8 +729,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine item.Name, startParam, postOnRez, stateSource, m_MaxScriptQueue); - m_log.DebugFormat("[XEngine] Loaded script {0}.{1}", - part.ParentGroup.RootPart.Name, item.Name); + m_log.DebugFormat("[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}", + part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID, part.ParentGroup.RootPart.AbsolutePosition.ToString()); instance.AppDomain = appDomain; instance.LineMap = linemap; From 7a761560c6482b092b16464b2cde893a74f8ffb6 Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Thu, 13 Aug 2009 21:01:39 -0400 Subject: [PATCH 15/35] * Add AgentCircuitManager tests for adding, removing, changing circuit code, and authentication. --- .../Tests/AgentCircuitManagerTests.cs | 201 ++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 OpenSim/Framework/Tests/AgentCircuitManagerTests.cs diff --git a/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs b/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs new file mode 100644 index 0000000000..ab5f04ace1 --- /dev/null +++ b/OpenSim/Framework/Tests/AgentCircuitManagerTests.cs @@ -0,0 +1,201 @@ +/* + * 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.Collections.Generic; +using OpenMetaverse; +using NUnit.Framework; +using System; + +namespace OpenSim.Framework.Tests +{ + [TestFixture] + public class AgentCircuitManagerTests + { + private AgentCircuitData m_agentCircuitData1; + private AgentCircuitData m_agentCircuitData2; + private UUID AgentId1; + private UUID AgentId2; + private uint circuitcode1; + private uint circuitcode2; + + private UUID SessionId1; + private UUID SessionId2; + private Random rnd = new Random(Environment.TickCount); + + [SetUp] + public void setup() + { + + AgentId1 = UUID.Random(); + AgentId2 = UUID.Random(); + circuitcode1 = (uint) rnd.Next((int)uint.MinValue, int.MaxValue); + circuitcode2 = (uint) rnd.Next((int)uint.MinValue, int.MaxValue); + SessionId1 = UUID.Random(); + SessionId2 = UUID.Random(); + UUID BaseFolder = UUID.Random(); + string CapsPath = "http://www.opensimulator.org/Caps/Foo"; + Dictionary ChildrenCapsPaths = new Dictionary(); + ChildrenCapsPaths.Add(ulong.MaxValue, "http://www.opensimulator.org/Caps/Foo2"); + string firstname = "CoolAvatarTest"; + string lastname = "test"; + Vector3 StartPos = new Vector3(5, 23, 125); + + UUID SecureSessionId = UUID.Random(); + UUID SessionId = UUID.Random(); + + m_agentCircuitData1 = new AgentCircuitData(); + m_agentCircuitData1.AgentID = AgentId1; + m_agentCircuitData1.Appearance = new AvatarAppearance(AgentId1); + m_agentCircuitData1.BaseFolder = BaseFolder; + m_agentCircuitData1.CapsPath = CapsPath; + m_agentCircuitData1.child = false; + m_agentCircuitData1.ChildrenCapSeeds = ChildrenCapsPaths; + m_agentCircuitData1.circuitcode = circuitcode1; + m_agentCircuitData1.firstname = firstname; + m_agentCircuitData1.InventoryFolder = BaseFolder; + m_agentCircuitData1.lastname = lastname; + m_agentCircuitData1.SecureSessionID = SecureSessionId; + m_agentCircuitData1.SessionID = SessionId1; + m_agentCircuitData1.startpos = StartPos; + + m_agentCircuitData2 = new AgentCircuitData(); + m_agentCircuitData2.AgentID = AgentId2; + m_agentCircuitData2.Appearance = new AvatarAppearance(AgentId2); + m_agentCircuitData2.BaseFolder = BaseFolder; + m_agentCircuitData2.CapsPath = CapsPath; + m_agentCircuitData2.child = false; + m_agentCircuitData2.ChildrenCapSeeds = ChildrenCapsPaths; + m_agentCircuitData2.circuitcode = circuitcode2; + m_agentCircuitData2.firstname = firstname; + m_agentCircuitData2.InventoryFolder = BaseFolder; + m_agentCircuitData2.lastname = lastname; + m_agentCircuitData2.SecureSessionID = SecureSessionId; + m_agentCircuitData2.SessionID = SessionId2; + m_agentCircuitData2.startpos = StartPos; + } + + /// + /// Validate that adding the circuit works appropriately + /// + [Test] + public void AddAgentCircuitTest() + { + AgentCircuitManager agentCircuitManager = new AgentCircuitManager(); + agentCircuitManager.AddNewCircuit(circuitcode1,m_agentCircuitData1); + agentCircuitManager.AddNewCircuit(circuitcode2, m_agentCircuitData2); + AgentCircuitData agent = agentCircuitManager.GetAgentCircuitData(circuitcode1); + + Assert.That((m_agentCircuitData1.AgentID == agent.AgentID)); + Assert.That((m_agentCircuitData1.BaseFolder == agent.BaseFolder)); + + Assert.That((m_agentCircuitData1.CapsPath == agent.CapsPath)); + Assert.That((m_agentCircuitData1.child == agent.child)); + Assert.That((m_agentCircuitData1.ChildrenCapSeeds.Count == agent.ChildrenCapSeeds.Count)); + Assert.That((m_agentCircuitData1.circuitcode == agent.circuitcode)); + Assert.That((m_agentCircuitData1.firstname == agent.firstname)); + Assert.That((m_agentCircuitData1.InventoryFolder == agent.InventoryFolder)); + Assert.That((m_agentCircuitData1.lastname == agent.lastname)); + Assert.That((m_agentCircuitData1.SecureSessionID == agent.SecureSessionID)); + Assert.That((m_agentCircuitData1.SessionID == agent.SessionID)); + Assert.That((m_agentCircuitData1.startpos == agent.startpos)); + } + + /// + /// Validate that removing the circuit code removes it appropriately + /// + [Test] + public void RemoveAgentCircuitTest() + { + AgentCircuitManager agentCircuitManager = new AgentCircuitManager(); + agentCircuitManager.AddNewCircuit(circuitcode1, m_agentCircuitData1); + agentCircuitManager.AddNewCircuit(circuitcode2, m_agentCircuitData2); + agentCircuitManager.RemoveCircuit(circuitcode2); + + AgentCircuitData agent = agentCircuitManager.GetAgentCircuitData(circuitcode2); + Assert.That(agent == null); + + } + + /// + /// Validate that changing the circuit code works + /// + [Test] + public void ChangeAgentCircuitCodeTest() + { + AgentCircuitManager agentCircuitManager = new AgentCircuitManager(); + agentCircuitManager.AddNewCircuit(circuitcode1, m_agentCircuitData1); + agentCircuitManager.AddNewCircuit(circuitcode2, m_agentCircuitData2); + bool result = false; + + result = agentCircuitManager.TryChangeCiruitCode(circuitcode1, 393930); + + AgentCircuitData agent = agentCircuitManager.GetAgentCircuitData(393930); + AgentCircuitData agent2 = agentCircuitManager.GetAgentCircuitData(circuitcode1); + Assert.That(agent != null); + Assert.That(agent2 == null); + Assert.That(result); + + } + + /// + /// Validates that the login authentication scheme is working + /// First one should be authorized + /// Rest should not be authorized + /// + [Test] + public void ValidateLoginTest() + { + AgentCircuitManager agentCircuitManager = new AgentCircuitManager(); + agentCircuitManager.AddNewCircuit(circuitcode1, m_agentCircuitData1); + agentCircuitManager.AddNewCircuit(circuitcode2, m_agentCircuitData2); + + // should be authorized + AuthenticateResponse resp = agentCircuitManager.AuthenticateSession(SessionId1, AgentId1, circuitcode1); + Assert.That(resp.Authorised); + + + //should not be authorized + resp = agentCircuitManager.AuthenticateSession(SessionId1, UUID.Random(), circuitcode1); + Assert.That(!resp.Authorised); + + resp = agentCircuitManager.AuthenticateSession(UUID.Random(), AgentId1, circuitcode1); + Assert.That(!resp.Authorised); + + resp = agentCircuitManager.AuthenticateSession(SessionId1, AgentId1, circuitcode2); + Assert.That(!resp.Authorised); + + resp = agentCircuitManager.AuthenticateSession(SessionId2, AgentId1, circuitcode2); + Assert.That(!resp.Authorised); + + agentCircuitManager.RemoveCircuit(circuitcode2); + + resp = agentCircuitManager.AuthenticateSession(SessionId2, AgentId2, circuitcode2); + Assert.That(!resp.Authorised); + + } + + } +} From 0781ac9a5e307e6ed0a0685c1dad98d5fb51b76b Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Thu, 13 Aug 2009 22:12:37 -0400 Subject: [PATCH 16/35] * Add ThreadTracker Tests, Tests default thread, Adding Testing and Removing a thread, a dead thread, and a null Thread * Fix a null thread situation --- OpenSim/Framework/Tests/ThreadTrackerTests.cs | 192 ++++++++++++++++++ OpenSim/Framework/ThreadTracker.cs | 36 ++-- 2 files changed, 216 insertions(+), 12 deletions(-) create mode 100644 OpenSim/Framework/Tests/ThreadTrackerTests.cs diff --git a/OpenSim/Framework/Tests/ThreadTrackerTests.cs b/OpenSim/Framework/Tests/ThreadTrackerTests.cs new file mode 100644 index 0000000000..37c75ef8c6 --- /dev/null +++ b/OpenSim/Framework/Tests/ThreadTrackerTests.cs @@ -0,0 +1,192 @@ +/* + * 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 NUnit.Framework; +using System.Threading; +using System.Collections.Generic; + +namespace OpenSim.Framework.Tests +{ + [TestFixture] + public class ThreadTrackerTests + { + private bool running = true; + private bool running2 = true; + + [Test] + public void DefaultThreadTrackerTest() + { + List lThread = ThreadTracker.GetThreads(); + + /* + foreach (Thread t in lThread) + { + System.Console.WriteLine(t.Name); + } + */ + + Assert.That(lThread.Count == 1); + Assert.That(lThread[0].Name == "ThreadTrackerThread"); + } + + /// + /// Validate that adding a thread to the thread tracker works + /// Validate that removing a thread from the thread tracker also works. + /// + [Test] + public void AddThreadToThreadTrackerTestAndRemoveTest() + { + Thread t = new Thread(run); + t.Name = "TestThread"; + t.Priority = ThreadPriority.BelowNormal; + t.IsBackground = true; + t.SetApartmentState(ApartmentState.MTA); + t.Start(); + ThreadTracker.Add(t); + + List lThread = ThreadTracker.GetThreads(); + + Assert.That(lThread.Count == 2); + + foreach (Thread tr in lThread) + { + Assert.That((tr.Name == "ThreadTrackerThread" || tr.Name == "TestThread")); + } + running = false; + ThreadTracker.Remove(t); + + lThread = ThreadTracker.GetThreads(); + + Assert.That(lThread.Count == 1); + + foreach (Thread tr in lThread) + { + Assert.That((tr.Name == "ThreadTrackerThread")); + } + + + } + + /// + /// Test a dead thread removal by aborting it and setting it's last seen active date to 50 seconds + /// + [Test] + public void DeadThreadTest() + { + Thread t = new Thread(run2); + t.Name = "TestThread"; + t.Priority = ThreadPriority.BelowNormal; + t.IsBackground = true; + t.SetApartmentState(ApartmentState.MTA); + t.Start(); + ThreadTracker.Add(t); + t.Abort(); + Thread.Sleep(5000); + ThreadTracker.m_Threads[1].LastSeenActive = DateTime.Now.Ticks - (50*10000000); + ThreadTracker.CleanUp(); + List lThread = ThreadTracker.GetThreads(); + + Assert.That(lThread.Count == 1); + + foreach (Thread tr in lThread) + { + Assert.That((tr.Name == "ThreadTrackerThread")); + } + } + + [Test] + public void UnstartedThreadTest() + { + Thread t = new Thread(run2); + t.Name = "TestThread"; + t.Priority = ThreadPriority.BelowNormal; + t.IsBackground = true; + t.SetApartmentState(ApartmentState.MTA); + ThreadTracker.Add(t); + ThreadTracker.m_Threads[1].LastSeenActive = DateTime.Now.Ticks - (50 * 10000000); + ThreadTracker.CleanUp(); + List lThread = ThreadTracker.GetThreads(); + + Assert.That(lThread.Count == 1); + + foreach (Thread tr in lThread) + { + Assert.That((tr.Name == "ThreadTrackerThread")); + } + } + + [Test] + public void NullThreadTest() + { + Thread t = null; + ThreadTracker.Add(t); + + List lThread = ThreadTracker.GetThreads(); + + Assert.That(lThread.Count == 1); + + foreach (Thread tr in lThread) + { + Assert.That((tr.Name == "ThreadTrackerThread")); + } + } + + + /// + /// Worker thread 0 + /// + /// + public void run( object o) + { + while (running) + { + Thread.Sleep(5000); + } + } + + /// + /// Worker thread 1 + /// + /// + public void run2(object o) + { + try + { + while (running2) + { + Thread.Sleep(5000); + } + + } + catch (ThreadAbortException) + { + } + } + + } +} diff --git a/OpenSim/Framework/ThreadTracker.cs b/OpenSim/Framework/ThreadTracker.cs index d8bd2c0f96..fa6f0b8d0f 100644 --- a/OpenSim/Framework/ThreadTracker.cs +++ b/OpenSim/Framework/ThreadTracker.cs @@ -77,12 +77,15 @@ namespace OpenSim.Framework public static void Add(Thread thread) { #if DEBUG - lock (m_Threads) + if (thread != null) { - ThreadTrackerItem tti = new ThreadTrackerItem(); - tti.Thread = thread; - tti.LastSeenActive = DateTime.Now.Ticks; - m_Threads.Add(tti); + lock (m_Threads) + { + ThreadTrackerItem tti = new ThreadTrackerItem(); + tti.Thread = thread; + tti.LastSeenActive = DateTime.Now.Ticks; + m_Threads.Add(tti); + } } #endif } @@ -107,16 +110,25 @@ namespace OpenSim.Framework { foreach (ThreadTrackerItem tti in new ArrayList(m_Threads)) { - if (tti.Thread.IsAlive) + try { - // Its active - tti.LastSeenActive = DateTime.Now.Ticks; + + + if (tti.Thread.IsAlive) + { + // Its active + tti.LastSeenActive = DateTime.Now.Ticks; + } + else + { + // Its not active -- if its expired then remove it + if (tti.LastSeenActive + ThreadTimeout < DateTime.Now.Ticks) + m_Threads.Remove(tti); + } } - else + catch (NullReferenceException) { - // Its not active -- if its expired then remove it - if (tti.LastSeenActive + ThreadTimeout < DateTime.Now.Ticks) - m_Threads.Remove(tti); + m_Threads.Remove(tti); } } } From 6ece8d86e051ffb58afd01d92ee780d98eca997a Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Thu, 13 Aug 2009 23:06:29 -0400 Subject: [PATCH 17/35] Deal with possible race in TestAddNeighborRegion in ScenePresenceTests --- .../Scenes/Tests/ScenePresenceTests.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index 1836447673..a3672d576f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs @@ -147,7 +147,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelper.InMethod(); string reason; + + if (acd1 == null) + fixNullPresence(); + scene.NewUserConnection(acd1, out reason); + if (testclient == null) + testclient = new TestClient(acd1, scene); scene.AddNewClient(testclient); ScenePresence presence = scene.GetScenePresence(agent1); @@ -162,6 +168,24 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(neighbours.Count, Is.EqualTo(2)); } + public void fixNullPresence() + { + string firstName = "testfirstname"; + + AgentCircuitData agent = new AgentCircuitData(); + agent.AgentID = agent1; + agent.firstname = firstName; + agent.lastname = "testlastname"; + agent.SessionID = UUID.Zero; + agent.SecureSessionID = UUID.Zero; + agent.circuitcode = 123; + agent.BaseFolder = UUID.Zero; + agent.InventoryFolder = UUID.Zero; + agent.startpos = Vector3.Zero; + agent.CapsPath = GetRandomCapsObjectPath(); + + acd1 = agent; + } [Test] public void T013_TestRemoveNeighbourRegion() From 7a2a2e68e7e235b9d79c09d98a4cf0b6f87a2a85 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 14 Aug 2009 14:18:56 +0100 Subject: [PATCH 18/35] Remove the script sponsor logic because scripts are timing out again. This needs to be looked into. This commit, unfortunately, reinstates a memory leak in regions that see significant script fluctuation, e.g. lots of scripted attachments, or script development. --- .../Shared/Api/Implementation/LSL_Api.cs | 6 +++--- .../Shared/Api/Implementation/OSSL_Api.cs | 6 +++--- .../ScriptEngine/Shared/Api/Runtime/ScriptBase.cs | 15 ++++++++------- .../Shared/Instance/ScriptInstance.cs | 7 +------ 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ff85b96d50..691732aa75 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -125,9 +125,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (lease.CurrentState == LeaseState.Initial) { - lease.InitialLeaseTime = TimeSpan.FromMinutes(1.0); - lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0); - lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0); + lease.InitialLeaseTime = TimeSpan.FromMinutes(0); +// lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0); +// lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0); } return lease; } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 6539bda958..6e3a3abb61 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -166,9 +166,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (lease.CurrentState == LeaseState.Initial) { - lease.InitialLeaseTime = TimeSpan.FromMinutes(1.0); - lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0); - lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0); + lease.InitialLeaseTime = TimeSpan.FromMinutes(0); +// lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0); +// lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0); } return lease; } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs index d119a7739d..838cafb820 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs @@ -42,16 +42,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public partial class ScriptBaseClass : MarshalByRefObject, IScript { private Dictionary inits = new Dictionary(); - private ScriptSponsor m_sponser; +// private ScriptSponsor m_sponser; public override Object InitializeLifetimeService() { ILease lease = (ILease)base.InitializeLifetimeService(); if (lease.CurrentState == LeaseState.Initial) { - lease.InitialLeaseTime = TimeSpan.FromMinutes(1.0); - lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0); - lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0); + // Infinite + lease.InitialLeaseTime = TimeSpan.FromMinutes(0); +// lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0); +// lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0); } return lease; } @@ -79,7 +80,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase } } - m_sponser = new ScriptSponsor(); +// m_sponser = new ScriptSponsor(); } private Executor m_Executor = null; @@ -112,7 +113,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return; ILease lease = (ILease)RemotingServices.GetLifetimeService(data as MarshalByRefObject); - lease.Register(m_sponser); +// lease.Register(m_sponser); MethodInfo mi = inits[api]; @@ -126,7 +127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public void Close() { - m_sponser.Close(); +// m_sponser.Close(); } public Dictionary GetVars() diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 4211cedaa5..7bbaac0a0e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -53,7 +53,7 @@ using OpenSim.Region.ScriptEngine.Interfaces; namespace OpenSim.Region.ScriptEngine.Shared.Instance { - public class ScriptInstance : MarshalByRefObject, IScriptInstance, ISponsor + public class ScriptInstance : MarshalByRefObject, IScriptInstance { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -1006,10 +1006,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance { return true; } - - public TimeSpan Renewal(ILease lease) - { - return lease.InitialLeaseTime; - } } } From a851b68333756d11be2c5afe2aa76c58ae771b4b Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 14 Aug 2009 14:27:56 +0100 Subject: [PATCH 19/35] Remove one more sponsor reference --- OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 7bbaac0a0e..225126dcd5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -261,7 +261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance "SecondLife.Script"); ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); - lease.Register(this); +// lease.Register(this); } catch (Exception) { From c18f7560d9ab13c0c7a73c679383ceee13d1b1e3 Mon Sep 17 00:00:00 2001 From: Kunnis Date: Sun, 9 Aug 2009 02:05:21 -0500 Subject: [PATCH 20/35] Adding in Reflection-based testing, to ensure that all properties are covered. --- .../Data/Tests/PropertyCompareConstraint.cs | 298 ++++++++++++++++++ OpenSim/Data/Tests/ScrambleForTesting.cs | 102 ++++++ 2 files changed, 400 insertions(+) create mode 100644 OpenSim/Data/Tests/PropertyCompareConstraint.cs create mode 100644 OpenSim/Data/Tests/ScrambleForTesting.cs diff --git a/OpenSim/Data/Tests/PropertyCompareConstraint.cs b/OpenSim/Data/Tests/PropertyCompareConstraint.cs new file mode 100644 index 0000000000..678501e842 --- /dev/null +++ b/OpenSim/Data/Tests/PropertyCompareConstraint.cs @@ -0,0 +1,298 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Linq.Expressions; +using System.Reflection; +using NUnit.Framework; +using NUnit.Framework.Constraints; +using NUnit.Framework.SyntaxHelpers; +using OpenMetaverse; +using OpenSim.Framework; + +namespace OpenSim.Data.Tests +{ + public static class Constraints + { + //This is here because C# has a gap in the language, you can't infer type from a constructor + public static PropertyCompareConstraint PropertyCompareConstraint(T expected) + { + return new PropertyCompareConstraint(expected); + } + } + + public class PropertyCompareConstraint : NUnit.Framework.Constraints.Constraint + { + private readonly object _expected; + //the reason everywhere uses propertyNames.Reverse().ToArray() is because the stack is backwards of the order we want to display the properties in. + private string failingPropertyName = string.Empty; + private object failingExpected; + private object failingActual; + + public PropertyCompareConstraint(T expected) + { + _expected = expected; + } + + public override bool Matches(object actual) + { + return ObjectCompare(_expected, actual, new Stack()); + } + + private bool ObjectCompare(object expected, object actual, Stack propertyNames) + { + if (actual.GetType() != expected.GetType()) + { + propertyNames.Push("GetType()"); + failingPropertyName = string.Join(".", propertyNames.Reverse().ToArray()); + propertyNames.Pop(); + failingActual = actual.GetType(); + failingExpected = expected.GetType(); + return false; + } + + if(actual.GetType() == typeof(Color)) + { + Color actualColor = (Color) actual; + Color expectedColor = (Color) expected; + if (actualColor.R != expectedColor.R) + { + propertyNames.Push("R"); + failingPropertyName = string.Join(".", propertyNames.Reverse().ToArray()); + propertyNames.Pop(); + failingActual = actualColor.R; + failingExpected = expectedColor.R; + return false; + } + if (actualColor.G != expectedColor.G) + { + propertyNames.Push("G"); + failingPropertyName = string.Join(".", propertyNames.Reverse().ToArray()); + propertyNames.Pop(); + failingActual = actualColor.G; + failingExpected = expectedColor.G; + return false; + } + if (actualColor.B != expectedColor.B) + { + propertyNames.Push("B"); + failingPropertyName = string.Join(".", propertyNames.Reverse().ToArray()); + propertyNames.Pop(); + failingActual = actualColor.B; + failingExpected = expectedColor.B; + return false; + } + if (actualColor.A != expectedColor.A) + { + propertyNames.Push("A"); + failingPropertyName = string.Join(".", propertyNames.Reverse().ToArray()); + propertyNames.Pop(); + failingActual = actualColor.A; + failingExpected = expectedColor.A; + return false; + } + return true; + } + + //Skip static properties. I had a nasty problem comparing colors because of all of the public static colors. + PropertyInfo[] properties = expected.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance); + foreach (var property in properties) + { + if (ignores.Contains(property.Name)) + continue; + + object actualValue = property.GetValue(actual, null); + object expectedValue = property.GetValue(expected, null); + + //If they are both null, they are equal + if (actualValue == null && expectedValue == null) + continue; + + //If only one is null, then they aren't + if (actualValue == null || expectedValue == null) + { + propertyNames.Push(property.Name); + failingPropertyName = string.Join(".", propertyNames.Reverse().ToArray()); + propertyNames.Pop(); + failingActual = actualValue; + failingExpected = expectedValue; + return false; + } + + IComparable comp = actualValue as IComparable; + if (comp != null) + { + if (comp.CompareTo(expectedValue) != 0) + { + propertyNames.Push(property.Name); + failingPropertyName = string.Join(".", propertyNames.Reverse().ToArray()); + propertyNames.Pop(); + failingActual = actualValue; + failingExpected = expectedValue; + return false; + } + continue; + } + + IEnumerable arr = actualValue as IEnumerable; + if (arr != null) + { + List actualList = arr.Cast().ToList(); + List expectedList = ((IEnumerable)expectedValue).Cast().ToList(); + if (actualList.Count != expectedList.Count) + { + propertyNames.Push(property.Name); + propertyNames.Push("Count"); + failingPropertyName = string.Join(".", propertyNames.Reverse().ToArray()); + failingActual = actualList.Count; + failingExpected = expectedList.Count; + propertyNames.Pop(); + propertyNames.Pop(); + } + //Todo: A value-wise comparison of all of the values. + //Everything seems okay... + continue; + } + + propertyNames.Push(property.Name); + if (!ObjectCompare(expectedValue, actualValue, propertyNames)) + return false; + propertyNames.Pop(); + } + + return true; + } + + public override void WriteDescriptionTo(MessageWriter writer) + { + writer.WriteExpectedValue(failingExpected); + } + + public override void WriteActualValueTo(MessageWriter writer) + { + writer.WriteActualValue(failingActual); + writer.WriteLine(); + writer.Write(" On Property: " + failingPropertyName); + } + + //These notes assume the lambda: (x=>x.Parent.Value) + //ignores should really contain like a fully dotted version of the property name, but I'm starting with small steps + readonly List ignores = new List(); + public PropertyCompareConstraint IgnoreProperty(Expression> func) + { + Expression express = func.Body; + PullApartExpression(express); + + return this; + } + + private void PullApartExpression(Expression express) + { + //This deals with any casts... like implicit casts to object. Not all UnaryExpression are casts, but this is a first attempt. + if (express is UnaryExpression) + PullApartExpression(((UnaryExpression)express).Operand); + if (express is MemberExpression) + { + //If the inside of the lambda is the access to x, we've hit the end of the chain. + // We should track by the fully scoped parameter name, but this is the first rev of doing this. + if (((MemberExpression)express).Expression is ParameterExpression) + { + ignores.Add(((MemberExpression)express).Member.Name); + } + else + { + //Otherwise there could be more parameters inside... + PullApartExpression(((MemberExpression)express).Expression); + } + } + } + } + + [TestFixture] + public class PropertyCompareConstraintTest + { + public class HasInt + { + public int TheValue { get; set; } + } + + [Test] + public void IntShouldMatch() + { + HasInt actual = new HasInt { TheValue = 5 }; + HasInt expected = new HasInt { TheValue = 5 }; + var constraint = Constraints.PropertyCompareConstraint(expected); + + Assert.That(constraint.Matches(actual), Is.True); + } + + [Test] + public void IntShouldNotMatch() + { + HasInt actual = new HasInt { TheValue = 5 }; + HasInt expected = new HasInt { TheValue = 4 }; + var constraint = Constraints.PropertyCompareConstraint(expected); + + Assert.That(constraint.Matches(actual), Is.False); + } + + + [Test] + public void IntShouldIgnore() + { + HasInt actual = new HasInt { TheValue = 5 }; + HasInt expected = new HasInt { TheValue = 4 }; + var constraint = Constraints.PropertyCompareConstraint(expected).IgnoreProperty(x=>x.TheValue); + + Assert.That(constraint.Matches(actual), Is.True); + } + + [Test] + public void AssetShouldMatch() + { + UUID uuid1 = UUID.Random(); + AssetBase actual = new AssetBase(uuid1, "asset one"); + AssetBase expected = new AssetBase(uuid1, "asset one"); + + var constraint = Constraints.PropertyCompareConstraint(expected); + + Assert.That(constraint.Matches(actual), Is.True); + } + + [Test] + public void AssetShouldNotMatch() + { + UUID uuid1 = UUID.Random(); + AssetBase actual = new AssetBase(uuid1, "asset one"); + AssetBase expected = new AssetBase(UUID.Random(), "asset one"); + + var constraint = Constraints.PropertyCompareConstraint(expected); + + Assert.That(constraint.Matches(actual), Is.False); + } + + [Test] + public void AssetShouldNotMatch2() + { + UUID uuid1 = UUID.Random(); + AssetBase actual = new AssetBase(uuid1, "asset one"); + AssetBase expected = new AssetBase(uuid1, "asset two"); + + var constraint = Constraints.PropertyCompareConstraint(expected); + + Assert.That(constraint.Matches(actual), Is.False); + } + + [Test] + public void TestColors() + { + Color actual = Color.Red; + Color expected = Color.FromArgb(actual.A, actual.R, actual.G, actual.B); + + var constraint = Constraints.PropertyCompareConstraint(expected); + + Assert.That(constraint.Matches(actual), Is.True); + } + } +} \ No newline at end of file diff --git a/OpenSim/Data/Tests/ScrambleForTesting.cs b/OpenSim/Data/Tests/ScrambleForTesting.cs new file mode 100644 index 0000000000..c6e467f60e --- /dev/null +++ b/OpenSim/Data/Tests/ScrambleForTesting.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections; +using System.Reflection; +using System.Text; +using NUnit.Framework; +using OpenMetaverse; +using OpenSim.Framework; + +namespace OpenSim.Data.Tests +{ + public static class ScrambleForTesting + { + private static readonly Random random = new Random(); + public static void Scramble(object obj) + { + PropertyInfo[] properties = obj.GetType().GetProperties(); + foreach (var property in properties) + { + //Skip indexers of classes. We will assume that everything that has an indexer + // is also IEnumberable. May not always be true, but should be true normally. + if(property.GetIndexParameters().Length > 0) + continue; + + RandomizeProperty(obj, property, null); + } + //Now if it implments IEnumberable, it's probably some kind of list, so we should randomize + // everything inside of it. + IEnumerable enumerable = obj as IEnumerable; + if(enumerable != null) + { + foreach (object value in enumerable) + { + Scramble(value); + } + } + } + + private static void RandomizeProperty(object obj, PropertyInfo property, object[] index) + { + Type t = property.PropertyType; + if (!property.CanWrite) + return; + object value = property.GetValue(obj, index); + if (value == null) + return; + + if (t == typeof (string)) + property.SetValue(obj, RandomName(), index); + else if (t == typeof (UUID)) + property.SetValue(obj, UUID.Random(), index); + else if (t == typeof (sbyte)) + property.SetValue(obj, (sbyte)random.Next(sbyte.MinValue, sbyte.MaxValue), index); + else if (t == typeof (short)) + property.SetValue(obj, (short)random.Next(short.MinValue, short.MaxValue), index); + else if (t == typeof (int)) + property.SetValue(obj, random.Next(), index); + else if (t == typeof (long)) + property.SetValue(obj, random.Next() * int.MaxValue, index); + else if (t == typeof (byte)) + property.SetValue(obj, (byte)random.Next(byte.MinValue, byte.MaxValue), index); + else if (t == typeof (ushort)) + property.SetValue(obj, (ushort)random.Next(ushort.MinValue, ushort.MaxValue), index); + else if (t == typeof (uint)) + property.SetValue(obj, Convert.ToUInt32(random.Next()), index); + else if (t == typeof (ulong)) + property.SetValue(obj, Convert.ToUInt64(random.Next()) * Convert.ToUInt64(UInt32.MaxValue), index); + else if (t == typeof (bool)) + property.SetValue(obj, true, index); + else if (t == typeof (byte[])) + { + byte[] bytes = new byte[30]; + random.NextBytes(bytes); + property.SetValue(obj, bytes, index); + } + else + Scramble(value); + } + + private static string RandomName() + { + StringBuilder name = new StringBuilder(); + int size = random.Next(5, 12); + for (int i = 0; i < size; i++) + { + char ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))); + name.Append(ch); + } + return name.ToString(); + } + } + + [TestFixture] + public class ScrableForTestingTest + { + [Test] + public void TestScramble() + { + AssetBase actual = new AssetBase(UUID.Random(), "asset one"); + ScrambleForTesting.Scramble(actual); + } + } +} \ No newline at end of file From 31820b002618b773b38ce1c1a073383cec89277b Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 14 Aug 2009 18:36:09 +0100 Subject: [PATCH 21/35] minor formatting adjustments --- OpenSim/Data/Tests/BasicUserTest.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/OpenSim/Data/Tests/BasicUserTest.cs b/OpenSim/Data/Tests/BasicUserTest.cs index d3e6f41c27..4e4ddc8572 100644 --- a/OpenSim/Data/Tests/BasicUserTest.cs +++ b/OpenSim/Data/Tests/BasicUserTest.cs @@ -204,8 +204,16 @@ namespace OpenSim.Data.Tests UUID webloginkey = UUID.Random(); uint homeregx = (uint) random.Next(); uint homeregy = (uint) random.Next(); - Vector3 homeloc = new Vector3((float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5)); - Vector3 homelookat = new Vector3((float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5)); + Vector3 homeloc + = new Vector3( + (float)Math.Round(random.NextDouble(), 5), + (float)Math.Round(random.NextDouble(), 5), + (float)Math.Round(random.NextDouble(), 5)); + Vector3 homelookat + = new Vector3( + (float)Math.Round(random.NextDouble(), 5), + (float)Math.Round(random.NextDouble(), 5), + (float)Math.Round(random.NextDouble(), 5)); int created = random.Next(); int lastlogin = random.Next(); string userinvuri = RandomName(); From b02f12da78472606034e9edb43bc872286b1347e Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 14 Aug 2009 18:57:18 +0100 Subject: [PATCH 22/35] Return minimum mono version in README to 2.0.1 for now (recommended is still 2.4.2) --- README.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.txt b/README.txt index e796bb2810..5c34201aea 100644 --- a/README.txt +++ b/README.txt @@ -25,7 +25,7 @@ See configuring OpenSim == Installation on Linux == Prereqs: - * Mono >= 2.4 (>= 2.4.2 is better) + * Mono >= 2.0.1 (>= 2.4.2 is better) * Nant >= 0.86beta * sqlite3 or mysql 5.x (you'll need a back end database) From 957962b48276861948267701159775c2361b235b Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 14 Aug 2009 19:06:24 +0100 Subject: [PATCH 23/35] Remove NRE catching on TestReplicateArchivePathToUserInventory() since race failure now appears to have gone --- .../Archiver/Tests/InventoryArchiverTests.cs | 34 +++++-------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 28b4d6496e..2169e36d30 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -395,17 +395,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, InventoryReceived); Monitor.Wait(this, 60000); } - - //userInfo.FetchInventory(); - /* - for (int i = 0 ; i < 50 ; i++) - { - if (userInfo.HasReceivedInventory == true) - break; - Thread.Sleep(200); - } - Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); - */ Console.WriteLine("userInfo.RootFolder 1: {0}", userInfo.RootFolder); @@ -429,22 +418,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder); - try - { - new InventoryArchiveReadRequest(userInfo, null, (Stream)null, null, null) - .ReplicateArchivePathToUserInventory(itemArchivePath, false, userInfo.RootFolder, foldersCreated, nodesLoaded); + new InventoryArchiveReadRequest(userInfo, null, (Stream)null, null, null) + .ReplicateArchivePathToUserInventory( + itemArchivePath, false, userInfo.RootFolder, foldersCreated, nodesLoaded); - Console.WriteLine("userInfo.RootFolder 3: {0}", userInfo.RootFolder); - InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a"); - Assert.That(folder1, Is.Not.Null, "Could not find folder a"); - InventoryFolderImpl folder2 = folder1.FindFolderByPath("b"); - Assert.That(folder2, Is.Not.Null, "Could not find folder b"); - } - catch (NullReferenceException e) - { - // Non fatal for now until we resolve the race condition - Console.WriteLine("Test failed with {0}", e); - } + Console.WriteLine("userInfo.RootFolder 3: {0}", userInfo.RootFolder); + InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a"); + Assert.That(folder1, Is.Not.Null, "Could not find folder a"); + InventoryFolderImpl folder2 = folder1.FindFolderByPath("b"); + Assert.That(folder2, Is.Not.Null, "Could not find folder b"); } } } From dce81225c50e9ce15187bfb412870716127a31fa Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Fri, 14 Aug 2009 14:15:49 -0400 Subject: [PATCH 24/35] * allocate the dictionary for AgentCircuitData.ChildrenCapSeeds when creating the circuitdata object to see if it's the cause of a null reference exception in the TestAddNeighbourRegio test --- OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index a3672d576f..88452d2345 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs @@ -113,6 +113,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests agent.InventoryFolder = UUID.Zero; agent.startpos = Vector3.Zero; agent.CapsPath = GetRandomCapsObjectPath(); + agent.ChildrenCapSeeds = new Dictionary(); string reason; scene.NewUserConnection(agent, out reason); From a668a5b0d39f04497e5ea170e5af0e659a43febb Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 14 Aug 2009 19:59:42 +0100 Subject: [PATCH 25/35] Add standard doc and standard doc formatting to IAssetService --- .../Archiver/Tests/InventoryArchiverTests.cs | 2 +- OpenSim/Services/Interfaces/IAssetService.cs | 46 +++++++++++++++---- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 2169e36d30..9784fcfab5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -82,7 +82,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryArchiverModule archiverModule = new InventoryArchiverModule(); - Scene scene = SceneSetupHelpers.SetupScene(""); + Scene scene = SceneSetupHelpers.SetupScene("Inventory"); SceneSetupHelpers.SetupSceneModules(scene, archiverModule); CommunicationsManager cm = scene.CommsManager; diff --git a/OpenSim/Services/Interfaces/IAssetService.cs b/OpenSim/Services/Interfaces/IAssetService.cs index ec8a71bb55..6dfe78d724 100644 --- a/OpenSim/Services/Interfaces/IAssetService.cs +++ b/OpenSim/Services/Interfaces/IAssetService.cs @@ -34,25 +34,53 @@ namespace OpenSim.Services.Interfaces public interface IAssetService { - // Three different ways to retrieve an asset - // + /// + /// Get an asset synchronously. + /// + /// + /// AssetBase Get(string id); + + /// + /// Get an asset's metadata + /// + /// + /// AssetMetadata GetMetadata(string id); + byte[] GetData(string id); + /// + /// Get an asset asynchronously + /// + /// The asset id + /// Represents the requester. Passed back via the handler + /// The handler to call back once the asset has been retrieved + /// True if the id was parseable, false otherwise bool Get(string id, Object sender, AssetRetrieved handler); - // Creates a new asset - // Returns a random ID if none is passed into it - // + /// + /// Creates a new asset + /// + /// Returns a random ID if none is passed into it + /// + /// string Store(AssetBase asset); - // Attachments and bare scripts need this!! - // + /// + /// Update an asset's content + /// + /// Attachments and bare scripts need this!! + /// + /// + /// bool UpdateContent(string id, byte[] data); - // Kill an asset - // + /// + /// Delete an asset + /// + /// + /// bool Delete(string id); } } From ff28ecee1b35ba24ec538d8ed018c764476c62b4 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 14 Aug 2009 20:07:13 +0100 Subject: [PATCH 26/35] Re-enable TestSaveIarV0_1() Implement more parts of TestAssetService --- .../Archiver/Tests/InventoryArchiverTests.cs | 2 +- OpenSim/Tests/Common/Mock/TestAssetService.cs | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 9784fcfab5..c66678f316 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -74,7 +74,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests /// /// Test saving a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet). /// - //[Test] + [Test] public void TestSaveIarV0_1() { TestHelper.InMethod(); diff --git a/OpenSim/Tests/Common/Mock/TestAssetService.cs b/OpenSim/Tests/Common/Mock/TestAssetService.cs index 5f1184bd96..81f123a1e5 100644 --- a/OpenSim/Tests/Common/Mock/TestAssetService.cs +++ b/OpenSim/Tests/Common/Mock/TestAssetService.cs @@ -45,7 +45,13 @@ namespace OpenSim.Tests.Common.Mock public AssetBase Get(string id) { - return Assets[ id ]; + AssetBase asset; + if (Assets.ContainsKey(id)) + asset = Assets[id]; + else + asset = null; + + return asset; } public AssetMetadata GetMetadata(string id) @@ -59,8 +65,10 @@ namespace OpenSim.Tests.Common.Mock } public bool Get(string id, object sender, AssetRetrieved handler) - { - throw new NotImplementedException(); + { + handler(id, sender, Get(id)); + + return true; } public string Store(AssetBase asset) From e17a2331a02d36a3b9f6f37630601ab4a63a4fb2 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 14 Aug 2009 20:38:56 +0100 Subject: [PATCH 27/35] * Re-enable TestLoadIarV0_1ExistingUsers() --- .../Archiver/Tests/InventoryArchiverTests.cs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index c66678f316..470a386f23 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -222,7 +222,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where /// an account exists with the creator name. /// - //[Test] + [Test] public void TestLoadIarV0_1ExistingUsers() { TestHelper.InMethod(); @@ -262,7 +262,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryArchiverModule archiverModule = new InventoryArchiverModule(); // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene - Scene scene = SceneSetupHelpers.SetupScene(); + Scene scene = SceneSetupHelpers.SetupScene("inventory"); IUserAdminService userAdminService = scene.CommsManager.UserAdminService; SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); @@ -276,16 +276,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); - //userInfo.FetchInventory(); - /* - for (int i = 0 ; i < 50 ; i++) - { - if (userInfo.HasReceivedInventory == true) - break; - Thread.Sleep(200); - } - Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); - */ + InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName); Assert.That(foundItem, Is.Not.Null, "Didn't find loaded item"); Assert.That( From 386aa470ea6c5da4264c077478b75ea4db773c27 Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Fri, 14 Aug 2009 17:52:57 -0400 Subject: [PATCH 28/35] * Kunnis' third patch in mantis: http://opensimulator.org/mantis/view.php?id=3993 * Sets the assembly target of all projects to .NET 3.5. I was asked to apply this by Diva to resolve a build issue with LinQ on Visual Studio 2008 but I have not tested it personally. --- prebuild.xml | 225 ++++++++++++++++++++++++++------------------------- 1 file changed, 113 insertions(+), 112 deletions(-) diff --git a/prebuild.xml b/prebuild.xml index bd94c379a2..eff16ade68 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -34,7 +34,7 @@ - + ../../../../bin/ @@ -91,7 +91,7 @@ - + ../../../bin/ @@ -113,7 +113,7 @@ - + ../../bin/ @@ -145,7 +145,7 @@ - + ../../../bin/ @@ -170,7 +170,7 @@ - + ../../../bin/ @@ -194,7 +194,7 @@ - + ../../bin/ @@ -223,7 +223,7 @@ - + ../../../../bin/ @@ -248,7 +248,7 @@ - + ../../../../bin/ @@ -275,7 +275,7 @@ - + ../../../../bin/ @@ -300,7 +300,7 @@ - + ../../../../bin/ @@ -326,7 +326,7 @@ - + ../../../../bin/ @@ -351,7 +351,7 @@ - + ../../../bin/ @@ -384,7 +384,7 @@ - + ../../../../bin/ @@ -412,7 +412,7 @@ - + ../../../../bin/Physics/ @@ -435,7 +435,7 @@ - + ../../../../bin/Physics/ @@ -458,7 +458,7 @@ - + ../../../../bin/Physics/ @@ -483,7 +483,7 @@ - + ../../../../bin/Physics/ @@ -512,7 +512,7 @@ - + ../../../../bin/Physics/ @@ -542,7 +542,7 @@ - + ../../../../bin/Physics/ @@ -570,7 +570,7 @@ - + ../../../../bin/Physics/ @@ -598,7 +598,7 @@ - + ../../../bin/ @@ -626,7 +626,7 @@ - + ../../../bin/ @@ -660,7 +660,7 @@ - + ../../../bin/ @@ -702,7 +702,7 @@ - + ../../../bin/ @@ -752,7 +752,7 @@ - + ../../../../bin/ @@ -783,7 +783,7 @@ - + ../../../../bin/ @@ -820,7 +820,7 @@ - + ../../../../bin/ @@ -847,7 +847,7 @@ - + ../../../bin/ @@ -878,7 +878,7 @@ - + ../../../bin/ @@ -913,7 +913,7 @@ - + ../../../bin/ @@ -950,7 +950,7 @@ - + ../../../bin/ @@ -982,7 +982,7 @@ - + ../../../bin/ @@ -1012,7 +1012,7 @@ - + ../../../../bin/ @@ -1043,7 +1043,7 @@ - + ../../../../../bin/ @@ -1072,7 +1072,7 @@ - + ../../../../../bin/ @@ -1104,7 +1104,7 @@ - + ../../../bin/ @@ -1143,7 +1143,7 @@ - + ../../../bin/ @@ -1181,7 +1181,7 @@ - + ../../../bin/ @@ -1213,7 +1213,7 @@ - + ../../../bin/ @@ -1247,7 +1247,7 @@ - + ../../../bin/ @@ -1281,7 +1281,7 @@ - + ../../../bin/ @@ -1308,7 +1308,7 @@ - + ../../../bin/ @@ -1338,7 +1338,7 @@ - + ../../../bin/ @@ -1371,7 +1371,7 @@ - + ../../../bin/ @@ -1402,7 +1402,7 @@ - + ../../../bin/ @@ -1433,7 +1433,7 @@ - + ../../../bin/ @@ -1464,7 +1464,7 @@ - + ../../../bin/ @@ -1496,7 +1496,7 @@ - + ../../../bin/ @@ -1524,7 +1524,7 @@ - + ../../../bin/ @@ -1560,7 +1560,7 @@ - + ../../bin/ @@ -1593,7 +1593,7 @@ - + ../../../bin/ @@ -1654,7 +1654,7 @@ - + ../../../../../../bin/Terrain/ @@ -1677,7 +1677,7 @@ - + ../../../bin/ @@ -1736,7 +1736,7 @@ - + ../../../../bin/ @@ -1773,7 +1773,7 @@ - + ../../../bin/ @@ -1810,7 +1810,7 @@ - + ../../../../bin/ @@ -1851,7 +1851,7 @@ - + ../../../bin/ @@ -1878,7 +1878,7 @@ - + ../../../bin/ @@ -1920,7 +1920,7 @@ - + ../../../bin/ @@ -1955,7 +1955,7 @@ - + ../../../bin/ @@ -1985,7 +1985,7 @@ - + ../../../bin/ @@ -2028,7 +2028,7 @@ - + ../../../bin/ @@ -2068,7 +2068,7 @@ - @@ -2104,7 +2104,7 @@ - @@ -2142,7 +2142,7 @@ - @@ -2187,7 +2187,7 @@ - + ../../../bin/ @@ -2220,7 +2220,7 @@ - + bin/ @@ -2250,7 +2250,7 @@ - + ../../../bin/ @@ -2279,7 +2279,7 @@ - + ../../../bin/ @@ -2310,7 +2310,7 @@ - + ../../../bin/ @@ -2350,7 +2350,7 @@ - + ../../../bin/ @@ -2386,7 +2386,7 @@ - + ../../../bin/ @@ -2419,7 +2419,7 @@ - + ../../../bin/ @@ -2456,7 +2456,7 @@ - + ../../../bin/ @@ -2496,7 +2496,7 @@ - + ../../bin/ @@ -2518,7 +2518,7 @@ - + ../../../../bin/ @@ -2557,7 +2557,7 @@ - + ../../../../../../bin/ @@ -2592,7 +2592,7 @@ - + ../../../../../../../bin/ @@ -2626,7 +2626,7 @@ - + ../../../../../../bin/ @@ -2665,7 +2665,7 @@ - + ../../../../../bin/ @@ -2698,7 +2698,7 @@ - + ../../../../../bin/ @@ -2737,7 +2737,7 @@ - + ../../../../bin/ @@ -2780,7 +2780,7 @@ - + ../../../../bin/ @@ -2820,7 +2820,7 @@ - + ../../../bin/ @@ -2842,7 +2842,7 @@ - + ../../../bin/ @@ -2880,7 +2880,7 @@ - + ../../../bin/ @@ -2921,7 +2921,7 @@ - + ../../../../../bin/ @@ -2960,7 +2960,7 @@ - + ../../../../../bin/ @@ -2999,7 +2999,7 @@ - + ../../../../../bin/ @@ -3041,7 +3041,7 @@ - + ../../../../../bin/ @@ -3081,7 +3081,7 @@ - + ../../../../../bin/ @@ -3121,7 +3121,7 @@ - + ../../../../bin/ @@ -3166,7 +3166,7 @@ - + ../../../bin/ @@ -3217,7 +3217,7 @@ - + ../../../bin/ @@ -3244,7 +3244,7 @@ - + ../../bin/ @@ -3271,7 +3271,7 @@ - + ../../../bin/ @@ -3311,7 +3311,7 @@ - + ../../../bin/ @@ -3326,6 +3326,7 @@ ../../../bin/ + @@ -3342,7 +3343,7 @@ - + ../../../../bin/ @@ -3378,7 +3379,7 @@ - + ../../../../bin/ @@ -3417,7 +3418,7 @@ - + ../../../../bin/ @@ -3454,7 +3455,7 @@ - + ../../../bin/ @@ -3484,7 +3485,7 @@ - + ../../../../bin/ @@ -3514,7 +3515,7 @@ - + ../../../../../bin/ @@ -3543,7 +3544,7 @@ - + ../../../../bin/ @@ -3578,7 +3579,7 @@ - + ../../../bin/ @@ -3639,7 +3640,7 @@ - + ../../../bin/ @@ -3695,7 +3696,7 @@ - + ../../../../../bin/ @@ -3728,7 +3729,7 @@ - + ../../../bin/ @@ -3774,7 +3775,7 @@ TODO: this is kind of lame, we basically build a duplicate assembly but with tests added in, just because we can't resolve cross-bin-dir-refs. --> - + ../../../../bin/ @@ -3802,7 +3803,7 @@ - + ../../../../bin/ @@ -3861,7 +3862,7 @@ - + DEBUG;TRACE From 2c20d60de69251a7b3158366f9b0e1549a1a3f43 Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Fri, 14 Aug 2009 17:59:57 -0400 Subject: [PATCH 29/35] * Added Kunnis to CONTRIBUTORS.txt --- CONTRIBUTORS.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 6aaf6c80bc..c48ede5f80 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -77,7 +77,6 @@ what it is today. * Intimidated * Jeremy Bongio (IBM) * jhurliman -* Mike Osias (IBM) * John R Sohn (XenReborn) * jonc * Junta Kohime @@ -91,6 +90,7 @@ what it is today. * maimedleech * Mic Bowman * Michelle Argus +* Mike Osias (IBM) * Mike Pitman (IBM) * mikkopa/_someone - RealXtend * Mircea Kitsune @@ -119,9 +119,11 @@ what it is today. * Xantor * Y. Nitta * YZh +* Zackary Geers aka Kunnis Basiat * Zha Ewry + LSL Devs * Alondria From 1b933c91160a27fe53f3dff2e706363190b1ede9 Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Fri, 14 Aug 2009 19:12:42 -0400 Subject: [PATCH 30/35] * Put the StandaloneTeleportTest in a new thread and call Thread.Join() inside a try/Catch (ThreadAbortException) to try and get around scene code aborting the testing thread. Use a Messenger class to report the results back to the test thread. --- .../Scenes/Tests/StandaloneTeleportTests.cs | 115 +++++++++++++++--- 1 file changed, 95 insertions(+), 20 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs index ed2d3175d4..23eab9010c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs @@ -38,6 +38,7 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion; using OpenSim.Tests.Common; using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Setup; +using System.Threading; namespace OpenSim.Region.Framework.Scenes.Tests { @@ -55,56 +56,130 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void TestSimpleNotNeighboursTeleport() { TestHelper.InMethod(); + ThreadRunResults results = new ThreadRunResults(); + results.Result = false; + results.Message = "Test did not run"; + TestRunning testClass = new TestRunning(results); + Thread testThread = new Thread(testClass.run); + + try + { + // Seems kind of redundant to start a thread and then join it, however.. We need to protect against + // A thread abort exception in the simulator code. + testThread.Start(); + testThread.Join(); + } + catch (ThreadAbortException) + { + + } + Assert.That(testClass.results.Result, Is.EqualTo(true), testClass.results.Message); // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); + } + + } + + public class ThreadRunResults + { + public bool Result = false; + public string Message = string.Empty; + } + + public class TestRunning + { + public ThreadRunResults results; + public TestRunning(ThreadRunResults t) + { + results = t; + } + public void run(object o) + { + //results.Result = true; log4net.Config.XmlConfigurator.Configure(); - + UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100"); UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200"); TestCommunicationsManager cm = new TestCommunicationsManager(); // shared module ISharedRegionModule interregionComms = new RESTInterregionComms(); - + Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, cm); SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); sceneA.RegisterRegionWithGrid(); - + Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, cm); SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); sceneB.RegisterRegionWithGrid(); - - UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); + + UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); TestClient client = SceneSetupHelpers.AddRootAgent(sceneA, agentId); - + ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface(); + + results.Result = (sceneACapsModule.GetCapsPath(agentId) == client.CapsSeedUrl); + if (!results.Result) + { + results.Message = "Incorrect caps object path set up in sceneA"; + return; + } + + /* Assert.That( - sceneACapsModule.GetCapsPath(agentId), - Is.EqualTo(client.CapsSeedUrl), + sceneACapsModule.GetCapsPath(agentId), + Is.EqualTo(client.CapsSeedUrl), "Incorrect caps object path set up in sceneA"); - + */ // FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used. - client.TeleportTargetScene = sceneB; + + + client.TeleportTargetScene = sceneB; client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40)); + + results.Result = (sceneB.GetScenePresence(agentId) != null); + if (!results.Result) + { + results.Message = "Client does not have an agent in sceneB"; + return; + } + + //Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB"); - Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB"); - Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA"); - + //Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA"); + + results.Result = (sceneA.GetScenePresence(agentId) == null); + if (!results.Result) + { + results.Message = "Client still had an agent in sceneA"; + return; + } + ICapabilitiesModule sceneBCapsModule = sceneB.RequestModuleInterface(); - + + + results.Result = ("http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/" == client.CapsSeedUrl); + if (!results.Result) + { + results.Message = "Incorrect caps object path set up in sceneB"; + return; + } + // Temporary assertion - caps url construction should at least be doable through a method. + /* Assert.That( - "http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/", - Is.EqualTo(client.CapsSeedUrl), - "Incorrect caps object path set up in sceneB"); - + "http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/", + Is.EqualTo(client.CapsSeedUrl), + "Incorrect caps object path set up in sceneB"); + */ // This assertion will currently fail since we don't remove the caps paths when no longer needed //Assert.That(sceneACapsModule.GetCapsPath(agentId), Is.Null, "sceneA still had a caps object path"); - + // TODO: Check that more of everything is as it should be - + // TODO: test what happens if we try to teleport to a region that doesn't exist } } From 2f61fb0243e8e6b4da6e2ca1847faaba3ccee3d9 Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Fri, 14 Aug 2009 21:19:04 -0400 Subject: [PATCH 31/35] * minor : comments * also re-trigger panda --- .../Scenes/SceneCommunicationService.cs | 72 ++++++++++++++++++- 1 file changed, 69 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 0140faa485..c1e39a987d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -48,6 +48,9 @@ namespace OpenSim.Region.Framework.Scenes public delegate void RemoveKnownRegionsFromAvatarList(UUID avatarID, List regionlst); + /// + /// Class that Region communications runs through + /// public class SceneCommunicationService //one instance per region { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -60,15 +63,46 @@ namespace OpenSim.Region.Framework.Scenes protected List m_agentsInTransit; + /// + /// An agent is crossing into this region + /// public event AgentCrossing OnAvatarCrossingIntoRegion; + + /// + /// A user will arrive shortly, set up appropriate credentials so it can connect + /// public event ExpectUserDelegate OnExpectUser; + + /// + /// A Prim will arrive shortly + /// public event ExpectPrimDelegate OnExpectPrim; public event CloseAgentConnection OnCloseAgentConnection; + + /// + /// A new prim has arrived + /// public event PrimCrossing OnPrimCrossingIntoRegion; + + /// + /// A New Region is up and available + /// public event RegionUp OnRegionUp; + + /// + /// We have a child agent for this avatar and we're getting a status update about it + /// public event ChildAgentUpdate OnChildAgentUpdate; //public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar; + + /// + /// Time to log one of our users off. Grid Service sends this mostly + /// public event LogOffUser OnLogOffUser; + + /// + /// A region wants land data from us! + /// public event GetLandData OnGetLandData; private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion; @@ -123,11 +157,20 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Returns a region with the name closest to string provided + /// + /// Partial Region Name for matching + /// Region Information for the region public RegionInfo RequestClosestRegion(string name) { return m_commsProvider.GridService.RequestClosestRegion(name); } + /// + /// This region is shutting down, de-register all events! + /// De-Register region from Grid! + /// public void Close() { if (regionCommsHost != null) @@ -159,10 +202,9 @@ namespace OpenSim.Region.Framework.Scenes #region CommsManager Event handlers /// - /// + /// A New User will arrive shortly, Informs the scene that there's a new user on the way /// - /// - /// + /// Data we need to ensure that the agent can connect /// protected void NewUserConnection(AgentCircuitData agent) { @@ -174,6 +216,12 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// The Grid has requested us to log-off the user + /// + /// Unique ID of agent to log-off + /// The secret string that the region establishes with the grid when registering + /// The message to send to the user that tells them why they were logged off protected void GridLogOffUser(UUID AgentID, UUID RegionSecret, string message) { handlerLogOffUser = OnLogOffUser; @@ -183,6 +231,11 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// A New Region is now available. Inform the scene that there is a new region available. + /// + /// Information about the new region that is available + /// True if the event was handled protected bool newRegionUp(RegionInfo region) { handlerRegionUp = OnRegionUp; @@ -194,6 +247,11 @@ namespace OpenSim.Region.Framework.Scenes return true; } + /// + /// Inform the scene that we've got an update about a child agent that we have + /// + /// + /// protected bool ChildAgentUpdate(ChildAgentDataUpdate cAgentData) { handlerChildAgentUpdate = OnChildAgentUpdate; @@ -204,6 +262,7 @@ namespace OpenSim.Region.Framework.Scenes return true; } + protected void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) { handlerAvatarCrossingIntoRegion = OnAvatarCrossingIntoRegion; @@ -213,6 +272,13 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// We have a new prim from a neighbor + /// + /// unique ID for the primative + /// XML2 encoded data of the primative + /// An Int that represents the version of the XMLMethod + /// True if the prim was accepted, false if it was not protected bool IncomingPrimCrossing(UUID primID, String objXMLData, int XMLMethod) { handlerExpectPrim = OnExpectPrim; From f208628667aed5d1d98d17b5dda815ae5ed9bcc9 Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Fri, 14 Aug 2009 21:37:25 -0400 Subject: [PATCH 32/35] * minor : Comments * Also re-trigger Panda. --- OpenSim/Region/Framework/Scenes/Scene.cs | 71 +++++++++++++++++++++++- 1 file changed, 68 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 919075c1bd..56e5ef0994 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2170,6 +2170,14 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Sets the Home Point. The GridService uses this to know where to put a user when they log-in + /// + /// + /// + /// + /// + /// public virtual void SetHomeRezPoint(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags) { UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(remoteClient.AgentId); @@ -2340,6 +2348,12 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Removes region from an avatar's known region list. This coincides with child agents. For each child agent, there will be a known region entry. + /// + /// + /// + /// public void HandleRemoveKnownRegionsFromAvatar(UUID avatarID, List regionslst) { ScenePresence av = GetScenePresence(avatarID); @@ -2355,12 +2369,19 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Closes all endpoints with the circuitcode provided. + /// + /// Circuit Code of the endpoint to close public override void CloseAllAgents(uint circuitcode) { // Called by ClientView to kill all circuit codes ClientManager.CloseAllAgents(circuitcode); } + /// + /// Inform all other ScenePresences on this Scene that someone else has changed position on the minimap. + /// public void NotifyMyCoarseLocationChange() { ForEachScenePresence(delegate(ScenePresence presence) { presence.CoarseLocationChange(); }); @@ -2455,9 +2476,10 @@ namespace OpenSim.Region.Framework.Scenes /// The return bool should allow for connections to be refused, but as not all calling paths /// take proper notice of it let, we allowed banned users in still. /// - /// - /// - /// + /// CircuitData of the agent who is connecting + /// Outputs the reason for the false response on this string + /// True if the region accepts this agent. False if it does not. False will + /// also return a reason. public bool NewUserConnection(AgentCircuitData agent, out string reason) { // Don't disable this log message - it's too helpful @@ -2530,6 +2552,13 @@ namespace OpenSim.Region.Framework.Scenes return true; } + /// + /// Verifies that the user has a session on the Grid + /// + /// Circuit Data of the Agent we're verifying + /// Outputs the reason for the false response on this string + /// True if the user has a session on the grid. False if it does not. False will + /// also return a reason. public virtual bool AuthenticateUser(AgentCircuitData agent, out string reason) { reason = String.Empty; @@ -2542,6 +2571,13 @@ namespace OpenSim.Region.Framework.Scenes return result; } + /// + /// Verify if the user can connect to this region. Checks the banlist and ensures that the region is set for public access + /// + /// The circuit data for the agent + /// outputs the reason to this string + /// True if the region accepts this agent. False if it does not. False will + /// also return a reason. protected virtual bool AuthorizeUser(AgentCircuitData agent, out string reason) { reason = String.Empty; @@ -2600,16 +2636,32 @@ namespace OpenSim.Region.Framework.Scenes return true; } + /// + /// Update an AgentCircuitData object with new information + /// + /// Information to update the AgentCircuitData with public void UpdateCircuitData(AgentCircuitData data) { m_authenticateHandler.UpdateAgentData(data); } + /// + /// Change the Circuit Code for the user's Circuit Data + /// + /// The old Circuit Code. Must match a previous circuit code + /// The new Circuit Code. Must not be an already existing circuit code + /// True if we successfully changed it. False if we did not public bool ChangeCircuitCode(uint oldcc, uint newcc) { return m_authenticateHandler.TryChangeCiruitCode(oldcc, newcc); } + /// + /// The Grid has requested that we log-off a user. Log them off. + /// + /// Unique ID of the avatar to log-off + /// SecureSessionID of the user, or the RegionSecret text when logging on to the grid + /// message to display to the user. Reason for being logged off public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message) { ScenePresence loggingOffUser = null; @@ -2675,6 +2727,13 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// We've got an update about an agent that sees into this region, + /// send it to ScenePresence for processing It's the full data. + /// + /// Agent that contains all of the relevant things about an agent. + /// Appearance, animations, position, etc. + /// true if we handled it. public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData) { // m_log.DebugFormat( @@ -2692,6 +2751,12 @@ namespace OpenSim.Region.Framework.Scenes return false; } + /// + /// We've got an update about an agent that sees into this region, + /// send it to ScenePresence for processing It's only positional data + /// + /// AgentPosition that contains agent positional data so we can know what to send + /// true if we handled it. public virtual bool IncomingChildAgentDataUpdate(AgentPosition cAgentData) { //m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName); From 95be3eccd28f39b33e70202d2db4f7d57a99c9c8 Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Sat, 15 Aug 2009 00:01:58 -0400 Subject: [PATCH 33/35] * minor: comments * also re-trigger panda --- OpenSim/Region/Framework/Scenes/Scene.cs | 101 ++++++++++++++++++++++- 1 file changed, 99 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 56e5ef0994..18d7badbc1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1038,6 +1038,10 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Send out simstats data to all clients + /// + /// Stats on the Simulator's performance private void SendSimStatsPackets(SimStats stats) { List StatSendAgents = GetScenePresences(); @@ -1050,6 +1054,9 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Recount SceneObjectPart in parcel aabb + /// private void UpdateLand() { if (LandChannel != null) @@ -1061,11 +1068,17 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Update the terrain if it needs to be updated. + /// private void UpdateTerrain() { EventManager.TriggerTerrainTick(); } + /// + /// Back up queued up changes + /// private void UpdateStorageBackup() { if (!m_backingup) @@ -1078,6 +1091,9 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Sends out the OnFrame event to the modules + /// private void UpdateEvents() { m_eventManager.TriggerOnFrame(); @@ -1133,6 +1149,10 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Synchronous force backup. For deletes and links/unlinks + /// + /// Object to be backed up public void ForceSceneObjectBackup(SceneObjectGroup group) { if (group != null) @@ -1141,6 +1161,13 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Return object to avatar Message + /// + /// Avatar Unique Id + /// Name of object returned + /// Location of object returned + /// Reasion for object return public void AddReturn(UUID agentID, string objectName, Vector3 location, string reason) { lock (m_returns) @@ -1167,6 +1194,9 @@ namespace OpenSim.Region.Framework.Scenes #region Load Terrain + /// + /// Store the terrain in the persistant data store + /// public void SaveTerrain() { m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); @@ -1269,6 +1299,10 @@ namespace OpenSim.Region.Framework.Scenes #region Load Land + /// + /// Loads all Parcel data from the datastore for region identified by regionID + /// + /// Unique Identifier of the Region to load parcel data for public void loadAllLandObjectsFromStorage(UUID regionID) { m_log.Info("[SCENE]: Loading land objects from storage"); @@ -1322,6 +1356,20 @@ namespace OpenSim.Region.Framework.Scenes m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); } + + /// + /// Gets a new rez location based on the raycast and the size of the object that is being rezzed. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) { Vector3 pos = Vector3.Zero; @@ -1412,6 +1460,19 @@ namespace OpenSim.Region.Framework.Scenes } } + + /// + /// Create a New SceneObjectGroup/Part by raycasting + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// public virtual void AddNewPrim(UUID ownerID, UUID groupID, Vector3 RayEnd, Quaternion rot, PrimitiveBaseShape shape, byte bypassRaycast, Vector3 RayStart, UUID RayTargetID, byte RayEndIsIntersection) @@ -1829,6 +1890,12 @@ namespace OpenSim.Region.Framework.Scenes return true; } + /// + /// Attachment rezzing + /// + /// Agent Unique ID + /// Object ID + /// False public virtual bool IncomingCreateObject(UUID userID, UUID itemID) { ScenePresence sp = GetScenePresence(userID); @@ -1841,6 +1908,13 @@ namespace OpenSim.Region.Framework.Scenes return false; } + /// + /// Adds a Scene Object group to the Scene. + /// Verifies that the creator of the object is not banned from the simulator. + /// Checks if the item is an Attachment + /// + /// + /// True if the SceneObjectGroup was added, False if it was not public bool AddSceneObject(SceneObjectGroup sceneObject) { // If the user is banned, we won't let any of their objects @@ -1933,6 +2007,10 @@ namespace OpenSim.Region.Framework.Scenes #region Add/Remove Avatar Methods + /// + /// Adding a New Client and Create a Presence for it. + /// + /// public override void AddNewClient(IClientAPI client) { SubscribeToClientEvents(client); @@ -1977,6 +2055,10 @@ namespace OpenSim.Region.Framework.Scenes EventManager.TriggerOnNewClient(client); } + /// + /// Register for events from the client + /// + /// The IClientAPI of the connected client protected virtual void SubscribeToClientEvents(IClientAPI client) { client.OnRegionHandShakeReply += SendLayerData; @@ -2070,8 +2152,8 @@ namespace OpenSim.Region.Framework.Scenes /// /// Teleport an avatar to their home region /// - /// - /// + /// The avatar's Unique ID + /// The IClientAPI for the client public virtual void TeleportClientHome(UUID agentId, IClientAPI client) { UserProfileData UserProfile = CommsManager.UserService.GetUserProfile(agentId); @@ -2099,6 +2181,21 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Duplicates object specified by localID at position raycasted against RayTargetObject using + /// RayEnd and RayStart to determine what the angle of the ray is + /// + /// ID of object to duplicate + /// + /// Agent doing the duplication + /// Group of new object + /// The target of the Ray + /// The ending of the ray (farthest away point) + /// The Beginning of the ray (closest point) + /// Bool to bypass raycasting + /// The End specified is the place to add the object + /// Position the object at the center of the face that it's colliding with + /// Rotate the object the same as the localID object public void doObjectDuplicateOnRay(uint localID, uint dupeFlags, UUID AgentID, UUID GroupID, UUID RayTargetObj, Vector3 RayEnd, Vector3 RayStart, bool BypassRaycast, bool RayEndIsIntersection, bool CopyCenters, bool CopyRotates) From 72c2819c53e395569cb6b1cd047159ab07b18966 Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Sat, 15 Aug 2009 00:22:18 -0400 Subject: [PATCH 34/35] * Comment out XEngineTest that doesn't appear to test anything. It just creates a scene named 'My Test' which just happens to be the last scene displayed in the nunit log before it goes boom. --- OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs index aac52a490f..637b52f7a9 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs @@ -40,6 +40,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Tests /// /// Scene presence tests /// + /// Commented out XEngineTests that don't do anything + /* [TestFixture] public class XEngineTest { @@ -65,4 +67,5 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Tests xengine.RegionLoaded(scene); } } + * } From ddac88da6a952f24f35caa69be0cff2dd725e824 Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Sat, 15 Aug 2009 00:29:34 -0400 Subject: [PATCH 35/35] * whoops, missing a / --- OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs index 637b52f7a9..045abb4490 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs @@ -67,5 +67,5 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Tests xengine.RegionLoaded(scene); } } - * + */ }