From 3e71c71cbffb0de454759e2bbd0ff840dfa480bc Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 3 Oct 2012 16:07:11 -0400 Subject: Add modular configuration for Robust connectors We can provide modular ini for connectors... look for our configuration in the following places... 1) in the default ini/-inifile 2) in the named file (ConfigName) located in the configured directory (see Robust[.HG].ini [Start] section for ConfigDirectory) 3) in the repository named in the connector (ConfigURL) In this case, the file will be written into the configured directory with the specified See example connector/service @ https://github.com/BlueWall/SlipStream for testing. --- OpenSim/Server/Base/ServerUtils.cs | 38 +++++++++++++++ OpenSim/Server/Base/ServicesServerBase.cs | 8 ++++ OpenSim/Server/Handlers/Base/ServerConnector.cs | 61 +++++++++++++++++++++++++ bin/Robust.HG.ini.example | 4 ++ bin/Robust.ini.example | 5 ++ 5 files changed, 116 insertions(+) diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 42c82cf..4a696c4 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -33,6 +33,7 @@ using System.Xml.Serialization; using System.Text; using System.Collections.Generic; using log4net; +using Nini.Config; using OpenSim.Framework; using OpenMetaverse; @@ -333,5 +334,42 @@ namespace OpenSim.Server.Base return ret; } + + public static IConfig GetConfig(string configFile, string configName) + { + IConfig config; + + if (File.Exists(configFile)) + { + IConfigSource configsource = new IniConfigSource(configFile); + config = configsource.Configs[configName]; + } + else + config = null; + + return config; + } + + public static IConfigSource LoadInitialConfig(string url) + { + IConfigSource source = new XmlConfigSource(); + m_log.InfoFormat("[CONFIG]: {0} is a http:// URI, fetching ...", url); + + // The ini file path is a http URI + // Try to read it + try + { + XmlReader r = XmlReader.Create(url); + IConfigSource cs = new XmlConfigSource(r); + source.Merge(cs); + } + catch (Exception e) + { + m_log.FatalFormat("[CONFIG]: Exception reading config from URI {0}\n" + e.ToString(), url); + Environment.Exit(1); + } + + return source; + } } } diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 0cff6ed..2f12288 100644 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -64,6 +64,12 @@ namespace OpenSim.Server.Base get { return m_Config; } } + public string ConfigDirectory + { + get; + private set; + } + // Run flag // private bool m_Running = true; @@ -153,6 +159,8 @@ namespace OpenSim.Server.Base startupConfig = m_Config.Configs["Startup"]; } + ConfigDirectory = startupConfig.GetString("ConfigDirectory", "."); + prompt = startupConfig.GetString("Prompt", prompt); // Allow derived classes to load config before the console is diff --git a/OpenSim/Server/Handlers/Base/ServerConnector.cs b/OpenSim/Server/Handlers/Base/ServerConnector.cs index 71876da..951cd89 100644 --- a/OpenSim/Server/Handlers/Base/ServerConnector.cs +++ b/OpenSim/Server/Handlers/Base/ServerConnector.cs @@ -39,8 +39,69 @@ namespace OpenSim.Server.Handlers.Base public class ServiceConnector : IServiceConnector { + public virtual string ConfigURL + { + get; + protected set; + } + + public virtual string ConfigName + { + get; + protected set; + } + + public virtual string ConfigFile + { + get; + protected set; + } + + public virtual IConfigSource Config + { + get; + protected set; + } + public ServiceConnector(IConfigSource config, IHttpServer server, string configName) { } + + // We call this from our plugin module to get our configuration + public IConfig GetConfig() + { + IConfig config = null; + config = ServerUtils.GetConfig(ConfigFile, ConfigName); + + // Our file is not here? We can get one to bootstrap our plugin module + if ( config == null ) + { + IConfigSource remotesource = GetConfigSource(); + + if (remotesource != null) + { + IniConfigSource initialconfig = new IniConfigSource(); + initialconfig.Merge (remotesource); + initialconfig.Save(ConfigFile); + } + + config = remotesource.Configs[ConfigName]; + } + + return config; + } + + // We get our remote initial configuration for bootstrapping + private IConfigSource GetConfigSource() + { + IConfigSource source = null; + + source = ServerUtils.LoadInitialConfig(ConfigURL); + + if (source == null) + System.Console.WriteLine(String.Format ("Config Url: {0} Not found!", ConfigURL)); + + return source; + } } } diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index 18094b7..995f181 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -23,6 +23,10 @@ [Startup] ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8004/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8002/OpenSim.Server.Handlers.dll:GatekeeperServiceInConnector,8002/OpenSim.Server.Handlers.dll:UserAgentServerConnector,HGInventoryService@8002/OpenSim.Server.Handlers.dll:XInventoryInConnector,HGAssetService@8002/OpenSim.Server.Handlers.dll:AssetServiceConnector,8002/OpenSim.Server.Handlers.dll:HeloServiceInConnector,8002/OpenSim.Server.Handlers.dll:HGFriendsServerConnector,8002/OpenSim.Server.Handlers.dll:InstantMessageServerConnector,8003/OpenSim.Server.Handlers.dll:MapAddServiceConnector,8002/OpenSim.Server.Handlers.dll:MapGetServiceConnector" +; Modular configurations +; Set path to directory for modular ini files... +ConfigDirectory = "/home/opensim/etc/Configs" + ; * This is common for all services, it's the network setup for the entire ; * server instance, if none is specified above ; * diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 5a9d613..7b8e83d 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -15,6 +15,11 @@ [Startup] ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8004/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8003/OpenSim.Server.Handlers.dll:MapAddServiceConnector,8002/OpenSim.Server.Handlers.dll:MapGetServiceConnector" + +; Modular configurations +; Set path to directory for modular ini files... +ConfigDirectory = "/home/opensim/etc/Configs" + ; * This is common for all services, it's the network setup for the entire ; * server instance, if none is specified above ; * -- cgit v1.1 From 227cfbdc67dd96adcf6fba592fba8811c6fad152 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 3 Oct 2012 19:48:54 -0400 Subject: Update Mono.Addins Update Mono.Addins to latest - 3177b22e958c82bf2c5655ac3d4ef7ad25cc2588 --- bin/Mono.Addins.CecilReflector.dll | Bin 364032 -> 226816 bytes bin/Mono.Addins.Setup.dll | Bin 103424 -> 130560 bytes bin/Mono.Addins.dll | Bin 202752 -> 235008 bytes 3 files changed, 0 insertions(+), 0 deletions(-) diff --git a/bin/Mono.Addins.CecilReflector.dll b/bin/Mono.Addins.CecilReflector.dll index a1a6382..fb95e00 100755 Binary files a/bin/Mono.Addins.CecilReflector.dll and b/bin/Mono.Addins.CecilReflector.dll differ diff --git a/bin/Mono.Addins.Setup.dll b/bin/Mono.Addins.Setup.dll index 8aa6d5f..502ad18 100755 Binary files a/bin/Mono.Addins.Setup.dll and b/bin/Mono.Addins.Setup.dll differ diff --git a/bin/Mono.Addins.dll b/bin/Mono.Addins.dll index ea330fd..1bc4c55 100755 Binary files a/bin/Mono.Addins.dll and b/bin/Mono.Addins.dll differ -- cgit v1.1 From 741471e02cecdd70db90954aa8e4e47ac2627d9a Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 3 Oct 2012 21:49:58 -0400 Subject: Remove duplicate files We are keeping these in bin/lib(32/64) now --- bin/openjpeg-dotnet-x86_64.dll | Bin 215040 -> 0 bytes bin/openjpeg-dotnet.dll | Bin 201216 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100755 bin/openjpeg-dotnet-x86_64.dll delete mode 100755 bin/openjpeg-dotnet.dll diff --git a/bin/openjpeg-dotnet-x86_64.dll b/bin/openjpeg-dotnet-x86_64.dll deleted file mode 100755 index 9e8cd21..0000000 Binary files a/bin/openjpeg-dotnet-x86_64.dll and /dev/null differ diff --git a/bin/openjpeg-dotnet.dll b/bin/openjpeg-dotnet.dll deleted file mode 100755 index 6377b8d..0000000 Binary files a/bin/openjpeg-dotnet.dll and /dev/null differ -- cgit v1.1 From 440726250cc2a523463f575b682a6ddb6242408c Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sat, 6 Oct 2012 11:48:21 -0400 Subject: Added parts to manage repositories and plugin management This is working - more testing to follow, then soem documentation --- OpenSim/Server/Base/CommandManager.cs | 353 +++++++++++++++ OpenSim/Server/Base/PluginManager.cs | 555 ++++++++++++++++++++++++ OpenSim/Server/Base/ServerUtils.cs | 106 +++++ OpenSim/Server/Handlers/Base/ServerConnector.cs | 4 + OpenSim/Server/ServerMain.cs | 10 + bin/Robust.HG.ini.example | 8 + bin/Robust.ini.example | 8 + prebuild.xml | 8 +- 8 files changed, 1051 insertions(+), 1 deletion(-) create mode 100644 OpenSim/Server/Base/CommandManager.cs create mode 100644 OpenSim/Server/Base/PluginManager.cs diff --git a/OpenSim/Server/Base/CommandManager.cs b/OpenSim/Server/Base/CommandManager.cs new file mode 100644 index 0000000..45652b3 --- /dev/null +++ b/OpenSim/Server/Base/CommandManager.cs @@ -0,0 +1,353 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +using System; +using System.Text; +using System.Linq; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Mono.Addins; +using Mono.Addins.Setup; +using Mono.Addins.Description; +using OpenSim.Framework; + +namespace OpenSim.Server.Base +{ + public class CommandManager + { + protected AddinRegistry PluginRegistry; + protected PluginManager PluginManager; + + public CommandManager(AddinRegistry registry) + { + PluginRegistry = registry; + PluginManager = new PluginManager(PluginRegistry); + AddManagementCommands(); + } + + private void AddManagementCommands() + { + // add plugin + MainConsole.Instance.Commands.AddCommand("Plugin", true, + "plugin add", "plugin add \"plugin index\"", + "Install plugin from repository.", + HandleConsoleInstallPlugin); + + // remove plugin + MainConsole.Instance.Commands.AddCommand("Plugin", true, + "plugin remove", "plugin remove \"plugin index\"", + "Remove plugin from repository", + HandleConsoleUnInstallPlugin); + + // list installed plugins + MainConsole.Instance.Commands.AddCommand("Plugin", true, + "plugin list installed", + "plugin list installed","List install plugins", + HandleConsoleListInstalledPlugin); + + // list plugins available from registered repositories + MainConsole.Instance.Commands.AddCommand("Plugin", true, + "plugin list available", + "plugin list available","List available plugins", + HandleConsoleListAvailablePlugin); + // List available updates + MainConsole.Instance.Commands.AddCommand("Plugin", true, + "plugin updates", "plugin updates","List availble updates", + HandleConsoleListUpdates); + + // Update plugin + MainConsole.Instance.Commands.AddCommand("Plugin", true, + "plugin update", "plugin update \"plugin index\"","Update the plugin", + HandleConsoleUpdatePlugin); + + // Add repository + MainConsole.Instance.Commands.AddCommand("Repository", true, + "repo add", "repo add \"url\"","Add repository", + HandleConsoleAddRepo); + + // Refresh repo + MainConsole.Instance.Commands.AddCommand("Repository", true, + "repo refresh", "repo refresh \"url\"", "Sync with a registered repository", + HandleConsoleGetRepo); + + // Remove repository from registry + MainConsole.Instance.Commands.AddCommand("Repository", true, + "repo remove", + "repo remove \"[url | index]\"", + "Remove repository from registry", + HandleConsoleRemoveRepo); + + // Enable repo + MainConsole.Instance.Commands.AddCommand("Repository", true, + "repo enable", "repo enable \"[url | index]\"", + "Enable registered repository", + HandleConsoleEnableRepo); + + // Disable repo + MainConsole.Instance.Commands.AddCommand("Repository", true, + "repo disable", "repo disable\"[url | index]\"", + "Disable registered repository", + HandleConsoleDisableRepo); + + // List registered repositories + MainConsole.Instance.Commands.AddCommand("Repository", true, + "repo list", "repo list", + "List registered repositories", + HandleConsoleListRepos); + + // * + MainConsole.Instance.Commands.AddCommand("Plugin", true, + "plugin info", "plugin info \"plugin index\"","Show detailed information for plugin", + HandleConsoleShowAddinInfo); + + // Plugin disable + MainConsole.Instance.Commands.AddCommand("Plugin", true, + "plugin disable", "plugin disable \"plugin index\"", + "Disable a plugin", + HandleConsoleDisablePlugin); + + // Enable plugin + MainConsole.Instance.Commands.AddCommand("Plugin", true, + "plugin enable", "plugin enable \"plugin index\"", + "Enable the selected plugin plugin", + HandleConsoleEnablePlugin); + } + + #region console handlers + // Handle our console commands + // + // Install plugin from registered repository + /// + /// Handles the console install plugin command. Attempts to install the selected plugin + /// and + /// + /// + /// Module. + /// + /// + /// Cmd. + /// + private void HandleConsoleInstallPlugin(string module, string[] cmd) + { + Dictionary result = new Dictionary(); + + if (cmd.Length == 3) + { + int ndx = Convert.ToInt16(cmd[2]); + if (PluginManager.InstallPlugin(ndx, out result) == true) + { + ArrayList s = new ArrayList(); + s.AddRange(result.Keys); + s.Sort(); + + var list = result.Keys.ToList(); + list.Sort(); + foreach (var k in list) + { + Dictionary plugin = (Dictionary)result[k]; + bool enabled = (bool)plugin["enabled"]; + MainConsole.Instance.OutputFormat("{0}) {1} {2} rev. {3}", + k, + enabled == true ? "[ ]" : "[X]", + plugin["name"], plugin["version"]); + } + } + } + return; + } + + // Remove installed plugin + private void HandleConsoleUnInstallPlugin(string module, string[] cmd) + { + if (cmd.Length == 3) + { + int ndx = Convert.ToInt16(cmd[2]); + PluginManager.UnInstall(ndx); + } + return; + } + + // List installed plugins + private void HandleConsoleListInstalledPlugin(string module, string[] cmd) + { + Dictionary result = new Dictionary(); + PluginManager.ListInstalledAddins(out result); + + ArrayList s = new ArrayList(); + s.AddRange(result.Keys); + s.Sort(); + + var list = result.Keys.ToList(); + list.Sort(); + foreach (var k in list) + { + Dictionary plugin = (Dictionary)result[k]; + bool enabled = (bool)plugin["enabled"]; + MainConsole.Instance.OutputFormat("{0}) {1} {2} rev. {3}", + k, + enabled == true ? "[ ]" : "[X]", + plugin["name"], plugin["version"]); + } + return; + } + + // List available plugins on registered repositories + private void HandleConsoleListAvailablePlugin(string module, string[] cmd) + { + Dictionary result = new Dictionary(); + PluginManager.ListAvailable(out result); + + var list = result.Keys.ToList(); + list.Sort(); + foreach (var k in list) + { + // name, version, repository + Dictionary plugin = (Dictionary)result[k]; + MainConsole.Instance.OutputFormat("{0}) {1} rev. {2} {3}", + k, + plugin["name"], + plugin["version"], + plugin["repository"]); + } + return; + } + + // List available updates **not ready + private void HandleConsoleListUpdates(string module, string[] cmd) + { + PluginManager.ListUpdates(); + return; + } + + // Update plugin **not ready + private void HandleConsoleUpdatePlugin(string module, string[] cmd) + { + MainConsole.Instance.Output(PluginManager.Update()); + return; + } + + // Register repository + private void HandleConsoleAddRepo(string module, string[] cmd) + { + if ( cmd.Length == 3) + { + PluginManager.AddRepository(cmd[2]); + } + return; + } + + // Get repository status **not working + private void HandleConsoleGetRepo(string module, string[] cmd) + { + PluginManager.GetRepository(); + return; + } + + // Remove registered repository + private void HandleConsoleRemoveRepo(string module, string[] cmd) + { + if (cmd.Length == 3) + PluginManager.RemoveRepository(cmd); + return; + } + + // Enable repository + private void HandleConsoleEnableRepo(string module, string[] cmd) + { + PluginManager.EnableRepository(cmd); + return; + } + + // Disable repository + private void HandleConsoleDisableRepo(string module, string[] cmd) + { + PluginManager.DisableRepository(cmd); + return; + } + + // List repositories + private void HandleConsoleListRepos(string module, string[] cmd) + { + Dictionary result = new Dictionary(); + PluginManager.ListRepositories(out result); + + var list = result.Keys.ToList(); + list.Sort(); + foreach (var k in list) + { + Dictionary repo = (Dictionary)result[k]; + bool enabled = (bool)repo["enabled"]; + MainConsole.Instance.OutputFormat("{0}) {1} {2}", + k, + enabled == true ? "[ ]" : "[X]", + repo["name"], repo["url"]); + } + + return; + } + + // Show description information + private void HandleConsoleShowAddinInfo(string module, string[] cmd) + { + if (cmd.Length >= 3) + { + + Dictionary result = new Dictionary(); + + int ndx = Convert.ToInt16(cmd[2]); + PluginManager.AddinInfo(ndx, out result); + + MainConsole.Instance.OutputFormat("Name: {0}\nURL: {1}\nFile: {2}\nAuthor: {3}\nCategory: {4}\nDesc: {5}", + result["name"], + result["url"], + result["file_name"], + result["author"], + result["category"], + result["description"]); + + return; + } + } + + // Disable plugin + private void HandleConsoleDisablePlugin(string module, string[] cmd) + { + PluginManager.DisablePlugin(cmd); + return; + } + + // Enable plugin + private void HandleConsoleEnablePlugin(string module, string[] cmd) + { + PluginManager.EnablePlugin(cmd); + return; + } + #endregion + } +} \ No newline at end of file diff --git a/OpenSim/Server/Base/PluginManager.cs b/OpenSim/Server/Base/PluginManager.cs new file mode 100644 index 0000000..6248e74 --- /dev/null +++ b/OpenSim/Server/Base/PluginManager.cs @@ -0,0 +1,555 @@ + +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +using System; +using System.Text; +using System.Linq; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Mono.Addins; +using Mono.Addins.Setup; +using Mono.Addins.Description; +using OpenSim.Framework; + +namespace OpenSim.Server.Base +{ + public class PluginManager : SetupService + { + protected AddinRegistry PluginRegistry; + + internal PluginManager(AddinRegistry registry): base (registry) + { + PluginRegistry = registry; + + } + + /// + /// Installs the plugin. + /// + /// + /// The plugin. + /// + /// + /// Arguments. + /// + public bool InstallPlugin(int ndx, out Dictionary result) + { + Dictionary res = new Dictionary(); + + PackageCollection pack = new PackageCollection(); + PackageCollection toUninstall; + DependencyCollection unresolved; + + IProgressStatus ps = new ConsoleProgressStatus(false); + + AddinRepositoryEntry[] available = GetSortedAvailbleAddins(); + + if (ndx > (available.Length - 1)) + { + MainConsole.Instance.Output("Selection out of range"); + result = res; + return false; + } + + AddinRepositoryEntry aentry = available[ndx]; + + Package p = Package.FromRepository(aentry); + pack.Add(p); + + ResolveDependencies(ps, pack, out toUninstall, out unresolved); + + // Attempt to install the plugin disabled + if (Install(ps, pack) == true) + { + PluginRegistry.Update(ps); + Addin addin = PluginRegistry.GetAddin(aentry.Addin.Id); + PluginRegistry.DisableAddin(addin.Id); + addin.Enabled = false; + + MainConsole.Instance.Output("Installation Success"); + ListInstalledAddins(out res); + result = res; + return true; + } + else + { + MainConsole.Instance.Output("Installation Failed"); + result = res; + return false; + } + } + + // Remove plugin + /// + /// Uns the install. + /// + /// + /// Arguments. + /// + public void UnInstall(int ndx) + { + Addin[] addins = GetSortedAddinList("RobustPlugin"); + + if (ndx > (addins.Length -1)) + { + MainConsole.Instance.Output("Selection out of range"); + return; + } + + Addin addin = addins[ndx]; + MainConsole.Instance.OutputFormat("Uninstalling plugin {0}", addin.Id); + AddinManager.Registry.DisableAddin(addin.Id); + addin.Enabled = false; + IProgressStatus ps = new ConsoleProgressStatus(false); + Uninstall(ps, addin.Id); + MainConsole.Instance.Output("Uninstall Success - restart to complete operation"); + return; + } + + /// + /// Checks the installed. + /// + /// + /// The installed. + /// + public string CheckInstalled() + { + return "CheckInstall"; + } + + /// + /// Lists the installed addins. + /// + /// + /// Result. + /// + public void ListInstalledAddins(out Dictionary result) + { + Dictionary res = new Dictionary(); + + Addin[] addins = GetSortedAddinList("RobustPlugin"); + if(addins.Count() < 1) + { + MainConsole.Instance.Output("Error!"); + } + int count = 0; + foreach (Addin addin in addins) + { + Dictionary r = new Dictionary(); + r["enabled"] = addin.Enabled == true ? true : false; + r["name"] = addin.LocalId; + r["version"] = addin.Version; + + res.Add(count.ToString(), r); + + count++; + } + result = res; + return; + } + + // List compatible plugins in registered repositories + /// + /// Lists the available. + /// + /// + /// Result. + /// + public void ListAvailable(out Dictionary result) + { + Dictionary res = new Dictionary(); + + AddinRepositoryEntry[] addins = GetSortedAvailbleAddins(); + + int count = 0; + foreach (AddinRepositoryEntry addin in addins) + { + Dictionary r = new Dictionary(); + r["name"] = addin.Addin.Name; + r["version"] = addin.Addin.Version; + r["repository"] = addin.RepositoryName; + + res.Add(count.ToString(), r); + count++; + } + result = res; + return; + } + + // List available updates ** 1 + /// + /// Lists the updates. + /// + public void ListUpdates() + { + IProgressStatus ps = new ConsoleProgressStatus(true); + Console.WriteLine ("Looking for updates..."); + Repositories.UpdateAllRepositories (ps); + Console.WriteLine ("Available add-in updates:"); + bool found = false; + AddinRepositoryEntry[] entries = Repositories.GetAvailableUpdates(); + + foreach (AddinRepositoryEntry entry in entries) + { + Console.WriteLine(String.Format("{0}",entry.Addin.Id)); + } + } + + // Sync to repositories + /// + /// Update this instance. + /// + public string Update() + { + IProgressStatus ps = new ConsoleProgressStatus(true); + Repositories.UpdateAllRepositories(ps); + return "Update"; + } + + // Register a repository + /// + /// Register a repository with our server. + /// + /// + /// result of the action + /// + /// + /// The URL of the repository we want to add + /// + public bool AddRepository(string repo) + { + Repositories.RegisterRepository(null, repo, true); + return true; + } + + /// + /// Gets the repository. + /// + public void GetRepository() + { + Repositories.UpdateAllRepositories(new ConsoleProgressStatus(false)); + } + + // Remove a repository from the list + /// + /// Removes the repository. + /// + /// + /// Arguments. + /// + public void RemoveRepository(string[] args) + { + AddinRepository[] reps = Repositories.GetRepositories(); + Array.Sort(reps, (r1,r2) => r1.Title.CompareTo(r2.Title)); + if (reps.Length == 0) + { + MainConsole.Instance.Output("No repositories have been registered."); + return; + } + + int n = Convert.ToInt16(args[2]); + if (n > (reps.Length -1)) + { + MainConsole.Instance.Output("Selection out of range"); + return; + } + + AddinRepository rep = reps[n]; + Repositories.RemoveRepository(rep.Url); + return; + } + + // Enable repository + /// + /// Enables the repository. + /// + /// + /// Arguments. + /// + public void EnableRepository(string[] args) + { + AddinRepository[] reps = Repositories.GetRepositories(); + Array.Sort(reps, (r1,r2) => r1.Title.CompareTo(r2.Title)); + if (reps.Length == 0) + { + MainConsole.Instance.Output("No repositories have been registered."); + return; + } + + int n = Convert.ToInt16(args[2]); + if (n > (reps.Length -1)) + { + MainConsole.Instance.Output("Selection out of range"); + return; + } + + AddinRepository rep = reps[n]; + Repositories.SetRepositoryEnabled(rep.Url, true); + return; + } + + // Disable a repository + /// + /// Disables the repository. + /// + /// + /// Arguments. + /// + public void DisableRepository(string[] args) + { + AddinRepository[] reps = Repositories.GetRepositories(); + Array.Sort(reps, (r1,r2) => r1.Title.CompareTo(r2.Title)); + if (reps.Length == 0) + { + MainConsole.Instance.Output("No repositories have been registered."); + return; + } + + int n = Convert.ToInt16(args[2]); + if (n > (reps.Length -1)) + { + MainConsole.Instance.Output("Selection out of range"); + return; + } + + AddinRepository rep = reps[n]; + Repositories.SetRepositoryEnabled(rep.Url, false); + return; + } + + // List registered repositories + /// + /// Lists the repositories. + /// + /// + /// Result. + /// + public void ListRepositories(out Dictionary result) + { + Dictionary res = new Dictionary(); + result = res; + + AddinRepository[] reps = GetSortedAddinRepo(); + if (reps.Length == 0) + { + MainConsole.Instance.Output("No repositories have been registered."); + return; + } + + int count = 0; + foreach (AddinRepository rep in reps) + { + Dictionary r = new Dictionary(); + r["enabled"] = rep.Enabled == true ? true : false; + r["name"] = rep.Name; + r["url"] = rep.Url; + + res.Add(count.ToString(), r); + count++; + } + return; + } + + /// + /// Updates the registry. + /// + public void UpdateRegistry() + { + PluginRegistry.Update(); + } + + // Show plugin info + /// + /// Addins the info. + /// + /// + /// The info. + /// + /// + /// Arguments. + /// + public bool AddinInfo(int ndx, out Dictionary result) + { + Dictionary res = new Dictionary(); + result = res; + + Addin[] addins = GetSortedAddinList("RobustPlugin"); + + if (ndx > (addins.Length - 1)) + { + MainConsole.Instance.Output("Selection out of range"); + return false; + } + // author category description + Addin addin = addins[ndx]; + + res["author"] = addin.Description.Author; + res["category"] = addin.Description.Category; + res["description"] = addin.Description.Description; + res["name"] = addin.Name; + res["url"] = addin.Description.Url; + res["file_name"] = addin.Description.FileName; + + result = res; + return true; + } + + // Disable a plugin + /// + /// Disables the plugin. + /// + /// + /// Arguments. + /// + public void DisablePlugin(string[] args) + { + Addin[] addins = GetSortedAddinList("RobustPlugin"); + + int n = Convert.ToInt16(args[2]); + if (n > (addins.Length -1)) + { + MainConsole.Instance.Output("Selection out of range"); + return; + } + + Addin addin = addins[n]; + AddinManager.Registry.DisableAddin(addin.Id); + addin.Enabled = false; + return; + } + + // Enable plugin + /// + /// Enables the plugin. + /// + /// + /// Arguments. + /// + public void EnablePlugin(string[] args) + { + Addin[] addins = GetSortedAddinList("RobustPlugin"); + + int n = Convert.ToInt16(args[2]); + if (n > (addins.Length -1)) + { + MainConsole.Instance.Output("Selection out of range"); + return; + } + + Addin addin = addins[n]; + + addin.Enabled = true; + AddinManager.Registry.EnableAddin(addin.Id); + // AddinManager.Registry.Update(); + if(PluginRegistry.IsAddinEnabled(addin.Id)) + { + ConsoleProgressStatus ps = new ConsoleProgressStatus(false); + if (!AddinManager.AddinEngine.IsAddinLoaded(addin.Id)) + { + AddinManager.Registry.Rebuild(ps); + AddinManager.AddinEngine.LoadAddin(ps, addin.Id); + } + } + else + { + MainConsole.Instance.OutputFormat("Not Enabled in this domain {0}", addin.Name); + } + return; + } + + + + #region Util + private void Testing() + { + Addin[] list = Registry.GetAddins(); + + var addins = list.Where( a => a.Description.Category == "RobustPlugin"); + + foreach (Addin addin in addins) + { + MainConsole.Instance.OutputFormat("Addin {0}", addin.Name); + } + } + + // These will let us deal with numbered lists instead + // of needing to type in the full ids + private AddinRepositoryEntry[] GetSortedAvailbleAddins() + { + ArrayList list = new ArrayList(); + list.AddRange(Repositories.GetAvailableAddins()); + + AddinRepositoryEntry[] addins = list.ToArray(typeof(AddinRepositoryEntry)) as AddinRepositoryEntry[]; + + Array.Sort(addins,(r1,r2) => r1.Addin.Id.CompareTo(r2.Addin.Id)); + + return addins; + } + + private AddinRepository[] GetSortedAddinRepo() + { + ArrayList list = new ArrayList(); + list.AddRange(Repositories.GetRepositories()); + + AddinRepository[] repos = list.ToArray(typeof(AddinRepository)) as AddinRepository[]; + Array.Sort (repos,(r1,r2) => r1.Name.CompareTo(r2.Name)); + + return repos; + } + + private Addin[] GetSortedAddinList(string category) + { + + ArrayList xlist = new ArrayList(); + ArrayList list = new ArrayList(); + try + { + list.AddRange(PluginRegistry.GetAddins()); + } + catch(Exception e) + { + Addin[] x = xlist.ToArray(typeof(Addin)) as Addin[]; + return x; + } + + foreach (Addin addin in list) + { + if (addin.Description.Category == category) + xlist.Add(addin); + } + + Addin[] addins = xlist.ToArray(typeof(Addin)) as Addin[]; + Array.Sort(addins,(r1,r2) => r1.Id.CompareTo(r2.Id)); + + return addins; + } + #endregion Util + } +} \ No newline at end of file diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 4a696c4..6c6af62 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -36,9 +36,115 @@ using log4net; using Nini.Config; using OpenSim.Framework; using OpenMetaverse; +using Mono.Addins; +using OpenSim.Framework.Servers.HttpServer; +using OpenSim.Framework.Servers; + +[assembly:AddinRoot("Robust", "0.1")] namespace OpenSim.Server.Base { + [TypeExtensionPoint(Path="/Robust/Connector", Name="RobustConnector")] + public interface IRobustConnector + { + string ConfigName + { + get; + } + + bool Enabled + { + get; + } + + string PluginPath + { + get; + set; + } + + uint Configure(IConfigSource config); + void Initialize(IHttpServer server); + } + + public class PluginLoader + { + static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + public AddinRegistry Registry + { + get; + private set; + } + + public IConfigSource Config + { + get; + private set; + } + + public PluginLoader(IConfigSource config, string registryPath) + { + Config = config; + + Registry = new AddinRegistry(registryPath, "."); + AddinManager.Initialize(registryPath); + AddinManager.Registry.Update(); + CommandManager commandmanager = new CommandManager(Registry); + AddinManager.AddExtensionNodeHandler("/Robust/Connector", OnExtensionChanged); + } + + private void OnExtensionChanged(object s, ExtensionNodeEventArgs args) + { + IRobustConnector connector = (IRobustConnector)args.ExtensionObject; + + Addin a = Registry.GetAddin(args.ExtensionNode.Addin.Id); + m_log.InfoFormat("[SERVER]: Extension Change: {0}/{1}", Registry.DefaultAddinsFolder, a.Name.Replace(',', '.')); + + switch(args.Change) + { + case ExtensionChange.Add: + connector.PluginPath = String.Format("{0}/{1}", Registry.DefaultAddinsFolder, a.Name.Replace(',', '.')); + LoadPlugin(connector); + break; + case ExtensionChange.Remove: + UnloadPlugin(connector); + break; + } + } + + private void LoadPlugin(IRobustConnector connector) + { + IHttpServer server = null; + uint port = connector.Configure(Config); + + if(connector.Enabled) + { + server = GetServer(connector, port); + m_log.InfoFormat("[SERVER]: Path is {0}", connector.PluginPath); + connector.Initialize(server); + } + else + m_log.InfoFormat("[SERVER]: {0} Disabled.", connector.ConfigName); + } + + private void UnloadPlugin(IRobustConnector connector) + { + } + + private IHttpServer GetServer(IRobustConnector connector, uint port) + { + IHttpServer server; + + if(port != 0) + server = MainServer.GetHttpServer(port); + else + server = MainServer.Instance; + + return server; + } + } + public static class ServerUtils { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Server/Handlers/Base/ServerConnector.cs b/OpenSim/Server/Handlers/Base/ServerConnector.cs index 951cd89..067fd2a 100644 --- a/OpenSim/Server/Handlers/Base/ServerConnector.cs +++ b/OpenSim/Server/Handlers/Base/ServerConnector.cs @@ -63,6 +63,10 @@ namespace OpenSim.Server.Handlers.Base protected set; } + public ServiceConnector() + { + } + public ServiceConnector(IConfigSource config, IHttpServer server, string configName) { } diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 21fb678..575d560 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -34,6 +34,7 @@ using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Server.Base; using OpenSim.Server.Handlers.Base; +using Mono.Addins; namespace OpenSim.Server { @@ -48,9 +49,13 @@ namespace OpenSim.Server protected static List m_ServiceConnectors = new List(); + protected static PluginLoader loader; + public static int Main(string[] args) { m_Server = new HttpServerBase("R.O.B.U.S.T.", args); + + string registryLocation; IConfig serverConfig = m_Server.Config.Configs["Startup"]; if (serverConfig == null) @@ -61,6 +66,8 @@ namespace OpenSim.Server string connList = serverConfig.GetString("ServiceConnectors", String.Empty); string[] conns = connList.Split(new char[] {',', ' '}); + + registryLocation = serverConfig.GetString("RegistryLocation","."); // int i = 0; foreach (string c in conns) @@ -123,6 +130,9 @@ namespace OpenSim.Server m_log.InfoFormat("[SERVER]: Failed to load {0}", conn); } } + + loader = new PluginLoader(m_Server.Config, registryLocation); + int res = m_Server.Run(); Environment.Exit(res); diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index 995f181..107a42d 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -23,8 +23,16 @@ [Startup] ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8004/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8002/OpenSim.Server.Handlers.dll:GatekeeperServiceInConnector,8002/OpenSim.Server.Handlers.dll:UserAgentServerConnector,HGInventoryService@8002/OpenSim.Server.Handlers.dll:XInventoryInConnector,HGAssetService@8002/OpenSim.Server.Handlers.dll:AssetServiceConnector,8002/OpenSim.Server.Handlers.dll:HeloServiceInConnector,8002/OpenSim.Server.Handlers.dll:HGFriendsServerConnector,8002/OpenSim.Server.Handlers.dll:InstantMessageServerConnector,8003/OpenSim.Server.Handlers.dll:MapAddServiceConnector,8002/OpenSim.Server.Handlers.dll:MapGetServiceConnector" +; Plugin Registry Location +; Set path to directory for plugin registry. Information +; about the registered repositories and installed plugins +; will be stored here +; The Robust.exe process must hvae R/W access to the location +RegistryLocation = "." + ; Modular configurations ; Set path to directory for modular ini files... +; The Robust.exe process must hvae R/W access to the location ConfigDirectory = "/home/opensim/etc/Configs" ; * This is common for all services, it's the network setup for the entire diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 7b8e83d..430be26 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -15,9 +15,17 @@ [Startup] ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003/OpenSim.Server.Handlers.dll:XInventoryInConnector,8004/OpenSim.Server.Handlers.dll:FreeswitchServerConnector,8003/OpenSim.Server.Handlers.dll:GridServiceConnector,8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector,8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector,8002/OpenSim.Server.Handlers.dll:OpenIdServerConnector,8003/OpenSim.Server.Handlers.dll:AvatarServiceConnector,8002/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector,8003/OpenSim.Server.Handlers.dll:PresenceServiceConnector,8003/OpenSim.Server.Handlers.dll:UserAccountServiceConnector,8003/OpenSim.Server.Handlers.dll:GridUserServiceConnector,8003/OpenSim.Server.Handlers.dll:FriendsServiceConnector,8003/OpenSim.Server.Handlers.dll:MapAddServiceConnector,8002/OpenSim.Server.Handlers.dll:MapGetServiceConnector" +; Plugin Registry Location +; Set path to directory for plugin registry. Information +; about the registered repositories and installed plugins +; will be stored here +; The Robust.exe process must hvae R/W access to the location +RegistryLocation = "." + ; Modular configurations ; Set path to directory for modular ini files... +; The Robust.exe process must hvae R/W access to the location ConfigDirectory = "/home/opensim/etc/Configs" ; * This is common for all services, it's the network setup for the entire diff --git a/prebuild.xml b/prebuild.xml index d3af892..fe8dcef 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -733,7 +733,10 @@ + + + @@ -856,6 +859,7 @@ + @@ -864,7 +868,6 @@ - @@ -1260,6 +1263,7 @@ + @@ -1336,6 +1340,8 @@ + + -- cgit v1.1 From 92849c5cc39bb6d83c478c300ba10fab9d7f8bfc Mon Sep 17 00:00:00 2001 From: BlueWall Date: Tue, 9 Oct 2012 07:59:44 -0400 Subject: missed some conflict markup --- OpenSim/Server/ServerMain.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index be12f8a..8be69a9 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -86,7 +86,6 @@ namespace OpenSim.Server } string[] conns = connList.Split(new char[] {',', ' ', '\n', '\r', '\t'}); ->>>>>>> master // int i = 0; foreach (string c in conns) -- cgit v1.1 From a960efeabaf00563fef551fd3b4f6d215306c3ea Mon Sep 17 00:00:00 2001 From: BlueWall Date: Tue, 9 Oct 2012 08:00:02 -0400 Subject: Fix registry issue Rebuild registry if loading from a local dll to give access to the addin data for it on the first pass. --- OpenSim/Server/Base/ServerUtils.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 6c6af62..d0b6c81 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -97,8 +97,14 @@ namespace OpenSim.Server.Base private void OnExtensionChanged(object s, ExtensionNodeEventArgs args) { IRobustConnector connector = (IRobustConnector)args.ExtensionObject; - Addin a = Registry.GetAddin(args.ExtensionNode.Addin.Id); + + if(a == null) + { + Registry.Rebuild(null); + a = Registry.GetAddin(args.ExtensionNode.Addin.Id); + } + m_log.InfoFormat("[SERVER]: Extension Change: {0}/{1}", Registry.DefaultAddinsFolder, a.Name.Replace(',', '.')); switch(args.Change) -- cgit v1.1 From 08f6c8065e79b4a74300efc31fbba8fbc03652ed Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 10 Oct 2012 09:32:31 -0400 Subject: Add System.Core to references --- prebuild.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/prebuild.xml b/prebuild.xml index ca27e2c..82c4dc9 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -730,6 +730,7 @@ ../../../bin/ + -- cgit v1.1 From 83073ebd03e46789b3509af2c4e37ef3b3428174 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 10 Oct 2012 09:35:08 -0400 Subject: Implement plugin unloading Plugin may be enabled and disabled on the fly. --- OpenSim/Server/Base/PluginManager.cs | 2 ++ OpenSim/Server/Base/ServerUtils.cs | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/OpenSim/Server/Base/PluginManager.cs b/OpenSim/Server/Base/PluginManager.cs index 6248e74..d2cf668 100644 --- a/OpenSim/Server/Base/PluginManager.cs +++ b/OpenSim/Server/Base/PluginManager.cs @@ -246,6 +246,8 @@ namespace OpenSim.Server.Base public bool AddRepository(string repo) { Repositories.RegisterRepository(null, repo, true); + PluginRegistry.Rebuild(null); + return true; } diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index d0b6c81..6cbf332 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -65,6 +65,7 @@ namespace OpenSim.Server.Base uint Configure(IConfigSource config); void Initialize(IHttpServer server); + void Unload(); } public class PluginLoader @@ -105,12 +106,17 @@ namespace OpenSim.Server.Base a = Registry.GetAddin(args.ExtensionNode.Addin.Id); } - m_log.InfoFormat("[SERVER]: Extension Change: {0}/{1}", Registry.DefaultAddinsFolder, a.Name.Replace(',', '.')); - switch(args.Change) { case ExtensionChange.Add: - connector.PluginPath = String.Format("{0}/{1}", Registry.DefaultAddinsFolder, a.Name.Replace(',', '.')); + if (a.AddinFile.Contains(Registry.DefaultAddinsFolder)) + { + connector.PluginPath = String.Format("{0}/{1}", Registry.DefaultAddinsFolder, a.Name.Replace(',', '.')); + } + else + { + connector.PluginPath = a.AddinFile; + } LoadPlugin(connector); break; case ExtensionChange.Remove: @@ -127,15 +133,19 @@ namespace OpenSim.Server.Base if(connector.Enabled) { server = GetServer(connector, port); - m_log.InfoFormat("[SERVER]: Path is {0}", connector.PluginPath); connector.Initialize(server); } else + { m_log.InfoFormat("[SERVER]: {0} Disabled.", connector.ConfigName); + } } private void UnloadPlugin(IRobustConnector connector) { + m_log.InfoFormat("[Server]: Unloading {0}", connector.ConfigName); + + connector.Unload(); } private IHttpServer GetServer(IRobustConnector connector, uint port) -- cgit v1.1 From c8393dd0bedfa88c32c940249d86cb7781c1e815 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Thu, 11 Oct 2012 07:38:15 -0400 Subject: Add logging to help track sequence of events --- OpenSim/Server/Base/ServerUtils.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 6cbf332..8ecf3d3 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -111,10 +111,12 @@ namespace OpenSim.Server.Base case ExtensionChange.Add: if (a.AddinFile.Contains(Registry.DefaultAddinsFolder)) { + m_log.InfoFormat("[SERVER]: Adding {0}", a.Name); connector.PluginPath = String.Format("{0}/{1}", Registry.DefaultAddinsFolder, a.Name.Replace(',', '.')); } else { + m_log.InfoFormat("[SERVER]: Removing {0}", a.Name); connector.PluginPath = a.AddinFile; } LoadPlugin(connector); -- cgit v1.1 From 99bb6c930479fedee4e55a662fa715702f6110b7 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Fri, 19 Oct 2012 07:38:36 -0400 Subject: Move PluginManager Move PluginManager out to OpenSimFramework for general use --- OpenSim/Framework/PluginManager.cs | 561 ++++++++++++++++++++++++ OpenSim/Server/Base/CommandManager.cs | 10 +- OpenSim/Server/Base/PluginManager.cs | 557 ----------------------- OpenSim/Server/Base/ServerUtils.cs | 5 +- OpenSim/Server/Handlers/Base/ServerConnector.cs | 8 +- prebuild.xml | 2 +- 6 files changed, 578 insertions(+), 565 deletions(-) create mode 100644 OpenSim/Framework/PluginManager.cs delete mode 100644 OpenSim/Server/Base/PluginManager.cs diff --git a/OpenSim/Framework/PluginManager.cs b/OpenSim/Framework/PluginManager.cs new file mode 100644 index 0000000..188d90a --- /dev/null +++ b/OpenSim/Framework/PluginManager.cs @@ -0,0 +1,561 @@ + +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +using System; +using System.Text; +using System.Linq; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Mono.Addins; +using Mono.Addins.Setup; +using Mono.Addins.Description; +using OpenSim.Framework; + + +namespace OpenSim.Framework +{ + /// + /// Manager for registries and plugins + /// + public class PluginManager : SetupService + { + public AddinRegistry PluginRegistry; + + public PluginManager(AddinRegistry registry): base (registry) + { + PluginRegistry = registry; + + } + + /// + /// Installs the plugin. + /// + /// + /// The plugin. + /// + /// + /// Arguments. + /// + public bool InstallPlugin(int ndx, out Dictionary result) + { + Dictionary res = new Dictionary(); + + PackageCollection pack = new PackageCollection(); + PackageCollection toUninstall; + DependencyCollection unresolved; + + IProgressStatus ps = new ConsoleProgressStatus(false); + + AddinRepositoryEntry[] available = GetSortedAvailbleAddins(); + + if (ndx > (available.Length - 1)) + { + MainConsole.Instance.Output("Selection out of range"); + result = res; + return false; + } + + AddinRepositoryEntry aentry = available[ndx]; + + Package p = Package.FromRepository(aentry); + pack.Add(p); + + ResolveDependencies(ps, pack, out toUninstall, out unresolved); + + // Attempt to install the plugin disabled + if (Install(ps, pack) == true) + { + PluginRegistry.Update(ps); + Addin addin = PluginRegistry.GetAddin(aentry.Addin.Id); + PluginRegistry.DisableAddin(addin.Id); + addin.Enabled = false; + + MainConsole.Instance.Output("Installation Success"); + ListInstalledAddins(out res); + result = res; + return true; + } + else + { + MainConsole.Instance.Output("Installation Failed"); + result = res; + return false; + } + } + + // Remove plugin + /// + /// Uns the install. + /// + /// + /// Arguments. + /// + public void UnInstall(int ndx) + { + Addin[] addins = GetSortedAddinList("RobustPlugin"); + + if (ndx > (addins.Length -1)) + { + MainConsole.Instance.Output("Selection out of range"); + return; + } + + Addin addin = addins[ndx]; + MainConsole.Instance.OutputFormat("Uninstalling plugin {0}", addin.Id); + AddinManager.Registry.DisableAddin(addin.Id); + addin.Enabled = false; + IProgressStatus ps = new ConsoleProgressStatus(false); + Uninstall(ps, addin.Id); + MainConsole.Instance.Output("Uninstall Success - restart to complete operation"); + return; + } + + /// + /// Checks the installed. + /// + /// + /// The installed. + /// + public string CheckInstalled() + { + return "CheckInstall"; + } + + /// + /// Lists the installed addins. + /// + /// + /// Result. + /// + public void ListInstalledAddins(out Dictionary result) + { + Dictionary res = new Dictionary(); + + Addin[] addins = GetSortedAddinList("RobustPlugin"); + if(addins.Count() < 1) + { + MainConsole.Instance.Output("Error!"); + } + int count = 0; + foreach (Addin addin in addins) + { + Dictionary r = new Dictionary(); + r["enabled"] = addin.Enabled == true ? true : false; + r["name"] = addin.LocalId; + r["version"] = addin.Version; + + res.Add(count.ToString(), r); + + count++; + } + result = res; + return; + } + + // List compatible plugins in registered repositories + /// + /// Lists the available. + /// + /// + /// Result. + /// + public void ListAvailable(out Dictionary result) + { + Dictionary res = new Dictionary(); + + AddinRepositoryEntry[] addins = GetSortedAvailbleAddins(); + + int count = 0; + foreach (AddinRepositoryEntry addin in addins) + { + Dictionary r = new Dictionary(); + r["name"] = addin.Addin.Name; + r["version"] = addin.Addin.Version; + r["repository"] = addin.RepositoryName; + + res.Add(count.ToString(), r); + count++; + } + result = res; + return; + } + + // List available updates ** 1 + /// + /// Lists the updates. + /// + public void ListUpdates() + { + IProgressStatus ps = new ConsoleProgressStatus(true); + Console.WriteLine ("Looking for updates..."); + Repositories.UpdateAllRepositories (ps); + Console.WriteLine ("Available add-in updates:"); + bool found = false; + AddinRepositoryEntry[] entries = Repositories.GetAvailableUpdates(); + + foreach (AddinRepositoryEntry entry in entries) + { + Console.WriteLine(String.Format("{0}",entry.Addin.Id)); + } + } + + // Sync to repositories + /// + /// Update this instance. + /// + public string Update() + { + IProgressStatus ps = new ConsoleProgressStatus(true); + Repositories.UpdateAllRepositories(ps); + return "Update"; + } + + // Register a repository + /// + /// Register a repository with our server. + /// + /// + /// result of the action + /// + /// + /// The URL of the repository we want to add + /// + public bool AddRepository(string repo) + { + Repositories.RegisterRepository(null, repo, true); + PluginRegistry.Rebuild(null); + + return true; + } + + /// + /// Gets the repository. + /// + public void GetRepository() + { + Repositories.UpdateAllRepositories(new ConsoleProgressStatus(false)); + } + + // Remove a repository from the list + /// + /// Removes the repository. + /// + /// + /// Arguments. + /// + public void RemoveRepository(string[] args) + { + AddinRepository[] reps = Repositories.GetRepositories(); + Array.Sort(reps, (r1,r2) => r1.Title.CompareTo(r2.Title)); + if (reps.Length == 0) + { + MainConsole.Instance.Output("No repositories have been registered."); + return; + } + + int n = Convert.ToInt16(args[2]); + if (n > (reps.Length -1)) + { + MainConsole.Instance.Output("Selection out of range"); + return; + } + + AddinRepository rep = reps[n]; + Repositories.RemoveRepository(rep.Url); + return; + } + + // Enable repository + /// + /// Enables the repository. + /// + /// + /// Arguments. + /// + public void EnableRepository(string[] args) + { + AddinRepository[] reps = Repositories.GetRepositories(); + Array.Sort(reps, (r1,r2) => r1.Title.CompareTo(r2.Title)); + if (reps.Length == 0) + { + MainConsole.Instance.Output("No repositories have been registered."); + return; + } + + int n = Convert.ToInt16(args[2]); + if (n > (reps.Length -1)) + { + MainConsole.Instance.Output("Selection out of range"); + return; + } + + AddinRepository rep = reps[n]; + Repositories.SetRepositoryEnabled(rep.Url, true); + return; + } + + // Disable a repository + /// + /// Disables the repository. + /// + /// + /// Arguments. + /// + public void DisableRepository(string[] args) + { + AddinRepository[] reps = Repositories.GetRepositories(); + Array.Sort(reps, (r1,r2) => r1.Title.CompareTo(r2.Title)); + if (reps.Length == 0) + { + MainConsole.Instance.Output("No repositories have been registered."); + return; + } + + int n = Convert.ToInt16(args[2]); + if (n > (reps.Length -1)) + { + MainConsole.Instance.Output("Selection out of range"); + return; + } + + AddinRepository rep = reps[n]; + Repositories.SetRepositoryEnabled(rep.Url, false); + return; + } + + // List registered repositories + /// + /// Lists the repositories. + /// + /// + /// Result. + /// + public void ListRepositories(out Dictionary result) + { + Dictionary res = new Dictionary(); + result = res; + + AddinRepository[] reps = GetSortedAddinRepo(); + if (reps.Length == 0) + { + MainConsole.Instance.Output("No repositories have been registered."); + return; + } + + int count = 0; + foreach (AddinRepository rep in reps) + { + Dictionary r = new Dictionary(); + r["enabled"] = rep.Enabled == true ? true : false; + r["name"] = rep.Name; + r["url"] = rep.Url; + + res.Add(count.ToString(), r); + count++; + } + return; + } + + /// + /// Updates the registry. + /// + public void UpdateRegistry() + { + PluginRegistry.Update(); + } + + // Show plugin info + /// + /// Addins the info. + /// + /// + /// The info. + /// + /// + /// Arguments. + /// + public bool AddinInfo(int ndx, out Dictionary result) + { + Dictionary res = new Dictionary(); + result = res; + + Addin[] addins = GetSortedAddinList("RobustPlugin"); + + if (ndx > (addins.Length - 1)) + { + MainConsole.Instance.Output("Selection out of range"); + return false; + } + // author category description + Addin addin = addins[ndx]; + + res["author"] = addin.Description.Author; + res["category"] = addin.Description.Category; + res["description"] = addin.Description.Description; + res["name"] = addin.Name; + res["url"] = addin.Description.Url; + res["file_name"] = addin.Description.FileName; + + result = res; + return true; + } + + // Disable a plugin + /// + /// Disables the plugin. + /// + /// + /// Arguments. + /// + public void DisablePlugin(string[] args) + { + Addin[] addins = GetSortedAddinList("RobustPlugin"); + + int n = Convert.ToInt16(args[2]); + if (n > (addins.Length -1)) + { + MainConsole.Instance.Output("Selection out of range"); + return; + } + + Addin addin = addins[n]; + AddinManager.Registry.DisableAddin(addin.Id); + addin.Enabled = false; + return; + } + + // Enable plugin + /// + /// Enables the plugin. + /// + /// + /// Arguments. + /// + public void EnablePlugin(string[] args) + { + Addin[] addins = GetSortedAddinList("RobustPlugin"); + + int n = Convert.ToInt16(args[2]); + if (n > (addins.Length -1)) + { + MainConsole.Instance.Output("Selection out of range"); + return; + } + + Addin addin = addins[n]; + + addin.Enabled = true; + AddinManager.Registry.EnableAddin(addin.Id); + // AddinManager.Registry.Update(); + if(PluginRegistry.IsAddinEnabled(addin.Id)) + { + ConsoleProgressStatus ps = new ConsoleProgressStatus(false); + if (!AddinManager.AddinEngine.IsAddinLoaded(addin.Id)) + { + AddinManager.Registry.Rebuild(ps); + AddinManager.AddinEngine.LoadAddin(ps, addin.Id); + } + } + else + { + MainConsole.Instance.OutputFormat("Not Enabled in this domain {0}", addin.Name); + } + return; + } + + + + #region Util + private void Testing() + { + Addin[] list = Registry.GetAddins(); + + var addins = list.Where( a => a.Description.Category == "RobustPlugin"); + + foreach (Addin addin in addins) + { + MainConsole.Instance.OutputFormat("Addin {0}", addin.Name); + } + } + + // These will let us deal with numbered lists instead + // of needing to type in the full ids + private AddinRepositoryEntry[] GetSortedAvailbleAddins() + { + ArrayList list = new ArrayList(); + list.AddRange(Repositories.GetAvailableAddins()); + + AddinRepositoryEntry[] addins = list.ToArray(typeof(AddinRepositoryEntry)) as AddinRepositoryEntry[]; + + Array.Sort(addins,(r1,r2) => r1.Addin.Id.CompareTo(r2.Addin.Id)); + + return addins; + } + + private AddinRepository[] GetSortedAddinRepo() + { + ArrayList list = new ArrayList(); + list.AddRange(Repositories.GetRepositories()); + + AddinRepository[] repos = list.ToArray(typeof(AddinRepository)) as AddinRepository[]; + Array.Sort (repos,(r1,r2) => r1.Name.CompareTo(r2.Name)); + + return repos; + } + + private Addin[] GetSortedAddinList(string category) + { + + ArrayList xlist = new ArrayList(); + ArrayList list = new ArrayList(); + try + { + list.AddRange(PluginRegistry.GetAddins()); + } + catch(Exception e) + { + Addin[] x = xlist.ToArray(typeof(Addin)) as Addin[]; + return x; + } + + foreach (Addin addin in list) + { + if (addin.Description.Category == category) + xlist.Add(addin); + } + + Addin[] addins = xlist.ToArray(typeof(Addin)) as Addin[]; + Array.Sort(addins,(r1,r2) => r1.Id.CompareTo(r2.Id)); + + return addins; + } + #endregion Util + } +} diff --git a/OpenSim/Server/Base/CommandManager.cs b/OpenSim/Server/Base/CommandManager.cs index 45652b3..88aac00 100644 --- a/OpenSim/Server/Base/CommandManager.cs +++ b/OpenSim/Server/Base/CommandManager.cs @@ -33,15 +33,21 @@ using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using Mono.Addins; -using Mono.Addins.Setup; +// using Mono.Addins.Setup; using Mono.Addins.Description; using OpenSim.Framework; namespace OpenSim.Server.Base { + /// + /// Command manager - + /// Wrapper for OpenSim.Framework.PluginManager to allow + /// us to add commands to the console to perform operations + /// on our repos and plugins + /// public class CommandManager { - protected AddinRegistry PluginRegistry; + public AddinRegistry PluginRegistry; protected PluginManager PluginManager; public CommandManager(AddinRegistry registry) diff --git a/OpenSim/Server/Base/PluginManager.cs b/OpenSim/Server/Base/PluginManager.cs deleted file mode 100644 index d2cf668..0000000 --- a/OpenSim/Server/Base/PluginManager.cs +++ /dev/null @@ -1,557 +0,0 @@ - -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -using System; -using System.Text; -using System.Linq; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using Mono.Addins; -using Mono.Addins.Setup; -using Mono.Addins.Description; -using OpenSim.Framework; - -namespace OpenSim.Server.Base -{ - public class PluginManager : SetupService - { - protected AddinRegistry PluginRegistry; - - internal PluginManager(AddinRegistry registry): base (registry) - { - PluginRegistry = registry; - - } - - /// - /// Installs the plugin. - /// - /// - /// The plugin. - /// - /// - /// Arguments. - /// - public bool InstallPlugin(int ndx, out Dictionary result) - { - Dictionary res = new Dictionary(); - - PackageCollection pack = new PackageCollection(); - PackageCollection toUninstall; - DependencyCollection unresolved; - - IProgressStatus ps = new ConsoleProgressStatus(false); - - AddinRepositoryEntry[] available = GetSortedAvailbleAddins(); - - if (ndx > (available.Length - 1)) - { - MainConsole.Instance.Output("Selection out of range"); - result = res; - return false; - } - - AddinRepositoryEntry aentry = available[ndx]; - - Package p = Package.FromRepository(aentry); - pack.Add(p); - - ResolveDependencies(ps, pack, out toUninstall, out unresolved); - - // Attempt to install the plugin disabled - if (Install(ps, pack) == true) - { - PluginRegistry.Update(ps); - Addin addin = PluginRegistry.GetAddin(aentry.Addin.Id); - PluginRegistry.DisableAddin(addin.Id); - addin.Enabled = false; - - MainConsole.Instance.Output("Installation Success"); - ListInstalledAddins(out res); - result = res; - return true; - } - else - { - MainConsole.Instance.Output("Installation Failed"); - result = res; - return false; - } - } - - // Remove plugin - /// - /// Uns the install. - /// - /// - /// Arguments. - /// - public void UnInstall(int ndx) - { - Addin[] addins = GetSortedAddinList("RobustPlugin"); - - if (ndx > (addins.Length -1)) - { - MainConsole.Instance.Output("Selection out of range"); - return; - } - - Addin addin = addins[ndx]; - MainConsole.Instance.OutputFormat("Uninstalling plugin {0}", addin.Id); - AddinManager.Registry.DisableAddin(addin.Id); - addin.Enabled = false; - IProgressStatus ps = new ConsoleProgressStatus(false); - Uninstall(ps, addin.Id); - MainConsole.Instance.Output("Uninstall Success - restart to complete operation"); - return; - } - - /// - /// Checks the installed. - /// - /// - /// The installed. - /// - public string CheckInstalled() - { - return "CheckInstall"; - } - - /// - /// Lists the installed addins. - /// - /// - /// Result. - /// - public void ListInstalledAddins(out Dictionary result) - { - Dictionary res = new Dictionary(); - - Addin[] addins = GetSortedAddinList("RobustPlugin"); - if(addins.Count() < 1) - { - MainConsole.Instance.Output("Error!"); - } - int count = 0; - foreach (Addin addin in addins) - { - Dictionary r = new Dictionary(); - r["enabled"] = addin.Enabled == true ? true : false; - r["name"] = addin.LocalId; - r["version"] = addin.Version; - - res.Add(count.ToString(), r); - - count++; - } - result = res; - return; - } - - // List compatible plugins in registered repositories - /// - /// Lists the available. - /// - /// - /// Result. - /// - public void ListAvailable(out Dictionary result) - { - Dictionary res = new Dictionary(); - - AddinRepositoryEntry[] addins = GetSortedAvailbleAddins(); - - int count = 0; - foreach (AddinRepositoryEntry addin in addins) - { - Dictionary r = new Dictionary(); - r["name"] = addin.Addin.Name; - r["version"] = addin.Addin.Version; - r["repository"] = addin.RepositoryName; - - res.Add(count.ToString(), r); - count++; - } - result = res; - return; - } - - // List available updates ** 1 - /// - /// Lists the updates. - /// - public void ListUpdates() - { - IProgressStatus ps = new ConsoleProgressStatus(true); - Console.WriteLine ("Looking for updates..."); - Repositories.UpdateAllRepositories (ps); - Console.WriteLine ("Available add-in updates:"); - bool found = false; - AddinRepositoryEntry[] entries = Repositories.GetAvailableUpdates(); - - foreach (AddinRepositoryEntry entry in entries) - { - Console.WriteLine(String.Format("{0}",entry.Addin.Id)); - } - } - - // Sync to repositories - /// - /// Update this instance. - /// - public string Update() - { - IProgressStatus ps = new ConsoleProgressStatus(true); - Repositories.UpdateAllRepositories(ps); - return "Update"; - } - - // Register a repository - /// - /// Register a repository with our server. - /// - /// - /// result of the action - /// - /// - /// The URL of the repository we want to add - /// - public bool AddRepository(string repo) - { - Repositories.RegisterRepository(null, repo, true); - PluginRegistry.Rebuild(null); - - return true; - } - - /// - /// Gets the repository. - /// - public void GetRepository() - { - Repositories.UpdateAllRepositories(new ConsoleProgressStatus(false)); - } - - // Remove a repository from the list - /// - /// Removes the repository. - /// - /// - /// Arguments. - /// - public void RemoveRepository(string[] args) - { - AddinRepository[] reps = Repositories.GetRepositories(); - Array.Sort(reps, (r1,r2) => r1.Title.CompareTo(r2.Title)); - if (reps.Length == 0) - { - MainConsole.Instance.Output("No repositories have been registered."); - return; - } - - int n = Convert.ToInt16(args[2]); - if (n > (reps.Length -1)) - { - MainConsole.Instance.Output("Selection out of range"); - return; - } - - AddinRepository rep = reps[n]; - Repositories.RemoveRepository(rep.Url); - return; - } - - // Enable repository - /// - /// Enables the repository. - /// - /// - /// Arguments. - /// - public void EnableRepository(string[] args) - { - AddinRepository[] reps = Repositories.GetRepositories(); - Array.Sort(reps, (r1,r2) => r1.Title.CompareTo(r2.Title)); - if (reps.Length == 0) - { - MainConsole.Instance.Output("No repositories have been registered."); - return; - } - - int n = Convert.ToInt16(args[2]); - if (n > (reps.Length -1)) - { - MainConsole.Instance.Output("Selection out of range"); - return; - } - - AddinRepository rep = reps[n]; - Repositories.SetRepositoryEnabled(rep.Url, true); - return; - } - - // Disable a repository - /// - /// Disables the repository. - /// - /// - /// Arguments. - /// - public void DisableRepository(string[] args) - { - AddinRepository[] reps = Repositories.GetRepositories(); - Array.Sort(reps, (r1,r2) => r1.Title.CompareTo(r2.Title)); - if (reps.Length == 0) - { - MainConsole.Instance.Output("No repositories have been registered."); - return; - } - - int n = Convert.ToInt16(args[2]); - if (n > (reps.Length -1)) - { - MainConsole.Instance.Output("Selection out of range"); - return; - } - - AddinRepository rep = reps[n]; - Repositories.SetRepositoryEnabled(rep.Url, false); - return; - } - - // List registered repositories - /// - /// Lists the repositories. - /// - /// - /// Result. - /// - public void ListRepositories(out Dictionary result) - { - Dictionary res = new Dictionary(); - result = res; - - AddinRepository[] reps = GetSortedAddinRepo(); - if (reps.Length == 0) - { - MainConsole.Instance.Output("No repositories have been registered."); - return; - } - - int count = 0; - foreach (AddinRepository rep in reps) - { - Dictionary r = new Dictionary(); - r["enabled"] = rep.Enabled == true ? true : false; - r["name"] = rep.Name; - r["url"] = rep.Url; - - res.Add(count.ToString(), r); - count++; - } - return; - } - - /// - /// Updates the registry. - /// - public void UpdateRegistry() - { - PluginRegistry.Update(); - } - - // Show plugin info - /// - /// Addins the info. - /// - /// - /// The info. - /// - /// - /// Arguments. - /// - public bool AddinInfo(int ndx, out Dictionary result) - { - Dictionary res = new Dictionary(); - result = res; - - Addin[] addins = GetSortedAddinList("RobustPlugin"); - - if (ndx > (addins.Length - 1)) - { - MainConsole.Instance.Output("Selection out of range"); - return false; - } - // author category description - Addin addin = addins[ndx]; - - res["author"] = addin.Description.Author; - res["category"] = addin.Description.Category; - res["description"] = addin.Description.Description; - res["name"] = addin.Name; - res["url"] = addin.Description.Url; - res["file_name"] = addin.Description.FileName; - - result = res; - return true; - } - - // Disable a plugin - /// - /// Disables the plugin. - /// - /// - /// Arguments. - /// - public void DisablePlugin(string[] args) - { - Addin[] addins = GetSortedAddinList("RobustPlugin"); - - int n = Convert.ToInt16(args[2]); - if (n > (addins.Length -1)) - { - MainConsole.Instance.Output("Selection out of range"); - return; - } - - Addin addin = addins[n]; - AddinManager.Registry.DisableAddin(addin.Id); - addin.Enabled = false; - return; - } - - // Enable plugin - /// - /// Enables the plugin. - /// - /// - /// Arguments. - /// - public void EnablePlugin(string[] args) - { - Addin[] addins = GetSortedAddinList("RobustPlugin"); - - int n = Convert.ToInt16(args[2]); - if (n > (addins.Length -1)) - { - MainConsole.Instance.Output("Selection out of range"); - return; - } - - Addin addin = addins[n]; - - addin.Enabled = true; - AddinManager.Registry.EnableAddin(addin.Id); - // AddinManager.Registry.Update(); - if(PluginRegistry.IsAddinEnabled(addin.Id)) - { - ConsoleProgressStatus ps = new ConsoleProgressStatus(false); - if (!AddinManager.AddinEngine.IsAddinLoaded(addin.Id)) - { - AddinManager.Registry.Rebuild(ps); - AddinManager.AddinEngine.LoadAddin(ps, addin.Id); - } - } - else - { - MainConsole.Instance.OutputFormat("Not Enabled in this domain {0}", addin.Name); - } - return; - } - - - - #region Util - private void Testing() - { - Addin[] list = Registry.GetAddins(); - - var addins = list.Where( a => a.Description.Category == "RobustPlugin"); - - foreach (Addin addin in addins) - { - MainConsole.Instance.OutputFormat("Addin {0}", addin.Name); - } - } - - // These will let us deal with numbered lists instead - // of needing to type in the full ids - private AddinRepositoryEntry[] GetSortedAvailbleAddins() - { - ArrayList list = new ArrayList(); - list.AddRange(Repositories.GetAvailableAddins()); - - AddinRepositoryEntry[] addins = list.ToArray(typeof(AddinRepositoryEntry)) as AddinRepositoryEntry[]; - - Array.Sort(addins,(r1,r2) => r1.Addin.Id.CompareTo(r2.Addin.Id)); - - return addins; - } - - private AddinRepository[] GetSortedAddinRepo() - { - ArrayList list = new ArrayList(); - list.AddRange(Repositories.GetRepositories()); - - AddinRepository[] repos = list.ToArray(typeof(AddinRepository)) as AddinRepository[]; - Array.Sort (repos,(r1,r2) => r1.Name.CompareTo(r2.Name)); - - return repos; - } - - private Addin[] GetSortedAddinList(string category) - { - - ArrayList xlist = new ArrayList(); - ArrayList list = new ArrayList(); - try - { - list.AddRange(PluginRegistry.GetAddins()); - } - catch(Exception e) - { - Addin[] x = xlist.ToArray(typeof(Addin)) as Addin[]; - return x; - } - - foreach (Addin addin in list) - { - if (addin.Description.Category == category) - xlist.Add(addin); - } - - Addin[] addins = xlist.ToArray(typeof(Addin)) as Addin[]; - Array.Sort(addins,(r1,r2) => r1.Id.CompareTo(r2.Id)); - - return addins; - } - #endregion Util - } -} \ No newline at end of file diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 8ecf3d3..31b0446 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs @@ -111,17 +111,18 @@ namespace OpenSim.Server.Base case ExtensionChange.Add: if (a.AddinFile.Contains(Registry.DefaultAddinsFolder)) { - m_log.InfoFormat("[SERVER]: Adding {0}", a.Name); + m_log.InfoFormat("[SERVER]: Adding {0} from registry", a.Name); connector.PluginPath = String.Format("{0}/{1}", Registry.DefaultAddinsFolder, a.Name.Replace(',', '.')); } else { - m_log.InfoFormat("[SERVER]: Removing {0}", a.Name); + m_log.InfoFormat("[SERVER]: Adding {0} from ./bin", a.Name); connector.PluginPath = a.AddinFile; } LoadPlugin(connector); break; case ExtensionChange.Remove: + m_log.InfoFormat("[SERVER]: Removing {0}", a.Name); UnloadPlugin(connector); break; } diff --git a/OpenSim/Server/Handlers/Base/ServerConnector.cs b/OpenSim/Server/Handlers/Base/ServerConnector.cs index 067fd2a..72014db 100644 --- a/OpenSim/Server/Handlers/Base/ServerConnector.cs +++ b/OpenSim/Server/Handlers/Base/ServerConnector.cs @@ -41,8 +41,7 @@ namespace OpenSim.Server.Handlers.Base { public virtual string ConfigURL { - get; - protected set; + get { return String.Empty; } } public virtual string ConfigName @@ -95,7 +94,10 @@ namespace OpenSim.Server.Handlers.Base return config; } - // We get our remote initial configuration for bootstrapping + // We get our remote initial configuration for bootstrapping in case + // we have no configuration in our main file or in an existing + // modular config file. This is the last resort to bootstrap the + // configuration, likely a new plugin loading for the first time. private IConfigSource GetConfigSource() { IConfigSource source = null; diff --git a/prebuild.xml b/prebuild.xml index 82c4dc9..6c58e38 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -105,6 +105,7 @@ + @@ -737,7 +738,6 @@ - -- cgit v1.1 From f473252fa8022f95f60e219b24ffa342966f8c13 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Nov 2012 03:56:53 +0000 Subject: Add AllowRegionRestartFromClient setting to [EstateManagement] section of OpenSim.ini. Setting this to false will block all restart requests from the viewer even if they are otherwise legitimate. One use is to block region restarts if necessary whilst restart functionality remains buggy or triggers bugs in modules, though these should be fixed as soon as practicable. Default is true, as has been the case historically. --- .../World/Estate/EstateManagementModule.cs | 103 +++++++++++++-------- bin/OpenSimDefaults.ini | 6 ++ 2 files changed, 69 insertions(+), 40 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index f974a63..eb06fcc 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -53,6 +53,11 @@ namespace OpenSim.Region.CoreModules.World.Estate protected EstateManagementCommands m_commands; + /// + /// If false, region restart requests from the client are blocked even if they are otherwise legitimate. + /// + public bool AllowRegionRestartFromClient { get; set; } + private EstateTerrainXferHandler TerrainUploader; public TelehubManager m_Telehub; @@ -60,6 +65,53 @@ namespace OpenSim.Region.CoreModules.World.Estate public event ChangeDelegate OnEstateInfoChange; public event MessageDelegate OnEstateMessage; + #region Region Module interface + + public string Name { get { return "EstateManagementModule"; } } + + public Type ReplaceableInterface { get { return null; } } + + public void Initialise(IConfigSource source) + { + AllowRegionRestartFromClient = true; + + IConfig config = source.Configs["EstateManagement"]; + + if (config != null) + AllowRegionRestartFromClient = config.GetBoolean("AllowRegionRestartFromClient", true); + } + + public void AddRegion(Scene scene) + { + Scene = scene; + Scene.RegisterModuleInterface(this); + Scene.EventManager.OnNewClient += EventManager_OnNewClient; + Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; + + m_Telehub = new TelehubManager(scene); + + m_commands = new EstateManagementCommands(this); + m_commands.Initialise(); + } + + public void RemoveRegion(Scene scene) {} + + public void RegionLoaded(Scene scene) + { + // Sets up the sun module based no the saved Estate and Region Settings + // DO NOT REMOVE or the sun will stop working + scene.TriggerEstateSunUpdate(); + + UserManager = scene.RequestModuleInterface(); + } + + public void Close() + { + m_commands.Close(); + } + + #endregion + #region Packet Data Responders private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice) @@ -184,6 +236,7 @@ namespace OpenSim.Region.CoreModules.World.Estate Scene.RegionInfo.RegionSettings.TerrainTexture4 = texture; break; } + Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); sendRegionInfoPacketToAll(); @@ -215,6 +268,7 @@ namespace OpenSim.Region.CoreModules.World.Estate Scene.RegionInfo.RegionSettings.Elevation2NE = highValue; break; } + Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); sendRegionHandshakeToAll(); @@ -255,6 +309,12 @@ namespace OpenSim.Region.CoreModules.World.Estate private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds) { + if (!AllowRegionRestartFromClient) + { + remoteClient.SendAlertMessage("Region restart has been disabled on this simulator."); + return; + } + IRestartModule restartModule = Scene.RequestModuleInterface(); if (restartModule != null) { @@ -329,6 +389,7 @@ namespace OpenSim.Region.CoreModules.World.Estate } } + if ((estateAccessType & 8) != 0) // User remove { if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) @@ -360,6 +421,7 @@ namespace OpenSim.Region.CoreModules.World.Estate remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); } } + if ((estateAccessType & 16) != 0) // Group add { if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true)) @@ -623,7 +685,7 @@ namespace OpenSim.Region.CoreModules.World.Estate } } - public void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) + public void handleOnEstateManageTelehub(IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) { SceneObjectPart part; @@ -1081,45 +1143,6 @@ namespace OpenSim.Region.CoreModules.World.Estate #endregion - #region Region Module interface - - public string Name { get { return "EstateManagementModule"; } } - - public Type ReplaceableInterface { get { return null; } } - - public void Initialise(IConfigSource source) {} - - public void AddRegion(Scene scene) - { - Scene = scene; - Scene.RegisterModuleInterface(this); - Scene.EventManager.OnNewClient += EventManager_OnNewClient; - Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; - - m_Telehub = new TelehubManager(scene); - - m_commands = new EstateManagementCommands(this); - m_commands.Initialise(); - } - - public void RemoveRegion(Scene scene) {} - - public void RegionLoaded(Scene scene) - { - // Sets up the sun module based no the saved Estate and Region Settings - // DO NOT REMOVE or the sun will stop working - scene.TriggerEstateSunUpdate(); - - UserManager = scene.RequestModuleInterface(); - } - - public void Close() - { - m_commands.Close(); - } - - #endregion - #region Other Functions public void changeWaterHeight(float height) diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 818321e..19e081f 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -368,6 +368,12 @@ ; alert_uri = "http://myappserver.net/my_handler/" +[EstateManagement] + ; If false, then block any region restart requests from the client even if they are otherwise valid. + ; Default is true + AllowRegionRestartFromClient = true + + [SMTP] enabled = false -- cgit v1.1 From 1f336579c87b6b9e3152175c8b6724bff2777b65 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Nov 2012 04:06:48 +0000 Subject: minor: Make note in log if scene was restarted due to an unrecoverable physics error --- OpenSim/Region/Framework/Scenes/Scene.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 8ef22bd..1ad5edd 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -740,7 +740,12 @@ namespace OpenSim.Region.Framework.Scenes // // Out of memory // Operating system has killed the plugin - m_sceneGraph.UnRecoverableError += RestartNow; + m_sceneGraph.UnRecoverableError + += () => + { + m_log.ErrorFormat("[SCENE]: Restarting region {0} due to unrecoverable physics crash", Name); + RestartNow(); + }; RegisterDefaultSceneEvents(); -- cgit v1.1 From acc1810af2d4527d9cb0e3e7aaaf43c2f54ffb43 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Nov 2012 04:08:17 +0000 Subject: minor: remove some mono compiler warnings --- OpenSim/Region/CoreModules/World/Sound/SoundModule.cs | 4 ++-- OpenSim/Region/CoreModules/World/Wind/WindModule.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs index 513a8f5..089fcda 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs @@ -43,8 +43,8 @@ namespace OpenSim.Region.CoreModules.World.Sound [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SoundModule")] public class SoundModule : INonSharedRegionModule, ISoundModule { - private static readonly ILog m_log = LogManager.GetLogger( - MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger( +// MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene; diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs index fd8e2b4..9de588c 100644 --- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs +++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs @@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules public void Initialise(IConfigSource config) { m_windConfig = config.Configs["Wind"]; - string desiredWindPlugin = m_dWindPluginName; +// string desiredWindPlugin = m_dWindPluginName; if (m_windConfig != null) { -- cgit v1.1 From edbdbd44b95b6fb11958eda1cd8e70da799849b5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Nov 2012 04:09:45 +0000 Subject: Enable further client stack packet pooling by default by setting RecycleBaseUDPPackets = true by default. This reduces base memory churn of every client connection, improving the garbage collection situation. The effect is a significant portion of base load (an avatar standing still on a completely blank island) but will probably still be swallowed up by other memory use on active regions. Tests have shown no noticeable impact on speed of processing incoming packets, though setting remains in case a switch back is needed. --- bin/OpenSimDefaults.ini | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 19e081f..8a451ec 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -1592,8 +1592,7 @@ ; If true, then the basic packet objects used to receive data are also recycled, not just the LLUDP packets. ; This reduces data churn - ; This setting is currently experimental and defaults to false. - RecycleBaseUDPPackets = false; + RecycleBaseUDPPackets = true [InterestManagement] -- cgit v1.1 From 065d6d6fe1c8cd010d2bf0e68d6a2a926b17fc5c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Nov 2012 04:15:21 +0000 Subject: Delete unused BaseHttpServer.HandleAgentRequest() --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 53 ---------------------- 1 file changed, 53 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 66d80cf..2cd626f 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -1282,59 +1282,6 @@ namespace OpenSim.Framework.Servers.HttpServer map["login"] = OSD.FromString("false"); return map; } - /// - /// A specific agent handler was provided. Such a handler is expecetd to have an - /// intimate, and highly specific relationship with the client. Consequently, - /// nothing is done here. - /// - /// - /// - /// - - private bool HandleAgentRequest(IHttpAgentHandler handler, OSHttpRequest request, OSHttpResponse response) - { - // In the case of REST, then handler is responsible for ALL aspects of - // the request/response handling. Nothing is done here, not even encoding. - - try - { - return handler.Handle(request, response); - } - catch (Exception e) - { - // If the handler did in fact close the stream, then this will blow - // chunks. So that that doesn't disturb anybody we throw away any - // and all exceptions raised. We've done our best to release the - // client. - try - { - m_log.Warn("[HTTP-AGENT]: Error - " + e.Message); - response.SendChunked = false; - response.KeepAlive = true; - response.StatusCode = (int)OSHttpStatusCode.ServerErrorInternalError; - //response.OutputStream.Close(); - try - { - response.Send(); - //response.FreeContext(); - } - catch (SocketException f) - { - // This has to be here to prevent a Linux/Mono crash - m_log.Warn( - String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux. ", f.Message), f); - } - } - catch(Exception) - { - } - } - - // Indicate that the request has been "handled" - - return true; - - } public byte[] HandleHTTPRequest(OSHttpRequest request, OSHttpResponse response) { -- cgit v1.1 From 4b46a0d5368ae1ae95b5ba817f0ef4f7ed0c2692 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Nov 2012 04:19:08 +0000 Subject: Make "show version" console command available across all servers --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 8 -------- OpenSim/Framework/Servers/ServerBase.cs | 7 +++++++ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 89d3507..d8b4737 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -104,10 +104,6 @@ namespace OpenSim.Framework.Servers "show threads", "Show thread status", HandleShow); - m_console.Commands.AddCommand("General", false, "show version", - "show version", - "Show server version", HandleShow); - m_console.Commands.AddCommand("General", false, "threads abort", "threads abort ", "Abort a managed thread. Use \"show threads\" to find possible threads.", HandleThreadsAbort); @@ -263,10 +259,6 @@ namespace OpenSim.Framework.Servers case "threads": Notice(GetThreadsReport()); break; - - case "version": - Notice(GetVersionText()); - break; } } diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs index c182a3a..431dc9e 100644 --- a/OpenSim/Framework/Servers/ServerBase.cs +++ b/OpenSim/Framework/Servers/ServerBase.cs @@ -168,6 +168,9 @@ namespace OpenSim.Framework.Servers "General", false, "show info", "show info", "Show general information about the server", HandleShow); m_console.Commands.AddCommand( + "General", false, "show version", "show version", "Show server version", HandleShow); + + m_console.Commands.AddCommand( "General", false, "show uptime", "show uptime", "Show server uptime", HandleShow); m_console.Commands.AddCommand( @@ -222,6 +225,10 @@ namespace OpenSim.Framework.Servers ShowInfo(); break; + case "version": + Notice(GetVersionText()); + break; + case "uptime": Notice(GetUptimeReport()); break; -- cgit v1.1 From e0a3e01850ea066ef10bfe59ffa81b8ac425442a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 23 Nov 2012 04:27:04 +0000 Subject: Make "force gc" console command available across all servers --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 11 ----------- OpenSim/Framework/Servers/ServerBase.cs | 12 ++++++++++++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index d8b4737..3f66ab5 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -112,17 +112,6 @@ namespace OpenSim.Framework.Servers "threads show", "Show thread status. Synonym for \"show threads\"", (string module, string[] args) => Notice(GetThreadsReport())); - - m_console.Commands.AddCommand("General", false, "force gc", - "force gc", - "Manually invoke runtime garbage collection. For debugging purposes", - HandleForceGc); - } - - private void HandleForceGc(string module, string[] args) - { - MainConsole.Instance.Output("Manually invoking runtime garbage collection"); - GC.Collect(); } /// diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs index 431dc9e..b8bc27e 100644 --- a/OpenSim/Framework/Servers/ServerBase.cs +++ b/OpenSim/Framework/Servers/ServerBase.cs @@ -209,6 +209,18 @@ namespace OpenSim.Framework.Servers "General", false, "command-script", "command-script --> + + + + + +Your browser does not support Javascript. This won't work for you. + + + + + + + + + + +Simulator Stats + + + + + + +Region Stats + + + + + + +Sessions + + + + + + +Log File + + + + + + + + + +
+Your browser does not support Javascript. This won't work for you. +