From 0eac34b7ab0b557733906da3390a07fda250ae4d Mon Sep 17 00:00:00 2001
From: Tedd Hansen
Date: Mon, 24 Sep 2007 13:57:16 +0000
Subject: More structural changes to new SE
---
.../ScriptServer/Region/RegionConnectionManager.cs | 2 +-
.../ScriptServer/Region/RegionScriptDaemon.cs | 94 --------------------
.../ScriptServer/ScriptServer/RegionCommManager.cs | 99 ++++++++++++++++++++++
.../ScriptServer/ScriptServer/RegionsManager.cs | 19 -----
.../ScriptEngine/ScriptEngineLoader.cs | 5 +-
.../ScriptServer/ScriptServer/ScriptEngines.cs | 41 +++++++++
OpenSim/Grid/ScriptServer/ScriptServerMain.cs | 13 ++-
7 files changed, 150 insertions(+), 123 deletions(-)
delete mode 100644 OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionScriptDaemon.cs
create mode 100644 OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs
delete mode 100644 OpenSim/Grid/ScriptServer/ScriptServer/RegionsManager.cs
create mode 100644 OpenSim/Grid/ScriptServer/ScriptServer/ScriptEngines.cs
(limited to 'OpenSim/Grid')
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionConnectionManager.cs
index 6a517e9..7171b82 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/Region/RegionScriptDaemon.cs
deleted file mode 100644
index 0385693..0000000
--- a/OpenSim/Grid/ScriptServer/ScriptServer/Region/RegionScriptDaemon.cs
+++ /dev/null
@@ -1,94 +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 System.Collections.Generic;
-using System.Text;
-using System.Threading;
-
-namespace OpenSim.Grid.ScriptServer
-{
- // Waiting for incoming script requests from region
- internal class RegionScriptDaemon
- {
- private Thread listenThread;
-
- public ScriptServerMain m_ScriptServer;
- public RegionScriptDaemon(ScriptServerMain scriptServer)
- {
- m_ScriptServer = scriptServer;
- }
- ~RegionScriptDaemon()
- {
- Stop();
- }
-
- ///
- /// Starts listening for region requests
- ///
- public void Start()
- {
- // Start listener
- Stop();
- listenThread = new Thread(ListenThreadLoop);
- listenThread.Name = "listenThread";
- listenThread.IsBackground = true;
- listenThread.Start();
- }
- ///
- /// Stops listening for region requests
- ///
- public void Stop()
- {
- // Stop listener, clean up
- if (listenThread != null)
- {
- try
- {
- if (listenThread.IsAlive)
- listenThread.Abort();
- listenThread.Join(1000); // Wait 1 second for thread to shut down
- }
- catch { }
- listenThread = null;
- }
- }
-
- private void ListenThreadLoop()
- {
- // * Listen for requests from regions
- // * When a request is received:
- // - Authenticate region
- // - Authenticate user
- // - Have correct scriptengine load script
- // ~ ask scriptengines if they will accept script?
- // - Add script to shared communication channel towards that region
-
- }
-
- }
-}
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs
new file mode 100644
index 0000000..d609d63
--- /dev/null
+++ b/OpenSim/Grid/ScriptServer/ScriptServer/RegionCommManager.cs
@@ -0,0 +1,99 @@
+/*
+* 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 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 RegionCommManager
+ {
+ private Thread listenThread;
+
+ private List Regions = new List();
+
+ private LogBase m_log;
+ private ScriptServerMain m_ScriptServerMain;
+ public RegionCommManager(ScriptServerMain scm, LogBase logger)
+ {
+ m_ScriptServerMain = scm;
+ m_log = logger;
+ }
+ ~RegionCommManager()
+ {
+ Stop();
+ }
+
+ ///
+ /// Starts listening for region requests
+ ///
+ public void Start()
+ {
+ // Start listener
+ Stop();
+ listenThread = new Thread(ListenThreadLoop);
+ listenThread.Name = "listenThread";
+ listenThread.IsBackground = true;
+ listenThread.Start();
+ }
+ ///
+ /// Stops listening for region requests
+ ///
+ public void Stop()
+ {
+ // Stop listener, clean up
+ if (listenThread != null)
+ {
+ try
+ {
+ if (listenThread.IsAlive)
+ listenThread.Abort();
+ listenThread.Join(1000); // Wait 1 second for thread to shut down
+ }
+ catch { }
+ listenThread = null;
+ }
+ }
+
+ private void ListenThreadLoop()
+ {
+ // * Listen for requests from regions
+ // * When a request is received:
+ // - Authenticate region
+ // - Authenticate user
+ // - Have correct scriptengine load script
+ // ~ ask scriptengines if they will accept script?
+ // - Add script to shared communication channel towards that region
+
+ }
+
+ }
+}
diff --git a/OpenSim/Grid/ScriptServer/ScriptServer/RegionsManager.cs b/OpenSim/Grid/ScriptServer/ScriptServer/RegionsManager.cs
deleted file mode 100644
index eeec92b..0000000
--- 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 1b5dc39..8b07ab0 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 0000000..0313edf
--- /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 4fce3d6..f85cf98 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()
--
cgit v1.1