diff options
author | MW | 2009-02-26 20:01:20 +0000 |
---|---|---|
committer | MW | 2009-02-26 20:01:20 +0000 |
commit | 33e7c09b7b894551b35fb8ab29133c96a5d7b037 (patch) | |
tree | a21839dc38477c2679b9c94fcebc96cca8bcc26d /OpenSim/Region | |
parent | Attempt to fix the "region starts but doesn't load anything" issue (diff) | |
download | opensim-SC-33e7c09b7b894551b35fb8ab29133c96a5d7b037.zip opensim-SC-33e7c09b7b894551b35fb8ab29133c96a5d7b037.tar.gz opensim-SC-33e7c09b7b894551b35fb8ab29133c96a5d7b037.tar.bz2 opensim-SC-33e7c09b7b894551b35fb8ab29133c96a5d7b037.tar.xz |
Added IRegistryCore and RegistryCore to OpenSim.Framework.
Added a ApplicationRegistry to OpenSimBase.
Changed LoadRegionsPlugin so it registers itself to that application registry.
Added a event to LoadRegionsPlugin, that is triggered when it creates a new scene ,although maybe this event should actually be in opensimBase incase other plugins are creating regions (like the RemoteAdminPlugin).
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Application/HGOpenSimNode.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 67 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 34 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/RegionApplicationBase.cs | 15 |
4 files changed, 74 insertions, 44 deletions
diff --git a/OpenSim/Region/Application/HGOpenSimNode.cs b/OpenSim/Region/Application/HGOpenSimNode.cs index ded6443..1130c70 100644 --- a/OpenSim/Region/Application/HGOpenSimNode.cs +++ b/OpenSim/Region/Application/HGOpenSimNode.cs | |||
@@ -47,7 +47,7 @@ namespace OpenSim | |||
47 | public class HGOpenSimNode : OpenSim | 47 | public class HGOpenSimNode : OpenSim |
48 | { | 48 | { |
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | private IHyperlink HGServices = null; | 50 | public IHyperlink HGServices = null; |
51 | 51 | ||
52 | private uint m_autoMappingX = 0; | 52 | private uint m_autoMappingX = 0; |
53 | private uint m_autoMappingY = 0; | 53 | private uint m_autoMappingY = 0; |
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index a17d92f..a8adf58 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -95,6 +95,40 @@ namespace OpenSim | |||
95 | m_console.SetGuiMode(m_gui); | 95 | m_console.SetGuiMode(m_gui); |
96 | MainConsole.Instance = m_console; | 96 | MainConsole.Instance = m_console; |
97 | 97 | ||
98 | RegisterConsoleCommands(); | ||
99 | |||
100 | base.StartupSpecific(); | ||
101 | |||
102 | //Run Startup Commands | ||
103 | if (String.IsNullOrEmpty( m_startupCommandsFile )) | ||
104 | { | ||
105 | m_log.Info("[STARTUP]: No startup command script specified. Moving on..."); | ||
106 | } | ||
107 | else | ||
108 | { | ||
109 | RunCommandScript(m_startupCommandsFile); | ||
110 | } | ||
111 | |||
112 | // Start timer script (run a script every xx seconds) | ||
113 | if (m_timedScript != "disabled") | ||
114 | { | ||
115 | m_scriptTimer = new Timer(); | ||
116 | m_scriptTimer.Enabled = true; | ||
117 | m_scriptTimer.Interval = 1200 * 1000; | ||
118 | m_scriptTimer.Elapsed += RunAutoTimerScript; | ||
119 | } | ||
120 | |||
121 | PrintFileToConsole("startuplogo.txt"); | ||
122 | |||
123 | // For now, start at the 'root' level by default | ||
124 | if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it | ||
125 | ChangeSelectedRegion("region", new string[] {"change", "region", m_sceneManager.Scenes[0].RegionInfo.RegionName}); | ||
126 | else | ||
127 | ChangeSelectedRegion("region", new string[] {"change", "region", "root"}); | ||
128 | } | ||
129 | |||
130 | private void RegisterConsoleCommands() | ||
131 | { | ||
98 | m_console.Commands.AddCommand("region", false, "clear assets", | 132 | m_console.Commands.AddCommand("region", false, "clear assets", |
99 | "clear assets", | 133 | "clear assets", |
100 | "Clear the asset cache", HandleClearAssets); | 134 | "Clear the asset cache", HandleClearAssets); |
@@ -255,35 +289,6 @@ namespace OpenSim | |||
255 | "reset user password [<first> [<last> [<password>]]]", | 289 | "reset user password [<first> [<last> [<password>]]]", |
256 | "Reset a user password", HandleResetUserPassword); | 290 | "Reset a user password", HandleResetUserPassword); |
257 | } | 291 | } |
258 | |||
259 | base.StartupSpecific(); | ||
260 | |||
261 | //Run Startup Commands | ||
262 | if (String.IsNullOrEmpty( m_startupCommandsFile )) | ||
263 | { | ||
264 | m_log.Info("[STARTUP]: No startup command script specified. Moving on..."); | ||
265 | } | ||
266 | else | ||
267 | { | ||
268 | RunCommandScript(m_startupCommandsFile); | ||
269 | } | ||
270 | |||
271 | // Start timer script (run a script every xx seconds) | ||
272 | if (m_timedScript != "disabled") | ||
273 | { | ||
274 | m_scriptTimer = new Timer(); | ||
275 | m_scriptTimer.Enabled = true; | ||
276 | m_scriptTimer.Interval = 1200 * 1000; | ||
277 | m_scriptTimer.Elapsed += RunAutoTimerScript; | ||
278 | } | ||
279 | |||
280 | PrintFileToConsole("startuplogo.txt"); | ||
281 | |||
282 | // For now, start at the 'root' level by default | ||
283 | if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it | ||
284 | ChangeSelectedRegion("region", new string[] {"change", "region", m_sceneManager.Scenes[0].RegionInfo.RegionName}); | ||
285 | else | ||
286 | ChangeSelectedRegion("region", new string[] {"change", "region", "root"}); | ||
287 | } | 292 | } |
288 | 293 | ||
289 | public override void ShutdownSpecific() | 294 | public override void ShutdownSpecific() |
@@ -410,9 +415,9 @@ namespace OpenSim | |||
410 | { | 415 | { |
411 | m_console.Error("Usage: create region <region name> <region_file.xml>"); | 416 | m_console.Error("Usage: create region <region name> <region_file.xml>"); |
412 | } | 417 | } |
413 | |||
414 | 418 | ||
415 | CreateRegion(new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source), true); | 419 | IScene scene; |
420 | CreateRegion(new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source), true, out scene); | ||
416 | } | 421 | } |
417 | 422 | ||
418 | private void HandleLoginEnable(string module, string[] cmd) | 423 | private void HandleLoginEnable(string module, string[] cmd) |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 4d809b0..2b74aa3 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -120,7 +120,14 @@ namespace OpenSim | |||
120 | get { return m_moduleLoader; } | 120 | get { return m_moduleLoader; } |
121 | set { m_moduleLoader = value; } | 121 | set { m_moduleLoader = value; } |
122 | } | 122 | } |
123 | protected ModuleLoader m_moduleLoader; | 123 | protected ModuleLoader m_moduleLoader; |
124 | |||
125 | protected RegistryCore m_applicationRegistry = new RegistryCore(); | ||
126 | |||
127 | public RegistryCore ApplicationRegistry | ||
128 | { | ||
129 | get { return m_applicationRegistry; } | ||
130 | } | ||
124 | 131 | ||
125 | /// <summary> | 132 | /// <summary> |
126 | /// Constructor. | 133 | /// Constructor. |
@@ -176,7 +183,7 @@ namespace OpenSim | |||
176 | base.StartupSpecific(); | 183 | base.StartupSpecific(); |
177 | 184 | ||
178 | m_stats = StatsManager.StartCollectingSimExtraStats(); | 185 | m_stats = StatsManager.StartCollectingSimExtraStats(); |
179 | 186 | ||
180 | LibraryRootFolder libraryRootFolder = new LibraryRootFolder(m_configSettings.LibrariesXMLFile); | 187 | LibraryRootFolder libraryRootFolder = new LibraryRootFolder(m_configSettings.LibrariesXMLFile); |
181 | 188 | ||
182 | // Standalone mode is determined by !startupConfig.GetBoolean("gridmode", false) | 189 | // Standalone mode is determined by !startupConfig.GetBoolean("gridmode", false) |
@@ -194,6 +201,7 @@ namespace OpenSim | |||
194 | m_moduleLoader = new ModuleLoader(m_config.Source); | 201 | m_moduleLoader = new ModuleLoader(m_config.Source); |
195 | 202 | ||
196 | LoadPlugins(); | 203 | LoadPlugins(); |
204 | |||
197 | 205 | ||
198 | foreach (IApplicationPlugin plugin in m_plugins) | 206 | foreach (IApplicationPlugin plugin in m_plugins) |
199 | { | 207 | { |
@@ -202,7 +210,10 @@ namespace OpenSim | |||
202 | 210 | ||
203 | 211 | ||
204 | // Only enable logins to the regions once we have completely finished starting up (apart from scripts) | 212 | // Only enable logins to the regions once we have completely finished starting up (apart from scripts) |
205 | m_commsManager.GridService.RegionLoginsEnabled = true; | 213 | if ((m_commsManager != null) && (m_commsManager.GridService != null)) |
214 | { | ||
215 | m_commsManager.GridService.RegionLoginsEnabled = true; | ||
216 | } | ||
206 | 217 | ||
207 | // If console exists add plugin commands. | 218 | // If console exists add plugin commands. |
208 | if (m_console != null) | 219 | if (m_console != null) |
@@ -541,9 +552,9 @@ namespace OpenSim | |||
541 | /// <param name="regionInfo"></param> | 552 | /// <param name="regionInfo"></param> |
542 | /// <param name="portadd_flag"></param> | 553 | /// <param name="portadd_flag"></param> |
543 | /// <returns></returns> | 554 | /// <returns></returns> |
544 | public IClientNetworkServer CreateRegion(RegionInfo regionInfo, bool portadd_flag) | 555 | public IClientNetworkServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene) |
545 | { | 556 | { |
546 | return CreateRegion(regionInfo, portadd_flag, false); | 557 | return CreateRegion(regionInfo, portadd_flag, false, out scene); |
547 | } | 558 | } |
548 | 559 | ||
549 | /// <summary> | 560 | /// <summary> |
@@ -551,9 +562,9 @@ namespace OpenSim | |||
551 | /// </summary> | 562 | /// </summary> |
552 | /// <param name="regionInfo"></param> | 563 | /// <param name="regionInfo"></param> |
553 | /// <returns></returns> | 564 | /// <returns></returns> |
554 | public IClientNetworkServer CreateRegion(RegionInfo regionInfo) | 565 | public IClientNetworkServer CreateRegion(RegionInfo regionInfo, out IScene scene) |
555 | { | 566 | { |
556 | return CreateRegion(regionInfo, false, true); | 567 | return CreateRegion(regionInfo, false, true, out scene); |
557 | } | 568 | } |
558 | 569 | ||
559 | /// <summary> | 570 | /// <summary> |
@@ -563,7 +574,7 @@ namespace OpenSim | |||
563 | /// <param name="portadd_flag"></param> | 574 | /// <param name="portadd_flag"></param> |
564 | /// <param name="do_post_init"></param> | 575 | /// <param name="do_post_init"></param> |
565 | /// <returns></returns> | 576 | /// <returns></returns> |
566 | public IClientNetworkServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init) | 577 | public IClientNetworkServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene) |
567 | { | 578 | { |
568 | int port = regionInfo.InternalEndPoint.Port; | 579 | int port = regionInfo.InternalEndPoint.Port; |
569 | 580 | ||
@@ -640,6 +651,7 @@ namespace OpenSim | |||
640 | } | 651 | } |
641 | } | 652 | } |
642 | 653 | ||
654 | mscene = scene; | ||
643 | return clientServer; | 655 | return clientServer; |
644 | } | 656 | } |
645 | 657 | ||
@@ -722,8 +734,8 @@ namespace OpenSim | |||
722 | m_clientServers[clientServerElement].Server.Close(); | 734 | m_clientServers[clientServerElement].Server.Close(); |
723 | m_clientServers.RemoveAt(clientServerElement); | 735 | m_clientServers.RemoveAt(clientServerElement); |
724 | } | 736 | } |
725 | 737 | IScene scene; | |
726 | CreateRegion(whichRegion, true); | 738 | CreateRegion(whichRegion, true, out scene); |
727 | } | 739 | } |
728 | 740 | ||
729 | # region Setup methods | 741 | # region Setup methods |
@@ -738,7 +750,7 @@ namespace OpenSim | |||
738 | /// Handler to supply the current status of this sim | 750 | /// Handler to supply the current status of this sim |
739 | /// </summary> | 751 | /// </summary> |
740 | /// Currently this is always OK if the simulator is still listening for connections on its HTTP service | 752 | /// Currently this is always OK if the simulator is still listening for connections on its HTTP service |
741 | protected class SimStatusHandler : IStreamedRequestHandler | 753 | public class SimStatusHandler : IStreamedRequestHandler |
742 | { | 754 | { |
743 | public byte[] Handle(string path, Stream request, | 755 | public byte[] Handle(string path, Stream request, |
744 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 756 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 55cf1ae..731e0e5 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs | |||
@@ -45,16 +45,21 @@ namespace OpenSim.Region.ClientStack | |||
45 | private static readonly ILog m_log | 45 | private static readonly ILog m_log |
46 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | protected IAssetCache m_assetCache; | ||
49 | protected Dictionary<EndPoint, uint> m_clientCircuits = new Dictionary<EndPoint, uint>(); | 48 | protected Dictionary<EndPoint, uint> m_clientCircuits = new Dictionary<EndPoint, uint>(); |
50 | protected NetworkServersInfo m_networkServersInfo; | 49 | protected NetworkServersInfo m_networkServersInfo; |
51 | 50 | ||
51 | public NetworkServersInfo NetServersInfo | ||
52 | { | ||
53 | get { return m_networkServersInfo; } | ||
54 | } | ||
55 | |||
52 | protected BaseHttpServer m_httpServer; | 56 | protected BaseHttpServer m_httpServer; |
53 | protected uint m_httpServerPort; | 57 | protected uint m_httpServerPort; |
54 | 58 | ||
55 | public CommunicationsManager CommunicationsManager | 59 | public CommunicationsManager CommunicationsManager |
56 | { | 60 | { |
57 | get { return m_commsManager; } | 61 | get { return m_commsManager; } |
62 | set { m_commsManager = value; } | ||
58 | } | 63 | } |
59 | protected CommunicationsManager m_commsManager; | 64 | protected CommunicationsManager m_commsManager; |
60 | 65 | ||
@@ -67,6 +72,14 @@ namespace OpenSim.Region.ClientStack | |||
67 | get { return m_sceneManager; } | 72 | get { return m_sceneManager; } |
68 | } | 73 | } |
69 | protected SceneManager m_sceneManager = new SceneManager(); | 74 | protected SceneManager m_sceneManager = new SceneManager(); |
75 | |||
76 | protected IAssetCache m_assetCache; | ||
77 | |||
78 | public IAssetCache AssetCache | ||
79 | { | ||
80 | get { return m_assetCache; } | ||
81 | set { m_assetCache = value; } | ||
82 | } | ||
70 | 83 | ||
71 | protected abstract void Initialize(); | 84 | protected abstract void Initialize(); |
72 | 85 | ||