diff options
author | Melanie | 2012-11-12 23:27:47 +0000 |
---|---|---|
committer | Melanie | 2012-11-12 23:27:47 +0000 |
commit | 2e0ce70e639391ecec9d63d88c6d8910e3b0ebfc (patch) | |
tree | 308caeac8741ef507a3f02f41d4403a29d06b06e /OpenSim/Region/Framework | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Completely remove the IRegionModule interface (diff) | |
download | opensim-SC_OLD-2e0ce70e639391ecec9d63d88c6d8910e3b0ebfc.zip opensim-SC_OLD-2e0ce70e639391ecec9d63d88c6d8910e3b0ebfc.tar.gz opensim-SC_OLD-2e0ce70e639391ecec9d63d88c6d8910e3b0ebfc.tar.bz2 opensim-SC_OLD-2e0ce70e639391ecec9d63d88c6d8910e3b0ebfc.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/Application/OpenSimBase.cs
OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs
OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
OpenSim/Region/Framework/ModuleLoader.cs
OpenSim/Region/Framework/Scenes/SceneManager.cs
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/IRegionModule.cs | 55 | ||||
-rw-r--r-- | OpenSim/Region/Framework/ModuleLoader.cs | 263 | ||||
-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 | 25 |
5 files changed, 12 insertions, 415 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionModule.cs deleted file mode 100644 index aacc26b..0000000 --- a/OpenSim/Region/Framework/Interfaces/IRegionModule.cs +++ /dev/null | |||
@@ -1,55 +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 | using System; | ||
28 | |||
29 | using Nini.Config; | ||
30 | using OpenSim.Region.Framework.Scenes; | ||
31 | |||
32 | namespace OpenSim.Region.Framework.Interfaces | ||
33 | { | ||
34 | /// <summary> | ||
35 | /// DEPRECATED! Use INonSharedRegionModule or ISharedRegionModule instead | ||
36 | /// </summary> | ||
37 | [Obsolete("Use INonSharedRegionModule or ISharedRegionModule instead", false)] | ||
38 | public interface IRegionModule | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// Initialize the module. | ||
42 | /// </summary> | ||
43 | /// <remarks> | ||
44 | /// For a shared module this can be called multiple times - once per scene. | ||
45 | /// </remarks> | ||
46 | /// <param name="scene"></param> | ||
47 | /// <param name="source">Configuration information. For a shared module this will be identical on every scene call</param> | ||
48 | void Initialise(Scene scene, IConfigSource source); | ||
49 | |||
50 | void PostInitialise(); | ||
51 | void Close(); | ||
52 | string Name { get; } | ||
53 | bool IsSharedModule { get; } | ||
54 | } | ||
55 | } | ||
diff --git a/OpenSim/Region/Framework/ModuleLoader.cs b/OpenSim/Region/Framework/ModuleLoader.cs deleted file mode 100644 index 32ee674..0000000 --- a/OpenSim/Region/Framework/ModuleLoader.cs +++ /dev/null | |||
@@ -1,263 +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 | // TomMeta: WTF? No, how about we /don't/ throw a fatal exception when there's no need to? | ||
231 | //throw e; | ||
232 | } | ||
233 | } | ||
234 | |||
235 | return modules.ToArray(); | ||
236 | } | ||
237 | |||
238 | public void PostInitialise() | ||
239 | { | ||
240 | foreach (IRegionModule module in m_loadedSharedModules.Values) | ||
241 | { | ||
242 | module.PostInitialise(); | ||
243 | } | ||
244 | |||
245 | foreach (IRegionModule module in m_loadedModules) | ||
246 | { | ||
247 | module.PostInitialise(); | ||
248 | } | ||
249 | } | ||
250 | |||
251 | public void ClearCache() | ||
252 | { | ||
253 | LoadedAssemblys.Clear(); | ||
254 | } | ||
255 | |||
256 | public void UnloadModule(IRegionModule rm) | ||
257 | { | ||
258 | rm.Close(); | ||
259 | |||
260 | m_loadedModules.Remove(rm); | ||
261 | } | ||
262 | } | ||
263 | } | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2543333..80d9f6e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -177,7 +177,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
177 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); | 177 | protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); |
178 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); | 178 | protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); |
179 | protected string m_simulatorVersion = "OpenSimulator Server"; | 179 | protected string m_simulatorVersion = "OpenSimulator Server"; |
180 | protected ModuleLoader m_moduleLoader; | ||
181 | protected AgentCircuitManager m_authenticateHandler; | 180 | protected AgentCircuitManager m_authenticateHandler; |
182 | protected SceneCommunicationService m_sceneGridService; | 181 | protected SceneCommunicationService m_sceneGridService; |
183 | protected ISnmpModule m_snmpService = null; | 182 | protected ISnmpModule m_snmpService = null; |
@@ -679,7 +678,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
679 | public Scene(RegionInfo regInfo, AgentCircuitManager authen, | 678 | public Scene(RegionInfo regInfo, AgentCircuitManager authen, |
680 | SceneCommunicationService sceneGridService, | 679 | SceneCommunicationService sceneGridService, |
681 | ISimulationDataService simDataService, IEstateDataService estateDataService, | 680 | ISimulationDataService simDataService, IEstateDataService estateDataService, |
682 | ModuleLoader moduleLoader, bool dumpAssetsToFile, | 681 | bool dumpAssetsToFile, |
683 | IConfigSource config, string simulatorVersion) | 682 | IConfigSource config, string simulatorVersion) |
684 | : this(regInfo) | 683 | : this(regInfo) |
685 | { | 684 | { |
@@ -690,7 +689,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
690 | Random random = new Random(); | 689 | Random random = new Random(); |
691 | 690 | ||
692 | m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4); | 691 | m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4); |
693 | m_moduleLoader = moduleLoader; | ||
694 | m_authenticateHandler = authen; | 692 | m_authenticateHandler = authen; |
695 | m_sceneGridService = sceneGridService; | 693 | m_sceneGridService = sceneGridService; |
696 | m_SimulationDataService = simDataService; | 694 | m_SimulationDataService = simDataService; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 7c8bd88..74c9582 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; } |
@@ -273,16 +267,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
273 | /// </summary> | 267 | /// </summary> |
274 | public virtual void Close() | 268 | public virtual void Close() |
275 | { | 269 | { |
276 | // Shut down all non shared modules. | ||
277 | foreach (IRegionModule module in Modules.Values) | ||
278 | { | ||
279 | if (!module.IsSharedModule) | ||
280 | { | ||
281 | module.Close(); | ||
282 | } | ||
283 | } | ||
284 | Modules.Clear(); | ||
285 | |||
286 | try | 270 | try |
287 | { | 271 | { |
288 | EventManager.TriggerShutdown(); | 272 | EventManager.TriggerShutdown(); |
@@ -313,19 +297,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
313 | #region Module Methods | 297 | #region Module Methods |
314 | 298 | ||
315 | /// <summary> | 299 | /// <summary> |
316 | /// Add a module to this scene. | ||
317 | /// </summary> | ||
318 | /// <param name="name"></param> | ||
319 | /// <param name="module"></param> | ||
320 | public void AddModule(string name, IRegionModule module) | ||
321 | { | ||
322 | if (!Modules.ContainsKey(name)) | ||
323 | { | ||
324 | Modules.Add(name, module); | ||
325 | } | ||
326 | } | ||
327 | |||
328 | /// <summary> | ||
329 | /// Add a region-module to this scene. TODO: This will replace AddModule in the future. | 300 | /// Add a region-module to this scene. TODO: This will replace AddModule in the future. |
330 | /// </summary> | 301 | /// </summary> |
331 | /// <param name="name"></param> | 302 | /// <param name="name"></param> |
@@ -509,9 +480,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
509 | /// <param name="shorthelp"></param> | 480 | /// <param name="shorthelp"></param> |
510 | /// <param name="longhelp"></param> | 481 | /// <param name="longhelp"></param> |
511 | /// <param name="callback"></param> | 482 | /// <param name="callback"></param> |
512 | public void AddCommand(object mod, string command, string shorthelp, string longhelp, CommandDelegate callback) | 483 | public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback) |
513 | { | 484 | { |
514 | AddCommand(mod, command, shorthelp, longhelp, string.Empty, callback); | 485 | AddCommand(module, command, shorthelp, longhelp, string.Empty, callback); |
515 | } | 486 | } |
516 | 487 | ||
517 | /// <summary> | 488 | /// <summary> |
@@ -529,9 +500,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
529 | /// <param name="longhelp"></param> | 500 | /// <param name="longhelp"></param> |
530 | /// <param name="callback"></param> | 501 | /// <param name="callback"></param> |
531 | public void AddCommand( | 502 | public void AddCommand( |
532 | string category, object mod, string command, string shorthelp, string longhelp, CommandDelegate callback) | 503 | string category, IRegionModuleBase module, string command, string shorthelp, string longhelp, CommandDelegate callback) |
533 | { | 504 | { |
534 | AddCommand(category, mod, command, shorthelp, longhelp, string.Empty, callback); | 505 | AddCommand(category, module, command, shorthelp, longhelp, string.Empty, callback); |
535 | } | 506 | } |
536 | 507 | ||
537 | /// <summary> | 508 | /// <summary> |
@@ -543,29 +514,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
543 | /// <param name="longhelp"></param> | 514 | /// <param name="longhelp"></param> |
544 | /// <param name="descriptivehelp"></param> | 515 | /// <param name="descriptivehelp"></param> |
545 | /// <param name="callback"></param> | 516 | /// <param name="callback"></param> |
546 | public void AddCommand(object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) | 517 | public void AddCommand(IRegionModuleBase module, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) |
547 | { | 518 | { |
548 | string moduleName = ""; | 519 | string moduleName = ""; |
549 | 520 | ||
550 | if (mod != null) | 521 | if (module != null) |
551 | { | 522 | moduleName = module.Name; |
552 | if (mod is IRegionModule) | ||
553 | { | ||
554 | IRegionModule module = (IRegionModule)mod; | ||
555 | moduleName = module.Name; | ||
556 | } | ||
557 | else if (mod is IRegionModuleBase) | ||
558 | { | ||
559 | IRegionModuleBase module = (IRegionModuleBase)mod; | ||
560 | moduleName = module.Name; | ||
561 | } | ||
562 | else | ||
563 | { | ||
564 | throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase"); | ||
565 | } | ||
566 | } | ||
567 | 523 | ||
568 | AddCommand(moduleName, mod, command, shorthelp, longhelp, descriptivehelp, callback); | 524 | AddCommand(moduleName, module, command, shorthelp, longhelp, descriptivehelp, callback); |
569 | } | 525 | } |
570 | 526 | ||
571 | /// <summary> | 527 | /// <summary> |
@@ -581,7 +537,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
581 | /// <param name="descriptivehelp"></param> | 537 | /// <param name="descriptivehelp"></param> |
582 | /// <param name="callback"></param> | 538 | /// <param name="callback"></param> |
583 | public void AddCommand( | 539 | public void AddCommand( |
584 | string category, object mod, string command, | 540 | string category, IRegionModuleBase module, string command, |
585 | string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) | 541 | string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) |
586 | { | 542 | { |
587 | if (MainConsole.Instance == null) | 543 | if (MainConsole.Instance == null) |
@@ -589,22 +545,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
589 | 545 | ||
590 | bool shared = false; | 546 | bool shared = false; |
591 | 547 | ||
592 | if (mod != null) | 548 | if (module != null) |
593 | { | 549 | shared = module is ISharedRegionModule; |
594 | if (mod is IRegionModule) | ||
595 | { | ||
596 | IRegionModule module = (IRegionModule)mod; | ||
597 | shared = module.IsSharedModule; | ||
598 | } | ||
599 | else if (mod is IRegionModuleBase) | ||
600 | { | ||
601 | shared = mod is ISharedRegionModule; | ||
602 | } | ||
603 | else | ||
604 | { | ||
605 | throw new Exception("AddCommand module parameter must be IRegionModule or IRegionModuleBase"); | ||
606 | } | ||
607 | } | ||
608 | 550 | ||
609 | MainConsole.Instance.Commands.AddCommand( | 551 | MainConsole.Instance.Commands.AddCommand( |
610 | category, shared, command, shorthelp, longhelp, descriptivehelp, callback); | 552 | category, shared, command, shorthelp, longhelp, descriptivehelp, callback); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index dba3a61..89e3ac5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs | |||
@@ -138,31 +138,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
138 | 138 | ||
139 | public void Close() | 139 | public void Close() |
140 | { | 140 | { |
141 | // collect known shared modules in sharedModules | ||
142 | Dictionary<string, IRegionModule> sharedModules = new Dictionary<string, IRegionModule>(); | ||
143 | |||
144 | List<Scene> sceneList = Scenes; | ||
145 | for (int i = 0; i < sceneList.Count; i++) | ||
146 | { | ||
147 | // extract known shared modules from scene | ||
148 | foreach (string k in sceneList[i].Modules.Keys) | ||
149 | { | ||
150 | if (sceneList[i].Modules[k].IsSharedModule && | ||
151 | !sharedModules.ContainsKey(k)) | ||
152 | sharedModules[k] = sceneList[i].Modules[k]; | ||
153 | } | ||
154 | // close scene/region | ||
155 | sceneList[i].Close(); | ||
156 | } | ||
157 | |||
158 | // all regions/scenes are now closed, we can now safely | ||
159 | // close all shared modules | ||
160 | foreach (IRegionModule mod in sharedModules.Values) | ||
161 | { | ||
162 | mod.Close(); | ||
163 | } | ||
164 | |||
165 | m_localScenes.Clear(); | ||
166 | } | 141 | } |
167 | 142 | ||
168 | public void Close(Scene cscene) | 143 | public void Close(Scene cscene) |