diff options
author | MW | 2007-11-04 22:16:13 +0000 |
---|---|---|
committer | MW | 2007-11-04 22:16:13 +0000 |
commit | 1467720f6085dc5dfefdb3e83acd7afe21a11e28 (patch) | |
tree | 924d32f57782df808b35bb2b6e485be280f2860f | |
parent | * Small touchup of console messages (diff) | |
download | opensim-SC_OLD-1467720f6085dc5dfefdb3e83acd7afe21a11e28.zip opensim-SC_OLD-1467720f6085dc5dfefdb3e83acd7afe21a11e28.tar.gz opensim-SC_OLD-1467720f6085dc5dfefdb3e83acd7afe21a11e28.tar.bz2 opensim-SC_OLD-1467720f6085dc5dfefdb3e83acd7afe21a11e28.tar.xz |
Added forgotten ApplicationPlugins directory and moved the load region code out to a plugin.
To make opensim search for the new plugin, you will need to delete the "addin-db-000" and "addins" sub directories in bin if you have them.
-rw-r--r-- | OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs | 58 | ||||
-rw-r--r-- | OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs | 36 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimMain.cs | 63 | ||||
-rw-r--r-- | prebuild.xml | 9 |
4 files changed, 121 insertions, 45 deletions
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs new file mode 100644 index 0000000..f0232e6 --- /dev/null +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs | |||
@@ -0,0 +1,58 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using OpenSim; | ||
5 | using OpenSim.Framework.Console; | ||
6 | using OpenSim.Framework; | ||
7 | using OpenSim.Framework.RegionLoader.Filesystem; | ||
8 | using OpenSim.Framework.RegionLoader.Web; | ||
9 | using Mono.Addins; | ||
10 | using Mono.Addins.Description; | ||
11 | using Nini; | ||
12 | using Nini.Config; | ||
13 | |||
14 | [assembly:Addin] | ||
15 | [assembly:AddinDependency ("OpenSim", "0.4")] | ||
16 | |||
17 | namespace OpenSim.ApplicationPlugins.Example | ||
18 | { | ||
19 | [Extension("/OpenSim/Startup")] | ||
20 | public class LoadRegionsPlugin : IApplicationPlugin | ||
21 | { | ||
22 | public void Initialise(OpenSimMain openSim) | ||
23 | { | ||
24 | System.Console.WriteLine("Load Regions addin being initialised"); | ||
25 | |||
26 | IRegionLoader regionLoader; | ||
27 | if (openSim.ConfigSource.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem") | ||
28 | { | ||
29 | MainLog.Instance.Notice("Loading Region Info from filesystem"); | ||
30 | regionLoader = new RegionLoaderFileSystem(); | ||
31 | } | ||
32 | else | ||
33 | { | ||
34 | MainLog.Instance.Notice("Loading Region Info from web"); | ||
35 | regionLoader = new RegionLoaderWebServer(); | ||
36 | } | ||
37 | |||
38 | regionLoader.SetIniConfigSource(openSim.ConfigSource); | ||
39 | RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); | ||
40 | |||
41 | openSim.ModuleLoader.LoadDefaultSharedModules(); | ||
42 | |||
43 | for (int i = 0; i < regionsToLoad.Length; i++) | ||
44 | { | ||
45 | MainLog.Instance.Debug("Creating Region: " + regionsToLoad[i].RegionName); | ||
46 | openSim.CreateRegion(regionsToLoad[i]); | ||
47 | } | ||
48 | |||
49 | openSim.ModuleLoader.PostInitialise(); | ||
50 | openSim.ModuleLoader.ClearCache(); | ||
51 | } | ||
52 | |||
53 | public void Close() | ||
54 | { | ||
55 | |||
56 | } | ||
57 | } | ||
58 | } | ||
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs b/OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0b5f4bd --- /dev/null +++ b/OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,36 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("OpenSim.Addin")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("")] | ||
12 | [assembly: AssemblyProduct("OpenSim.Addin")] | ||
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
18 | // to COM components. If you need to access a type in this assembly from | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("45b979d9-d8d4-42fd-9780-fe9ac7e86cb4")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | // You can specify all the values or you can default the Build and Revision Numbers | ||
33 | // by using the '*' as shown below: | ||
34 | // [assembly: AssemblyVersion("1.0.*")] | ||
35 | [assembly: AssemblyVersion("1.0.0.0")] | ||
36 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 666e0d2..69cedaf 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -35,8 +35,6 @@ using OpenSim.Framework; | |||
35 | using OpenSim.Framework.Communications.Cache; | 35 | using OpenSim.Framework.Communications.Cache; |
36 | using OpenSim.Framework.Console; | 36 | using OpenSim.Framework.Console; |
37 | using OpenSim.Framework.Servers; | 37 | using OpenSim.Framework.Servers; |
38 | using OpenSim.Framework.RegionLoader.Filesystem; | ||
39 | using OpenSim.Framework.RegionLoader.Web; | ||
40 | using OpenSim.Region.ClientStack; | 38 | using OpenSim.Region.ClientStack; |
41 | using OpenSim.Region.Communications.Local; | 39 | using OpenSim.Region.Communications.Local; |
42 | using OpenSim.Region.Communications.OGS1; | 40 | using OpenSim.Region.Communications.OGS1; |
@@ -63,9 +61,7 @@ namespace OpenSim | |||
63 | 61 | ||
64 | private OpenSimController m_controller; | 62 | private OpenSimController m_controller; |
65 | 63 | ||
66 | protected ModuleLoader m_moduleLoader; | ||
67 | protected LocalLoginService m_loginService; | 64 | protected LocalLoginService m_loginService; |
68 | private IniConfigSource m_config; | ||
69 | 65 | ||
70 | protected string m_storageDLL = "OpenSim.DataStore.NullStorage.dll"; | 66 | protected string m_storageDLL = "OpenSim.DataStore.NullStorage.dll"; |
71 | 67 | ||
@@ -90,6 +86,24 @@ namespace OpenSim | |||
90 | public ConsoleCommand CreateAccount = null; | 86 | public ConsoleCommand CreateAccount = null; |
91 | private bool m_dumpAssetsToFile; | 87 | private bool m_dumpAssetsToFile; |
92 | 88 | ||
89 | private List<IApplicationPlugin> m_plugins = new List<IApplicationPlugin>(); | ||
90 | |||
91 | private IniConfigSource m_config; | ||
92 | |||
93 | public IniConfigSource ConfigSource | ||
94 | { | ||
95 | get { return m_config; } | ||
96 | set { m_config = value; } | ||
97 | } | ||
98 | |||
99 | private ModuleLoader m_moduleLoader; | ||
100 | |||
101 | public ModuleLoader ModuleLoader | ||
102 | { | ||
103 | get { return m_moduleLoader; } | ||
104 | set { m_moduleLoader = value; } | ||
105 | } | ||
106 | |||
93 | public OpenSimMain(IConfigSource configSource) | 107 | public OpenSimMain(IConfigSource configSource) |
94 | : base() | 108 | : base() |
95 | { | 109 | { |
@@ -278,44 +292,16 @@ namespace OpenSim | |||
278 | m_httpServer.AddStreamHandler(new SimStatusHandler()); | 292 | m_httpServer.AddStreamHandler(new SimStatusHandler()); |
279 | } | 293 | } |
280 | 294 | ||
295 | m_moduleLoader = new ModuleLoader(m_log, m_config); | ||
296 | |||
281 | MainLog.Instance.Verbose("Plugins", "Loading OpenSim application plugins"); | 297 | MainLog.Instance.Verbose("Plugins", "Loading OpenSim application plugins"); |
282 | foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/OpenSim/Startup")) | 298 | foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/OpenSim/Startup")) |
283 | { | 299 | { |
284 | IApplicationPlugin plugin = (IApplicationPlugin)node.CreateInstance(); | 300 | IApplicationPlugin plugin = (IApplicationPlugin)node.CreateInstance(); |
285 | plugin.Initialise(this); | 301 | plugin.Initialise(this); |
302 | m_plugins.Add(plugin); | ||
286 | } | 303 | } |
287 | 304 | ||
288 | IRegionLoader regionLoader; | ||
289 | if (m_config.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem") | ||
290 | { | ||
291 | MainLog.Instance.Notice("Loading Region Info from filesystem"); | ||
292 | regionLoader = new RegionLoaderFileSystem(); | ||
293 | } | ||
294 | else | ||
295 | { | ||
296 | MainLog.Instance.Notice("Loading Region Info from web"); | ||
297 | regionLoader = new RegionLoaderWebServer(); | ||
298 | } | ||
299 | |||
300 | regionLoader.SetIniConfigSource(m_config); | ||
301 | RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); | ||
302 | |||
303 | m_moduleLoader = new ModuleLoader(m_log, m_config); | ||
304 | MainLog.Instance.Verbose("Loading Shared Modules"); | ||
305 | m_moduleLoader.LoadDefaultSharedModules(); | ||
306 | |||
307 | // Load all script engines found (scripting engine is now a IRegionModule so loaded in the module loader | ||
308 | // OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader ScriptEngineLoader = new OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineLoader(m_log); | ||
309 | |||
310 | for (int i = 0; i < regionsToLoad.Length; i++) | ||
311 | { | ||
312 | MainLog.Instance.Debug("Creating Region: " + regionsToLoad[i].RegionName); | ||
313 | CreateRegion(regionsToLoad[i]); | ||
314 | } | ||
315 | |||
316 | m_moduleLoader.PostInitialise(); | ||
317 | m_moduleLoader.ClearCache(); | ||
318 | |||
319 | // Start UDP servers | 305 | // Start UDP servers |
320 | for (int i = 0; i < m_udpServers.Count; i++) | 306 | for (int i = 0; i < m_udpServers.Count; i++) |
321 | { | 307 | { |
@@ -349,13 +335,6 @@ namespace OpenSim | |||
349 | 335 | ||
350 | scene.SetModuleInterfaces(); | 336 | scene.SetModuleInterfaces(); |
351 | 337 | ||
352 | // Check if we have a script engine to load | ||
353 | //if (m_scriptEngine != null && m_scriptEngine != "") | ||
354 | //{ | ||
355 | // OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine = ScriptEngineLoader.LoadScriptEngine(m_scriptEngine); | ||
356 | // scene.AddScriptEngine(ScriptEngine, m_log); | ||
357 | //} | ||
358 | |||
359 | //Server side object editing permissions checking | 338 | //Server side object editing permissions checking |
360 | scene.PermissionsMngr.BypassPermissions = !m_permissions; | 339 | scene.PermissionsMngr.BypassPermissions = !m_permissions; |
361 | 340 | ||
diff --git a/prebuild.xml b/prebuild.xml index 6a4416d..404a750 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -675,8 +675,6 @@ | |||
675 | <Reference name="OpenSim.Framework.Console"/> | 675 | <Reference name="OpenSim.Framework.Console"/> |
676 | <Reference name="OpenSim.Region.Physics.Manager"/> | 676 | <Reference name="OpenSim.Region.Physics.Manager"/> |
677 | <Reference name="OpenSim.Framework.Servers"/> | 677 | <Reference name="OpenSim.Framework.Servers"/> |
678 | <Reference name="OpenSim.Framework.RegionLoader.Filesystem"/> | ||
679 | <Reference name="OpenSim.Framework.RegionLoader.Web"/> | ||
680 | <Reference name="OpenSim.Region.Environment"/> | 678 | <Reference name="OpenSim.Region.Environment"/> |
681 | <Reference name="OpenSim.Region.ClientStack"/> | 679 | <Reference name="OpenSim.Region.ClientStack"/> |
682 | <Reference name="OpenSim.Framework.Communications"/> | 680 | <Reference name="OpenSim.Framework.Communications"/> |
@@ -689,7 +687,7 @@ | |||
689 | </Files> | 687 | </Files> |
690 | </Project> | 688 | </Project> |
691 | 689 | ||
692 | <Project name="OpenSim.ApplicationPlugins.Example" path="OpenSim/ApplicationPlugins/Example" type="Library"> | 690 | <Project name="OpenSim.ApplicationPlugins.LoadRegions" path="OpenSim/ApplicationPlugins/LoadRegions" type="Library"> |
693 | <Configuration name="Debug"> | 691 | <Configuration name="Debug"> |
694 | <Options> | 692 | <Options> |
695 | <OutputPath>../../../bin/</OutputPath> | 693 | <OutputPath>../../../bin/</OutputPath> |
@@ -706,9 +704,14 @@ | |||
706 | <Reference name="System"/> | 704 | <Reference name="System"/> |
707 | <Reference name="System.Xml"/> | 705 | <Reference name="System.Xml"/> |
708 | <Reference name="libsecondlife.dll" /> | 706 | <Reference name="libsecondlife.dll" /> |
707 | <Reference name="Nini.dll" /> | ||
709 | <Reference name="OpenSim"/> | 708 | <Reference name="OpenSim"/> |
710 | <Reference name="OpenSim.Region.ClientStack"/> | 709 | <Reference name="OpenSim.Region.ClientStack"/> |
710 | <Reference name="OpenSim.Region.Environment"/> | ||
711 | <Reference name="OpenSim.Framework"/> | ||
711 | <Reference name="OpenSim.Framework.Console"/> | 712 | <Reference name="OpenSim.Framework.Console"/> |
713 | <Reference name="OpenSim.Framework.RegionLoader.Filesystem"/> | ||
714 | <Reference name="OpenSim.Framework.RegionLoader.Web"/> | ||
712 | <Files> | 715 | <Files> |
713 | <Match pattern="*.cs" recurse="true"/> | 716 | <Match pattern="*.cs" recurse="true"/> |
714 | </Files> | 717 | </Files> |