From 54c6a920baa0ef02a9ea09e08cc1effcef3b0a3a Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 7 Feb 2009 12:25:39 +0000 Subject: Replace the console for all OpenSim apps with a new console featuring command line editing, context sensitive help (press ? at any time), command line history, a new plugin command system and new appender features thet let you type while the console is scrolling. Seamlessly integrates the ICommander interfaces. --- OpenSim/Region/Application/Application.cs | 15 +- OpenSim/Region/Application/HGOpenSimNode.cs | 27 +- OpenSim/Region/Application/OpenSim.cs | 1033 ++++++++++---------- OpenSim/Region/Application/OpenSimBase.cs | 40 + .../Region/ClientStack/RegionApplicationBase.cs | 2 + .../Framework/InterfaceCommander/Command.cs | 12 + .../Modules/World/Permissions/PermissionsModule.cs | 148 +-- OpenSim/Region/Framework/Interfaces/ICommand.cs | 1 + OpenSim/Region/Framework/Scenes/Scene.cs | 18 +- OpenSim/Region/Framework/Scenes/SceneBase.cs | 8 + .../Shared/Api/Implementation/LSL_Api.cs | 6 - 11 files changed, 692 insertions(+), 618 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index a8e1499..7a427dc 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -34,6 +34,7 @@ using log4net.Config; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Console; +using OpenSim.Region.Framework.Scenes; namespace OpenSim { @@ -46,6 +47,8 @@ namespace OpenSim public static bool m_saveCrashDumps = false; public static string m_crashDir = "crashes"; + protected static OpenSimBase m_sim = null; + //could move our main function into OpenSimMain and kill this class public static void Main(string[] args) { @@ -93,18 +96,18 @@ namespace OpenSim if (background) { - OpenSimBase sim = new OpenSimBackground(configSource); - sim.Startup(); + m_sim = new OpenSimBackground(configSource); + m_sim.Startup(); } else { - OpenSimBase sim = null; + m_sim = null; if (hgrid) - sim = new HGOpenSimNode(configSource); + m_sim = new HGOpenSimNode(configSource); else - sim = new OpenSim(configSource); + m_sim = new OpenSim(configSource); - sim.Startup(); + m_sim.Startup(); while (true) { diff --git a/OpenSim/Region/Application/HGOpenSimNode.cs b/OpenSim/Region/Application/HGOpenSimNode.cs index 4941fb4..2de9ddf 100644 --- a/OpenSim/Region/Application/HGOpenSimNode.cs +++ b/OpenSim/Region/Application/HGOpenSimNode.cs @@ -77,6 +77,9 @@ namespace OpenSim m_log.Info("===================================================================="); base.StartupSpecific(); + + MainConsole.Instance.Commands.AddCommand("hypergrid", "link-mapping", "link-mapping [ ] ", "Set local coordinate to map HG regions to", RunCommand); + MainConsole.Instance.Commands.AddCommand("hypergrid", "link-region", "link-region ", "Link a hypergrid region", RunCommand); } protected override void InitialiseStandaloneServices(LibraryRootFolder libraryRootFolder) @@ -143,11 +146,18 @@ namespace OpenSim m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version); } - public override void RunCmd(string command, string[] cmdparams) + public void RunCommand(string module, string[] cp) { + List cmdparams = new List(cp); + if (cmdparams.Count < 1) + return; + + string command = cmdparams[0]; + cmdparams.RemoveAt(0); + if (command.Equals("link-mapping")) { - if (cmdparams.Length == 2) + if (cmdparams.Count == 2) { try { @@ -166,11 +176,11 @@ namespace OpenSim else if (command.Equals("link-region")) { // link-region - if (cmdparams.Length < 4) + if (cmdparams.Count < 4) { - if ((cmdparams.Length == 1) || (cmdparams.Length ==2)) + if ((cmdparams.Count == 1) || (cmdparams.Count ==2)) { - LoadXmlLinkFile(cmdparams); + LoadXmlLinkFile(cmdparams.ToArray()); } else { @@ -201,19 +211,16 @@ namespace OpenSim if (TryCreateLink(xloc, yloc, externalPort, externalHostName, out regInfo)) { - if (cmdparams.Length >= 5) + if (cmdparams.Count >= 5) { regInfo.RegionName = ""; - for (int i = 4; i < cmdparams.Length; i++) + for (int i = 4; i < cmdparams.Count; i++) regInfo.RegionName += cmdparams[i] + " "; } } return; } - - base.RunCmd(command, cmdparams); - } private void LoadXmlLinkFile(string[] cmdparams) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index af42a3d..37066c2 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -49,7 +49,7 @@ namespace OpenSim /// /// Interactive OpenSim region server /// - public class OpenSim : OpenSimBase, conscmd_callback + public class OpenSim : OpenSimBase { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -59,11 +59,6 @@ namespace OpenSim private string m_timedScript = "disabled"; private Timer m_scriptTimer; - /// - /// List of Console Plugin Commands - /// - private static List m_PluginCommandInfos = new List(); - public OpenSim(IConfigSource configSource) : base(configSource) { } @@ -97,9 +92,189 @@ namespace OpenSim //GCSettings.LatencyMode = GCLatencyMode.Batch; //m_log.InfoFormat("[OPENSIM MAIN]: GC Latency Mode: {0}", GCSettings.LatencyMode.ToString()); - m_console = new ConsoleBase("Region", this); + m_console = new ConsoleBase("Region"); MainConsole.Instance = m_console; + m_console.Commands.AddCommand("region", "clear assets", + "clear assets", + "Clear the asset cache", HandleClearAssets); + + m_console.Commands.AddCommand("region", "force update", + "force update", + "Force the update of all objects on clients", + HandleForceUpdate); + + m_console.Commands.AddCommand("region", "debug packet", + "debug packet ", + "Turn on packet debugging", Debug); + + m_console.Commands.AddCommand("region", "debug scene", + "debug scene ", + "Turn on scene debugging", Debug); + + m_console.Commands.AddCommand("region", "change region", + "change region ", + "Change current console region", ChangeSelectedRegion); + + m_console.Commands.AddCommand("region", "save xml", + "save xml", + "Save a region's data in XML format", SaveXml); + + m_console.Commands.AddCommand("region", "save xml2", + "save xml2", + "Save a region's data in XML2 format", SaveXml2); + + m_console.Commands.AddCommand("region", "load xml", + "load xml [-newIDs [ ]]", + "Load a region's data from XML format", LoadXml); + + m_console.Commands.AddCommand("region", "load xml2", + "load xml2", + "Load a region's data from XML2 format", LoadXml2); + + m_console.Commands.AddCommand("region", "save prims xml2", + "save prims xml2 [ ]", + "Save named prim to XML2", SavePrimsXml2); + + m_console.Commands.AddCommand("region", "load oar", + "load oar ", + "Load a region's data from OAR archive", LoadOar); + + m_console.Commands.AddCommand("region", "save oar", + "save oar ", + "Save a region's data to an OAR archive", SaveOar); + + m_console.Commands.AddCommand("region", "save inventory", + "save inventory ", + "Save user inventory data", SaveInv); + + m_console.Commands.AddCommand("region", "load inventory", + "load inventory ", + "Load user inventory data", LoadInv); + + m_console.Commands.AddCommand("region", "edit scale", + "edit scale ", + "Change the scale of a named prim", HandleEditScale); + + m_console.Commands.AddCommand("region", "kick user", + "kick user ", + "Kick a user off the simulator", HandleEditScale); + + m_console.Commands.AddCommand("region", "show assets", + "show assets", + "Show asset data", HandleShow); + + m_console.Commands.AddCommand("region", "show users", + "show users [full]", + "Show user data", HandleShow); + + m_console.Commands.AddCommand("region", "show users full", + "show users full", + String.Empty, HandleShow); + + m_console.Commands.AddCommand("region", "show modules", + "show modules", + "Show module data", HandleShow); + + m_console.Commands.AddCommand("region", "show regions", + "show regions", + "Show region data", HandleShow); + + m_console.Commands.AddCommand("region", "show queues", + "show queues", + "Show queue data", HandleShow); + + m_console.Commands.AddCommand("region", "alert", + "alert ", + "Send an alert to a user", RunCommand); + + m_console.Commands.AddCommand("region", "alert general", + "alert general ", + "Send an alert everyone", RunCommand); + + m_console.Commands.AddCommand("region", "backup", + "backup", + "Persist objects to the database now", RunCommand); + + m_console.Commands.AddCommand("region", "create region", + "create region", + "Create a new region", HandleCreateRegion); + + m_console.Commands.AddCommand("region", "login enable", + "login enable", + "Enable logins to the simulator", HandleLoginEnable); + + m_console.Commands.AddCommand("region", "login disable", + "login disable", + "Disable logins to the simulator", HandleLoginDisable); + + m_console.Commands.AddCommand("region", "login status", + "login status", + "Display status of logins", HandleLoginStatus); + + m_console.Commands.AddCommand("region", "restart", + "restart", + "Restart all sims in this instance", RunCommand); + + m_console.Commands.AddCommand("region", "config set", + "config set
", + "Set a config option", HandleConfig); + + m_console.Commands.AddCommand("region", "config get", + "config get
", + "Read a config option", HandleConfig); + + m_console.Commands.AddCommand("region", "config save", + "config save", + "Save current configuration", HandleConfig); + + m_console.Commands.AddCommand("region", "command-script", + "command-script