From ccd74f888bcb2fe60d14d45bfc9506a2c005aa82 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 23 Aug 2008 02:30:07 +0000 Subject: Some complex re-ordering to make prebuild do what needed to be done. It is now possible to use module interfaces without referencing Scene. Place those interfaces in OpenSim/Region/Interfaces. They may not use any refs from OpenSim.Region.Environment as parameters. This resolves a circular library ref introduced in r5949 --- .../Framework/Communications/Capabilities/Caps.cs | 5 +-- OpenSim/Framework/IScene.cs | 4 +- .../Region/Environment/Interfaces/IMoneyModule.cs | 46 ---------------------- .../AssetTransaction/AssetTransactionModule.cs | 1 + .../Currency/SampleMoney/SampleMoneyModule.cs | 3 +- .../Region/Environment/Scenes/Scene.Inventory.cs | 1 + OpenSim/Region/Environment/Scenes/Scene.cs | 2 +- OpenSim/Region/Environment/Scenes/SceneBase.cs | 5 +++ OpenSim/Region/Interfaces/IMoneyModule.cs | 46 ++++++++++++++++++++++ .../ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 1 + .../Common/ScriptEngineBase/EventManager.cs | 1 + .../Shared/Api/Implementation/LSL_Api.cs | 1 + .../Region/ScriptEngine/XEngine/EventManager.cs | 1 + 13 files changed, 65 insertions(+), 52 deletions(-) delete mode 100644 OpenSim/Region/Environment/Interfaces/IMoneyModule.cs create mode 100644 OpenSim/Region/Interfaces/IMoneyModule.cs (limited to 'OpenSim') diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index 338604d..6946561 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs @@ -35,8 +35,7 @@ using log4net; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Servers; using OpenSim.Framework; -using OpenSim.Region.Environment.Interfaces; -using OpenSim.Region.Environment.Scenes; +using OpenSim.Region.Interfaces; namespace OpenSim.Framework.Communications.Capabilities { @@ -614,7 +613,7 @@ namespace OpenSim.Framework.Communications.Capabilities llsdRequest.asset_type == "sound") { IClientAPI client = GetClient(m_agentID); - Scene scene = (Scene)client.Scene; + IScene scene = client.Scene; IMoneyModule mm = scene.RequestModuleInterface(); diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs index 82002c2..2cce12f 100644 --- a/OpenSim/Framework/IScene.cs +++ b/OpenSim/Framework/IScene.cs @@ -63,5 +63,7 @@ namespace OpenSim.Framework bool PresenceChildStatus(LLUUID avatarID); string GetCapsPath(LLUUID agentId); + + T RequestModuleInterface(); } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/Interfaces/IMoneyModule.cs b/OpenSim/Region/Environment/Interfaces/IMoneyModule.cs deleted file mode 100644 index 49d096b..0000000 --- a/OpenSim/Region/Environment/Interfaces/IMoneyModule.cs +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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 OpenSim 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 OpenSim.Framework; -using libsecondlife; - -namespace OpenSim.Region.Environment.Interfaces -{ - public delegate void ObjectPaid(LLUUID objectID, LLUUID agentID, int amount); - public interface IMoneyModule : IRegionModule - { - bool ObjectGiveMoney(LLUUID objectID, LLUUID fromID, LLUUID toID, - int amount); - - int GetBalance(IClientAPI client); - void ApplyUploadCharge(LLUUID agentID); - bool UploadCovered(IClientAPI client); - - event ObjectPaid OnObjectPaid; - } -} diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs index d8720db..d5e4df7 100644 --- a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs +++ b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs @@ -32,6 +32,7 @@ using libsecondlife; using log4net; using Nini.Config; using OpenSim.Framework; +using OpenSim.Region.Interfaces; using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Scenes; diff --git a/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs index e31770f..4a6828c 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs @@ -38,6 +38,7 @@ using Nini.Config; using Nwc.XmlRpc; using OpenSim.Framework; using OpenSim.Region.Environment.Interfaces; +using OpenSim.Region.Interfaces; using OpenSim.Region.Environment.Scenes; using OpenSim.Framework.Communications.Cache; @@ -54,7 +55,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney /// Centralized grid structure example using OpenSimWi Redux revision 9+ /// svn co https://opensimwiredux.svn.sourceforge.net/svnroot/opensimwiredux /// - public class SampleMoneyModule : IMoneyModule + public class SampleMoneyModule : IMoneyModule, IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 9c91725..8382467 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -35,6 +35,7 @@ using libsecondlife.Packets; using log4net; using OpenSim.Framework; using OpenSim.Framework.Communications.Cache; +using OpenSim.Region.Interfaces; using OpenSim.Region.Environment.Interfaces; namespace OpenSim.Region.Environment.Scenes diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index fb2cbb6..3bae463 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -2963,7 +2963,7 @@ namespace OpenSim.Region.Environment.Scenes /// For the given interface, retrieve the region module which implements it. /// /// null if there is no module implementing that interface - public T RequestModuleInterface() + public override T RequestModuleInterface() { if (ModuleInterfaces.ContainsKey(typeof(T))) { diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index fbef367..c624a41 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs @@ -220,5 +220,10 @@ namespace OpenSim.Region.Environment.Scenes return null; } + + public virtual T RequestModuleInterface() + { + return default(T); + } } } diff --git a/OpenSim/Region/Interfaces/IMoneyModule.cs b/OpenSim/Region/Interfaces/IMoneyModule.cs new file mode 100644 index 0000000..5636857 --- /dev/null +++ b/OpenSim/Region/Interfaces/IMoneyModule.cs @@ -0,0 +1,46 @@ +/* + * 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 OpenSim 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 OpenSim.Framework; +using libsecondlife; + +namespace OpenSim.Region.Interfaces +{ + public delegate void ObjectPaid(LLUUID objectID, LLUUID agentID, int amount); + public interface IMoneyModule + { + bool ObjectGiveMoney(LLUUID objectID, LLUUID fromID, LLUUID toID, + int amount); + + int GetBalance(IClientAPI client); + void ApplyUploadCharge(LLUUID agentID); + bool UploadCovered(IClientAPI client); + + event ObjectPaid OnObjectPaid; + } +} diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 6c62d88..be337e7 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -38,6 +38,7 @@ using libsecondlife.Packets; using OpenSim.Framework; using OpenSim.Framework.Communications.Cache; using OpenSim.Region.Environment; +using OpenSim.Region.Interfaces; using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney; using OpenSim.Region.Environment.Modules.World.Land; diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs index eea7ab4..a6bb405 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventManager.cs @@ -31,6 +31,7 @@ using libsecondlife; using OpenSim.Framework; using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney; using OpenSim.Region.Environment; +using OpenSim.Region.Interfaces; using OpenSim.Region; using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Interfaces; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b90ab79..2428bc4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -39,6 +39,7 @@ using OpenSim; using OpenSim.Framework; using OpenSim.Framework.Communications.Cache; using OpenSim.Region.Environment; +using OpenSim.Region.Interfaces; using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney; using OpenSim.Region.Environment.Modules.World.Land; diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs index db11e6b..a4b9d4c 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using libsecondlife; using OpenSim.Framework; using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney; +using OpenSim.Region.Interfaces; using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.ScriptEngine.Shared; -- cgit v1.1