From 0eac34b7ab0b557733906da3390a07fda250ae4d Mon Sep 17 00:00:00 2001 From: Tedd Hansen Date: Mon, 24 Sep 2007 13:57:16 +0000 Subject: [PATCH] More structural changes to new SE --- .../Region/RegionConnectionManager.cs | 2 +- ...onScriptDaemon.cs => RegionCommManager.cs} | 15 ++++--- .../ScriptServer/RegionsManager.cs | 19 --------- .../ScriptEngine/ScriptEngineLoader.cs | 5 ++- .../ScriptServer/ScriptEngines.cs | 41 +++++++++++++++++++ OpenSim/Grid/ScriptServer/ScriptServerMain.cs | 13 +++--- 6 files changed, 61 insertions(+), 34 deletions(-) rename OpenSim/Grid/ScriptServer/ScriptServer/{Region/RegionScriptDaemon.cs => RegionCommManager.cs} (86%) delete mode 100644 OpenSim/Grid/ScriptServer/ScriptServer/RegionsManager.cs create mode 100644 OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngines.cs diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs index 6a517e93d4..7171b8228a 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs @@ -5,7 +5,7 @@ using System.Text; namespace OpenSim.Grid.ScriptServer { // Maintains connection and communication to a region - class RegionConnectionManager + internal class RegionConnectionManager { public RegionConnectionManager() diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionScriptDaemon.cs b/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs similarity index 86% rename from OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionScriptDaemon.cs rename to OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs index 03856939ce..d609d6322b 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionScriptDaemon.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs @@ -29,20 +29,25 @@ using System; using System.Collections.Generic; using System.Text; using System.Threading; +using OpenSim.Framework.Console; namespace OpenSim.Grid.ScriptServer { // Waiting for incoming script requests from region - internal class RegionScriptDaemon + internal class RegionCommManager { private Thread listenThread; - public ScriptServerMain m_ScriptServer; - public RegionScriptDaemon(ScriptServerMain scriptServer) + private List Regions = new List(); + + private LogBase m_log; + private ScriptServerMain m_ScriptServerMain; + public RegionCommManager(ScriptServerMain scm, LogBase logger) { - m_ScriptServer = scriptServer; + m_ScriptServerMain = scm; + m_log = logger; } - ~RegionScriptDaemon() + ~RegionCommManager() { Stop(); } diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/RegionsManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/RegionsManager.cs deleted file mode 100644 index eeec92b724..0000000000 --- a/OpenSim/Grid/ScriptServer/ScriptServer/RegionsManager.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Grid.ScriptServer -{ - // Maintains all regions - class RegionsManager - { - private List Regions = new List(); - - public ScriptServerMain m_ScriptServer; - public RegionsManager(ScriptServerMain scriptServer) - { - m_ScriptServer = scriptServer; - } - - } -} diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngine/ScriptEngineLoader.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngine/ScriptEngineLoader.cs index 1b5dc399ee..8b07ab0037 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngine/ScriptEngineLoader.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngine/ScriptEngineLoader.cs @@ -32,13 +32,14 @@ using OpenSim.Framework.Console; namespace OpenSim.Grid.ScriptServer { - public class ScriptEngineLoader + internal class ScriptEngineLoader { private LogBase m_log; + public ScriptEngineLoader(LogBase logger) { - m_log = logger; + m_log = logger; } public ScriptEngineInterface LoadScriptEngine(string EngineName) diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngines.cs b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngines.cs new file mode 100644 index 0000000000..0313edfd8e --- /dev/null +++ b/OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngines.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Console; + +namespace OpenSim.Grid.ScriptServer +{ + internal class ScriptEngines + { + private LogBase m_log; + private ScriptEngineLoader ScriptEngineLoader; + private List scriptEngines = new List(); + private ScriptServerMain m_ScriptServerMain; + + // Initialize + public ScriptEngines(ScriptServerMain scm, LogBase logger) + { + m_ScriptServerMain = scm; + m_log = logger; + ScriptEngineLoader = new ScriptEngineLoader(m_log); + + // Temp - we should not load during initialize... Loading should be done later. + LoadEngine("DotNetScriptEngine"); + } + ~ScriptEngines() + { + } + + public void LoadEngine(string engineName) + { + // Load and add to list of ScriptEngines + ScriptEngineInterface sei = ScriptEngineLoader.LoadScriptEngine(engineName); + if (sei != null) + { + scriptEngines.Add(sei); + } + } + + + } +} diff --git a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs index 4fce3d6058..f85cf98648 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs @@ -7,21 +7,20 @@ using OpenSim.Framework.Utilities; namespace OpenSim.Grid.ScriptServer { - class ScriptServerMain : conscmd_callback + public class ScriptServerMain : conscmd_callback { private readonly string m_logFilename = ("region-console.log"); - public RegionScriptDaemon RegionScriptDaemon; // Listen for incoming from region - public RegionsManager RegionManager; // Handle regions - public ScriptEngineLoader ScriptEngineLoader; // Loads scriptengines + internal RegionCommManager RegionScriptDaemon; // Listen for incoming from region + internal ScriptEngines ScriptEngines; // Loads scriptengines private LogBase m_log; public ScriptServerMain() { m_log = CreateLog(); - RegionScriptDaemon = new RegionScriptDaemon(this); - RegionManager = new RegionsManager(this); - ScriptEngineLoader = new ScriptEngineLoader(m_log); + RegionScriptDaemon = new RegionCommManager(this, m_log); + ScriptEngines = new ScriptEngines(this, m_log); + } ~ScriptServerMain()