diff options
author | Justin Clarke Casey | 2008-02-04 18:52:24 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-02-04 18:52:24 +0000 |
commit | baefa05b575b28e1ed08670e9c937ca307f09269 (patch) | |
tree | 8f9703391fe86df4ecc1008a140e1ea760c1ae1b /OpenSim/Region/Application | |
parent | Change sim command from "stats" to "show stats" for consistency (diff) | |
download | opensim-SC_OLD-baefa05b575b28e1ed08670e9c937ca307f09269.zip opensim-SC_OLD-baefa05b575b28e1ed08670e9c937ca307f09269.tar.gz opensim-SC_OLD-baefa05b575b28e1ed08670e9c937ca307f09269.tar.bz2 opensim-SC_OLD-baefa05b575b28e1ed08670e9c937ca307f09269.tar.xz |
* Rebase all current servers on common abstract BaseOpenSimServer class
* The immediate upshot is that "show uptime" from the console will now show uptime on all server types (user, asset, grid, etc)
* DEV: This refactoring is far from complete - only just enough to makes the "show uptime" command common accross the servers. More is needed, but in this case it's somewhat like eating cabbage, which I prefer not to do all at once
Diffstat (limited to 'OpenSim/Region/Application')
-rw-r--r-- | OpenSim/Region/Application/OpenSimMain.cs | 149 |
1 files changed, 70 insertions, 79 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 0d182fe..ec7aa18 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -360,7 +360,7 @@ namespace OpenSim | |||
360 | m_moduleLoader = new ModuleLoader(m_log, m_config); | 360 | m_moduleLoader = new ModuleLoader(m_log, m_config); |
361 | 361 | ||
362 | ExtensionNodeList nodes = AddinManager.GetExtensionNodes("/OpenSim/Startup"); | 362 | ExtensionNodeList nodes = AddinManager.GetExtensionNodes("/OpenSim/Startup"); |
363 | MainLog.Instance.Verbose("PLUGINS", "Loading {0} OpenSim application plugins", nodes.Count); | 363 | m_log.Verbose("PLUGINS", "Loading {0} OpenSim application plugins", nodes.Count); |
364 | 364 | ||
365 | foreach (TypeExtensionNode node in nodes) | 365 | foreach (TypeExtensionNode node in nodes) |
366 | { | 366 | { |
@@ -383,7 +383,7 @@ namespace OpenSim | |||
383 | } | 383 | } |
384 | else | 384 | else |
385 | { | 385 | { |
386 | MainLog.Instance.Verbose("STARTUP", "No startup command script specified. Moving on..."); | 386 | m_log.Verbose("STARTUP", "No startup command script specified. Moving on..."); |
387 | } | 387 | } |
388 | 388 | ||
389 | // Start timer script (run a script every xx seconds) | 389 | // Start timer script (run a script every xx seconds) |
@@ -396,7 +396,7 @@ namespace OpenSim | |||
396 | } | 396 | } |
397 | 397 | ||
398 | // We are done with startup | 398 | // We are done with startup |
399 | MainLog.Instance.Status("STARTUP", | 399 | m_log.Status("STARTUP", |
400 | "Startup complete, serving " + m_udpServers.Count.ToString() + " region(s)"); | 400 | "Startup complete, serving " + m_udpServers.Count.ToString() + " region(s)"); |
401 | 401 | ||
402 | // When we return now we will be in a wait for input command loop. | 402 | // When we return now we will be in a wait for input command loop. |
@@ -448,23 +448,23 @@ namespace OpenSim | |||
448 | UDPServer udpServer; | 448 | UDPServer udpServer; |
449 | Scene scene = SetupScene(regionInfo, out udpServer, m_permissions); | 449 | Scene scene = SetupScene(regionInfo, out udpServer, m_permissions); |
450 | 450 | ||
451 | MainLog.Instance.Verbose("MODULES", "Loading Region's modules"); | 451 | m_log.Verbose("MODULES", "Loading Region's modules"); |
452 | 452 | ||
453 | m_moduleLoader.PickupModules(scene, "."); | 453 | m_moduleLoader.PickupModules(scene, "."); |
454 | //m_moduleLoader.PickupModules(scene, "ScriptEngines"); | 454 | //m_moduleLoader.PickupModules(scene, "ScriptEngines"); |
455 | //m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", m_scriptEngine), scene); | 455 | //m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", m_scriptEngine), scene); |
456 | MainLog.Instance.Verbose("MODULES", "Loading scripting engine modules"); | 456 | m_log.Verbose("MODULES", "Loading scripting engine modules"); |
457 | foreach (string module in m_scriptEngine.Split(',')) | 457 | foreach (string module in m_scriptEngine.Split(',')) |
458 | { | 458 | { |
459 | string mod = module.Trim(" \t".ToCharArray()); // Clean up name | 459 | string mod = module.Trim(" \t".ToCharArray()); // Clean up name |
460 | MainLog.Instance.Verbose("MODULES", "Loading scripting engine: " + mod); | 460 | m_log.Verbose("MODULES", "Loading scripting engine: " + mod); |
461 | try | 461 | try |
462 | { | 462 | { |
463 | m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", mod), scene); | 463 | m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", mod), scene); |
464 | } | 464 | } |
465 | catch (Exception ex) | 465 | catch (Exception ex) |
466 | { | 466 | { |
467 | MainLog.Instance.Error("MODULES", "Failed to load script engine: " + ex.ToString()); | 467 | m_log.Error("MODULES", "Failed to load script engine: " + ex.ToString()); |
468 | } | 468 | } |
469 | } | 469 | } |
470 | 470 | ||
@@ -503,7 +503,7 @@ namespace OpenSim | |||
503 | SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager); | 503 | SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager); |
504 | if (m_SendChildAgentTaskData) | 504 | if (m_SendChildAgentTaskData) |
505 | { | 505 | { |
506 | MainLog.Instance.Error("WARNING", | 506 | m_log.Error("WARNING", |
507 | "Send Child Agent Task Updates is enabled. This is for testing only."); | 507 | "Send Child Agent Task Updates is enabled. This is for testing only."); |
508 | //Thread.Sleep(12000); | 508 | //Thread.Sleep(12000); |
509 | } | 509 | } |
@@ -516,7 +516,7 @@ namespace OpenSim | |||
516 | 516 | ||
517 | public void handleRestartRegion(RegionInfo whichRegion) | 517 | public void handleRestartRegion(RegionInfo whichRegion) |
518 | { | 518 | { |
519 | MainLog.Instance.Error("MAIN", "Got restart signal from SceneManager"); | 519 | m_log.Error("MAIN", "Got restart signal from SceneManager"); |
520 | // Shutting down the UDP server | 520 | // Shutting down the UDP server |
521 | bool foundUDPServer = false; | 521 | bool foundUDPServer = false; |
522 | int UDPServerElement = 0; | 522 | int UDPServerElement = 0; |
@@ -637,7 +637,7 @@ namespace OpenSim | |||
637 | /// <param name="fileName"></param> | 637 | /// <param name="fileName"></param> |
638 | private void RunCommandScript(string fileName) | 638 | private void RunCommandScript(string fileName) |
639 | { | 639 | { |
640 | MainLog.Instance.Verbose("COMMANDFILE", "Running " + fileName); | 640 | m_log.Verbose("COMMANDFILE", "Running " + fileName); |
641 | if (File.Exists(fileName)) | 641 | if (File.Exists(fileName)) |
642 | { | 642 | { |
643 | StreamReader readFile = File.OpenText(fileName); | 643 | StreamReader readFile = File.OpenText(fileName); |
@@ -646,14 +646,14 @@ namespace OpenSim | |||
646 | { | 646 | { |
647 | if (currentCommand != String.Empty) | 647 | if (currentCommand != String.Empty) |
648 | { | 648 | { |
649 | MainLog.Instance.Verbose("COMMANDFILE", "Running '" + currentCommand + "'"); | 649 | m_log.Verbose("COMMANDFILE", "Running '" + currentCommand + "'"); |
650 | MainLog.Instance.MainLogRunCommand(currentCommand); | 650 | m_log.MainLogRunCommand(currentCommand); |
651 | } | 651 | } |
652 | } | 652 | } |
653 | } | 653 | } |
654 | else | 654 | else |
655 | { | 655 | { |
656 | MainLog.Instance.Error("COMMANDFILE", "Command script missing. Can not run commands"); | 656 | m_log.Error("COMMANDFILE", "Command script missing. Can not run commands"); |
657 | } | 657 | } |
658 | } | 658 | } |
659 | 659 | ||
@@ -662,10 +662,10 @@ namespace OpenSim | |||
662 | /// </summary> | 662 | /// </summary> |
663 | /// <param name="command">The first argument of the parameter (the command)</param> | 663 | /// <param name="command">The first argument of the parameter (the command)</param> |
664 | /// <param name="cmdparams">Additional arguments passed to the command</param> | 664 | /// <param name="cmdparams">Additional arguments passed to the command</param> |
665 | public void RunCmd(string command, string[] cmdparams) | 665 | public override void RunCmd(string command, string[] cmdparams) |
666 | { | 666 | { |
667 | string result = String.Empty; | 667 | base.RunCmd(command, cmdparams); |
668 | 668 | ||
669 | switch (command) | 669 | switch (command) |
670 | { | 670 | { |
671 | case "set-time": | 671 | case "set-time": |
@@ -692,44 +692,36 @@ namespace OpenSim | |||
692 | break; | 692 | break; |
693 | 693 | ||
694 | case "help": | 694 | case "help": |
695 | m_log.Error("alert - send alert to a designated user or all users."); | 695 | m_log.Notice("alert - send alert to a designated user or all users."); |
696 | m_log.Error(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive."); | 696 | m_log.Notice(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive."); |
697 | m_log.Error(" alert general [Message] - send an alert to all users."); | 697 | m_log.Notice(" alert general [Message] - send an alert to all users."); |
698 | m_log.Error("backup - trigger a simulator backup"); | 698 | m_log.Notice("backup - trigger a simulator backup"); |
699 | m_log.Error("create user - adds a new user"); | 699 | m_log.Notice("create user - adds a new user"); |
700 | m_log.Error("change-region [name] - sets the region that many of these commands affect."); | 700 | m_log.Notice("change-region [name] - sets the region that many of these commands affect."); |
701 | m_log.Error("command-script [filename] - Execute command in a file."); | 701 | m_log.Notice("command-script [filename] - Execute command in a file."); |
702 | m_log.Error("debug - debugging commands"); | 702 | m_log.Notice("debug - debugging commands"); |
703 | m_log.Error(" packet 0..255 - print incoming/outgoing packets (0=off)"); | 703 | m_log.Notice(" packet 0..255 - print incoming/outgoing packets (0=off)"); |
704 | m_log.Error("edit-scale [prim name] [x] [y] [z] - resize given prim"); | 704 | m_log.Notice("edit-scale [prim name] [x] [y] [z] - resize given prim"); |
705 | m_log.Error("export-map [filename] - save image of world map"); | 705 | m_log.Notice("export-map [filename] - save image of world map"); |
706 | m_log.Error("force-update - force an update of prims in the scene"); | 706 | m_log.Notice("force-update - force an update of prims in the scene"); |
707 | m_log.Error("load-xml [filename] - load prims from XML"); | 707 | m_log.Notice("load-xml [filename] - load prims from XML"); |
708 | m_log.Error("load-xml2 [filename] - load prims from XML using version 2 format"); | 708 | m_log.Notice("load-xml2 [filename] - load prims from XML using version 2 format"); |
709 | m_log.Error("permissions [true/false] - turn on/off permissions on the scene"); | 709 | m_log.Notice("permissions [true/false] - turn on/off permissions on the scene"); |
710 | m_log.Error("quit - equivalent to shutdown."); | 710 | m_log.Notice("quit - equivalent to shutdown."); |
711 | m_log.Error("restart - disconnects all clients and restarts the sims in the instance."); | 711 | m_log.Notice("restart - disconnects all clients and restarts the sims in the instance."); |
712 | m_log.Error("remove-region [name] - remove a region"); | 712 | m_log.Notice("remove-region [name] - remove a region"); |
713 | m_log.Error("save-xml [filename] - save prims to XML"); | 713 | m_log.Notice("save-xml [filename] - save prims to XML"); |
714 | m_log.Error("save-xml2 [filename] - save prims to XML using version 2 format"); | 714 | m_log.Notice("save-xml2 [filename] - save prims to XML using version 2 format"); |
715 | m_log.Error("script - manually trigger scripts? or script commands?"); | 715 | m_log.Notice("script - manually trigger scripts? or script commands?"); |
716 | m_log.Error("set-time [x] - set the current scene time phase"); | 716 | m_log.Notice("set-time [x] - set the current scene time phase"); |
717 | m_log.Error("show uptime - show simulator startup and uptime."); | 717 | m_log.Notice("show users - show info about connected users."); |
718 | m_log.Error("show users - show info about connected users."); | 718 | m_log.Notice("show modules - shows info aboutloaded modules."); |
719 | m_log.Error("show modules - shows info aboutloaded modules."); | 719 | m_log.Notice("show stats - statistical information for this server not displayed in the client"); |
720 | m_log.Error("show stats - statistical information for this server not displayed in the client"); | 720 | m_log.Notice("shutdown - disconnect all clients and shutdown."); |
721 | m_log.Error("shutdown - disconnect all clients and shutdown."); | 721 | m_log.Notice("config set section field value - set a config value"); |
722 | m_log.Error("config set section field value - set a config value"); | 722 | m_log.Notice("config get section field - get a config value"); |
723 | m_log.Error("config get section field - get a config value"); | 723 | m_log.Notice("config save - save OpenSim.ini"); |
724 | m_log.Error("config save - save OpenSim.ini"); | 724 | m_log.Notice("terrain help - show help for terrain commands."); |
725 | m_log.Error("terrain help - show help for terrain commands."); | ||
726 | break; | ||
727 | |||
728 | case "show": | ||
729 | if (cmdparams.Length > 0) | ||
730 | { | ||
731 | Show(cmdparams[0]); | ||
732 | } | ||
733 | break; | 725 | break; |
734 | 726 | ||
735 | case "save-xml": | 727 | case "save-xml": |
@@ -800,6 +792,8 @@ namespace OpenSim | |||
800 | break; | 792 | break; |
801 | 793 | ||
802 | case "terrain": | 794 | case "terrain": |
795 | string result = String.Empty; | ||
796 | |||
803 | if (!m_sceneManager.RunTerrainCmdOnCurrentScene(cmdparams, ref result)) | 797 | if (!m_sceneManager.RunTerrainCmdOnCurrentScene(cmdparams, ref result)) |
804 | { | 798 | { |
805 | m_log.Error(result); | 799 | m_log.Error(result); |
@@ -873,20 +867,20 @@ namespace OpenSim | |||
873 | 867 | ||
874 | if (!m_sceneManager.TrySetCurrentScene(regionName)) | 868 | if (!m_sceneManager.TrySetCurrentScene(regionName)) |
875 | { | 869 | { |
876 | MainLog.Instance.Error("Couldn't set current region to: " + regionName); | 870 | m_log.Error("Couldn't set current region to: " + regionName); |
877 | } | 871 | } |
878 | } | 872 | } |
879 | 873 | ||
880 | if (m_sceneManager.CurrentScene == null) | 874 | if (m_sceneManager.CurrentScene == null) |
881 | { | 875 | { |
882 | MainLog.Instance.Verbose("CONSOLE", | 876 | m_log.Notice("CONSOLE", |
883 | "Currently at Root level. To change region please use 'change-region <regioname>'"); | 877 | "Currently at Root level. To change region please use 'change-region <regioname>'"); |
884 | } | 878 | } |
885 | else | 879 | else |
886 | { | 880 | { |
887 | MainLog.Instance.Verbose("CONSOLE", | 881 | m_log.Notice("CONSOLE", |
888 | "Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName + | 882 | "Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName + |
889 | ". To change region please use 'change-region <regioname>'"); | 883 | ". To change region please use 'change-region <regioname>'"); |
890 | } | 884 | } |
891 | 885 | ||
892 | break; | 886 | break; |
@@ -911,8 +905,8 @@ namespace OpenSim | |||
911 | case "set": | 905 | case "set": |
912 | if (cmdparams.Length < 4) | 906 | if (cmdparams.Length < 4) |
913 | { | 907 | { |
914 | MainLog.Instance.Notice(n, "SYNTAX: " + n + " SET SECTION KEY VALUE"); | 908 | m_log.Notice(n, "SYNTAX: " + n + " SET SECTION KEY VALUE"); |
915 | MainLog.Instance.Notice(n, "EXAMPLE: " + n + " SET ScriptEngine.DotNetEngine NumberOfScriptThreads 5"); | 909 | m_log.Notice(n, "EXAMPLE: " + n + " SET ScriptEngine.DotNetEngine NumberOfScriptThreads 5"); |
916 | } | 910 | } |
917 | else | 911 | else |
918 | { | 912 | { |
@@ -923,7 +917,7 @@ namespace OpenSim | |||
923 | c.Set(cmdparams[2], _value); | 917 | c.Set(cmdparams[2], _value); |
924 | m_config.Merge(c.ConfigSource); | 918 | m_config.Merge(c.ConfigSource); |
925 | 919 | ||
926 | MainLog.Instance.Notice(n, | 920 | m_log.Notice(n, |
927 | n + " " + n + " " + cmdparams[1] + " " + cmdparams[2] + " " + | 921 | n + " " + n + " " + cmdparams[1] + " " + cmdparams[2] + " " + |
928 | _value); | 922 | _value); |
929 | } | 923 | } |
@@ -931,20 +925,20 @@ namespace OpenSim | |||
931 | case "get": | 925 | case "get": |
932 | if (cmdparams.Length < 3) | 926 | if (cmdparams.Length < 3) |
933 | { | 927 | { |
934 | MainLog.Instance.Notice(n, "SYNTAX: " + n + " GET SECTION KEY"); | 928 | m_log.Notice(n, "SYNTAX: " + n + " GET SECTION KEY"); |
935 | MainLog.Instance.Notice(n, "EXAMPLE: " + n + " GET ScriptEngine.DotNetEngine NumberOfScriptThreads"); | 929 | m_log.Notice(n, "EXAMPLE: " + n + " GET ScriptEngine.DotNetEngine NumberOfScriptThreads"); |
936 | } | 930 | } |
937 | else | 931 | else |
938 | { | 932 | { |
939 | IConfig c = DefaultConfig().Configs[cmdparams[1]]; | 933 | IConfig c = DefaultConfig().Configs[cmdparams[1]]; |
940 | if (c == null) | 934 | if (c == null) |
941 | { | 935 | { |
942 | MainLog.Instance.Notice(n, "Section \"" + cmdparams[1] + "\" does not exist."); | 936 | m_log.Notice(n, "Section \"" + cmdparams[1] + "\" does not exist."); |
943 | break; | 937 | break; |
944 | } | 938 | } |
945 | else | 939 | else |
946 | { | 940 | { |
947 | MainLog.Instance.Notice(n, | 941 | m_log.Notice(n, |
948 | n + " GET " + cmdparams[1] + " " + cmdparams[2] + ": " + | 942 | n + " GET " + cmdparams[1] + " " + cmdparams[2] + ": " + |
949 | c.GetString(cmdparams[2])); | 943 | c.GetString(cmdparams[2])); |
950 | } | 944 | } |
@@ -952,18 +946,20 @@ namespace OpenSim | |||
952 | 946 | ||
953 | break; | 947 | break; |
954 | case "save": | 948 | case "save": |
955 | MainLog.Instance.Notice(n, "Saving configuration file: " + Application.iniFilePath); | 949 | m_log.Notice(n, "Saving configuration file: " + Application.iniFilePath); |
956 | m_config.Save(Application.iniFilePath); | 950 | m_config.Save(Application.iniFilePath); |
957 | break; | 951 | break; |
958 | } | 952 | } |
959 | } | 953 | } |
960 | else | ||
961 | { | ||
962 | } | ||
963 | break; | 954 | break; |
955 | |||
956 | /* | ||
957 | * Temporarily disabled but it would be good to have this - needs to be levered | ||
958 | * in to BaseOpenSimServer (which requires a RunCmd method restrcuture probably) | ||
964 | default: | 959 | default: |
965 | m_log.Error("Unknown command"); | 960 | m_log.Error("Unknown command"); |
966 | break; | 961 | break; |
962 | */ | ||
967 | } | 963 | } |
968 | } | 964 | } |
969 | 965 | ||
@@ -993,18 +989,13 @@ namespace OpenSim | |||
993 | } | 989 | } |
994 | } | 990 | } |
995 | 991 | ||
996 | /// <summary> | 992 | // see BaseOpenSimServer |
997 | /// Outputs to the console information about the region | ||
998 | /// </summary> | ||
999 | /// <param name="ShowWhat">What information to display (valid arguments are "uptime", "users")</param> | ||
1000 | public void Show(string ShowWhat) | 993 | public void Show(string ShowWhat) |
1001 | { | 994 | { |
995 | base.Show(ShowWhat); | ||
996 | |||
1002 | switch (ShowWhat) | 997 | switch (ShowWhat) |
1003 | { | 998 | { |
1004 | case "uptime": | ||
1005 | m_log.Error("OpenSim has been running since " + m_startuptime.ToString()); | ||
1006 | m_log.Error("That is " + (DateTime.Now - m_startuptime).ToString()); | ||
1007 | break; | ||
1008 | case "users": | 999 | case "users": |
1009 | m_log.Error( | 1000 | m_log.Error( |
1010 | String.Format("{0,-16}{1,-16}{2,-37}{3,-16}{4,-22}{5,-16}", "Firstname", "Lastname", | 1001 | String.Format("{0,-16}{1,-16}{2,-37}{3,-16}{4,-22}{5,-16}", "Firstname", "Lastname", |