From d04025ff3dd6208a8939c320e15cc0182e045b05 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Thu, 5 Feb 2009 18:36:53 +0000
Subject: * refactor: Move module handling code up into SceneBase from Scene,
reducing the large number of different things that Scene does
---
OpenSim/Region/Application/OpenSimBase.cs | 19 +--
.../Modules/World/Terrain/TerrainModule.cs | 1 +
OpenSim/Region/Environment/Scenes/Scene.cs | 186 +--------------------
OpenSim/Region/Environment/Scenes/SceneBase.cs | 177 +++++++++++++++++++-
4 files changed, 191 insertions(+), 192 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index ec40384..561a8a2 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -52,7 +52,7 @@ using OpenSim.Region.Physics.Manager;
namespace OpenSim
{
///
- /// Common OpenSim region service code
+ /// Common OpenSim simulator code
///
public class OpenSimBase : RegionApplicationBase
{
@@ -75,14 +75,13 @@ namespace OpenSim
/// The file to load and save inventory if no filename has been specified
///
protected const string DEFAULT_INV_BACKUP_FILENAME = "opensim_inv.tar.gz";
-
- protected ConfigSettings m_configSettings;
-
+
public ConfigSettings ConfigurationSettings
{
get { return m_configSettings; }
set { m_configSettings = value; }
}
+ protected ConfigSettings m_configSettings;
protected ConfigurationLoader m_configLoader;
@@ -123,15 +122,14 @@ namespace OpenSim
public uint HttpServerPort
{
get { return m_httpServerPort; }
- }
-
- protected ModuleLoader m_moduleLoader;
+ }
public ModuleLoader ModuleLoader
{
get { return m_moduleLoader; }
set { m_moduleLoader = value; }
}
+ protected ModuleLoader m_moduleLoader;
///
/// Constructor.
@@ -441,7 +439,7 @@ namespace OpenSim
if (!String.IsNullOrEmpty(scene.RegionInfo.RegionFile))
{
File.Delete(scene.RegionInfo.RegionFile);
- m_log.InfoFormat("[OPENSIM MAIN] deleting region file \"{0}\"", scene.RegionInfo.RegionFile);
+ m_log.InfoFormat("[OPENSIM]: deleting region file \"{0}\"", scene.RegionInfo.RegionFile);
}
}
@@ -480,7 +478,7 @@ namespace OpenSim
public void handleRestartRegion(RegionInfo whichRegion)
{
- m_log.Error("[OPENSIM MAIN]: Got restart signal from SceneManager");
+ m_log.Info("[OPENSIM]: Got restart signal from SceneManager");
// Shutting down the client server
bool foundClientServer = false;
@@ -488,8 +486,6 @@ namespace OpenSim
for (int i = 0; i < m_clientServers.Count; i++)
{
- //--> Melanie, the following needs to be fixed
- // the Equals override is not returning true if the locations are actually equal
if (m_clientServers[i].HandlesRegion(new Location(whichRegion.RegionHandle)))
{
clientServerElement = i;
@@ -497,6 +493,7 @@ namespace OpenSim
break;
}
}
+
if (foundClientServer)
{
m_clientServers[clientServerElement].Server.Close();
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs
index 00237b3..3d74c6a 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs
@@ -263,6 +263,7 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
throw new TerrainException(String.Format("unable to load heightmap: parser {0} does not support loading", loader.Value));
}
}
+
CheckForTerrainUpdates();
m_log.Info("[TERRAIN]: File (" + filename + ") loaded successfully");
return;
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 8d3792c..f798a0e 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -113,25 +113,6 @@ namespace OpenSim.Region.Environment.Scenes
get { return m_sceneGridService; }
}
- ///
- /// All the region modules attached to this scene.
- ///
- public Dictionary Modules
- {
- get { return m_modules; }
- }
- protected Dictionary m_modules = new Dictionary();
-
- ///
- /// The module interfaces available from this scene.
- ///
- protected Dictionary > ModuleInterfaces = new Dictionary >();
-
- protected Dictionary ModuleAPIMethods = new Dictionary();
- protected Dictionary m_moduleCommanders = new Dictionary();
-
- //API module interfaces
-
public IXfer XferManager;
protected IXMLRPC m_xmlrpcModule;
@@ -281,11 +262,6 @@ namespace OpenSim.Region.Environment.Scenes
public int objectCapacity = 45000;
- ///
- /// Registered classes that are capable of creating entities.
- ///
- protected Dictionary m_entityCreators = new Dictionary();
-
#endregion
#region Constructors
@@ -737,16 +713,6 @@ namespace OpenSim.Region.Environment.Scenes
// De-register with region communications (events cleanup)
UnRegisterRegionWithComms();
- // Shut down all non shared modules.
- foreach (IRegionModule module in Modules.Values)
- {
- if (!module.IsSharedModule)
- {
- module.Close();
- }
- }
- Modules.Clear();
-
// call the base class Close method.
base.Close();
}
@@ -1838,6 +1804,7 @@ namespace OpenSim.Region.Environment.Scenes
///
/// Add an object into the scene that has come from storage
///
+ ///
///
///
/// If true, changes to the object will be reflected in its persisted data
@@ -3158,128 +3125,8 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
- #region Module Methods
-
- ///
- /// Add a module to this scene.
- ///
- ///
- ///
- public void AddModule(string name, IRegionModule module)
- {
- if (!Modules.ContainsKey(name))
- {
- Modules.Add(name, module);
- }
- }
-
- public void RegisterModuleCommander(string name, ICommander commander)
- {
- lock (m_moduleCommanders)
- {
- m_moduleCommanders.Add(name, commander);
- }
- }
-
- public ICommander GetCommander(string name)
- {
- lock (m_moduleCommanders)
- {
- return m_moduleCommanders[name];
- }
- }
-
- public Dictionary GetCommanders()
- {
- return m_moduleCommanders;
- }
-
- ///
- /// Register an interface to a region module. This allows module methods to be called directly as
- /// well as via events. If there is already a module registered for this interface, it is not replaced
- /// (is this the best behaviour?)
- ///
- ///
- public void RegisterModuleInterface(M mod)
- {
- if (!ModuleInterfaces.ContainsKey(typeof(M)))
- {
- List