aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application/OpenSimBase.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Application/OpenSimBase.cs')
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs305
1 files changed, 119 insertions, 186 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index c3c87e7..ab6f036 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -36,17 +36,15 @@ using log4net;
36using Nini.Config; 36using Nini.Config;
37using OpenMetaverse; 37using OpenMetaverse;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Framework.Communications;
40using OpenSim.Framework.Console; 39using OpenSim.Framework.Console;
41using OpenSim.Framework.Servers; 40using OpenSim.Framework.Servers;
42using OpenSim.Framework.Servers.HttpServer; 41using OpenSim.Framework.Servers.HttpServer;
43using OpenSim.Framework.Monitoring; 42using OpenSim.Framework.Monitoring;
44using OpenSim.Region.ClientStack;
45using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; 43using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts;
46using OpenSim.Region.Framework; 44using OpenSim.Region.Framework;
47using OpenSim.Region.Framework.Interfaces; 45using OpenSim.Region.Framework.Interfaces;
48using OpenSim.Region.Framework.Scenes; 46using OpenSim.Region.Framework.Scenes;
49using OpenSim.Region.Physics.Manager; 47using OpenSim.Region.PhysicsModules.SharedBase;
50using OpenSim.Server.Base; 48using OpenSim.Server.Base;
51using OpenSim.Services.Base; 49using OpenSim.Services.Base;
52using OpenSim.Services.Interfaces; 50using OpenSim.Services.Interfaces;
@@ -71,10 +69,25 @@ namespace OpenSim
71 // OpenSim.ini Section name for ESTATES Settings 69 // OpenSim.ini Section name for ESTATES Settings
72 public const string ESTATE_SECTION_NAME = "Estates"; 70 public const string ESTATE_SECTION_NAME = "Estates";
73 71
72 /// <summary>
73 /// Allow all plugin loading to be disabled for tests/debug.
74 /// </summary>
75 /// <remarks>
76 /// true by default
77 /// </remarks>
78 public bool EnableInitialPluginLoad { get; set; }
79
80 /// <summary>
81 /// Control whether we attempt to load an estate data service.
82 /// </summary>
83 /// <remarks>For tests/debugging</remarks>
84 public bool LoadEstateDataService { get; set; }
85
74 protected string proxyUrl; 86 protected string proxyUrl;
75 protected int proxyOffset = 0; 87 protected int proxyOffset = 0;
76 88
77 public string userStatsURI = String.Empty; 89 public string userStatsURI = String.Empty;
90 public string managedStatsURI = String.Empty;
78 91
79 protected bool m_autoCreateClientStack = true; 92 protected bool m_autoCreateClientStack = true;
80 93
@@ -95,26 +108,19 @@ namespace OpenSim
95 108
96 public ConsoleCommand CreateAccount = null; 109 public ConsoleCommand CreateAccount = null;
97 110
98 protected List<IApplicationPlugin> m_plugins = new List<IApplicationPlugin>(); 111 public List<IApplicationPlugin> m_plugins = new List<IApplicationPlugin>();
99 112
100 /// <value> 113 /// <value>
101 /// The config information passed into the OpenSimulator region server. 114 /// The config information passed into the OpenSimulator region server.
102 /// </value> 115 /// </value>
103 public OpenSimConfigSource ConfigSource { get; private set; } 116 public OpenSimConfigSource ConfigSource { get; private set; }
104 117
105 public List<IClientNetworkServer> ClientServers
106 {
107 get { return m_clientServers; }
108 }
109
110 protected EnvConfigSource m_EnvConfigSource = new EnvConfigSource(); 118 protected EnvConfigSource m_EnvConfigSource = new EnvConfigSource();
111 119
112 public EnvConfigSource envConfigSource 120 public EnvConfigSource envConfigSource
113 { 121 {
114 get { return m_EnvConfigSource; } 122 get { return m_EnvConfigSource; }
115 } 123 }
116
117 protected List<IClientNetworkServer> m_clientServers = new List<IClientNetworkServer>();
118 124
119 public uint HttpServerPort 125 public uint HttpServerPort
120 { 126 {
@@ -134,6 +140,8 @@ namespace OpenSim
134 /// <param name="configSource"></param> 140 /// <param name="configSource"></param>
135 public OpenSimBase(IConfigSource configSource) : base() 141 public OpenSimBase(IConfigSource configSource) : base()
136 { 142 {
143 EnableInitialPluginLoad = true;
144 LoadEstateDataService = true;
137 LoadConfigSettings(configSource); 145 LoadConfigSettings(configSource);
138 } 146 }
139 147
@@ -153,14 +161,37 @@ namespace OpenSim
153 proxyUrl = networkConfig.GetString("proxy_url", ""); 161 proxyUrl = networkConfig.GetString("proxy_url", "");
154 proxyOffset = Int32.Parse(networkConfig.GetString("proxy_offset", "0")); 162 proxyOffset = Int32.Parse(networkConfig.GetString("proxy_offset", "0"));
155 } 163 }
164
165 IConfig startupConfig = Config.Configs["Startup"];
166 if (startupConfig != null)
167 {
168 Util.LogOverloads = startupConfig.GetBoolean("LogOverloads", true);
169 }
156 } 170 }
157 171
158 protected virtual void LoadPlugins() 172 protected virtual void LoadPlugins()
159 { 173 {
160 using (PluginLoader<IApplicationPlugin> loader = new PluginLoader<IApplicationPlugin>(new ApplicationPluginInitialiser(this))) 174 IConfig startupConfig = Config.Configs["Startup"];
175 string registryLocation = (startupConfig != null) ? startupConfig.GetString("RegistryLocation", String.Empty) : String.Empty;
176
177 // The location can also be specified in the environment. If there
178 // is no location in the configuration, we must call the constructor
179 // without a location parameter to allow that to happen.
180 if (registryLocation == String.Empty)
161 { 181 {
162 loader.Load("/OpenSim/Startup"); 182 using (PluginLoader<IApplicationPlugin> loader = new PluginLoader<IApplicationPlugin>(new ApplicationPluginInitialiser(this)))
163 m_plugins = loader.Plugins; 183 {
184 loader.Load("/OpenSim/Startup");
185 m_plugins = loader.Plugins;
186 }
187 }
188 else
189 {
190 using (PluginLoader<IApplicationPlugin> loader = new PluginLoader<IApplicationPlugin>(new ApplicationPluginInitialiser(this), registryLocation))
191 {
192 loader.Load("/OpenSim/Startup");
193 m_plugins = loader.Plugins;
194 }
164 } 195 }
165 } 196 }
166 197
@@ -188,6 +219,7 @@ namespace OpenSim
188 CreatePIDFile(pidFile); 219 CreatePIDFile(pidFile);
189 220
190 userStatsURI = startupConfig.GetString("Stats_URI", String.Empty); 221 userStatsURI = startupConfig.GetString("Stats_URI", String.Empty);
222 managedStatsURI = startupConfig.GetString("ManagedStatsRemoteFetchURI", String.Empty);
191 } 223 }
192 224
193 // Load the simulation data service 225 // Load the simulation data service
@@ -207,34 +239,32 @@ namespace OpenSim
207 module)); 239 module));
208 240
209 // Load the estate data service 241 // Load the estate data service
210 IConfig estateDataConfig = Config.Configs["EstateDataStore"]; 242 module = Util.GetConfigVarFromSections<string>(Config, "LocalServiceModule", new string[]{"EstateDataStore", "EstateService"}, String.Empty);
211 if (estateDataConfig == null)
212 throw new Exception("Configuration file is missing the [EstateDataStore] section. Have you copied OpenSim.ini.example to OpenSim.ini to reference config-include/ files?");
213
214 module = estateDataConfig.GetString("LocalServiceModule", String.Empty);
215 if (String.IsNullOrEmpty(module)) 243 if (String.IsNullOrEmpty(module))
216 throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] section"); 244 throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] or [EstateService] section");
217 245
218 m_estateDataService = ServerUtils.LoadPlugin<IEstateDataService>(module, new object[] { Config }); 246 if (LoadEstateDataService)
219 if (m_estateDataService == null) 247 {
220 throw new Exception( 248 m_estateDataService = ServerUtils.LoadPlugin<IEstateDataService>(module, new object[] { Config });
221 string.Format( 249 if (m_estateDataService == null)
222 "Could not load an IEstateDataService implementation from {0}, as configured in the LocalServiceModule parameter of the [EstateDataStore] config section.", 250 throw new Exception(
223 module)); 251 string.Format(
252 "Could not load an IEstateDataService implementation from {0}, as configured in the LocalServiceModule parameter of the [EstateDataStore] config section.",
253 module));
254 }
224 255
225 base.StartupSpecific(); 256 base.StartupSpecific();
226 257
227 LoadPlugins(); 258 if (EnableInitialPluginLoad)
259 LoadPlugins();
260
261 // We still want to post initalize any plugins even if loading has been disabled since a test may have
262 // inserted them manually.
228 foreach (IApplicationPlugin plugin in m_plugins) 263 foreach (IApplicationPlugin plugin in m_plugins)
229 {
230 plugin.PostInitialise(); 264 plugin.PostInitialise();
231 }
232 265
233 if (m_console != null) 266 if (m_console != null)
234 {
235 StatsManager.RegisterConsoleCommands(m_console);
236 AddPluginCommands(m_console); 267 AddPluginCommands(m_console);
237 }
238 } 268 }
239 269
240 protected virtual void AddPluginCommands(ICommandConsole console) 270 protected virtual void AddPluginCommands(ICommandConsole console)
@@ -298,6 +328,10 @@ namespace OpenSim
298 { 328 {
299 // Called from base.StartUp() 329 // Called from base.StartUp()
300 330
331 IConfig startupConfig = Config.Configs["Startup"];
332 if (startupConfig == null || startupConfig.GetBoolean("JobEngineEnabled", true))
333 WorkManager.JobEngine.Start();
334
301 m_httpServerPort = m_networkServersInfo.HttpListenerPort; 335 m_httpServerPort = m_networkServersInfo.HttpListenerPort;
302 SceneManager.OnRestartSim += HandleRestartRegion; 336 SceneManager.OnRestartSim += HandleRestartRegion;
303 337
@@ -316,9 +350,9 @@ namespace OpenSim
316 /// <param name="regionInfo"></param> 350 /// <param name="regionInfo"></param>
317 /// <param name="portadd_flag"></param> 351 /// <param name="portadd_flag"></param>
318 /// <returns></returns> 352 /// <returns></returns>
319 public IClientNetworkServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene) 353 public void CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene)
320 { 354 {
321 return CreateRegion(regionInfo, portadd_flag, false, out scene); 355 CreateRegion(regionInfo, portadd_flag, false, out scene);
322 } 356 }
323 357
324 /// <summary> 358 /// <summary>
@@ -326,9 +360,9 @@ namespace OpenSim
326 /// </summary> 360 /// </summary>
327 /// <param name="regionInfo"></param> 361 /// <param name="regionInfo"></param>
328 /// <returns></returns> 362 /// <returns></returns>
329 public IClientNetworkServer CreateRegion(RegionInfo regionInfo, out IScene scene) 363 public void CreateRegion(RegionInfo regionInfo, out IScene scene)
330 { 364 {
331 return CreateRegion(regionInfo, false, true, out scene); 365 CreateRegion(regionInfo, false, true, out scene);
332 } 366 }
333 367
334 /// <summary> 368 /// <summary>
@@ -338,7 +372,7 @@ namespace OpenSim
338 /// <param name="portadd_flag"></param> 372 /// <param name="portadd_flag"></param>
339 /// <param name="do_post_init"></param> 373 /// <param name="do_post_init"></param>
340 /// <returns></returns> 374 /// <returns></returns>
341 public IClientNetworkServer CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene) 375 public void CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene)
342 { 376 {
343 int port = regionInfo.InternalEndPoint.Port; 377 int port = regionInfo.InternalEndPoint.Port;
344 378
@@ -363,8 +397,7 @@ namespace OpenSim
363 Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); 397 Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName);
364 } 398 }
365 399
366 IClientNetworkServer clientServer; 400 Scene scene = SetupScene(regionInfo, proxyOffset, Config);
367 Scene scene = SetupScene(regionInfo, proxyOffset, Config, out clientServer);
368 401
369 m_log.Info("[MODULES]: Loading Region's modules (old style)"); 402 m_log.Info("[MODULES]: Loading Region's modules (old style)");
370 403
@@ -412,20 +445,20 @@ namespace OpenSim
412 445
413 SceneManager.Add(scene); 446 SceneManager.Add(scene);
414 447
415 if (m_autoCreateClientStack) 448 //if (m_autoCreateClientStack)
416 { 449 //{
417 m_clientServers.Add(clientServer); 450 // foreach (IClientNetworkServer clientserver in clientServers)
418 clientServer.Start(); 451 // {
419 } 452 // m_clientServers.Add(clientserver);
453 // clientserver.Start();
454 // }
455 //}
420 456
421 scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); }; 457 scene.EventManager.OnShutdown += delegate() { ShutdownRegion(scene); };
422 458
423 mscene = scene; 459 mscene = scene;
424 460
425 scene.Start(); 461 //return clientServers;
426 scene.StartScripts();
427
428 return clientServer;
429 } 462 }
430 463
431 /// <summary> 464 /// <summary>
@@ -533,7 +566,7 @@ namespace OpenSim
533 else 566 else
534 { 567 {
535 regionInfo.EstateSettings.EstateOwner = account.PrincipalID; 568 regionInfo.EstateSettings.EstateOwner = account.PrincipalID;
536 regionInfo.EstateSettings.Save(); 569 m_estateDataService.StoreEstateSettings(regionInfo.EstateSettings);
537 } 570 }
538 } 571 }
539 572
@@ -559,7 +592,7 @@ namespace OpenSim
559 592
560 scene.DeleteAllSceneObjects(); 593 scene.DeleteAllSceneObjects();
561 SceneManager.CloseScene(scene); 594 SceneManager.CloseScene(scene);
562 ShutdownClientServer(scene.RegionInfo); 595 //ShutdownClientServer(scene.RegionInfo);
563 596
564 if (!cleanup) 597 if (!cleanup)
565 return; 598 return;
@@ -620,7 +653,7 @@ namespace OpenSim
620 } 653 }
621 654
622 SceneManager.CloseScene(scene); 655 SceneManager.CloseScene(scene);
623 ShutdownClientServer(scene.RegionInfo); 656 //ShutdownClientServer(scene.RegionInfo);
624 } 657 }
625 658
626 /// <summary> 659 /// <summary>
@@ -641,9 +674,9 @@ namespace OpenSim
641 /// <param name="regionInfo"></param> 674 /// <param name="regionInfo"></param>
642 /// <param name="clientServer"> </param> 675 /// <param name="clientServer"> </param>
643 /// <returns></returns> 676 /// <returns></returns>
644 protected Scene SetupScene(RegionInfo regionInfo, out IClientNetworkServer clientServer) 677 protected Scene SetupScene(RegionInfo regionInfo)
645 { 678 {
646 return SetupScene(regionInfo, 0, null, out clientServer); 679 return SetupScene(regionInfo, 0, null);
647 } 680 }
648 681
649 /// <summary> 682 /// <summary>
@@ -654,176 +687,87 @@ namespace OpenSim
654 /// <param name="configSource"></param> 687 /// <param name="configSource"></param>
655 /// <param name="clientServer"> </param> 688 /// <param name="clientServer"> </param>
656 /// <returns></returns> 689 /// <returns></returns>
657 protected Scene SetupScene( 690 protected Scene SetupScene(RegionInfo regionInfo, int proxyOffset, IConfigSource configSource)
658 RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out IClientNetworkServer clientServer)
659 { 691 {
660 AgentCircuitManager circuitManager = new AgentCircuitManager(); 692 //List<IClientNetworkServer> clientNetworkServers = null;
661 IPAddress listenIP = regionInfo.InternalEndPoint.Address;
662 //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP))
663 // listenIP = IPAddress.Parse("0.0.0.0");
664
665 uint port = (uint) regionInfo.InternalEndPoint.Port;
666
667 if (m_autoCreateClientStack)
668 {
669 clientServer
670 = m_clientStackManager.CreateServer(
671 listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource,
672 circuitManager);
673 }
674 else
675 {
676 clientServer = null;
677 }
678
679 regionInfo.InternalEndPoint.Port = (int) port;
680 693
694 AgentCircuitManager circuitManager = new AgentCircuitManager();
681 Scene scene = CreateScene(regionInfo, m_simulationDataService, m_estateDataService, circuitManager); 695 Scene scene = CreateScene(regionInfo, m_simulationDataService, m_estateDataService, circuitManager);
682 696
683 if (m_autoCreateClientStack)
684 {
685 clientServer.AddScene(scene);
686 }
687
688 scene.LoadWorldMap(); 697 scene.LoadWorldMap();
689 698
690 scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName);
691 scene.PhysicsScene.RequestAssetMethod = scene.PhysicsRequestAsset;
692 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
693 scene.PhysicsScene.SetWaterLevel((float) regionInfo.RegionSettings.WaterHeight);
694
695 return scene; 699 return scene;
696 } 700 }
697 701
698 protected override ClientStackManager CreateClientStackManager()
699 {
700 return new ClientStackManager(m_configSettings.ClientstackDll);
701 }
702
703 protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, 702 protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService,
704 IEstateDataService estateDataService, AgentCircuitManager circuitManager) 703 IEstateDataService estateDataService, AgentCircuitManager circuitManager)
705 { 704 {
706 SceneCommunicationService sceneGridService = new SceneCommunicationService();
707
708 return new Scene( 705 return new Scene(
709 regionInfo, circuitManager, sceneGridService, 706 regionInfo, circuitManager,
710 simDataService, estateDataService, false, 707 simDataService, estateDataService,
711 Config, m_version); 708 Config, m_version);
712 } 709 }
713 710
714 protected void ShutdownClientServer(RegionInfo whichRegion)
715 {
716 // Close and remove the clientserver for a region
717 bool foundClientServer = false;
718 int clientServerElement = 0;
719 Location location = new Location(whichRegion.RegionHandle);
720
721 for (int i = 0; i < m_clientServers.Count; i++)
722 {
723 if (m_clientServers[i].HandlesRegion(location))
724 {
725 clientServerElement = i;
726 foundClientServer = true;
727 break;
728 }
729 }
730
731 if (foundClientServer)
732 {
733 m_clientServers[clientServerElement].NetworkStop();
734 m_clientServers.RemoveAt(clientServerElement);
735 }
736 }
737
738 protected virtual void HandleRestartRegion(RegionInfo whichRegion) 711 protected virtual void HandleRestartRegion(RegionInfo whichRegion)
739 { 712 {
740 m_log.InfoFormat( 713 m_log.InfoFormat(
741 "[OPENSIM]: Got restart signal from SceneManager for region {0} ({1},{2})", 714 "[OPENSIM]: Got restart signal from SceneManager for region {0} ({1},{2})",
742 whichRegion.RegionName, whichRegion.RegionLocX, whichRegion.RegionLocY); 715 whichRegion.RegionName, whichRegion.RegionLocX, whichRegion.RegionLocY);
743 716
744 ShutdownClientServer(whichRegion); 717 //ShutdownClientServer(whichRegion);
745 IScene scene; 718 IScene scene;
746 CreateRegion(whichRegion, true, out scene); 719 CreateRegion(whichRegion, true, out scene);
720 scene.Start();
747 } 721 }
748 722
749 # region Setup methods 723 # region Setup methods
750 724
751 protected override PhysicsScene GetPhysicsScene(string osSceneIdentifier)
752 {
753 return GetPhysicsScene(
754 m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, Config, osSceneIdentifier);
755 }
756
757 /// <summary> 725 /// <summary>
758 /// Handler to supply the current status of this sim 726 /// Handler to supply the current status of this sim
759 /// </summary> 727 /// </summary>
728 /// <remarks>
760 /// Currently this is always OK if the simulator is still listening for connections on its HTTP service 729 /// Currently this is always OK if the simulator is still listening for connections on its HTTP service
761 public class SimStatusHandler : IStreamedRequestHandler 730 /// </remarks>
731 public class SimStatusHandler : BaseStreamHandler
762 { 732 {
763 public byte[] Handle(string path, Stream request, 733 public SimStatusHandler() : base("GET", "/simstatus", "SimStatus", "Simulator Status") {}
734
735 protected override byte[] ProcessRequest(string path, Stream request,
764 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 736 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
765 { 737 {
766 return Util.UTF8.GetBytes("OK"); 738 return Util.UTF8.GetBytes("OK");
767 } 739 }
768 740
769 public string Name { get { return "SimStatus"; } } 741 public override string ContentType
770 public string Description { get { return "Simulator Status"; } }
771
772 public string ContentType
773 { 742 {
774 get { return "text/plain"; } 743 get { return "text/plain"; }
775 } 744 }
776
777 public string HttpMethod
778 {
779 get { return "GET"; }
780 }
781
782 public string Path
783 {
784 get { return "/simstatus"; }
785 }
786 } 745 }
787 746
788 /// <summary> 747 /// <summary>
789 /// Handler to supply the current extended status of this sim 748 /// Handler to supply the current extended status of this sim
790 /// Sends the statistical data in a json serialization 749 /// Sends the statistical data in a json serialization
791 /// </summary> 750 /// </summary>
792 public class XSimStatusHandler : IStreamedRequestHandler 751 public class XSimStatusHandler : BaseStreamHandler
793 { 752 {
794 OpenSimBase m_opensim; 753 OpenSimBase m_opensim;
795 string osXStatsURI = String.Empty;
796
797 public string Name { get { return "XSimStatus"; } }
798 public string Description { get { return "Simulator XStatus"; } }
799 754
800 public XSimStatusHandler(OpenSimBase sim) 755 public XSimStatusHandler(OpenSimBase sim)
756 : base("GET", "/" + Util.SHA1Hash(sim.osSecret), "XSimStatus", "Simulator XStatus")
801 { 757 {
802 m_opensim = sim; 758 m_opensim = sim;
803 osXStatsURI = Util.SHA1Hash(sim.osSecret);
804 } 759 }
805 760
806 public byte[] Handle(string path, Stream request, 761 protected override byte[] ProcessRequest(string path, Stream request,
807 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 762 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
808 { 763 {
809 return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest)); 764 return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest));
810 } 765 }
811 766
812 public string ContentType 767 public override string ContentType
813 { 768 {
814 get { return "text/plain"; } 769 get { return "text/plain"; }
815 } 770 }
816
817 public string HttpMethod
818 {
819 get { return "GET"; }
820 }
821
822 public string Path
823 {
824 // This is for the OpenSimulator instance and is the osSecret hashed
825 get { return "/" + osXStatsURI; }
826 }
827 } 771 }
828 772
829 /// <summary> 773 /// <summary>
@@ -832,42 +776,26 @@ namespace OpenSim
832 /// If the request contains a key, "callback" the response will be wrappend in the 776 /// If the request contains a key, "callback" the response will be wrappend in the
833 /// associated value for jsonp used with ajax/javascript 777 /// associated value for jsonp used with ajax/javascript
834 /// </summary> 778 /// </summary>
835 public class UXSimStatusHandler : IStreamedRequestHandler 779 protected class UXSimStatusHandler : BaseStreamHandler
836 { 780 {
837 OpenSimBase m_opensim; 781 OpenSimBase m_opensim;
838 string osUXStatsURI = String.Empty;
839
840 public string Name { get { return "UXSimStatus"; } }
841 public string Description { get { return "Simulator UXStatus"; } }
842 782
843 public UXSimStatusHandler(OpenSimBase sim) 783 public UXSimStatusHandler(OpenSimBase sim)
784 : base("GET", "/" + sim.userStatsURI, "UXSimStatus", "Simulator UXStatus")
844 { 785 {
845 m_opensim = sim; 786 m_opensim = sim;
846 osUXStatsURI = sim.userStatsURI;
847
848 } 787 }
849 788
850 public byte[] Handle(string path, Stream request, 789 protected override byte[] ProcessRequest(string path, Stream request,
851 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 790 IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
852 { 791 {
853 return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest)); 792 return Util.UTF8.GetBytes(m_opensim.StatReport(httpRequest));
854 } 793 }
855 794
856 public string ContentType 795 public override string ContentType
857 { 796 {
858 get { return "text/plain"; } 797 get { return "text/plain"; }
859 } 798 }
860
861 public string HttpMethod
862 {
863 get { return "GET"; }
864 }
865
866 public string Path
867 {
868 // This is for the OpenSimulator instance and is the user provided URI
869 get { return "/" + osUXStatsURI; }
870 }
871 } 799 }
872 800
873 #endregion 801 #endregion
@@ -875,7 +803,7 @@ namespace OpenSim
875 /// <summary> 803 /// <summary>
876 /// Performs any last-minute sanity checking and shuts down the region server 804 /// Performs any last-minute sanity checking and shuts down the region server
877 /// </summary> 805 /// </summary>
878 public override void ShutdownSpecific() 806 protected override void ShutdownSpecific()
879 { 807 {
880 if (proxyUrl.Length > 0) 808 if (proxyUrl.Length > 0)
881 { 809 {
@@ -890,11 +818,16 @@ namespace OpenSim
890 try 818 try
891 { 819 {
892 SceneManager.Close(); 820 SceneManager.Close();
821
822 foreach (IApplicationPlugin plugin in m_plugins)
823 plugin.Dispose();
893 } 824 }
894 catch (Exception e) 825 catch (Exception e)
895 { 826 {
896 m_log.Error("[SHUTDOWN]: Ignoring failure during shutdown - ", e); 827 m_log.Error("[SHUTDOWN]: Ignoring failure during shutdown - ", e);
897 } 828 }
829
830 base.ShutdownSpecific();
898 } 831 }
899 832
900 /// <summary> 833 /// <summary>
@@ -942,7 +875,7 @@ namespace OpenSim
942 regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, true); 875 regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, true);
943 876
944 string newName; 877 string newName;
945 if (estateName != null && estateName != "") 878 if (!string.IsNullOrEmpty(estateName))
946 newName = estateName; 879 newName = estateName;
947 else 880 else
948 newName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); 881 newName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName);
@@ -960,7 +893,7 @@ namespace OpenSim
960 // back to the default. The reloading of estate settings by scene could be eliminated if it 893 // back to the default. The reloading of estate settings by scene could be eliminated if it
961 // knows that the passed in settings in RegionInfo are already valid. Also, it might be 894 // knows that the passed in settings in RegionInfo are already valid. Also, it might be
962 // possible to eliminate some additional later saves made by callers of this method. 895 // possible to eliminate some additional later saves made by callers of this method.
963 regInfo.EstateSettings.Save(); 896 EstateDataService.StoreEstateSettings(regInfo.EstateSettings);
964 897
965 return true; 898 return true;
966 } 899 }
@@ -1082,4 +1015,4 @@ namespace OpenSim
1082 { 1015 {
1083 public IConfigSource Source; 1016 public IConfigSource Source;
1084 } 1017 }
1085} \ No newline at end of file 1018}