switching SerialiserModule to "new" region module scheme

remotes/origin/0.6.7-post-fixes
dr scofield (aka dirk husemann) 2009-09-01 10:25:10 +02:00
parent ef6c0bd7d8
commit 39726f0fda
3 changed files with 48 additions and 15 deletions

View File

@ -8,6 +8,7 @@
</Dependencies>
<Extension path = "/OpenSim/RegionModules">
<RegionModule id="ExportSerialisationModule" type="OpenSim.Region.CoreModules.World.Serialiser.SerialiserModule" />
<RegionModule id="ArchiverModule" type="OpenSim.Region.CoreModules.World.Archiver.ArchiverModule" />
<RegionModule id="CapabilitiesModule" type="OpenSim.Region.CoreModules.Agent.Capabilities.CapabilitiesModule" />
<RegionModule id="TerrainModule" type="OpenSim.Region.CoreModules.World.Terrain.TerrainModule" />

View File

@ -28,7 +28,11 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
using OpenSim.Region.Framework.Interfaces;
@ -37,25 +41,32 @@ using OpenSim.Region.Framework.Scenes.Serialization;
namespace OpenSim.Region.CoreModules.World.Serialiser
{
public class SerialiserModule : IRegionModule, IRegionSerialiserModule
public class SerialiserModule : ISharedRegionModule, IRegionSerialiserModule
{
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Commander m_commander = new Commander("export");
private List<Scene> m_regions = new List<Scene>();
private string m_savedir = "exports" + "/";
private List<IFileSerialiser> m_serialisers = new List<IFileSerialiser>();
#region IRegionModule Members
#region ISharedRegionModule Members
public void Initialise(Scene scene, IConfigSource source)
public Type ReplaceableInterface
{
get { return null; }
}
public void Initialise(IConfigSource source)
{
scene.RegisterModuleCommander(m_commander);
scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
scene.RegisterModuleInterface<IRegionSerialiserModule>(this);
lock (m_regions)
IConfig config = source.Configs["Serialiser"];
if (config != null)
{
m_regions.Add(scene);
m_savedir = config.GetString("save_dir", m_savedir);
}
m_log.InfoFormat("[Serialiser] Enabled, using save dir \"{0}\"", m_savedir);
}
public void PostInitialise()
@ -69,6 +80,31 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
LoadCommanderCommands();
}
public void AddRegion(Scene scene)
{
scene.RegisterModuleCommander(m_commander);
scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
scene.RegisterModuleInterface<IRegionSerialiserModule>(this);
lock (m_regions)
{
m_regions.Add(scene);
}
}
public void RegionLoaded(Scene scene)
{
}
public void RemoveRegion(Scene scene)
{
lock (m_regions)
{
m_regions.Remove(scene);
}
}
public void Close()
{
m_regions.Clear();
@ -79,13 +115,9 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
get { return "ExportSerialisationModule"; }
}
public bool IsSharedModule
{
get { return true; }
}
#endregion
#region IRegionSerialiser Members
public void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, Vector3 loadOffset)

View File

@ -367,7 +367,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
presence2.AddAttachment(sog1);
presence2.AddAttachment(sog2);
IRegionModule serialiser = new SerialiserModule();
ISharedRegionModule serialiser = new SerialiserModule();
SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser);
SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser);