diff options
author | dr scofield (aka dirk husemann) | 2009-09-01 10:25:10 +0200 |
---|---|---|
committer | dr scofield (aka dirk husemann) | 2009-09-01 10:28:29 +0200 |
commit | 39726f0fdac3316998131e723ae0070743f97786 (patch) | |
tree | 2c14ec5d6f9ab3c8fa4251ed38aebe82203cd9d9 /OpenSim | |
parent | cleanup. (diff) | |
download | opensim-SC-39726f0fdac3316998131e723ae0070743f97786.zip opensim-SC-39726f0fdac3316998131e723ae0070743f97786.tar.gz opensim-SC-39726f0fdac3316998131e723ae0070743f97786.tar.bz2 opensim-SC-39726f0fdac3316998131e723ae0070743f97786.tar.xz |
switching SerialiserModule to "new" region module scheme
Diffstat (limited to 'OpenSim')
3 files changed, 48 insertions, 15 deletions
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index 383063d..c882146 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | |||
@@ -8,6 +8,7 @@ | |||
8 | </Dependencies> | 8 | </Dependencies> |
9 | 9 | ||
10 | <Extension path = "/OpenSim/RegionModules"> | 10 | <Extension path = "/OpenSim/RegionModules"> |
11 | <RegionModule id="ExportSerialisationModule" type="OpenSim.Region.CoreModules.World.Serialiser.SerialiserModule" /> | ||
11 | <RegionModule id="ArchiverModule" type="OpenSim.Region.CoreModules.World.Archiver.ArchiverModule" /> | 12 | <RegionModule id="ArchiverModule" type="OpenSim.Region.CoreModules.World.Archiver.ArchiverModule" /> |
12 | <RegionModule id="CapabilitiesModule" type="OpenSim.Region.CoreModules.Agent.Capabilities.CapabilitiesModule" /> | 13 | <RegionModule id="CapabilitiesModule" type="OpenSim.Region.CoreModules.Agent.Capabilities.CapabilitiesModule" /> |
13 | <RegionModule id="TerrainModule" type="OpenSim.Region.CoreModules.World.Terrain.TerrainModule" /> | 14 | <RegionModule id="TerrainModule" type="OpenSim.Region.CoreModules.World.Terrain.TerrainModule" /> |
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs index b6d28ab..e0331d3 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs | |||
@@ -28,7 +28,11 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Reflection; | ||
32 | |||
33 | using log4net; | ||
31 | using Nini.Config; | 34 | using Nini.Config; |
35 | |||
32 | using OpenMetaverse; | 36 | using OpenMetaverse; |
33 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; | 37 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; |
34 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
@@ -37,25 +41,32 @@ using OpenSim.Region.Framework.Scenes.Serialization; | |||
37 | 41 | ||
38 | namespace OpenSim.Region.CoreModules.World.Serialiser | 42 | namespace OpenSim.Region.CoreModules.World.Serialiser |
39 | { | 43 | { |
40 | public class SerialiserModule : IRegionModule, IRegionSerialiserModule | 44 | public class SerialiserModule : ISharedRegionModule, IRegionSerialiserModule |
41 | { | 45 | { |
46 | private static readonly ILog m_log = | ||
47 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
42 | private Commander m_commander = new Commander("export"); | 49 | private Commander m_commander = new Commander("export"); |
43 | private List<Scene> m_regions = new List<Scene>(); | 50 | private List<Scene> m_regions = new List<Scene>(); |
44 | private string m_savedir = "exports" + "/"; | 51 | private string m_savedir = "exports" + "/"; |
45 | private List<IFileSerialiser> m_serialisers = new List<IFileSerialiser>(); | 52 | private List<IFileSerialiser> m_serialisers = new List<IFileSerialiser>(); |
46 | 53 | ||
47 | #region IRegionModule Members | 54 | #region ISharedRegionModule Members |
48 | 55 | ||
49 | public void Initialise(Scene scene, IConfigSource source) | 56 | public Type ReplaceableInterface |
50 | { | 57 | { |
51 | scene.RegisterModuleCommander(m_commander); | 58 | get { return null; } |
52 | scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; | 59 | } |
53 | scene.RegisterModuleInterface<IRegionSerialiserModule>(this); | ||
54 | 60 | ||
55 | lock (m_regions) | 61 | public void Initialise(IConfigSource source) |
62 | { | ||
63 | IConfig config = source.Configs["Serialiser"]; | ||
64 | if (config != null) | ||
56 | { | 65 | { |
57 | m_regions.Add(scene); | 66 | m_savedir = config.GetString("save_dir", m_savedir); |
58 | } | 67 | } |
68 | |||
69 | m_log.InfoFormat("[Serialiser] Enabled, using save dir \"{0}\"", m_savedir); | ||
59 | } | 70 | } |
60 | 71 | ||
61 | public void PostInitialise() | 72 | public void PostInitialise() |
@@ -69,6 +80,31 @@ namespace OpenSim.Region.CoreModules.World.Serialiser | |||
69 | LoadCommanderCommands(); | 80 | LoadCommanderCommands(); |
70 | } | 81 | } |
71 | 82 | ||
83 | |||
84 | public void AddRegion(Scene scene) | ||
85 | { | ||
86 | scene.RegisterModuleCommander(m_commander); | ||
87 | scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; | ||
88 | scene.RegisterModuleInterface<IRegionSerialiserModule>(this); | ||
89 | |||
90 | lock (m_regions) | ||
91 | { | ||
92 | m_regions.Add(scene); | ||
93 | } | ||
94 | } | ||
95 | |||
96 | public void RegionLoaded(Scene scene) | ||
97 | { | ||
98 | } | ||
99 | |||
100 | public void RemoveRegion(Scene scene) | ||
101 | { | ||
102 | lock (m_regions) | ||
103 | { | ||
104 | m_regions.Remove(scene); | ||
105 | } | ||
106 | } | ||
107 | |||
72 | public void Close() | 108 | public void Close() |
73 | { | 109 | { |
74 | m_regions.Clear(); | 110 | m_regions.Clear(); |
@@ -79,13 +115,9 @@ namespace OpenSim.Region.CoreModules.World.Serialiser | |||
79 | get { return "ExportSerialisationModule"; } | 115 | get { return "ExportSerialisationModule"; } |
80 | } | 116 | } |
81 | 117 | ||
82 | public bool IsSharedModule | ||
83 | { | ||
84 | get { return true; } | ||
85 | } | ||
86 | |||
87 | #endregion | 118 | #endregion |
88 | 119 | ||
120 | |||
89 | #region IRegionSerialiser Members | 121 | #region IRegionSerialiser Members |
90 | 122 | ||
91 | public void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, Vector3 loadOffset) | 123 | public void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, Vector3 loadOffset) |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index 8cd1d55..7fb2d25 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs | |||
@@ -367,7 +367,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
367 | presence2.AddAttachment(sog1); | 367 | presence2.AddAttachment(sog1); |
368 | presence2.AddAttachment(sog2); | 368 | presence2.AddAttachment(sog2); |
369 | 369 | ||
370 | IRegionModule serialiser = new SerialiserModule(); | 370 | ISharedRegionModule serialiser = new SerialiserModule(); |
371 | SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser); | 371 | SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser); |
372 | SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser); | 372 | SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser); |
373 | 373 | ||