diff options
author | Sean Dague | 2008-04-21 12:42:56 +0000 |
---|---|---|
committer | Sean Dague | 2008-04-21 12:42:56 +0000 |
commit | bf1580fba45df7624180b07599c8170074500c99 (patch) | |
tree | 696a69c94554f0789b123c82fb34c658e9a0b6af | |
parent | * Various refactorings. (diff) | |
download | opensim-SC_OLD-bf1580fba45df7624180b07599c8170074500c99.zip opensim-SC_OLD-bf1580fba45df7624180b07599c8170074500c99.tar.gz opensim-SC_OLD-bf1580fba45df7624180b07599c8170074500c99.tar.bz2 opensim-SC_OLD-bf1580fba45df7624180b07599c8170074500c99.tar.xz |
From: Dr Scofield <hud@zurich.ibm.com>
the attached patch set is centered around RemoteAdminPlugin and focuses
mainly on making it more robust (i.e. more parameter checking and better
error reporting) but also we've re-implemented the LoadTerrain stuff that
got disabled during the terrain code reworking:
* missing PostInitialize() calls on region modules that were loaded
for regions created via RemoteAdmin's CreateRegion XmlRpc call
* re-implements RemoteAdmin's LoadTerrain XmlRpc call (probably lost
during the TerrainModule rework)
* adds lots more parameter checking and error reporting to RemoteAdmin
* adds a read-only property to RegionApplicationBase so that we can
access the CommsManager
* adds Exceptions to TerrainModule so that we get better error case
feedback (and can report more meaningful errors in turn)
* adds a CheckForTerrainUpdate() call to
TerrainModule.LoadFromFile() to make terrain changes effective
* adds TryGetCurrentScene(LLUUID) to SceneManager so that we can
retrieve Scenes not only by name but also by LLUUID
cheers,
dr scofield
Diffstat (limited to '')
8 files changed, 170 insertions, 68 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 3e0f4f6..b8ee3ee 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -38,6 +38,7 @@ using Nwc.XmlRpc; | |||
38 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Servers; | 39 | using OpenSim.Framework.Servers; |
40 | using OpenSim.Region.Environment.Scenes; | 40 | using OpenSim.Region.Environment.Scenes; |
41 | using OpenSim.Region.Environment.Modules.Terrain; | ||
41 | 42 | ||
42 | [assembly : Addin] | 43 | [assembly : Addin] |
43 | [assembly : AddinDependency("OpenSim", "0.5")] | 44 | [assembly : AddinDependency("OpenSim", "0.5")] |
@@ -88,6 +89,9 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
88 | LLUUID regionID = new LLUUID((string) requestData["regionID"]); | 89 | LLUUID regionID = new LLUUID((string) requestData["regionID"]); |
89 | 90 | ||
90 | Hashtable responseData = new Hashtable(); | 91 | Hashtable responseData = new Hashtable(); |
92 | |||
93 | m_log.Info("[RADMIN]: Request to restart Region."); | ||
94 | |||
91 | if (requiredPassword != String.Empty && | 95 | if (requiredPassword != String.Empty && |
92 | (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) | 96 | (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) |
93 | { | 97 | { |
@@ -119,24 +123,30 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
119 | { | 123 | { |
120 | XmlRpcResponse response = new XmlRpcResponse(); | 124 | XmlRpcResponse response = new XmlRpcResponse(); |
121 | Hashtable requestData = (Hashtable) request.Params[0]; | 125 | Hashtable requestData = (Hashtable) request.Params[0]; |
122 | |||
123 | Hashtable responseData = new Hashtable(); | 126 | Hashtable responseData = new Hashtable(); |
124 | if (requiredPassword != String.Empty && | 127 | |
125 | (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) | 128 | try { |
126 | { | 129 | checkStringParameters(request, new string[] { "password", "message" }); |
127 | responseData["accepted"] = "false"; | 130 | |
128 | response.Value = responseData; | 131 | if (requiredPassword != String.Empty && |
129 | } | 132 | (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) |
130 | else | 133 | throw new Exception("wrong password"); |
131 | { | 134 | |
132 | string message = (string) requestData["message"]; | 135 | string message = (string) requestData["message"]; |
133 | m_log.Info("[RADMIN]: Broadcasting: " + message); | 136 | m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message); |
134 | 137 | ||
135 | responseData["accepted"] = "true"; | 138 | responseData["accepted"] = "true"; |
136 | response.Value = responseData; | 139 | response.Value = responseData; |
137 | 140 | ||
138 | m_app.SceneManager.SendGeneralMessage(message); | 141 | m_app.SceneManager.SendGeneralMessage(message); |
139 | } | 142 | } |
143 | catch(Exception e) | ||
144 | { | ||
145 | m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message); | ||
146 | m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString()); | ||
147 | responseData["accepted"] = "false"; | ||
148 | response.Value = responseData; | ||
149 | } | ||
140 | 150 | ||
141 | return response; | 151 | return response; |
142 | } | 152 | } |
@@ -146,35 +156,48 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
146 | XmlRpcResponse response = new XmlRpcResponse(); | 156 | XmlRpcResponse response = new XmlRpcResponse(); |
147 | Hashtable requestData = (Hashtable)request.Params[0]; | 157 | Hashtable requestData = (Hashtable)request.Params[0]; |
148 | 158 | ||
149 | Hashtable responseData = new Hashtable(); | 159 | m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}", request.ToString()); |
150 | if (requiredPassword != String.Empty && | 160 | foreach (string k in requestData.Keys) |
151 | (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword)) | ||
152 | { | 161 | { |
153 | responseData["accepted"] = "false"; | 162 | m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}: >{1}< {2}", |
154 | response.Value = responseData; | 163 | k, (string)requestData[k], ((string)requestData[k]).Length); |
155 | } | 164 | } |
156 | else | 165 | |
157 | { | 166 | Hashtable responseData = new Hashtable(); |
167 | try { | ||
168 | checkStringParameters(request, new string[] { "password", "filename", "regionid"}); | ||
169 | |||
170 | if (requiredPassword != String.Empty && | ||
171 | (!requestData.Contains("password") || (string)requestData["password"] != requiredPassword)) | ||
172 | throw new Exception("wrong password"); | ||
173 | |||
158 | string file = (string)requestData["filename"]; | 174 | string file = (string)requestData["filename"]; |
159 | LLUUID regionID = LLUUID.Parse((string)requestData["regionid"]); | 175 | LLUUID regionID = (string) requestData["regionid"]; |
160 | m_log.Info("[RADMIN]: Terrain Loading: " + file); | 176 | m_log.InfoFormat("[RADMIN]: Terrain Loading: {0}", file); |
161 | 177 | ||
162 | responseData["accepted"] = "true"; | 178 | responseData["accepted"] = "true"; |
163 | 179 | ||
164 | Scene region = null; | 180 | Scene region = null; |
165 | 181 | ||
166 | if (m_app.SceneManager.TryGetScene(regionID, out region)) | 182 | if (!m_app.SceneManager.TryGetScene(regionID, out region)) |
167 | { | 183 | throw new Exception("1: unable to get a scene with that name"); |
168 | //region.LoadWorldMap(file); | 184 | |
169 | responseData["success"] = "true"; | 185 | ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>(); |
170 | } | 186 | if (null == terrainModule) throw new Exception("terrain module not available"); |
171 | else | 187 | terrainModule.LoadFromFile(file); |
172 | { | 188 | |
173 | responseData["success"] = "false"; | 189 | responseData["success"] = "true"; |
174 | responseData["error"] = "1: Unable to get a scene with that name."; | 190 | |
175 | } | ||
176 | response.Value = responseData; | 191 | response.Value = responseData; |
177 | } | 192 | } |
193 | catch (Exception e) | ||
194 | { | ||
195 | m_log.ErrorFormat("[RADMIN] Terrain Loading: failed: {0}", e.Message); | ||
196 | m_log.DebugFormat("[RADMIN] Terrain Loading: failed: {0}", e.ToString()); | ||
197 | |||
198 | responseData["success"] = "false"; | ||
199 | responseData["error"] = e.Message; | ||
200 | } | ||
178 | 201 | ||
179 | return response; | 202 | return response; |
180 | } | 203 | } |
@@ -185,37 +208,32 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
185 | XmlRpcResponse response = new XmlRpcResponse(); | 208 | XmlRpcResponse response = new XmlRpcResponse(); |
186 | Hashtable requestData = (Hashtable) request.Params[0]; | 209 | Hashtable requestData = (Hashtable) request.Params[0]; |
187 | Hashtable responseData = new Hashtable(); | 210 | Hashtable responseData = new Hashtable(); |
188 | if (requiredPassword != String.Empty && | 211 | |
189 | (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) | 212 | try { |
190 | { | 213 | checkStringParameters(request, new string[] { "password", "shutdown" }); |
191 | responseData["accepted"] = "false"; | 214 | checkIntegerParams(request, new string[] { "milliseconds"}); |
215 | |||
216 | if (requiredPassword != String.Empty && | ||
217 | (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) | ||
218 | throw new Exception("wrong password"); | ||
219 | |||
220 | responseData["accepted"] = "true"; | ||
192 | response.Value = responseData; | 221 | response.Value = responseData; |
193 | } | 222 | |
194 | else | ||
195 | { | ||
196 | if ((string) requestData["shutdown"] == "delayed") | 223 | if ((string) requestData["shutdown"] == "delayed") |
197 | { | 224 | { |
198 | int timeout = (Int32) requestData["milliseconds"]; | 225 | int timeout = (Int32) requestData["milliseconds"]; |
199 | |||
200 | responseData["accepted"] = "true"; | ||
201 | response.Value = responseData; | ||
202 | |||
203 | m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int) (timeout/1000)).ToString() + | 226 | m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int) (timeout/1000)).ToString() + |
204 | " second(s). Please save what you are doing and log out."); | 227 | " second(s). Please save what you are doing and log out."); |
205 | 228 | ||
206 | // Perform shutdown | 229 | // Perform shutdown |
207 | Timer shutdownTimer = new Timer(timeout); // Wait before firing | 230 | Timer shutdownTimer = new Timer(timeout); // Wait before firing |
208 | shutdownTimer.AutoReset = false; | 231 | shutdownTimer.AutoReset = false; |
209 | shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed); | 232 | shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed); |
210 | shutdownTimer.Start(); | 233 | shutdownTimer.Start(); |
211 | 234 | } | |
212 | return response; | ||
213 | } | ||
214 | else | 235 | else |
215 | { | 236 | { |
216 | responseData["accepted"] = "true"; | ||
217 | response.Value = responseData; | ||
218 | |||
219 | m_app.SceneManager.SendGeneralMessage("Region is going down now."); | 237 | m_app.SceneManager.SendGeneralMessage("Region is going down now."); |
220 | 238 | ||
221 | // Perform shutdown | 239 | // Perform shutdown |
@@ -223,10 +241,18 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
223 | shutdownTimer.AutoReset = false; | 241 | shutdownTimer.AutoReset = false; |
224 | shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed); | 242 | shutdownTimer.Elapsed += new ElapsedEventHandler(shutdownTimer_Elapsed); |
225 | shutdownTimer.Start(); | 243 | shutdownTimer.Start(); |
226 | |||
227 | return response; | ||
228 | } | 244 | } |
229 | } | 245 | } |
246 | catch (Exception e) | ||
247 | { | ||
248 | m_log.ErrorFormat("[RADMIN] Shutdown: failed: {0}", e.Message); | ||
249 | m_log.DebugFormat("[RADMIN] Shutdown: failed: {0}", e.ToString()); | ||
250 | |||
251 | responseData["accepted"] = "false"; | ||
252 | responseData["error"] = e.Message; | ||
253 | |||
254 | response.Value = responseData; | ||
255 | } | ||
230 | return response; | 256 | return response; |
231 | } | 257 | } |
232 | 258 | ||
@@ -401,7 +427,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
401 | region.SaveRegionToFile("dynamic region", regionConfigPath); | 427 | region.SaveRegionToFile("dynamic region", regionConfigPath); |
402 | } | 428 | } |
403 | 429 | ||
404 | m_app.CreateRegion(region, true); | 430 | m_app.CreateRegion(region); |
405 | 431 | ||
406 | responseData["success"] = "true"; | 432 | responseData["success"] = "true"; |
407 | responseData["region_name"] = region.RegionName; | 433 | responseData["region_name"] = region.RegionName; |
@@ -484,8 +510,10 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
484 | uint regX = Convert.ToUInt32((Int32)requestData["start_region_x"]); | 510 | uint regX = Convert.ToUInt32((Int32)requestData["start_region_x"]); |
485 | uint regY = Convert.ToUInt32((Int32)requestData["start_region_y"]); | 511 | uint regY = Convert.ToUInt32((Int32)requestData["start_region_y"]); |
486 | 512 | ||
487 | // FIXME: need to check whether "firstname lastname" | 513 | UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname); |
488 | // already exists! | 514 | if (null != userProfile) |
515 | throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname)); | ||
516 | |||
489 | LLUUID userID = m_app.CreateUser(firstname, lastname, passwd, regX, regY); | 517 | LLUUID userID = m_app.CreateUser(firstname, lastname, passwd, regX, regY); |
490 | 518 | ||
491 | if (userID == LLUUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}", | 519 | if (userID == LLUUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}", |
@@ -523,22 +551,34 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
523 | try | 551 | try |
524 | { | 552 | { |
525 | // check completeness | 553 | // check completeness |
526 | foreach (string p in new string[] { "password", "region_name", "filename" }) | 554 | foreach (string p in new string[] { "password", "filename" }) |
527 | { | 555 | { |
528 | if (!requestData.Contains(p)) | 556 | if (!requestData.Contains(p)) |
529 | throw new Exception(String.Format("missing parameter {0}", p)); | 557 | throw new Exception(String.Format("missing parameter {0}", p)); |
558 | if (String.IsNullOrEmpty((string)requestData[p])) | ||
559 | throw new Exception(String.Format("parameter {0} is empty")); | ||
530 | } | 560 | } |
531 | 561 | ||
532 | // check password | 562 | // check password |
533 | if (!String.IsNullOrEmpty(requiredPassword) && | 563 | if (!String.IsNullOrEmpty(requiredPassword) && |
534 | (string)requestData["password"] != requiredPassword) throw new Exception("wrong password"); | 564 | (string)requestData["password"] != requiredPassword) throw new Exception("wrong password"); |
535 | 565 | ||
536 | string region_name = (string)requestData["region_name"]; | 566 | string filename = (string)requestData["filename"]; |
537 | string filename = (string)requestData["filename"]; | 567 | if (requestData.Contains("region_uuid")) |
538 | 568 | { | |
539 | if (!m_app.SceneManager.TrySetCurrentScene(region_name)) | 569 | LLUUID region_uuid = (string)requestData["region_uuid"]; |
540 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | 570 | if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) |
541 | m_log.InfoFormat("[RADMIN] Switched to region {0}"); | 571 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); |
572 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); | ||
573 | } | ||
574 | else if (requestData.Contains("region_name")) | ||
575 | { | ||
576 | string region_name = (string)requestData["region_name"]; | ||
577 | if (!m_app.SceneManager.TrySetCurrentScene(region_name)) | ||
578 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | ||
579 | m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); | ||
580 | } | ||
581 | else throw new Exception("neither region_name nor region_uuid given"); | ||
542 | 582 | ||
543 | responseData["switched"] = "true"; | 583 | responseData["switched"] = "true"; |
544 | 584 | ||
@@ -550,7 +590,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions | |||
550 | catch (Exception e) | 590 | catch (Exception e) |
551 | { | 591 | { |
552 | m_log.InfoFormat("[RADMIN] LoadXml: {0}", e.Message); | 592 | m_log.InfoFormat("[RADMIN] LoadXml: {0}", e.Message); |
553 | m_log.DebugFormat("[RADMIN] LoadXML {0}: {1}", e.ToString()); | 593 | m_log.DebugFormat("[RADMIN] LoadXml: {0}", e.ToString()); |
554 | 594 | ||
555 | responseData["loaded"] = "false"; | 595 | responseData["loaded"] = "false"; |
556 | responseData["switched"] = "false"; | 596 | responseData["switched"] = "false"; |
diff --git a/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs b/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs index 3e3ae16..f101131 100644 --- a/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs +++ b/OpenSim/Framework/Communications/Capabilities/CapsHandlers.cs | |||
@@ -44,6 +44,10 @@ namespace OpenSim.Region.Capabilities | |||
44 | private uint m_httpListenerPort; | 44 | private uint m_httpListenerPort; |
45 | 45 | ||
46 | /// <summary></summary> | 46 | /// <summary></summary> |
47 | /// CapsHandlers is a cap handler container but also takes | ||
48 | /// care of adding and removing cap handlers to and from the | ||
49 | /// supplied BaseHttpServer. | ||
50 | /// </summary> | ||
47 | /// <param name="httpListener">base HTTP server</param> | 51 | /// <param name="httpListener">base HTTP server</param> |
48 | /// <param name="httpListenerHostname">host name of the HTTP | 52 | /// <param name="httpListenerHostname">host name of the HTTP |
49 | /// server</param> | 53 | /// server</param> |
diff --git a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs index cfaaf02..0c01c5a 100644 --- a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs +++ b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs | |||
@@ -63,7 +63,7 @@ namespace OpenSim.Framework.RegionLoader.Filesystem | |||
63 | 63 | ||
64 | if (configFiles.Length == 0) | 64 | if (configFiles.Length == 0) |
65 | { | 65 | { |
66 | new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "default.xml"),false); | 66 | new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "default.xml"), false); |
67 | configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); | 67 | configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); |
68 | } | 68 | } |
69 | 69 | ||
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index aa08f81..26ae525 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -462,7 +462,28 @@ namespace OpenSim | |||
462 | /// <param name="regionInfo"></param> | 462 | /// <param name="regionInfo"></param> |
463 | /// <param name="portadd_flag"></param> | 463 | /// <param name="portadd_flag"></param> |
464 | /// <returns></returns> | 464 | /// <returns></returns> |
465 | public UDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag) | 465 | public UDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag) { |
466 | return CreateRegion(regionInfo, portadd_flag, false); | ||
467 | } | ||
468 | |||
469 | /// <summary> | ||
470 | /// Execute the region creation process. This includes setting up scene infrastructure. | ||
471 | /// </summary> | ||
472 | /// <param name="regionInfo"></param> | ||
473 | /// <param name="portadd_flag"></param> | ||
474 | /// <returns></returns> | ||
475 | public UDPServer CreateRegion(RegionInfo regionInfo) { | ||
476 | return CreateRegion(regionInfo, false, true); | ||
477 | } | ||
478 | |||
479 | /// <summary> | ||
480 | /// Execute the region creation process. This includes setting up scene infrastructure. | ||
481 | /// </summary> | ||
482 | /// <param name="regionInfo"></param> | ||
483 | /// <param name="portadd_flag"></param> | ||
484 | /// <param name="do_post_init"></param> | ||
485 | /// <returns></returns> | ||
486 | public UDPServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init) | ||
466 | { | 487 | { |
467 | int port = regionInfo.InternalEndPoint.Port; | 488 | int port = regionInfo.InternalEndPoint.Port; |
468 | 489 | ||
@@ -487,7 +508,7 @@ namespace OpenSim | |||
487 | 508 | ||
488 | m_log.Info("[MODULES]: Loading Region's modules"); | 509 | m_log.Info("[MODULES]: Loading Region's modules"); |
489 | 510 | ||
490 | m_moduleLoader.PickupModules(scene, "."); | 511 | List<IRegionModule> modules = m_moduleLoader.PickupModules(scene, "."); |
491 | //m_moduleLoader.PickupModules(scene, "ScriptEngines"); | 512 | //m_moduleLoader.PickupModules(scene, "ScriptEngines"); |
492 | //m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", m_scriptEngine), scene); | 513 | //m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", m_scriptEngine), scene); |
493 | 514 | ||
@@ -536,6 +557,14 @@ namespace OpenSim | |||
536 | m_regionData.Add(regionInfo); | 557 | m_regionData.Add(regionInfo); |
537 | udpServer.ServerListener(); | 558 | udpServer.ServerListener(); |
538 | 559 | ||
560 | if (do_post_init) | ||
561 | { | ||
562 | foreach (IRegionModule module in modules) | ||
563 | { | ||
564 | module.PostInitialise(); | ||
565 | } | ||
566 | } | ||
567 | |||
539 | return udpServer; | 568 | return udpServer; |
540 | } | 569 | } |
541 | 570 | ||
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index bc0bea3..a6124a9 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs | |||
@@ -54,6 +54,9 @@ namespace OpenSim.Region.ClientStack | |||
54 | protected uint m_httpServerPort; | 54 | protected uint m_httpServerPort; |
55 | 55 | ||
56 | protected CommunicationsManager m_commsManager; | 56 | protected CommunicationsManager m_commsManager; |
57 | public CommunicationsManager CommunicationsManager { | ||
58 | get { return m_commsManager; } | ||
59 | } | ||
57 | 60 | ||
58 | protected SceneManager m_sceneManager = new SceneManager(); | 61 | protected SceneManager m_sceneManager = new SceneManager(); |
59 | 62 | ||
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs index 43ca7bd..52a6fbd 100644 --- a/OpenSim/Region/Environment/ModuleLoader.cs +++ b/OpenSim/Region/Environment/ModuleLoader.cs | |||
@@ -62,14 +62,16 @@ namespace OpenSim.Region.Environment | |||
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | public void PickupModules(Scene scene, string moduleDir) | 65 | public List<IRegionModule> PickupModules(Scene scene, string moduleDir) |
66 | { | 66 | { |
67 | DirectoryInfo dir = new DirectoryInfo(moduleDir); | 67 | DirectoryInfo dir = new DirectoryInfo(moduleDir); |
68 | List<IRegionModule> modules = new List<IRegionModule>(); | ||
68 | 69 | ||
69 | foreach (FileInfo fileInfo in dir.GetFiles("*.dll")) | 70 | foreach (FileInfo fileInfo in dir.GetFiles("*.dll")) |
70 | { | 71 | { |
71 | LoadRegionModules(fileInfo.FullName, scene); | 72 | modules.AddRange(LoadRegionModules(fileInfo.FullName, scene)); |
72 | } | 73 | } |
74 | return modules; | ||
73 | } | 75 | } |
74 | 76 | ||
75 | public void LoadDefaultSharedModules() | 77 | public void LoadDefaultSharedModules() |
@@ -190,9 +192,10 @@ namespace OpenSim.Region.Environment | |||
190 | } | 192 | } |
191 | } | 193 | } |
192 | 194 | ||
193 | public void LoadRegionModules(string dllName, Scene scene) | 195 | public List<IRegionModule> LoadRegionModules(string dllName, Scene scene) |
194 | { | 196 | { |
195 | IRegionModule[] modules = LoadModules(dllName); | 197 | IRegionModule[] modules = LoadModules(dllName); |
198 | List<IRegionModule> initializedModules = new List<IRegionModule>(); | ||
196 | 199 | ||
197 | if (modules.Length > 0) | 200 | if (modules.Length > 0) |
198 | { | 201 | { |
@@ -203,6 +206,7 @@ namespace OpenSim.Region.Environment | |||
203 | { | 206 | { |
204 | m_log.InfoFormat("[MODULES]: [{0}]: Initializing.", module.Name); | 207 | m_log.InfoFormat("[MODULES]: [{0}]: Initializing.", module.Name); |
205 | InitializeModule(module, scene); | 208 | InitializeModule(module, scene); |
209 | initializedModules.Add(module); | ||
206 | } | 210 | } |
207 | else | 211 | else |
208 | { | 212 | { |
@@ -211,6 +215,7 @@ namespace OpenSim.Region.Environment | |||
211 | } | 215 | } |
212 | } | 216 | } |
213 | } | 217 | } |
218 | return initializedModules; | ||
214 | } | 219 | } |
215 | 220 | ||
216 | public void LoadRegionModule(string dllName, string moduleName, Scene scene) | 221 | public void LoadRegionModule(string dllName, string moduleName, Scene scene) |
diff --git a/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs index 987c3d0..f758c91 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs | |||
@@ -178,20 +178,24 @@ namespace OpenSim.Region.Environment.Modules.Terrain | |||
178 | { | 178 | { |
179 | m_log.Error("[TERRAIN]: Unable to load heightmap, the " + loader.Value + | 179 | m_log.Error("[TERRAIN]: Unable to load heightmap, the " + loader.Value + |
180 | " parser does not support file loading. (May be save only)"); | 180 | " parser does not support file loading. (May be save only)"); |
181 | return; | 181 | throw new Exception(String.Format("unable to load heightmap: parser {0} does not support loading", loader.Value)); |
182 | } | 182 | } |
183 | catch (FileNotFoundException) | 183 | catch (FileNotFoundException) |
184 | { | 184 | { |
185 | m_log.Error( | 185 | m_log.Error( |
186 | "[TERRAIN]: Unable to load heightmap, file not found. (A directory permissions error may also cause this)"); | 186 | "[TERRAIN]: Unable to load heightmap, file not found. (A directory permissions error may also cause this)"); |
187 | return; | 187 | throw new Exception(String.Format("unable to load heightmap: file {0} not found (or permissions do not allow access", |
188 | filename)); | ||
188 | } | 189 | } |
189 | } | 190 | } |
191 | CheckForTerrainUpdates(); | ||
190 | m_log.Info("[TERRAIN]: File (" + filename + ") loaded successfully"); | 192 | m_log.Info("[TERRAIN]: File (" + filename + ") loaded successfully"); |
191 | return; | 193 | return; |
192 | } | 194 | } |
193 | } | 195 | } |
194 | m_log.Error("[TERRAIN]: Unable to load heightmap, no file loader availible for that format."); | 196 | m_log.Error("[TERRAIN]: Unable to load heightmap, no file loader availible for that format."); |
197 | throw new Exception(String.Format("unable to load heightmap from file {0}: no loader available for that format", | ||
198 | filename)); | ||
195 | } | 199 | } |
196 | 200 | ||
197 | /// <summary> | 201 | /// <summary> |
@@ -214,6 +218,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain | |||
214 | catch (NotImplementedException) | 218 | catch (NotImplementedException) |
215 | { | 219 | { |
216 | m_log.Error("Unable to save to " + filename + ", saving of this file format has not been implemented."); | 220 | m_log.Error("Unable to save to " + filename + ", saving of this file format has not been implemented."); |
221 | throw new Exception(String.Format("unable to save heightmap: {0}: saving of this file format not implemented")); | ||
217 | } | 222 | } |
218 | } | 223 | } |
219 | 224 | ||
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index 61a4eae..40e313a 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs | |||
@@ -250,6 +250,22 @@ namespace OpenSim.Region.Environment.Scenes | |||
250 | } | 250 | } |
251 | } | 251 | } |
252 | 252 | ||
253 | public bool TrySetCurrentScene(LLUUID regionID) | ||
254 | { | ||
255 | Console.WriteLine("Searching for Region: '{0}'", regionID.ToString()); | ||
256 | |||
257 | foreach (Scene scene in m_localScenes) | ||
258 | { | ||
259 | if (scene.RegionInfo.RegionID == regionID) | ||
260 | { | ||
261 | m_currentScene = scene; | ||
262 | return true; | ||
263 | } | ||
264 | } | ||
265 | |||
266 | return false; | ||
267 | } | ||
268 | |||
253 | public bool TryGetScene(string regionName, out Scene scene) | 269 | public bool TryGetScene(string regionName, out Scene scene) |
254 | { | 270 | { |
255 | foreach (Scene mscene in m_localScenes) | 271 | foreach (Scene mscene in m_localScenes) |