From aa5b4b6437e3b11129ac08941992993a7660bbaf Mon Sep 17 00:00:00 2001 From: MW Date: Sat, 28 Feb 2009 16:04:11 +0000 Subject: [PATCH] Deleted the userserver project. As now the gridserver plugins and userserver plugins are loadable from the single server exe (gridserver.exe). Which plugins it loads (either those for gridserver or those for userserver or both) is defined in the opensim.grid.ini file (see opensim.grid.ini.example). Also all config settings are now in that ini file rather than the old xml files. So edit that file with your changes, as the server no longer asks startup questions for those values. And finally note all this is in a branch so no need for anyone to panic about all these changes. --- .../Resources/GridServer.Modules.addin.xml | 2 +- OpenSim/Grid/GridServer/GridServerBase.cs | 51 ++++-- OpenSim/Grid/UserServer/Main.cs | 150 ------------------ .../UserServer/Properties/AssemblyInfo.cs | 63 -------- .../Region/Application/ConfigurationLoader.cs | 7 +- bin/OpenSim.Grid.ini.example | 30 ++++ prebuild.xml | 39 +---- 7 files changed, 78 insertions(+), 264 deletions(-) delete mode 100644 OpenSim/Grid/UserServer/Main.cs delete mode 100644 OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs create mode 100644 bin/OpenSim.Grid.ini.example diff --git a/OpenSim/Grid/GridServer.Modules/Resources/GridServer.Modules.addin.xml b/OpenSim/Grid/GridServer.Modules/Resources/GridServer.Modules.addin.xml index c2c5ac3708..5a806ef555 100644 --- a/OpenSim/Grid/GridServer.Modules/Resources/GridServer.Modules.addin.xml +++ b/OpenSim/Grid/GridServer.Modules/Resources/GridServer.Modules.addin.xml @@ -6,6 +6,6 @@ - + diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs index 77c0255f92..1178725364 100644 --- a/OpenSim/Grid/GridServer/GridServerBase.cs +++ b/OpenSim/Grid/GridServer/GridServerBase.cs @@ -96,23 +96,42 @@ namespace OpenSim.Grid.GridServer { uint httpPort = 8051; - m_gconfig = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml"))); + // m_gconfig = new GridConfig("GRID SERVER", (Path.Combine(Util.configDir(), "GridServer_Config.xml"))); - m_uconfig = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); + //m_uconfig = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); + + m_uconfig = new UserConfig(); + m_uconfig.LoadConfigurationFromNini(m_configSource.Source); + + m_gconfig = new GridConfig(); + m_gconfig.LoadConfigurationFromNini(m_configSource.Source); + + Console.WriteLine("grid server database provider is {0} ", m_gconfig.DatabaseProvider); IConfig startupConfig = m_configSource.Source.Configs["Startup"]; if (startupConfig != null) { Convert.ToUInt32(startupConfig.GetString("HttpPort", "8051")); + + m_log.Info("[GRID]: Starting HTTP process"); + m_httpServer = new BaseHttpServer(httpPort); + + string pluginsToLoad = startupConfig.GetString("LoadPlugins", ""); + + if (!String.IsNullOrEmpty(pluginsToLoad)) + { + LoadPlugins(pluginsToLoad); + } + else + { + LoadPlugins(); + } + + m_httpServer.Start(); + } - - m_log.Info("[GRID]: Starting HTTP process"); - m_httpServer = new BaseHttpServer(httpPort); - - LoadPlugins(); - - m_httpServer.Start(); - + + base.StartupSpecific(); } @@ -125,6 +144,18 @@ namespace OpenSim.Grid.GridServer m_plugins = loader.Plugins; } + protected virtual void LoadPlugins(string pluginNames) + { + PluginLoader loader = + new PluginLoader(new GridPluginInitialiser(this)); + + PluginIdFilter filer = new PluginIdFilter(pluginNames); + loader.Add("/OpenSim/GridServer", filer); + + loader.Load(); + m_plugins = loader.Plugins; + } + public override void ShutdownSpecific() { foreach (IGridPlugin plugin in m_plugins) plugin.Dispose(); diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs deleted file mode 100644 index c527252a06..0000000000 --- a/OpenSim/Grid/UserServer/Main.cs +++ /dev/null @@ -1,150 +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 OpenSim 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.Collections.Generic; -using System.IO; -using System.Reflection; -using log4net; -using log4net.Config; -using OpenMetaverse; -using OpenSim.Data; -using OpenSim.Framework; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Communications.Cache; -using OpenSim.Framework.Console; -using OpenSim.Framework.Servers; -using OpenSim.Framework.Statistics; -using OpenSim.Grid.Communications.OGS1; -using OpenSim.Grid.Framework; -using OpenSim.Grid.UserServer.Modules; - -namespace OpenSim.Grid.UserServer -{ - /// - /// Grid user server main class - /// - public class OpenUser_Main : BaseOpenSimServer, IGridServiceCore - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - protected UserConfig Cfg; - - protected UserServerPlugin m_serverPlugin; - - public static void Main(string[] args) - { - XmlConfigurator.Configure(); - - m_log.Info("Launching UserServer..."); - - OpenUser_Main userserver = new OpenUser_Main(); - - userserver.Startup(); - userserver.Work(); - } - - public OpenUser_Main() - { - m_console = new ConsoleBase("User"); - MainConsole.Instance = m_console; - } - - public void Work() - { - m_console.Notice("Enter help for a list of commands\n"); - - while (true) - { - m_console.Prompt(); - } - } - - protected override void StartupSpecific() - { - Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); - - m_stats = StatsManager.StartCollectingUserStats(); - - m_httpServer = new BaseHttpServer(Cfg.HttpPort); - - m_serverPlugin = new UserServerPlugin(); - m_serverPlugin.Initialise(m_httpServer, this, Cfg); - - m_httpServer.Start(); - - base.StartupSpecific(); - } - - public override void ShutdownSpecific() - { - - } - - #region IUGAIMCore - protected Dictionary m_moduleInterfaces = new Dictionary(); - - /// - /// Register an Module interface. - /// - /// - /// - public void RegisterInterface(T iface) - { - lock (m_moduleInterfaces) - { - if (!m_moduleInterfaces.ContainsKey(typeof(T))) - { - m_moduleInterfaces.Add(typeof(T), iface); - } - } - } - - public bool TryGet(out T iface) - { - if (m_moduleInterfaces.ContainsKey(typeof(T))) - { - iface = (T)m_moduleInterfaces[typeof(T)]; - return true; - } - iface = default(T); - return false; - } - - public T Get() - { - return (T)m_moduleInterfaces[typeof(T)]; - } - - public BaseHttpServer GetHttpServer() - { - return m_httpServer; - } - #endregion - - } -} diff --git a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs deleted file mode 100644 index 1cc2c43c53..0000000000 --- a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,63 +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 OpenSim 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.Reflection; -using System.Runtime.InteropServices; - -// General information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. - -[assembly : AssemblyTitle("OGS-UserServer")] -[assembly : AssemblyDescription("")] -[assembly : AssemblyConfiguration("")] -[assembly : AssemblyCompany("http://opensimulator.org")] -[assembly : AssemblyProduct("OGS-UserServer")] -[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")] -[assembly : AssemblyTrademark("")] -[assembly : AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. - -[assembly : ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM - -[assembly : Guid("e266513a-090b-4d38-80f6-8599eef68c8c")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// - -[assembly : AssemblyVersion("0.6.3.*")] -[assembly : AssemblyFileVersion("1.0.0.0")] diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs index 64797dabd6..799d7dfaec 100644 --- a/OpenSim/Region/Application/ConfigurationLoader.cs +++ b/OpenSim/Region/Application/ConfigurationLoader.cs @@ -93,8 +93,11 @@ namespace OpenSim string[] fileEntries = Directory.GetFiles(iniDirName); foreach (string filePath in fileEntries) { - // m_log.InfoFormat("reading ini file < {0} > from config dir", filePath); - ReadConfig(Path.GetFileName(filePath), filePath, m_config, false); + if (Path.GetExtension(filePath).ToLower() == ".ini") + { + // m_log.InfoFormat("reading ini file < {0} > from config dir", filePath); + ReadConfig(Path.GetFileName(filePath), filePath, m_config, false); + } } } diff --git a/bin/OpenSim.Grid.ini.example b/bin/OpenSim.Grid.ini.example new file mode 100644 index 0000000000..771b42625b --- /dev/null +++ b/bin/OpenSim.Grid.ini.example @@ -0,0 +1,30 @@ +[Startup] + HttpPort = 8001 + LoadPlugins = "GridServerPlugin,UserServerPlugin" + +[UserServerConfig] + DatabaseProvider = "OpenSim.Data.MySql.dll" + DatabaseConnect = "" + DefaultStartupMsg = "Welcome to opensim" + DefaultX = 1000 + DefaultY = 1000 + GridRecvKey = "key" + GridSendKey = "key" + HttpSSL = false + DefaultUserLevel = 0 + LibraryXmlfile = ".\inventory\Libraries.xml" + InventoryUrl = "http://127.0.0.1:8004/" + GridServerURL = "http://127.0.0.1:8001/" + EnableLLSDLogin = true + +[GridServerConfig] + DatabaseProvider = "OpenSim.Data.MySql.dll" + DatabaseConnect = "" + DefaultAssetServer = "http://127.0.0.1:8003/" + DefaultUserServer = "http://127.0.0.1:8001/" + SimRecvKey = "key" + SimSendKey = "key" + UserRecvKey = "key" + UserSendKey = "key" + AssetRecvKey = "key" + AssetSendKey = "key" \ No newline at end of file diff --git a/prebuild.xml b/prebuild.xml index d8e9f59c61..7cd60f2bff 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -742,6 +742,7 @@ + @@ -969,44 +970,6 @@ - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - - - - - - -