changes to pass nini config object to the modules that get

loaded so that they may read out any bits they are interested in
afrisby
Sean Dague 2007-10-19 20:27:34 +00:00
parent aaaa3c6835
commit 139994757c
21 changed files with 1885 additions and 1858 deletions

View File

@ -34,6 +34,7 @@ using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Scenes.Scripting;
using OpenSim.Region.Environment.Interfaces;
using libsecondlife;
using Nini.Config;
namespace OpenSim.Grid.ScriptEngine.DotNetEngine
{
@ -103,7 +104,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine
#region IRegionModule
public void Initialise(Scene scene)
public void Initialise(Scene scene, IConfigSource config)
{
this.InitializeEngine(scene, MainLog.Instance);
}

View File

@ -63,6 +63,7 @@ namespace OpenSim
protected ModuleLoader m_moduleLoader;
protected LocalLoginService m_loginService;
private IConfigSource m_config;
protected string m_storageDLL = "OpenSim.DataStore.NullStorage.dll";
@ -89,9 +90,8 @@ namespace OpenSim
public OpenSimMain(IConfigSource configSource)
: base()
{
IConfigSource startupSource = configSource;
string iniFile = startupSource.Configs["Startup"].GetString("inifile", "OpenSim.ini");
string useExecutePathString = startupSource.Configs["Startup"].GetString("useexecutepath", "false").ToLower();
string iniFile = configSource.Configs["Startup"].GetString("inifile", "OpenSim.ini");
string useExecutePathString = configSource.Configs["Startup"].GetString("useexecutepath", "false").ToLower();
bool useExecutePath = false;
if (useExecutePathString == "true" || useExecutePathString == "" || useExecutePathString == "1" || useExecutePathString == "yes")
{
@ -104,46 +104,46 @@ namespace OpenSim
string iniFilePath = Path.Combine(Util.configDir(), iniFile);
if (File.Exists(iniFilePath))
{
startupSource = new IniConfigSource(iniFilePath);
m_config = new IniConfigSource(iniFilePath);
//enable following line, if we want the original config source(normally commandline args) merged with ini file settings.
//in this case we have it so that if both sources have the same named setting, the command line value will overwrite the ini file value.
//(as if someone has bothered to enter a command line arg, we should take notice of it)
startupSource.Merge(configSource);
m_config.Merge(configSource);
}
ReadConfigSettings(startupSource);
ReadConfigSettings();
}
protected void ReadConfigSettings(IConfigSource configSource)
protected void ReadConfigSettings()
{
m_networkServersInfo = new NetworkServersInfo();
m_sandbox = !configSource.Configs["Startup"].GetBoolean("gridmode", false);
m_physicsEngine = configSource.Configs["Startup"].GetString("physics", "basicphysics");
m_silent = configSource.Configs["Startup"].GetBoolean("noverbose", false);
m_permissions = configSource.Configs["Startup"].GetBoolean("serverside_object_permissions", false);
m_sandbox = !m_config.Configs["Startup"].GetBoolean("gridmode", false);
m_physicsEngine = m_config.Configs["Startup"].GetString("physics", "basicphysics");
m_silent = m_config.Configs["Startup"].GetBoolean("noverbose", false);
m_permissions = m_config.Configs["Startup"].GetBoolean("serverside_object_permissions", false);
m_storageDLL = configSource.Configs["Startup"].GetString("storage_plugin", "OpenSim.DataStore.NullStorage.dll");
m_storageDLL = m_config.Configs["Startup"].GetString("storage_plugin", "OpenSim.DataStore.NullStorage.dll");
m_startupCommandsFile = configSource.Configs["Startup"].GetString("startup_console_commands_file", "");
m_shutdownCommandsFile = configSource.Configs["Startup"].GetString("shutdown_console_commands_file", "");
m_startupCommandsFile = m_config.Configs["Startup"].GetString("startup_console_commands_file", "");
m_shutdownCommandsFile = m_config.Configs["Startup"].GetString("shutdown_console_commands_file", "");
m_scriptEngine = configSource.Configs["Startup"].GetString("script_engine", "DotNetEngine");
m_scriptEngine = m_config.Configs["Startup"].GetString("script_engine", "DotNetEngine");
m_assetStorage = configSource.Configs["Startup"].GetString("asset_database", "db4o");
m_assetStorage = m_config.Configs["Startup"].GetString("asset_database", "db4o");
configSource.Configs["Startup"].GetBoolean("default_modules", true);
configSource.Configs["Startup"].GetBoolean("default_shared_modules", true);
configSource.Configs["Startup"].GetString("except_modules", "");
configSource.Configs["Startup"].GetString("except_shared_modules", "");
m_config.Configs["Startup"].GetBoolean("default_modules", true);
m_config.Configs["Startup"].GetBoolean("default_shared_modules", true);
m_config.Configs["Startup"].GetString("except_modules", "");
m_config.Configs["Startup"].GetString("except_shared_modules", "");
standaloneAuthenticate = configSource.Configs["StandAlone"].GetBoolean("accounts_authenticate", false);
standaloneWelcomeMessage = configSource.Configs["StandAlone"].GetString("welcome_message", "Welcome to OpenSim");
standaloneInventoryPlugin = configSource.Configs["StandAlone"].GetString("inventory_plugin", "OpenSim.Framework.Data.SQLite.dll");
standaloneUserPlugin = configSource.Configs["StandAlone"].GetString("userDatabase_plugin", "OpenSim.Framework.Data.DB4o.dll");
standaloneAssetPlugin = configSource.Configs["StandAlone"].GetString("asset_plugin", "OpenSim.Framework.Data.SQLite.dll");
m_networkServersInfo.loadFromConfiguration(configSource);
standaloneAuthenticate = m_config.Configs["StandAlone"].GetBoolean("accounts_authenticate", false);
standaloneWelcomeMessage = m_config.Configs["StandAlone"].GetString("welcome_message", "Welcome to OpenSim");
standaloneInventoryPlugin = m_config.Configs["StandAlone"].GetString("inventory_plugin", "OpenSim.Framework.Data.SQLite.dll");
standaloneUserPlugin = m_config.Configs["StandAlone"].GetString("userDatabase_plugin", "OpenSim.Framework.Data.DB4o.dll");
standaloneAssetPlugin = m_config.Configs["StandAlone"].GetString("asset_plugin", "OpenSim.Framework.Data.SQLite.dll");
m_networkServersInfo.loadFromConfiguration(m_config);
}
@ -207,7 +207,7 @@ namespace OpenSim
configFiles = Directory.GetFiles(regionConfigPath, "*.xml");
}
m_moduleLoader = new ModuleLoader( m_log );
m_moduleLoader = new ModuleLoader( m_log, m_config );
MainLog.Instance.Verbose("Loading Shared Modules");
m_moduleLoader.LoadDefaultSharedModules();

View File

@ -27,12 +27,13 @@
*/
using OpenSim.Region.Environment.Scenes;
using Nini.Config;
namespace OpenSim.Region.Environment.Interfaces
{
public interface IRegionModule
{
void Initialise(Scene scene);
void Initialise(Scene scene, IConfigSource source);
void PostInitialise();
void Close();
string Name { get; }

View File

@ -34,6 +34,7 @@ using OpenSim.Framework.Console;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Modules;
using OpenSim.Region.Environment.Scenes;
using Nini.Config;
namespace OpenSim.Region.Environment
{
@ -44,10 +45,12 @@ namespace OpenSim.Region.Environment
public List<IRegionModule> LoadedModules = new List<IRegionModule>();
public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>();
private readonly LogBase m_log;
private IConfigSource m_config;
public ModuleLoader(LogBase log)
public ModuleLoader(LogBase log, IConfigSource config)
{
m_log = log;
m_config = config;
}
public void PickupModules(Scene scene, string moduleDir)
@ -70,14 +73,14 @@ namespace OpenSim.Region.Environment
{
foreach (IRegionModule module in LoadedSharedModules.Values)
{
module.Initialise(scene);
module.Initialise(scene, m_config);
scene.AddModule(module.Name, module); //should be doing this?
}
}
public void InitializeModule(IRegionModule module, Scene scene)
{
module.Initialise(scene);
module.Initialise(scene, m_config);
scene.AddModule(module.Name, module);
LoadedModules.Add(module);
}

View File

@ -29,6 +29,7 @@
using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using Nini.Config;
namespace OpenSim.Region.Environment.Modules
{
@ -40,7 +41,7 @@ namespace OpenSim.Region.Environment.Modules
{
}
public void Initialise(Scene scene)
public void Initialise(Scene scene, IConfigSource config)
{
m_scene = scene;
m_scene.EventManager.OnNewClient += NewClient;

View File

@ -30,6 +30,7 @@ using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using Nini.Config;
namespace OpenSim.Region.Environment.Modules
{
@ -41,7 +42,7 @@ namespace OpenSim.Region.Environment.Modules
{
}
public void Initialise(Scene scene)
public void Initialise(Scene scene, IConfigSource config)
{
m_scene = scene;
m_scene.EventManager.OnNewClient += NewClient;

View File

@ -35,6 +35,7 @@ using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Utilities;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using Nini.Config;
namespace OpenSim.Region.Environment.Modules
{
@ -67,7 +68,7 @@ namespace OpenSim.Region.Environment.Modules
m_ircReader = null;
}
public void Initialise(Scene scene)
public void Initialise(Scene scene, IConfigSource config)
{
m_scene = scene;
m_scene.EventManager.OnNewClient += NewClient;

View File

@ -33,6 +33,7 @@ using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using Nini.Config;
namespace OpenSim.Region.Environment.Modules
{
@ -45,7 +46,7 @@ namespace OpenSim.Region.Environment.Modules
private Dictionary<LLUUID, DynamicTextureUpdater> Updaters = new Dictionary<LLUUID, DynamicTextureUpdater>();
public void Initialise(Scene scene)
public void Initialise(Scene scene, IConfigSource config)
{
if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
{

View File

@ -28,6 +28,7 @@
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using Nini.Config;
namespace OpenSim.Region.Environment.Modules
{
@ -35,7 +36,7 @@ namespace OpenSim.Region.Environment.Modules
{
private Scene m_scene;
public void Initialise(Scene scene)
public void Initialise(Scene scene, IConfigSource config)
{
m_scene = scene;
}

View File

@ -28,6 +28,7 @@
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using Nini.Config;
namespace OpenSim.Region.Environment.Modules
{
@ -35,7 +36,7 @@ namespace OpenSim.Region.Environment.Modules
{
private Scene m_scene;
public void Initialise(Scene scene)
public void Initialise(Scene scene, IConfigSource config)
{
m_scene = scene;
}

View File

@ -30,6 +30,7 @@ using System.Collections.Generic;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Framework.Console;
using Nini.Config;
namespace OpenSim.Region.Environment.Modules
{
@ -38,7 +39,7 @@ namespace OpenSim.Region.Environment.Modules
private List<Scene> m_scenes = new List<Scene>();
private LogBase m_log;
public void Initialise(Scene scene)
public void Initialise(Scene scene, IConfigSource config)
{
if (!m_scenes.Contains(scene))
{

View File

@ -28,6 +28,7 @@
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using Nini.Config;
namespace OpenSim.Region.Environment.Modules
{
@ -35,7 +36,7 @@ namespace OpenSim.Region.Environment.Modules
{
private Scene m_scene;
public void Initialise(Scene scene)
public void Initialise(Scene scene, IConfigSource config)
{
m_scene = scene;
}

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
@ -8,6 +8,7 @@ using libsecondlife;
using OpenJPEGNet;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Interfaces;
using Nini.Config;
namespace OpenSim.Region.Environment.Modules
{
@ -17,7 +18,7 @@ namespace OpenSim.Region.Environment.Modules
private IDynamicTextureManager m_textureManager;
private Scene m_scene;
public void Initialise(Scene scene)
public void Initialise(Scene scene, IConfigSource config)
{
if (m_scene == null)
{

View File

@ -30,6 +30,7 @@ using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using Nini.Config;
namespace OpenSim.Region.Environment.Modules
{
@ -41,7 +42,7 @@ namespace OpenSim.Region.Environment.Modules
{
}
public void Initialise(Scene scene)
public void Initialise(Scene scene, IConfigSource config)
{
m_scene = scene;
m_scene.EventManager.OnNewClient += NewClient;

View File

@ -40,6 +40,7 @@ using OpenSim.Framework.Servers;
using Nwc.XmlRpc;
using System.Collections;
using System.Collections.Generic;
using Nini.Config;
/*****************************************************
*
@ -84,7 +85,7 @@ namespace OpenSim.Region.Environment.Modules
{
}
public void Initialise(Scene scene)
public void Initialise(Scene scene, IConfigSource config)
{
m_scene = scene;

View File

@ -39,6 +39,7 @@ using OpenSim.Framework.Servers;
using Nwc.XmlRpc;
using System.Collections;
using System.Collections.Generic;
using Nini.Config;
/*****************************************************
*
@ -93,7 +94,7 @@ namespace OpenSim.Region.Environment.Modules
{
}
public void Initialise(Scene scene)
public void Initialise(Scene scene, IConfigSource config)
{
m_scene = scene;

View File

@ -32,6 +32,7 @@ using libsecondlife;
using OpenSim.Framework.Interfaces;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using Nini.Config;
namespace OpenSim.Region.Environment.Modules
{
@ -46,7 +47,7 @@ namespace OpenSim.Region.Environment.Modules
{
}
public void Initialise(Scene scene)
public void Initialise(Scene scene, IConfigSource config)
{
m_scene = scene;
m_scene.EventManager.OnNewClient += NewClient;

View File

@ -39,12 +39,15 @@ using OpenSim.Region.Communications.Local;
using OpenSim.Region.Environment;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Physics.Manager;
using Nini.Config;
namespace SimpleApp
{
class Program : RegionApplicationBase, conscmd_callback
{
private ModuleLoader m_moduleLoader;
private IConfigSource m_config;
protected override LogBase CreateLog()
{
return new LogBase(null, "SimpleApp", this, false);
@ -86,7 +89,7 @@ namespace SimpleApp
UDPServer udpServer;
m_moduleLoader = new ModuleLoader( m_log );
m_moduleLoader = new ModuleLoader( m_log, m_config );
m_moduleLoader.LoadDefaultSharedModules();
Scene scene = SetupScene(regionInfo, out udpServer);
@ -155,7 +158,7 @@ namespace SimpleApp
protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager)
{
return new MyWorld(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer, new ModuleLoader( m_log ));
return new MyWorld(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer, new ModuleLoader( m_log, m_config ));
}
protected override StorageManager CreateStorageManager(RegionInfo regionInfo)

View File

@ -32,6 +32,7 @@ using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.ExtensionsScriptModule.CSharp;
using OpenSim.Region.ExtensionsScriptModule.JScript;
using OpenSim.Region.ExtensionsScriptModule.JVMEngine;
using Nini.Config;
namespace OpenSim.Region.ExtensionsScriptModule
{
@ -67,7 +68,7 @@ namespace OpenSim.Region.ExtensionsScriptModule
compilers.Add(javaCompiler.FileExt(), javaCompiler);
}
public void Initialise(Scene scene)
public void Initialise(Scene scene, IConfigSource config)
{
System.Console.WriteLine("Initialising Extensions Scripting Module");
m_scene = scene;

View File

@ -34,6 +34,7 @@ using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Scenes.Scripting;
using OpenSim.Region.Environment.Interfaces;
using libsecondlife;
using Nini.Config;
namespace OpenSim.Region.ScriptEngine.DotNetEngine
{
@ -103,7 +104,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
#region IRegionModule
public void Initialise(Scene scene)
public void Initialise(Scene scene, IConfigSource config)
{
this.InitializeEngine(scene, MainLog.Instance);
}

View File

@ -475,11 +475,12 @@
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Region.Physics.Manager"/>
<Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Region.ScriptEngine.DotNetEngine"/>
<!-- For scripting in funny languages by default -->
<Reference name="Microsoft.JScript"/>
<Reference name="XMLRPC.dll"/>
<Reference name="OpenSim.Framework.Communications"/>
<Reference name="Nini.dll" />
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
@ -592,7 +593,7 @@
<Reference name="OpenSim.Region.Environment"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="Axiom.MathLib.dll"/>
<Reference name="Nini.dll"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
@ -670,7 +671,7 @@
<Reference name="OpenSim.Region.ClientStack"/>
<Reference name="OpenSim.Region.Environment"/>
<Reference name="OpenSim.Region.Terrain.BasicTerrain"/>
<Reference name="Nini.dll" />
<Files>
<Match pattern="*.cs" recurse="true"/>
@ -895,6 +896,7 @@
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Region.ScriptEngine.Common"/>
<Reference name="Axiom.MathLib.dll" localCopy="false"/>
<Reference name="Nini.dll" />
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
@ -983,6 +985,8 @@
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Region.ScriptEngine.Common"/>
<Reference name="Axiom.MathLib.dll" localCopy="false"/>
<Reference name="Nini.dll" />
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>