From baefa05b575b28e1ed08670e9c937ca307f09269 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 4 Feb 2008 18:52:24 +0000 Subject: * 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 --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 47 ++++++- OpenSim/Grid/AssetServer/Main.cs | 44 +++--- OpenSim/Grid/GridServer/Main.cs | 34 +++-- OpenSim/Grid/InventoryServer/Main.cs | 23 ++-- OpenSim/Grid/MessagingServer/Main.cs | 27 ++-- OpenSim/Grid/ScriptServer/ScriptServerMain.cs | 14 +- OpenSim/Grid/UserServer/Main.cs | 43 +++--- OpenSim/Region/Application/OpenSimMain.cs | 149 ++++++++++----------- .../Region/ClientStack/RegionApplicationBase.cs | 9 +- 9 files changed, 201 insertions(+), 189 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index d04dbd7..3016715 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -28,16 +28,59 @@ using System; +using OpenSim.Framework.Console; + namespace OpenSim.Framework.Servers { /// /// Common base for the main OpenSimServers (user, grid, inventory, region, etc) - /// XXX Not yet implemented, may not grow up for some time /// - public class BaseOpenSimServer + public abstract class BaseOpenSimServer { + protected LogBase m_log; + + protected DateTime m_startuptime; + public BaseOpenSimServer() { + m_startuptime = DateTime.Now; + } + + /// + /// Runs commands issued by the server console from the operator + /// + /// The first argument of the parameter (the command) + /// Additional arguments passed to the command + public virtual void RunCmd(string command, string[] cmdparams) + { + switch (command) + { + case "help": + m_log.Notice("show uptime - show server startup and uptime."); + break; + + case "show": + if (cmdparams.Length > 0) + { + Show(cmdparams[0]); + } + break; + } + } + + /// + /// Outputs to the console information about the region + /// + /// What information to display (valid arguments are "uptime", "users") + public virtual void Show(string ShowWhat) + { + switch (ShowWhat) + { + case "uptime": + m_log.Notice("Server has been running since " + m_startuptime.ToString()); + m_log.Notice("That is " + (DateTime.Now - m_startuptime).ToString()); + break; + } } } } diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs index 23b0afa..a95ea71 100644 --- a/OpenSim/Grid/AssetServer/Main.cs +++ b/OpenSim/Grid/AssetServer/Main.cs @@ -41,13 +41,11 @@ namespace OpenSim.Grid.AssetServer /// /// An asset server /// - public class OpenAsset_Main : conscmd_callback + public class OpenAsset_Main : BaseOpenSimServer, conscmd_callback { public AssetConfig m_config; - public static OpenAsset_Main assetserver; - - private LogBase m_console; + public static OpenAsset_Main assetserver; // Temporarily hardcoded - should be a plugin protected IAssetLoader assetLoader = new AssetLoaderFileSystem(); @@ -67,11 +65,11 @@ namespace OpenSim.Grid.AssetServer private void Work() { - m_console.Notice("Enter help for a list of commands"); + m_log.Notice("Enter help for a list of commands"); while (true) { - m_console.MainLogPrompt(); + m_log.MainLogPrompt(); } } @@ -81,22 +79,28 @@ namespace OpenSim.Grid.AssetServer { Directory.CreateDirectory(Util.logDir()); } - m_console = - new LogBase((Path.Combine(Util.logDir(), "opengrid-AssetServer-console.log")), "OpenAsset", this, true); - MainLog.Instance = m_console; + + m_log = + new LogBase( + (Path.Combine(Util.logDir(), "opengrid-AssetServer-console.log")), + "OpenAsset", + this, + true); + + MainLog.Instance = m_log; } public void Startup() { m_config = new AssetConfig("ASSET SERVER", (Path.Combine(Util.configDir(), "AssetServer_Config.xml"))); - m_console.Verbose("ASSET", "Setting up asset DB"); + m_log.Verbose("ASSET", "Setting up asset DB"); setupDB(m_config); - m_console.Verbose("ASSET", "Loading default asset set.."); + m_log.Verbose("ASSET", "Loading default asset set.."); LoadDefaultAssets(); - m_console.Verbose("ASSET", "Starting HTTP process"); + m_log.Verbose("ASSET", "Starting HTTP process"); BaseHttpServer httpServer = new BaseHttpServer(m_config.HttpPort); StatsManager.StartCollectingAssetStats(); @@ -170,30 +174,28 @@ namespace OpenSim.Grid.AssetServer m_assetProvider.CreateAsset(asset); } - public void RunCmd(string cmd, string[] cmdparams) + public override void RunCmd(string cmd, string[] cmdparams) { + base.RunCmd(cmd, cmdparams); + switch (cmd) { case "help": - m_console.Notice( + m_log.Notice( @"shutdown - shutdown this asset server (USE CAUTION!) stats - statistical information for this server"); - break; + break; case "stats": - m_console.Notice("STATS", Environment.NewLine + StatsManager.AssetStats.Report()); + m_log.Notice("STATS", Environment.NewLine + StatsManager.AssetStats.Report()); break; case "shutdown": - m_console.Close(); + m_log.Close(); Environment.Exit(0); break; } } - - public void Show(string ShowWhat) - { - } } } diff --git a/OpenSim/Grid/GridServer/Main.cs b/OpenSim/Grid/GridServer/Main.cs index d4947b3..8a522c2 100644 --- a/OpenSim/Grid/GridServer/Main.cs +++ b/OpenSim/Grid/GridServer/Main.cs @@ -37,7 +37,7 @@ namespace OpenSim.Grid.GridServer { /// /// - public class OpenGrid_Main : conscmd_callback + public class OpenGrid_Main : BaseOpenSimServer, conscmd_callback { public GridConfig Cfg; @@ -51,8 +51,6 @@ namespace OpenSim.Grid.GridServer private GridManager m_gridManager; - private LogBase m_console; - [STAThread] public static void Main(string[] args) { @@ -70,11 +68,11 @@ namespace OpenSim.Grid.GridServer private void Work() { - m_console.Notice("Enter help for a list of commands\n"); + m_log.Notice("Enter help for a list of commands\n"); while (true) { - m_console.MainLogPrompt(); + m_log.MainLogPrompt(); } } @@ -84,9 +82,9 @@ namespace OpenSim.Grid.GridServer { Directory.CreateDirectory(Util.logDir()); } - m_console = + m_log = new LogBase((Path.Combine(Util.logDir(), "opengrid-gridserver-console.log")), "OpenGrid", this, true); - MainLog.Instance = m_console; + MainLog.Instance = m_log; } public void managercallback(string cmd) @@ -106,12 +104,12 @@ namespace OpenSim.Grid.GridServer //Yeah srsly, that's it. if (setuponly) Environment.Exit(0); - m_console.Verbose("GRID", "Connecting to Storage Server"); + m_log.Verbose("GRID", "Connecting to Storage Server"); m_gridManager = new GridManager(); m_gridManager.AddPlugin(Cfg.DatabaseProvider); // Made of win m_gridManager.config = Cfg; - m_console.Verbose("GRID", "Starting HTTP process"); + m_log.Verbose("GRID", "Starting HTTP process"); BaseHttpServer httpServer = new BaseHttpServer(Cfg.HttpPort); //GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback); @@ -137,7 +135,7 @@ namespace OpenSim.Grid.GridServer httpServer.Start(); - m_console.Verbose("GRID", "Starting sim status checker"); + m_log.Verbose("GRID", "Starting sim status checker"); Timer simCheckTimer = new Timer(3600000*3); // 3 Hours between updates. simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); @@ -181,25 +179,23 @@ namespace OpenSim.Grid.GridServer */ } - public void RunCmd(string cmd, string[] cmdparams) + public override void RunCmd(string cmd, string[] cmdparams) { + base.RunCmd(cmd, cmdparams); + switch (cmd) { case "help": - m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); - break; + m_log.Notice("shutdown - shutdown the grid (USE CAUTION!)"); + break; case "shutdown": - m_console.Close(); + m_log.Close(); Environment.Exit(0); break; } } - public void Show(string ShowWhat) - { - } - /*private void ConfigDB(IGenericConfig configData) { try @@ -223,4 +219,4 @@ namespace OpenSim.Grid.GridServer } }*/ } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs index ce371bf..b62c696 100644 --- a/OpenSim/Grid/InventoryServer/Main.cs +++ b/OpenSim/Grid/InventoryServer/Main.cs @@ -36,9 +36,8 @@ using OpenSim.Framework.Servers; namespace OpenSim.Grid.InventoryServer { - public class OpenInventory_Main : conscmd_callback + public class OpenInventory_Main : BaseOpenSimServer, conscmd_callback { - private LogBase m_console; private InventoryManager m_inventoryManager; private InventoryConfig m_config; private GridInventoryService m_inventoryService; @@ -56,8 +55,8 @@ namespace OpenSim.Grid.InventoryServer public OpenInventory_Main() { - m_console = new LogBase("opengrid-inventory-console.log", LogName, this, true); - MainLog.Instance = m_console; + m_log = new LogBase("opengrid-inventory-console.log", LogName, this, true); + MainLog.Instance = m_log; } public void Startup() @@ -104,16 +103,18 @@ namespace OpenSim.Grid.InventoryServer private void Work() { - m_console.Notice("Enter help for a list of commands\n"); + m_log.Notice("Enter help for a list of commands\n"); while (true) { - m_console.MainLogPrompt(); + m_log.MainLogPrompt(); } } - public void RunCmd(string cmd, string[] cmdparams) + public override void RunCmd(string cmd, string[] cmdparams) { + base.RunCmd(cmd, cmdparams); + switch (cmd) { case "quit": @@ -121,14 +122,10 @@ namespace OpenSim.Grid.InventoryServer m_inventoryService.CreateUsersInventory(LLUUID.Random().UUID); break; case "shutdown": - m_console.Close(); + m_log.Close(); Environment.Exit(0); break; } } - - public void Show(string ShowWhat) - { - } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs index a7c3a2a..3d5ceb4 100644 --- a/OpenSim/Grid/MessagingServer/Main.cs +++ b/OpenSim/Grid/MessagingServer/Main.cs @@ -39,14 +39,13 @@ namespace OpenSim.Grid.MessagingServer { /// /// - public class OpenMessage_Main : conscmd_callback + public class OpenMessage_Main : BaseOpenSimServer, conscmd_callback { private MessageServerConfig Cfg; //public UserManager m_userManager; //public UserLoginService m_loginService; - - private LogBase m_console; + private LLUUID m_lastCreatedUser = LLUUID.Random(); [STAThread] @@ -66,18 +65,18 @@ namespace OpenSim.Grid.MessagingServer { Directory.CreateDirectory(Util.logDir()); } - m_console = + m_log = new LogBase((Path.Combine(Util.logDir(), "opengrid-messagingserver-console.log")), "OpenMessage", this, true); - MainLog.Instance = m_console; + MainLog.Instance = m_log; } private void Work() { - m_console.Notice("Enter help for a list of commands\n"); + m_log.Notice("Enter help for a list of commands\n"); while (true) { - m_console.MainLogPrompt(); + m_log.MainLogPrompt(); } } @@ -105,7 +104,7 @@ namespace OpenSim.Grid.MessagingServer //new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod)); httpServer.Start(); - m_console.Status("SERVER", "Messageserver 0.4 - Startup complete"); + m_log.Status("SERVER", "Messageserver 0.4 - Startup complete"); } @@ -121,7 +120,7 @@ namespace OpenSim.Grid.MessagingServer //m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); } catch (Exception ex) { - m_console.Error("SERVER", "Error creating user: {0}", ex.ToString()); + m_log.Error("SERVER", "Error creating user: {0}", ex.ToString()); } try @@ -131,23 +130,25 @@ namespace OpenSim.Grid.MessagingServer } catch (Exception ex) { - m_console.Error("SERVER", "Error creating inventory for user: {0}", ex.ToString()); + m_log.Error("SERVER", "Error creating inventory for user: {0}", ex.ToString()); } // m_lastCreatedUser = userID; break; } } - public void RunCmd(string cmd, string[] cmdparams) + public override void RunCmd(string cmd, string[] cmdparams) { + base.RunCmd(cmd, cmdparams); + switch (cmd) { case "help": - m_console.Notice("shutdown - shutdown the message server (USE CAUTION!)"); + m_log.Notice("shutdown - shutdown the message server (USE CAUTION!)"); break; case "shutdown": - m_console.Close(); + m_log.Close(); Environment.Exit(0); break; } diff --git a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs index 5757be4..421467d 100644 --- a/OpenSim/Grid/ScriptServer/ScriptServerMain.cs +++ b/OpenSim/Grid/ScriptServer/ScriptServerMain.cs @@ -31,20 +31,20 @@ using libsecondlife; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Console; +using OpenSim.Framework.Servers; using OpenSim.Grid.ScriptServer.ScriptServer; using OpenSim.Region.ScriptEngine.Common; using OpenSim.Region.ScriptEngine.Common.TRPC; namespace OpenSim.Grid.ScriptServer { - public class ScriptServerMain : conscmd_callback + public class ScriptServerMain : BaseOpenSimServer, conscmd_callback { // // Root object. Creates objects used. // private int listenPort = 8010; private readonly string m_logFilename = ("scriptserver.log"); - private LogBase m_log; // TEMP public static ScriptServerInterfaces.ScriptEngine Engine; @@ -111,13 +111,5 @@ namespace OpenSim.Grid.ScriptServer return new LogBase((Path.Combine(Util.logDir(), m_logFilename)), "ScriptServer", this, true); } - - public void RunCmd(string command, string[] cmdparams) - { - } - - public void Show(string ShowWhat) - { - } } -} \ No newline at end of file +} diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 20828ba..32cefc1 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -40,7 +40,7 @@ namespace OpenSim.Grid.UserServer { /// /// - public class OpenUser_Main : conscmd_callback + public class OpenUser_Main : BaseOpenSimServer, conscmd_callback { private UserConfig Cfg; @@ -48,7 +48,6 @@ namespace OpenSim.Grid.UserServer public UserLoginService m_loginService; public MessageServersConnector m_messagesService; - private LogBase m_console; private LLUUID m_lastCreatedUser = LLUUID.Random(); [STAThread] @@ -68,18 +67,18 @@ namespace OpenSim.Grid.UserServer { Directory.CreateDirectory(Util.logDir()); } - m_console = + m_log = new LogBase((Path.Combine(Util.logDir(), "opengrid-userserver-console.log")), "OpenUser", this, true); - MainLog.Instance = m_console; + MainLog.Instance = m_log; } private void Work() { - m_console.Notice("Enter help for a list of commands\n"); + m_log.Notice("Enter help for a list of commands\n"); while (true) { - m_console.MainLogPrompt(); + m_log.MainLogPrompt(); } } @@ -129,7 +128,7 @@ namespace OpenSim.Grid.UserServer new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod)); httpServer.Start(); - m_console.Status("SERVER", "Userserver 0.4 - Startup complete"); + m_log.Status("SERVER", "Userserver 0.4 - Startup complete"); } @@ -144,11 +143,11 @@ namespace OpenSim.Grid.UserServer uint regX = 1000; uint regY = 1000; - tempfirstname = m_console.CmdPrompt("First name"); - templastname = m_console.CmdPrompt("Last name"); - tempMD5Passwd = m_console.PasswdPrompt("Password"); - regX = Convert.ToUInt32(m_console.CmdPrompt("Start Region X")); - regY = Convert.ToUInt32(m_console.CmdPrompt("Start Region Y")); + tempfirstname = m_log.CmdPrompt("First name"); + templastname = m_log.CmdPrompt("Last name"); + tempMD5Passwd = m_log.PasswdPrompt("Password"); + regX = Convert.ToUInt32(m_log.CmdPrompt("Start Region X")); + regY = Convert.ToUInt32(m_log.CmdPrompt("Start Region Y")); tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + String.Empty); @@ -159,7 +158,7 @@ namespace OpenSim.Grid.UserServer m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); } catch (Exception ex) { - m_console.Error("SERVER", "Error creating user: {0}", ex.ToString()); + m_log.Error("SERVER", "Error creating user: {0}", ex.ToString()); } try @@ -169,21 +168,23 @@ namespace OpenSim.Grid.UserServer } catch (Exception ex) { - m_console.Error("SERVER", "Error creating inventory for user: {0}", ex.ToString()); + m_log.Error("SERVER", "Error creating inventory for user: {0}", ex.ToString()); } m_lastCreatedUser = userID; break; } } - public void RunCmd(string cmd, string[] cmdparams) + public override void RunCmd(string cmd, string[] cmdparams) { + base.RunCmd(cmd, cmdparams); + switch (cmd) { case "help": - m_console.Notice("create user - create a new user"); - m_console.Notice("stats - statistical information for this server"); - m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); + m_log.Notice("create user - create a new user"); + m_log.Notice("stats - statistical information for this server"); + m_log.Notice("shutdown - shutdown the grid (USE CAUTION!)"); break; case "create": @@ -192,7 +193,7 @@ namespace OpenSim.Grid.UserServer case "shutdown": m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation; - m_console.Close(); + m_log.Close(); Environment.Exit(0); break; @@ -246,9 +247,5 @@ namespace OpenSim.Grid.UserServer } }*/ - - public void Show(string ShowWhat) - { - } } } 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 m_moduleLoader = new ModuleLoader(m_log, m_config); ExtensionNodeList nodes = AddinManager.GetExtensionNodes("/OpenSim/Startup"); - MainLog.Instance.Verbose("PLUGINS", "Loading {0} OpenSim application plugins", nodes.Count); + m_log.Verbose("PLUGINS", "Loading {0} OpenSim application plugins", nodes.Count); foreach (TypeExtensionNode node in nodes) { @@ -383,7 +383,7 @@ namespace OpenSim } else { - MainLog.Instance.Verbose("STARTUP", "No startup command script specified. Moving on..."); + m_log.Verbose("STARTUP", "No startup command script specified. Moving on..."); } // Start timer script (run a script every xx seconds) @@ -396,7 +396,7 @@ namespace OpenSim } // We are done with startup - MainLog.Instance.Status("STARTUP", + m_log.Status("STARTUP", "Startup complete, serving " + m_udpServers.Count.ToString() + " region(s)"); // When we return now we will be in a wait for input command loop. @@ -448,23 +448,23 @@ namespace OpenSim UDPServer udpServer; Scene scene = SetupScene(regionInfo, out udpServer, m_permissions); - MainLog.Instance.Verbose("MODULES", "Loading Region's modules"); + m_log.Verbose("MODULES", "Loading Region's modules"); m_moduleLoader.PickupModules(scene, "."); //m_moduleLoader.PickupModules(scene, "ScriptEngines"); //m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", m_scriptEngine), scene); - MainLog.Instance.Verbose("MODULES", "Loading scripting engine modules"); + m_log.Verbose("MODULES", "Loading scripting engine modules"); foreach (string module in m_scriptEngine.Split(',')) { string mod = module.Trim(" \t".ToCharArray()); // Clean up name - MainLog.Instance.Verbose("MODULES", "Loading scripting engine: " + mod); + m_log.Verbose("MODULES", "Loading scripting engine: " + mod); try { m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", mod), scene); } catch (Exception ex) { - MainLog.Instance.Error("MODULES", "Failed to load script engine: " + ex.ToString()); + m_log.Error("MODULES", "Failed to load script engine: " + ex.ToString()); } } @@ -503,7 +503,7 @@ namespace OpenSim SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager); if (m_SendChildAgentTaskData) { - MainLog.Instance.Error("WARNING", + m_log.Error("WARNING", "Send Child Agent Task Updates is enabled. This is for testing only."); //Thread.Sleep(12000); } @@ -516,7 +516,7 @@ namespace OpenSim public void handleRestartRegion(RegionInfo whichRegion) { - MainLog.Instance.Error("MAIN", "Got restart signal from SceneManager"); + m_log.Error("MAIN", "Got restart signal from SceneManager"); // Shutting down the UDP server bool foundUDPServer = false; int UDPServerElement = 0; @@ -637,7 +637,7 @@ namespace OpenSim /// private void RunCommandScript(string fileName) { - MainLog.Instance.Verbose("COMMANDFILE", "Running " + fileName); + m_log.Verbose("COMMANDFILE", "Running " + fileName); if (File.Exists(fileName)) { StreamReader readFile = File.OpenText(fileName); @@ -646,14 +646,14 @@ namespace OpenSim { if (currentCommand != String.Empty) { - MainLog.Instance.Verbose("COMMANDFILE", "Running '" + currentCommand + "'"); - MainLog.Instance.MainLogRunCommand(currentCommand); + m_log.Verbose("COMMANDFILE", "Running '" + currentCommand + "'"); + m_log.MainLogRunCommand(currentCommand); } } } else { - MainLog.Instance.Error("COMMANDFILE", "Command script missing. Can not run commands"); + m_log.Error("COMMANDFILE", "Command script missing. Can not run commands"); } } @@ -662,10 +662,10 @@ namespace OpenSim /// /// The first argument of the parameter (the command) /// Additional arguments passed to the command - public void RunCmd(string command, string[] cmdparams) + public override void RunCmd(string command, string[] cmdparams) { - string result = String.Empty; - + base.RunCmd(command, cmdparams); + switch (command) { case "set-time": @@ -692,44 +692,36 @@ namespace OpenSim break; case "help": - m_log.Error("alert - send alert to a designated user or all users."); - m_log.Error(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive."); - m_log.Error(" alert general [Message] - send an alert to all users."); - m_log.Error("backup - trigger a simulator backup"); - m_log.Error("create user - adds a new user"); - m_log.Error("change-region [name] - sets the region that many of these commands affect."); - m_log.Error("command-script [filename] - Execute command in a file."); - m_log.Error("debug - debugging commands"); - m_log.Error(" packet 0..255 - print incoming/outgoing packets (0=off)"); - m_log.Error("edit-scale [prim name] [x] [y] [z] - resize given prim"); - m_log.Error("export-map [filename] - save image of world map"); - m_log.Error("force-update - force an update of prims in the scene"); - m_log.Error("load-xml [filename] - load prims from XML"); - m_log.Error("load-xml2 [filename] - load prims from XML using version 2 format"); - m_log.Error("permissions [true/false] - turn on/off permissions on the scene"); - m_log.Error("quit - equivalent to shutdown."); - m_log.Error("restart - disconnects all clients and restarts the sims in the instance."); - m_log.Error("remove-region [name] - remove a region"); - m_log.Error("save-xml [filename] - save prims to XML"); - m_log.Error("save-xml2 [filename] - save prims to XML using version 2 format"); - m_log.Error("script - manually trigger scripts? or script commands?"); - m_log.Error("set-time [x] - set the current scene time phase"); - m_log.Error("show uptime - show simulator startup and uptime."); - m_log.Error("show users - show info about connected users."); - m_log.Error("show modules - shows info aboutloaded modules."); - m_log.Error("show stats - statistical information for this server not displayed in the client"); - m_log.Error("shutdown - disconnect all clients and shutdown."); - m_log.Error("config set section field value - set a config value"); - m_log.Error("config get section field - get a config value"); - m_log.Error("config save - save OpenSim.ini"); - m_log.Error("terrain help - show help for terrain commands."); - break; - - case "show": - if (cmdparams.Length > 0) - { - Show(cmdparams[0]); - } + m_log.Notice("alert - send alert to a designated user or all users."); + m_log.Notice(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive."); + m_log.Notice(" alert general [Message] - send an alert to all users."); + m_log.Notice("backup - trigger a simulator backup"); + m_log.Notice("create user - adds a new user"); + m_log.Notice("change-region [name] - sets the region that many of these commands affect."); + m_log.Notice("command-script [filename] - Execute command in a file."); + m_log.Notice("debug - debugging commands"); + m_log.Notice(" packet 0..255 - print incoming/outgoing packets (0=off)"); + m_log.Notice("edit-scale [prim name] [x] [y] [z] - resize given prim"); + m_log.Notice("export-map [filename] - save image of world map"); + m_log.Notice("force-update - force an update of prims in the scene"); + m_log.Notice("load-xml [filename] - load prims from XML"); + m_log.Notice("load-xml2 [filename] - load prims from XML using version 2 format"); + m_log.Notice("permissions [true/false] - turn on/off permissions on the scene"); + m_log.Notice("quit - equivalent to shutdown."); + m_log.Notice("restart - disconnects all clients and restarts the sims in the instance."); + m_log.Notice("remove-region [name] - remove a region"); + m_log.Notice("save-xml [filename] - save prims to XML"); + m_log.Notice("save-xml2 [filename] - save prims to XML using version 2 format"); + m_log.Notice("script - manually trigger scripts? or script commands?"); + m_log.Notice("set-time [x] - set the current scene time phase"); + m_log.Notice("show users - show info about connected users."); + m_log.Notice("show modules - shows info aboutloaded modules."); + m_log.Notice("show stats - statistical information for this server not displayed in the client"); + m_log.Notice("shutdown - disconnect all clients and shutdown."); + m_log.Notice("config set section field value - set a config value"); + m_log.Notice("config get section field - get a config value"); + m_log.Notice("config save - save OpenSim.ini"); + m_log.Notice("terrain help - show help for terrain commands."); break; case "save-xml": @@ -800,6 +792,8 @@ namespace OpenSim break; case "terrain": + string result = String.Empty; + if (!m_sceneManager.RunTerrainCmdOnCurrentScene(cmdparams, ref result)) { m_log.Error(result); @@ -873,20 +867,20 @@ namespace OpenSim if (!m_sceneManager.TrySetCurrentScene(regionName)) { - MainLog.Instance.Error("Couldn't set current region to: " + regionName); + m_log.Error("Couldn't set current region to: " + regionName); } } if (m_sceneManager.CurrentScene == null) { - MainLog.Instance.Verbose("CONSOLE", - "Currently at Root level. To change region please use 'change-region '"); + m_log.Notice("CONSOLE", + "Currently at Root level. To change region please use 'change-region '"); } else { - MainLog.Instance.Verbose("CONSOLE", - "Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName + - ". To change region please use 'change-region '"); + m_log.Notice("CONSOLE", + "Current Region: " + m_sceneManager.CurrentScene.RegionInfo.RegionName + + ". To change region please use 'change-region '"); } break; @@ -911,8 +905,8 @@ namespace OpenSim case "set": if (cmdparams.Length < 4) { - MainLog.Instance.Notice(n, "SYNTAX: " + n + " SET SECTION KEY VALUE"); - MainLog.Instance.Notice(n, "EXAMPLE: " + n + " SET ScriptEngine.DotNetEngine NumberOfScriptThreads 5"); + m_log.Notice(n, "SYNTAX: " + n + " SET SECTION KEY VALUE"); + m_log.Notice(n, "EXAMPLE: " + n + " SET ScriptEngine.DotNetEngine NumberOfScriptThreads 5"); } else { @@ -923,7 +917,7 @@ namespace OpenSim c.Set(cmdparams[2], _value); m_config.Merge(c.ConfigSource); - MainLog.Instance.Notice(n, + m_log.Notice(n, n + " " + n + " " + cmdparams[1] + " " + cmdparams[2] + " " + _value); } @@ -931,20 +925,20 @@ namespace OpenSim case "get": if (cmdparams.Length < 3) { - MainLog.Instance.Notice(n, "SYNTAX: " + n + " GET SECTION KEY"); - MainLog.Instance.Notice(n, "EXAMPLE: " + n + " GET ScriptEngine.DotNetEngine NumberOfScriptThreads"); + m_log.Notice(n, "SYNTAX: " + n + " GET SECTION KEY"); + m_log.Notice(n, "EXAMPLE: " + n + " GET ScriptEngine.DotNetEngine NumberOfScriptThreads"); } else { IConfig c = DefaultConfig().Configs[cmdparams[1]]; if (c == null) { - MainLog.Instance.Notice(n, "Section \"" + cmdparams[1] + "\" does not exist."); + m_log.Notice(n, "Section \"" + cmdparams[1] + "\" does not exist."); break; } else { - MainLog.Instance.Notice(n, + m_log.Notice(n, n + " GET " + cmdparams[1] + " " + cmdparams[2] + ": " + c.GetString(cmdparams[2])); } @@ -952,18 +946,20 @@ namespace OpenSim break; case "save": - MainLog.Instance.Notice(n, "Saving configuration file: " + Application.iniFilePath); + m_log.Notice(n, "Saving configuration file: " + Application.iniFilePath); m_config.Save(Application.iniFilePath); break; } } - else - { - } break; + + /* + * Temporarily disabled but it would be good to have this - needs to be levered + * in to BaseOpenSimServer (which requires a RunCmd method restrcuture probably) default: m_log.Error("Unknown command"); break; + */ } } @@ -993,18 +989,13 @@ namespace OpenSim } } - /// - /// Outputs to the console information about the region - /// - /// What information to display (valid arguments are "uptime", "users") + // see BaseOpenSimServer public void Show(string ShowWhat) { + base.Show(ShowWhat); + switch (ShowWhat) { - case "uptime": - m_log.Error("OpenSim has been running since " + m_startuptime.ToString()); - m_log.Error("That is " + (DateTime.Now - m_startuptime).ToString()); - break; case "users": m_log.Error( String.Format("{0,-16}{1,-16}{2,-37}{3,-16}{4,-22}{5,-16}", "Firstname", "Lastname", diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index d6cf7c3..72917d1 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -40,17 +40,15 @@ using OpenSim.Region.Physics.Manager; namespace OpenSim.Region.ClientStack { - public abstract class RegionApplicationBase + public abstract class RegionApplicationBase : BaseOpenSimServer { protected AssetCache m_assetCache; protected Dictionary m_clientCircuits = new Dictionary(); - protected DateTime m_startuptime; protected NetworkServersInfo m_networkServersInfo; protected BaseHttpServer m_httpServer; protected uint m_httpServerPort; - protected LogBase m_log; protected CommunicationsManager m_commsManager; protected SceneManager m_sceneManager = new SceneManager(); @@ -67,11 +65,6 @@ namespace OpenSim.Region.ClientStack get { return m_sceneManager; } } - public RegionApplicationBase() - { - m_startuptime = DateTime.Now; - } - public virtual void StartUp() { ClientView.TerrainManager = new TerrainManager(new SecondLife()); -- cgit v1.1