diff options
-rw-r--r-- | OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 47 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 26 | ||||
-rw-r--r-- | OpenSim/Region/Framework/ModuleLoader.cs | 262 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneBase.cs | 80 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneManager.cs | 16 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 2 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestScene.cs | 6 |
9 files changed, 21 insertions, 425 deletions
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs index a8a3237..fcb6991 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs | |||
@@ -136,9 +136,6 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
136 | } | 136 | } |
137 | } | 137 | } |
138 | } | 138 | } |
139 | |||
140 | m_openSim.ModuleLoader.PostInitialise(); | ||
141 | m_openSim.ModuleLoader.ClearCache(); | ||
142 | } | 139 | } |
143 | 140 | ||
144 | public void Dispose() | 141 | public void Dispose() |
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 2236e43..47252f6 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -757,33 +757,13 @@ namespace OpenSim | |||
757 | switch (cmdparams[0].ToLower()) | 757 | switch (cmdparams[0].ToLower()) |
758 | { | 758 | { |
759 | case "list": | 759 | case "list": |
760 | foreach (IRegionModule irm in m_moduleLoader.GetLoadedSharedModules) | 760 | //TODO: Convert to new region modules |
761 | { | ||
762 | MainConsole.Instance.Output(String.Format("Shared region module: {0}", irm.Name)); | ||
763 | } | ||
764 | break; | 761 | break; |
765 | case "unload": | 762 | case "unload": |
766 | if (cmdparams.Length > 1) | 763 | //TODO: Convert to new region modules |
767 | { | ||
768 | foreach (IRegionModule rm in new ArrayList(m_moduleLoader.GetLoadedSharedModules)) | ||
769 | { | ||
770 | if (rm.Name.ToLower() == cmdparams[1].ToLower()) | ||
771 | { | ||
772 | MainConsole.Instance.Output(String.Format("Unloading module: {0}", rm.Name)); | ||
773 | m_moduleLoader.UnloadModule(rm); | ||
774 | } | ||
775 | } | ||
776 | } | ||
777 | break; | 764 | break; |
778 | case "load": | 765 | case "load": |
779 | if (cmdparams.Length > 1) | 766 | //TODO: Convert to new region modules |
780 | { | ||
781 | foreach (Scene s in new ArrayList(SceneManager.Scenes)) | ||
782 | { | ||
783 | MainConsole.Instance.Output(String.Format("Loading module: {0}", cmdparams[1])); | ||
784 | m_moduleLoader.LoadRegionModules(cmdparams[1], s); | ||
785 | } | ||
786 | } | ||
787 | break; | 767 | break; |
788 | } | 768 | } |
789 | } | 769 | } |
@@ -1018,28 +998,9 @@ namespace OpenSim | |||
1018 | break; | 998 | break; |
1019 | 999 | ||
1020 | case "modules": | 1000 | case "modules": |
1021 | MainConsole.Instance.Output("The currently loaded shared modules are:"); | ||
1022 | foreach (IRegionModule module in m_moduleLoader.GetLoadedSharedModules) | ||
1023 | { | ||
1024 | MainConsole.Instance.Output("Shared Module: " + module.Name); | ||
1025 | } | ||
1026 | |||
1027 | SceneManager.ForEachScene( | ||
1028 | delegate(Scene scene) { | ||
1029 | m_log.Error("The currently loaded modules in " + scene.RegionInfo.RegionName + " are:"); | ||
1030 | foreach (IRegionModule module in scene.Modules.Values) | ||
1031 | { | ||
1032 | if (!module.IsSharedModule) | ||
1033 | { | ||
1034 | m_log.Error("Region Module: " + module.Name); | ||
1035 | } | ||
1036 | } | ||
1037 | } | ||
1038 | ); | ||
1039 | |||
1040 | SceneManager.ForEachScene( | 1001 | SceneManager.ForEachScene( |
1041 | delegate(Scene scene) { | 1002 | delegate(Scene scene) { |
1042 | MainConsole.Instance.Output("Loaded new region modules in" + scene.RegionInfo.RegionName + " are:"); | 1003 | MainConsole.Instance.Output("Loaded region modules in" + scene.RegionInfo.RegionName + " are:"); |
1043 | foreach (IRegionModuleBase module in scene.RegionModules.Values) | 1004 | foreach (IRegionModuleBase module in scene.RegionModules.Values) |
1044 | { | 1005 | { |
1045 | Type type = module.GetType().GetInterface("ISharedRegionModule"); | 1006 | Type type = module.GetType().GetInterface("ISharedRegionModule"); |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 7b591a8..a3d6820 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -127,14 +127,6 @@ namespace OpenSim | |||
127 | get { return m_httpServerPort; } | 127 | get { return m_httpServerPort; } |
128 | } | 128 | } |
129 | 129 | ||
130 | public ModuleLoader ModuleLoader | ||
131 | { | ||
132 | get { return m_moduleLoader; } | ||
133 | set { m_moduleLoader = value; } | ||
134 | } | ||
135 | |||
136 | protected ModuleLoader m_moduleLoader; | ||
137 | |||
138 | protected IRegistryCore m_applicationRegistry = new RegistryCore(); | 130 | protected IRegistryCore m_applicationRegistry = new RegistryCore(); |
139 | 131 | ||
140 | public IRegistryCore ApplicationRegistry | 132 | public IRegistryCore ApplicationRegistry |
@@ -223,9 +215,6 @@ namespace OpenSim | |||
223 | 215 | ||
224 | base.StartupSpecific(); | 216 | base.StartupSpecific(); |
225 | 217 | ||
226 | // Create a ModuleLoader instance | ||
227 | m_moduleLoader = new ModuleLoader(m_config.Source); | ||
228 | |||
229 | LoadPlugins(); | 218 | LoadPlugins(); |
230 | foreach (IApplicationPlugin plugin in m_plugins) | 219 | foreach (IApplicationPlugin plugin in m_plugins) |
231 | { | 220 | { |
@@ -370,12 +359,6 @@ namespace OpenSim | |||
370 | 359 | ||
371 | m_log.Info("[MODULES]: Loading Region's modules (old style)"); | 360 | m_log.Info("[MODULES]: Loading Region's modules (old style)"); |
372 | 361 | ||
373 | List<IRegionModule> modules = m_moduleLoader.PickupModules(scene, "."); | ||
374 | |||
375 | // This needs to be ahead of the script engine load, so the | ||
376 | // script module can pick up events exposed by a module | ||
377 | m_moduleLoader.InitialiseSharedModules(scene); | ||
378 | |||
379 | // Use this in the future, the line above will be deprecated soon | 362 | // Use this in the future, the line above will be deprecated soon |
380 | m_log.Info("[REGIONMODULES]: Loading Region's modules (new style)"); | 363 | m_log.Info("[REGIONMODULES]: Loading Region's modules (new style)"); |
381 | IRegionModulesController controller; | 364 | IRegionModulesController controller; |
@@ -426,13 +409,6 @@ namespace OpenSim | |||
426 | clientServer.Start(); | 409 | clientServer.Start(); |
427 | } | 410 | } |
428 | 411 | ||
429 | if (do_post_init) | ||
430 | { | ||
431 | foreach (IRegionModule module in modules) | ||
432 | { | ||
433 | module.PostInitialise(); | ||
434 | } | ||
435 | } | ||
436 | scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); }; | 412 | scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); }; |
437 | 413 | ||
438 | mscene = scene; | 414 | mscene = scene; |
@@ -722,7 +698,7 @@ namespace OpenSim | |||
722 | 698 | ||
723 | return new Scene( | 699 | return new Scene( |
724 | regionInfo, circuitManager, sceneGridService, | 700 | regionInfo, circuitManager, sceneGridService, |
725 | simDataService, estateDataService, m_moduleLoader, false, | 701 | simDataService, estateDataService, false, |
726 | m_config.Source, m_version); | 702 | m_config.Source, m_version); |
727 | } | 703 | } |
728 | 704 | ||
diff --git a/OpenSim/Region/Framework/ModuleLoader.cs b/OpenSim/Region/Framework/ModuleLoader.cs deleted file mode 100644 index 14ecd44..0000000 --- a/OpenSim/Region/Framework/ModuleLoader.cs +++ /dev/null | |||
@@ -1,262 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.IO; | ||
31 | using System.Reflection; | ||
32 | using log4net; | ||
33 | using Nini.Config; | ||
34 | using OpenSim.Region.Framework.Interfaces; | ||
35 | using OpenSim.Region.Framework.Scenes; | ||
36 | |||
37 | namespace OpenSim.Region.Framework | ||
38 | { | ||
39 | public class ModuleLoader | ||
40 | { | ||
41 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
42 | |||
43 | public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>(); | ||
44 | |||
45 | private readonly List<IRegionModule> m_loadedModules = new List<IRegionModule>(); | ||
46 | private readonly Dictionary<string, IRegionModule> m_loadedSharedModules = new Dictionary<string, IRegionModule>(); | ||
47 | private readonly IConfigSource m_config; | ||
48 | |||
49 | public ModuleLoader(IConfigSource config) | ||
50 | { | ||
51 | m_config = config; | ||
52 | } | ||
53 | |||
54 | public IRegionModule[] GetLoadedSharedModules | ||
55 | { | ||
56 | get | ||
57 | { | ||
58 | IRegionModule[] regionModules = new IRegionModule[m_loadedSharedModules.Count]; | ||
59 | m_loadedSharedModules.Values.CopyTo(regionModules, 0); | ||
60 | return regionModules; | ||
61 | } | ||
62 | } | ||
63 | |||
64 | public List<IRegionModule> PickupModules(Scene scene, string moduleDir) | ||
65 | { | ||
66 | DirectoryInfo dir = new DirectoryInfo(moduleDir); | ||
67 | List<IRegionModule> modules = new List<IRegionModule>(); | ||
68 | |||
69 | foreach (FileInfo fileInfo in dir.GetFiles("*.dll")) | ||
70 | { | ||
71 | modules.AddRange(LoadRegionModules(fileInfo.FullName, scene)); | ||
72 | } | ||
73 | return modules; | ||
74 | } | ||
75 | |||
76 | public void LoadDefaultSharedModule(IRegionModule module) | ||
77 | { | ||
78 | if (m_loadedSharedModules.ContainsKey(module.Name)) | ||
79 | { | ||
80 | m_log.ErrorFormat("[MODULES]: Module name \"{0}\" already exists in module list. Module not added!", module.Name); | ||
81 | } | ||
82 | else | ||
83 | { | ||
84 | m_loadedSharedModules.Add(module.Name, module); | ||
85 | } | ||
86 | } | ||
87 | |||
88 | |||
89 | public void InitialiseSharedModules(Scene scene) | ||
90 | { | ||
91 | foreach (IRegionModule module in m_loadedSharedModules.Values) | ||
92 | { | ||
93 | module.Initialise(scene, m_config); | ||
94 | scene.AddModule(module.Name, module); //should be doing this? | ||
95 | } | ||
96 | } | ||
97 | |||
98 | public void InitializeModule(IRegionModule module, Scene scene) | ||
99 | { | ||
100 | module.Initialise(scene, m_config); | ||
101 | scene.AddModule(module.Name, module); | ||
102 | m_loadedModules.Add(module); | ||
103 | } | ||
104 | |||
105 | /// <summary> | ||
106 | /// Loads/initialises a Module instance that can be used by multiple Regions | ||
107 | /// </summary> | ||
108 | /// <param name="dllName"></param> | ||
109 | /// <param name="moduleName"></param> | ||
110 | public void LoadSharedModule(string dllName, string moduleName) | ||
111 | { | ||
112 | IRegionModule module = LoadModule(dllName, moduleName); | ||
113 | |||
114 | if (module != null) | ||
115 | LoadSharedModule(module); | ||
116 | } | ||
117 | |||
118 | /// <summary> | ||
119 | /// Loads/initialises a Module instance that can be used by multiple Regions | ||
120 | /// </summary> | ||
121 | /// <param name="module"></param> | ||
122 | public void LoadSharedModule(IRegionModule module) | ||
123 | { | ||
124 | if (!m_loadedSharedModules.ContainsKey(module.Name)) | ||
125 | { | ||
126 | m_loadedSharedModules.Add(module.Name, module); | ||
127 | } | ||
128 | } | ||
129 | |||
130 | public List<IRegionModule> LoadRegionModules(string dllName, Scene scene) | ||
131 | { | ||
132 | IRegionModule[] modules = LoadModules(dllName); | ||
133 | List<IRegionModule> initializedModules = new List<IRegionModule>(); | ||
134 | |||
135 | if (modules.Length > 0) | ||
136 | { | ||
137 | m_log.InfoFormat("[MODULES]: Found Module Library [{0}]", dllName); | ||
138 | foreach (IRegionModule module in modules) | ||
139 | { | ||
140 | if (!module.IsSharedModule) | ||
141 | { | ||
142 | m_log.InfoFormat("[MODULES]: [{0}]: Initializing.", module.Name); | ||
143 | InitializeModule(module, scene); | ||
144 | initializedModules.Add(module); | ||
145 | } | ||
146 | else | ||
147 | { | ||
148 | m_log.InfoFormat("[MODULES]: [{0}]: Loading Shared Module.", module.Name); | ||
149 | LoadSharedModule(module); | ||
150 | } | ||
151 | } | ||
152 | } | ||
153 | return initializedModules; | ||
154 | } | ||
155 | |||
156 | public void LoadRegionModule(string dllName, string moduleName, Scene scene) | ||
157 | { | ||
158 | IRegionModule module = LoadModule(dllName, moduleName); | ||
159 | if (module != null) | ||
160 | { | ||
161 | InitializeModule(module, scene); | ||
162 | } | ||
163 | } | ||
164 | |||
165 | /// <summary> | ||
166 | /// Loads a external Module (if not already loaded) and creates a new instance of it. | ||
167 | /// </summary> | ||
168 | /// <param name="dllName"></param> | ||
169 | /// <param name="moduleName"></param> | ||
170 | public IRegionModule LoadModule(string dllName, string moduleName) | ||
171 | { | ||
172 | IRegionModule[] modules = LoadModules(dllName); | ||
173 | |||
174 | foreach (IRegionModule module in modules) | ||
175 | { | ||
176 | if ((module != null) && (module.Name == moduleName)) | ||
177 | { | ||
178 | return module; | ||
179 | } | ||
180 | } | ||
181 | |||
182 | return null; | ||
183 | } | ||
184 | |||
185 | public IRegionModule[] LoadModules(string dllName) | ||
186 | { | ||
187 | //m_log.DebugFormat("[MODULES]: Looking for modules in {0}", dllName); | ||
188 | |||
189 | List<IRegionModule> modules = new List<IRegionModule>(); | ||
190 | |||
191 | Assembly pluginAssembly; | ||
192 | if (!LoadedAssemblys.TryGetValue(dllName, out pluginAssembly)) | ||
193 | { | ||
194 | try | ||
195 | { | ||
196 | pluginAssembly = Assembly.LoadFrom(dllName); | ||
197 | LoadedAssemblys.Add(dllName, pluginAssembly); | ||
198 | } | ||
199 | catch (BadImageFormatException) | ||
200 | { | ||
201 | //m_log.InfoFormat("[MODULES]: The file [{0}] is not a module assembly.", e.FileName); | ||
202 | } | ||
203 | } | ||
204 | |||
205 | if (pluginAssembly != null) | ||
206 | { | ||
207 | try | ||
208 | { | ||
209 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
210 | { | ||
211 | if (pluginType.IsPublic) | ||
212 | { | ||
213 | if (!pluginType.IsAbstract) | ||
214 | { | ||
215 | if (pluginType.GetInterface("IRegionModule") != null) | ||
216 | { | ||
217 | modules.Add((IRegionModule)Activator.CreateInstance(pluginType)); | ||
218 | } | ||
219 | } | ||
220 | } | ||
221 | } | ||
222 | } | ||
223 | catch (Exception e) | ||
224 | { | ||
225 | m_log.ErrorFormat( | ||
226 | "[MODULES]: Could not load types for plugin DLL {0}. Exception {1} {2}", | ||
227 | pluginAssembly.FullName, e.Message, e.StackTrace); | ||
228 | |||
229 | // justincc: Right now this is fatal to really get the user's attention | ||
230 | throw e; | ||
231 | } | ||
232 | } | ||
233 | |||
234 | return modules.ToArray(); | ||
235 | } | ||
236 | |||
237 | public void PostInitialise() | ||
238 | { | ||
239 | foreach (IRegionModule module in m_loadedSharedModules.Values) | ||
240 | { | ||
241 | module.PostInitialise(); | ||
242 | } | ||
243 | |||
244 | foreach (IRegionModule module in m_loadedModules) | ||
245 | { | ||
246 | module.PostInitialise(); | ||
247 | } | ||
248 | } | ||
249 | |||
250 | public void ClearCache() | ||
251 | { | ||
252 | LoadedAssemblys.Clear(); | ||
253 | } | ||
254 | |||
255 | public void UnloadModule(IRegionModule rm) | ||
256 | { | ||
257 | rm.Close(); | ||
258 | |||
259 | m_loadedModules.Remove(rm); | ||
260 | } | ||
261 | } | ||
262 | } | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 69c1027..db45d6b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -176,7 +176,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
176 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); | 176 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); |
177 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); | 177 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); |
178 | protected string m_simulatorVersion = "OpenSimulator Server"; | 178 | protected string m_simulatorVersion = "OpenSimulator Server"; |
179 | protected ModuleLoader m_moduleLoader; | ||
180 | protected AgentCircuitManager m_authenticateHandler; | 179 | protected AgentCircuitManager m_authenticateHandler; |
181 | protected SceneCommunicationService m_sceneGridService; | 180 | protected SceneCommunicationService m_sceneGridService; |
182 | 181 | ||
@@ -659,7 +658,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
659 | public Scene(RegionInfo regInfo, AgentCircuitManager authen, | 658 | public Scene(RegionInfo regInfo, AgentCircuitManager authen, |
660 | SceneCommunicationService sceneGridService, | 659 | SceneCommunicationService sceneGridService, |
661 | ISimulationDataService simDataService, IEstateDataService estateDataService, | 660 | ISimulationDataService simDataService, IEstateDataService estateDataService, |
662 | ModuleLoader moduleLoader, bool dumpAssetsToFile, | 661 | bool dumpAssetsToFile, |
663 | IConfigSource config, string simulatorVersion) | 662 | IConfigSource config, string simulatorVersion) |
664 | : this(regInfo) | 663 | : this(regInfo) |
665 | { | 664 | { |
@@ -670,7 +669,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
670 | Random random = new Random(); | 669 | Random random = new Random(); |
671 | 670 | ||
672 | m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4); | 671 | m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4); |
673 | m_moduleLoader = moduleLoader; | ||
674 | m_authenticateHandler = authen; | 672 | m_authenticateHandler = authen; |
675 | m_sceneGridService = sceneGridService; | 673 | m_sceneGridService = sceneGridService; |
676 | m_SimulationDataService = simDataService; | 674 | m_SimulationDataService = simDataService; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index b87a38a..d3e968e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs | |||
@@ -67,12 +67,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
67 | /// <value> | 67 | /// <value> |
68 | /// All the region modules attached to this scene. | 68 | /// All the region modules attached to this scene. |
69 | /// </value> | 69 | /// </value> |
70 | public Dictionary<string, IRegionModule> Modules | ||
71 | { | ||
72 | get { return m_modules; } | ||
73 | } | ||
74 | protected Dictionary<string, IRegionModule> m_modules = new Dictionary<string, IRegionModule>(); | ||
75 | |||
76 | public Dictionary<string, IRegionModuleBase> RegionModules | 70 | public Dictionary<string, IRegionModuleBase> RegionModules |
77 | { | 71 | { |
78 | get { return m_regionModules; } | 72 | get { return m_regionModules; } |
@@ -272,16 +266,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
272 | /// </summary> | 266 | /// </summary> |
273 | public virtual void Close() | 267 | public virtual void Close() |
274 | { | 268 | { |
275 | // Shut down all non shared modules. | ||
276 | foreach (IRegionModule module in Modules.Values) | ||
277 | { | ||
278 | if (!module.IsSharedModule) | ||
279 | { | ||
280 | module.Close(); | ||
281 | } | ||
282 | } | ||
283 | Modules.Clear(); | ||
284 | |||
285 | try | 269 | try |
286 | { | 270 | { |
287 | EventManager.TriggerShutdown(); | 271 | EventManager.TriggerShutdown(); |
@@ -312,19 +296,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
312 | #region Module Methods | 296 | #region Module Methods |
313 | 297 | ||
314 | /// <summary> | 298 | /// <summary> |
315 | /// Add a module to this scene. | ||
316 | /// </summary> | ||
317 | /// <param name="name"></param> | ||
318 | /// <param name="module"></param> | ||
319 | public void AddModule(string name, IRegionModule module) | ||
320 | { | ||
321 | if (!Modules.ContainsKey(name)) | ||
322 | { | ||
323 | Modules.Add(name, module); | ||
324 | } | ||
325 | } | ||
326 | |||
327 | /// <summary> | ||
328 | /// Add a region-module to this scene. TODO: This will replace AddModule in the future. | 299 | /// Add a region-module to this scene. TODO: This will replace AddModule in the future. |
329 | /// </summary> | 300 | /// </summary> |
330 | /// <param name="name"></param> | 301 | /// <param name="name"></param> |
@@ -508,9 +479,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
508 | /// <param name="shorthelp"></param> | 479 | /// <param name="shorthelp"></param> |
509 | /// <param name="longhelp"></param> | 480 | /// <param name="longhelp"></param> |
510 | /// <param name="callback"></param> | 481 | /// <param name="callback"></param> |
511 | public void AddCommand(object mod, string command, string shorthelp, string longhelp, CommandDelegate callback) | 482 | public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback) |
512 | { | 483 | { |
513 | AddCommand(mod, command, shorthelp, longhelp, string.Empty, callback); | 484 | AddCommand(module, command, shorthelp, longhelp, string.Empty, callback); |
514 | } | 485 | } |
515 | 486 | ||
516 | /// <summary> | 487 | /// <summary> |
@@ -528,9 +499,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
528 | /// <param name="longhelp"></param> | 499 | /// <param name="longhelp"></param> |
529 | /// <param name="callback"></param> | 500 | /// <param name="callback"></param> |
530 | public void AddCommand( | 501 | public void AddCommand( |
531 | string category, object mod, string command, string shorthelp, string longhelp, CommandDelegate callback) | 502 | string category, IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback) |
532 | { | 503 | { |
533 | AddCommand(category, mod, command, shorthelp, longhelp, string.Empty, callback); | 504 | AddCommand(category, module, command, shorthelp, longhelp, string.Empty, callback); |
534 | } | 505 | } |
535 | 506 | ||
536 | /// <summary> | 507 | /// <summary> |
@@ -542,29 +513,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
542 | /// <param name="longhelp"></param> | 513 | /// <param name="longhelp"></param> |
543 | /// <param name="descriptivehelp"></param> | 514 | /// <param name="descriptivehelp"></param> |
544 | /// <param name="callback"></param> | 515 | /// <param name="callback"></param> |
545 | public void AddCommand(object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) | 516 | public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) |
546 | { | 517 | { |
547 | string moduleName = ""; | 518 | string moduleName = ""; |
548 | 519 | ||
549 | if (mod != null) | 520 | if (module != null) |
550 | { | 521 | moduleName = module.Name; |
551 | if (mod is IRegionModule) | ||
552 | { | ||
553 | IRegionModule module = (IRegionModule)mod; | ||
554 | moduleName = module.Name; | ||
555 | } | ||
556 | else if (mod is IRegionModuleBase) | ||
557 | { | ||
558 | IRegionModuleBase module = (IRegionModuleBase)mod; | ||
559 | moduleName = module.Name; | ||
560 | } | ||
561 | else | ||
562 | { | ||
563 | throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase"); | ||
564 | } | ||
565 | } | ||
566 | 522 | ||
567 | AddCommand(moduleName, mod, command, shorthelp, longhelp, descriptivehelp, callback); | 523 | AddCommand(moduleName, module, command, shorthelp, longhelp, descriptivehelp, callback); |
568 | } | 524 | } |
569 | 525 | ||
570 | /// <summary> | 526 | /// <summary> |
@@ -580,7 +536,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
580 | /// <param name="descriptivehelp"></param> | 536 | /// <param name="descriptivehelp"></param> |
581 | /// <param name="callback"></param> | 537 | /// <param name="callback"></param> |
582 | public void AddCommand( | 538 | public void AddCommand( |
583 | string category, object mod, string command, | 539 | string category, IRegionModuleBase module, string command, |
584 | string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) | 540 | string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) |
585 | { | 541 | { |
586 | if (MainConsole.Instance == null) | 542 | if (MainConsole.Instance == null) |
@@ -588,22 +544,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
588 | 544 | ||
589 | bool shared = false; | 545 | bool shared = false; |
590 | 546 | ||
591 | if (mod != null) | 547 | if (module != null) |
592 | { | 548 | shared = module is ISharedRegionModule; |
593 | if (mod is IRegionModule) | ||
594 | { | ||
595 | IRegionModule module = (IRegionModule)mod; | ||
596 | shared = module.IsSharedModule; | ||
597 | } | ||
598 | else if (mod is IRegionModuleBase) | ||
599 | { | ||
600 | shared = mod is ISharedRegionModule; | ||
601 | } | ||
602 | else | ||
603 | { | ||
604 | throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase"); | ||
605 | } | ||
606 | } | ||
607 | 549 | ||
608 | MainConsole.Instance.Commands.AddCommand( | 550 | MainConsole.Instance.Commands.AddCommand( |
609 | category, shared, command, shorthelp, longhelp, descriptivehelp, callback); | 551 | category, shared, command, shorthelp, longhelp, descriptivehelp, callback); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index cb5b2ba..992e71d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs | |||
@@ -144,22 +144,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
144 | // collect known shared modules in sharedModules | 144 | // collect known shared modules in sharedModules |
145 | Dictionary<string, IRegionModule> sharedModules = new Dictionary<string, IRegionModule>(); | 145 | Dictionary<string, IRegionModule> sharedModules = new Dictionary<string, IRegionModule>(); |
146 | 146 | ||
147 | lock (m_localScenes) | ||
148 | { | ||
149 | for (int i = 0; i < m_localScenes.Count; i++) | ||
150 | { | ||
151 | // extract known shared modules from scene | ||
152 | foreach (string k in m_localScenes[i].Modules.Keys) | ||
153 | { | ||
154 | if (m_localScenes[i].Modules[k].IsSharedModule && | ||
155 | !sharedModules.ContainsKey(k)) | ||
156 | sharedModules[k] = m_localScenes[i].Modules[k]; | ||
157 | } | ||
158 | // close scene/region | ||
159 | m_localScenes[i].Close(); | ||
160 | } | ||
161 | } | ||
162 | |||
163 | // all regions/scenes are now closed, we can now safely | 147 | // all regions/scenes are now closed, we can now safely |
164 | // close all shared modules | 148 | // close all shared modules |
165 | foreach (IRegionModule mod in sharedModules.Values) | 149 | foreach (IRegionModule mod in sharedModules.Values) |
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index c424439..939fc33 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs | |||
@@ -139,7 +139,7 @@ namespace OpenSim.Tests.Common | |||
139 | SceneCommunicationService scs = new SceneCommunicationService(); | 139 | SceneCommunicationService scs = new SceneCommunicationService(); |
140 | 140 | ||
141 | TestScene testScene = new TestScene( | 141 | TestScene testScene = new TestScene( |
142 | regInfo, m_acm, scs, m_simDataService, m_estateDataService, null, false, configSource, null); | 142 | regInfo, m_acm, scs, m_simDataService, m_estateDataService, false, configSource, null); |
143 | 143 | ||
144 | INonSharedRegionModule godsModule = new GodsModule(); | 144 | INonSharedRegionModule godsModule = new GodsModule(); |
145 | godsModule.Initialise(new IniConfigSource()); | 145 | godsModule.Initialise(new IniConfigSource()); |
diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs index eea68c3..d4b5648 100644 --- a/OpenSim/Tests/Common/Mock/TestScene.cs +++ b/OpenSim/Tests/Common/Mock/TestScene.cs | |||
@@ -41,9 +41,9 @@ namespace OpenSim.Tests.Common.Mock | |||
41 | public TestScene( | 41 | public TestScene( |
42 | RegionInfo regInfo, AgentCircuitManager authen, | 42 | RegionInfo regInfo, AgentCircuitManager authen, |
43 | SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService, | 43 | SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService, |
44 | ModuleLoader moduleLoader, bool dumpAssetsToFile, | 44 | bool dumpAssetsToFile, |
45 | IConfigSource config, string simulatorVersion) | 45 | IConfigSource config, string simulatorVersion) |
46 | : base(regInfo, authen, sceneGridService, simDataService, estateDataService, moduleLoader, | 46 | : base(regInfo, authen, sceneGridService, simDataService, estateDataService, |
47 | dumpAssetsToFile, config, simulatorVersion) | 47 | dumpAssetsToFile, config, simulatorVersion) |
48 | { | 48 | { |
49 | } | 49 | } |
@@ -73,4 +73,4 @@ namespace OpenSim.Tests.Common.Mock | |||
73 | get { return m_asyncSceneObjectDeleter; } | 73 | get { return m_asyncSceneObjectDeleter; } |
74 | } | 74 | } |
75 | } | 75 | } |
76 | } \ No newline at end of file | 76 | } |