From 646bbbc84b8010e0dacbeed5342cdb045f46cc49 Mon Sep 17 00:00:00 2001 From: MW Date: Wed, 27 Jun 2007 15:28:52 +0000 Subject: Some work on restructuring the namespaces / project names. Note this doesn't compile yet as not all the code has been changed to use the new namespaces. Am committing it now for feedback on the namespaces. --- OpenSim/Grid/UserServer/Main.cs | 219 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 219 insertions(+) create mode 100644 OpenSim/Grid/UserServer/Main.cs (limited to 'OpenSim/Grid/UserServer/Main.cs') diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs new file mode 100644 index 0000000..5c27d57 --- /dev/null +++ b/OpenSim/Grid/UserServer/Main.cs @@ -0,0 +1,219 @@ +/* +* Copyright (c) Contributors, http://www.openmetaverse.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; +using System.Collections.Generic; +using System.Reflection; +using System.IO; +using System.Text; +using libsecondlife; +using OpenSim.Framework.User; +using OpenSim.Framework.Sims; +using OpenSim.Framework.Inventory; +using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Console; +using OpenSim.Servers; +using OpenSim.Framework.Utilities; +using OpenSim.GenericConfig; + +namespace OpenGridServices.UserServer +{ + /// + /// + public class OpenUser_Main : conscmd_callback + { + private string ConfigDll = "OpenUser.Config.UserConfigDb4o.dll"; + private string StorageDll = "OpenGrid.Framework.Data.MySQL.dll"; + private UserConfig Cfg; + protected IGenericConfig localXMLConfig; + + public UserManager m_userManager; + + public Dictionary UserSessions = new Dictionary(); + + LogBase m_console; + + [STAThread] + public static void Main(string[] args) + { + Console.WriteLine("Launching UserServer..."); + + OpenUser_Main userserver = new OpenUser_Main(); + + userserver.Startup(); + userserver.Work(); + } + + private OpenUser_Main() + { + m_console = new LogBase("opengrid-userserver-console.log", "OpenUser", this , false); + OpenSim.Framework.Console.MainLog.Instance = m_console; + } + + private void Work() + { + m_console.Notice("Enter help for a list of commands\n"); + + while (true) + { + m_console.MainLogPrompt(); + } + } + + public void Startup() + { + this.localXMLConfig = new XmlConfig("UserServerConfig.xml"); + this.localXMLConfig.LoadData(); + this.ConfigDB(this.localXMLConfig); + this.localXMLConfig.Close(); + + OpenSim.Framework.Console.MainLog.Instance.Verbose("Main.cs:Startup() - Loading configuration"); + Cfg = this.LoadConfigDll(this.ConfigDll); + Cfg.InitConfig(); + + OpenSim.Framework.Console.MainLog.Instance.Verbose("Main.cs:Startup() - Establishing data connection"); + m_userManager = new UserManager(); + m_userManager._config = Cfg; + m_userManager.AddPlugin(StorageDll); + + OpenSim.Framework.Console.MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process"); + BaseHttpServer httpServer = new BaseHttpServer(8002); + + httpServer.AddXmlRPCHandler("login_to_simulator", m_userManager.XmlRpcLoginMethod); + + httpServer.AddRestHandler("GET", "/user/name/", m_userManager.RestGetUserMethodName); + httpServer.AddRestHandler("GET", "/user/uuid/", m_userManager.RestGetUserMethodUUID); + + httpServer.AddRestHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod); + + httpServer.Start(); + m_console.Status("Userserver 0.3 - Startup complete"); + } + + + public void do_create(string what) + { + switch (what) + { + case "user": + string tempfirstname; + string templastname; + string tempMD5Passwd; + uint regX = 997; + uint regY = 996; + + tempfirstname = m_console.CmdPrompt("First name"); + templastname = m_console.CmdPrompt("Last name"); + tempMD5Passwd = m_console.PasswdPrompt("Password"); + regX = Convert.ToUInt32(m_console.CmdPrompt("Start Region X")); + regY = Convert.ToUInt32(m_console.CmdPrompt("Start Region Y")); + + tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); + + m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); + break; + } + } + + public void RunCmd(string cmd, string[] cmdparams) + { + switch (cmd) + { + case "help": + m_console.Notice("create user - create a new user"); + m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)"); + break; + + case "create": + do_create(cmdparams[0]); + break; + + case "shutdown": + m_console.Close(); + Environment.Exit(0); + break; + } + } + + private void ConfigDB(IGenericConfig configData) + { + try + { + string attri = ""; + attri = configData.GetAttribute("DataBaseProvider"); + if (attri == "") + { + StorageDll = "OpenGrid.Framework.Data.DB4o.dll"; + configData.SetAttribute("DataBaseProvider", "OpenGrid.Framework.Data.DB4o.dll"); + } + else + { + StorageDll = attri; + } + configData.Commit(); + } + catch (Exception e) + { + + } + } + + private UserConfig LoadConfigDll(string dllName) + { + Assembly pluginAssembly = Assembly.LoadFrom(dllName); + UserConfig config = null; + + foreach (Type pluginType in pluginAssembly.GetTypes()) + { + if (pluginType.IsPublic) + { + if (!pluginType.IsAbstract) + { + Type typeInterface = pluginType.GetInterface("IUserConfig", true); + + if (typeInterface != null) + { + IUserConfig plug = (IUserConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + config = plug.GetConfigObject(); + break; + } + + typeInterface = null; + } + } + } + pluginAssembly = null; + return config; + } + + public void Show(string ShowWhat) + { + } + } +} -- cgit v1.1 From 2261e4ec2a43a56dbb74168a169f39b2c6c1f054 Mon Sep 17 00:00:00 2001 From: mingchen Date: Wed, 27 Jun 2007 18:04:07 +0000 Subject: *Fixed all renaming for OpenGridServices.sln, still a reference issue in prebuild.xml though --- OpenSim/Grid/UserServer/Main.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Grid/UserServer/Main.cs') diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 5c27d57..c0ff649 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -38,18 +38,18 @@ using OpenSim.Framework.Sims; using OpenSim.Framework.Inventory; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Console; -using OpenSim.Servers; +using OpenSim.Framework.Servers; using OpenSim.Framework.Utilities; using OpenSim.GenericConfig; -namespace OpenGridServices.UserServer +namespace OpenSim.Grid.UserServer { /// /// public class OpenUser_Main : conscmd_callback { private string ConfigDll = "OpenUser.Config.UserConfigDb4o.dll"; - private string StorageDll = "OpenGrid.Framework.Data.MySQL.dll"; + private string StorageDll = "OpenSim.Framework.Data.MySQL.dll"; private UserConfig Cfg; protected IGenericConfig localXMLConfig; @@ -169,8 +169,8 @@ namespace OpenGridServices.UserServer attri = configData.GetAttribute("DataBaseProvider"); if (attri == "") { - StorageDll = "OpenGrid.Framework.Data.DB4o.dll"; - configData.SetAttribute("DataBaseProvider", "OpenGrid.Framework.Data.DB4o.dll"); + StorageDll = "OpenSim.Framework.Data.DB4o.dll"; + configData.SetAttribute("DataBaseProvider", "OpenSim.Framework.Data.DB4o.dll"); } else { -- cgit v1.1 From 440bb4a358cdc01559f624dbcbb7391d260616e0 Mon Sep 17 00:00:00 2001 From: mingchen Date: Thu, 28 Jun 2007 02:07:59 +0000 Subject: *Fixed UserServer and OpenSim so now they start without crashing. --- OpenSim/Grid/UserServer/Main.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Grid/UserServer/Main.cs') diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index c0ff649..8ae4dbf 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -48,7 +48,7 @@ namespace OpenSim.Grid.UserServer /// public class OpenUser_Main : conscmd_callback { - private string ConfigDll = "OpenUser.Config.UserConfigDb4o.dll"; + private string ConfigDll = "OpenSim.Grid.UserServer.Config.dll"; private string StorageDll = "OpenSim.Framework.Data.MySQL.dll"; private UserConfig Cfg; protected IGenericConfig localXMLConfig; -- cgit v1.1 From bee543300fc812277e9a9478dc05b986e00ed44e Mon Sep 17 00:00:00 2001 From: mingchen Date: Thu, 28 Jun 2007 14:45:46 +0000 Subject: *User Profile requests on OGS UserServer now uses XMLRPC instead of REST *Added base support for setting up a master user --- OpenSim/Grid/UserServer/Main.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Grid/UserServer/Main.cs') diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 8ae4dbf..640f91a 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -107,8 +107,8 @@ namespace OpenSim.Grid.UserServer httpServer.AddXmlRPCHandler("login_to_simulator", m_userManager.XmlRpcLoginMethod); - httpServer.AddRestHandler("GET", "/user/name/", m_userManager.RestGetUserMethodName); - httpServer.AddRestHandler("GET", "/user/uuid/", m_userManager.RestGetUserMethodUUID); + httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); + httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID); httpServer.AddRestHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod); -- cgit v1.1 From 5e805656db1215518a344d6d5364629a4997fd47 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Sun, 1 Jul 2007 13:17:27 +0000 Subject: Fixed SimpleApp - aka thankgoditssundaycommit * Updated SimpleApp with various introduced dependencies * Extracted ScenePrescence creation in Scene * removed try-catchall from UserManagerBase (that actually hid a bug) * Refactored RegionInfo * handle is calculated * it will explode upon accessing x,y,ip,port,externalip if not explicitly initialized * Removed superfluous 'ref' keywords * Removed a shitload of 'catch Exception e' that causes build warnings * Lots of small refactorings, renames et c * Ignored some bins --- OpenSim/Grid/UserServer/Main.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Grid/UserServer/Main.cs') diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 640f91a..c65bb97 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -178,7 +178,7 @@ namespace OpenSim.Grid.UserServer } configData.Commit(); } - catch (Exception e) + catch { } -- cgit v1.1 From 9b6b6d05d45cf0f754a0b26bf6240ef50be66563 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Tue, 3 Jul 2007 14:37:29 +0000 Subject: * Optimized usings (the 'LL ate my scripts' commit) * added some licensing info --- OpenSim/Grid/UserServer/Main.cs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'OpenSim/Grid/UserServer/Main.cs') diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index c65bb97..5560e7d 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -27,18 +27,13 @@ */ using System; -using System.Collections; using System.Collections.Generic; using System.Reflection; -using System.IO; -using System.Text; using libsecondlife; -using OpenSim.Framework.User; -using OpenSim.Framework.Sims; -using OpenSim.Framework.Inventory; -using OpenSim.Framework.Interfaces; using OpenSim.Framework.Console; +using OpenSim.Framework.Interfaces; using OpenSim.Framework.Servers; +using OpenSim.Framework.User; using OpenSim.Framework.Utilities; using OpenSim.GenericConfig; @@ -73,7 +68,7 @@ namespace OpenSim.Grid.UserServer private OpenUser_Main() { m_console = new LogBase("opengrid-userserver-console.log", "OpenUser", this , false); - OpenSim.Framework.Console.MainLog.Instance = m_console; + MainLog.Instance = m_console; } private void Work() @@ -93,16 +88,16 @@ namespace OpenSim.Grid.UserServer this.ConfigDB(this.localXMLConfig); this.localXMLConfig.Close(); - OpenSim.Framework.Console.MainLog.Instance.Verbose("Main.cs:Startup() - Loading configuration"); + MainLog.Instance.Verbose("Main.cs:Startup() - Loading configuration"); Cfg = this.LoadConfigDll(this.ConfigDll); Cfg.InitConfig(); - OpenSim.Framework.Console.MainLog.Instance.Verbose("Main.cs:Startup() - Establishing data connection"); + MainLog.Instance.Verbose("Main.cs:Startup() - Establishing data connection"); m_userManager = new UserManager(); m_userManager._config = Cfg; m_userManager.AddPlugin(StorageDll); - OpenSim.Framework.Console.MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process"); + MainLog.Instance.Verbose("Main.cs:Startup() - Starting HTTP process"); BaseHttpServer httpServer = new BaseHttpServer(8002); httpServer.AddXmlRPCHandler("login_to_simulator", m_userManager.XmlRpcLoginMethod); -- cgit v1.1 From 6a2588454a1ac4bb484ad0b9ee648e9ac156f8db Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Wed, 4 Jul 2007 14:12:32 +0000 Subject: * Removed AssetHttpServer, using BaseHttpServer instead * Removed legacy REST handling * Created two custom IStreamHandlers for asset up/download * Removed quite a lot of double and triple encodings, trying to work towards binary only and direct write into storage. * Introduced BaseStreamHandler with GetParam() and some other goodies --- OpenSim/Grid/UserServer/Main.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Grid/UserServer/Main.cs') diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 5560e7d..30465a3 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -105,8 +105,8 @@ namespace OpenSim.Grid.UserServer httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); httpServer.AddXmlRPCHandler("get_user_by_uuid", m_userManager.XmlRPCGetUserMethodUUID); - httpServer.AddRestHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod); - + httpServer.AddStreamHandler( new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod )); + httpServer.Start(); m_console.Status("Userserver 0.3 - Startup complete"); } -- cgit v1.1 From bc02ddf5231d7731af33cc0aa5dc914cbdeb5ee7 Mon Sep 17 00:00:00 2001 From: mingchen Date: Fri, 6 Jul 2007 20:40:03 +0000 Subject: *Fixed several bugs that crashed the viewer and opensim server when logging in on grid mode *Note: Grid Mode now works in sugilite, but is still unstable **Known bug in which the grid server crashes after being relaunched from a previously create configuration **Crashing of the viewer crashes the OpenSim server which then crashes the grid server -- needs better handling of exceptions **Multiple sims is still untested, but should connect correctly. Moving between the sims may be a different story --- OpenSim/Grid/UserServer/Main.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Grid/UserServer/Main.cs') diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs index 30465a3..c792918 100644 --- a/OpenSim/Grid/UserServer/Main.cs +++ b/OpenSim/Grid/UserServer/Main.cs @@ -120,8 +120,8 @@ namespace OpenSim.Grid.UserServer string tempfirstname; string templastname; string tempMD5Passwd; - uint regX = 997; - uint regY = 996; + uint regX = 1000; + uint regY = 1000; tempfirstname = m_console.CmdPrompt("First name"); templastname = m_console.CmdPrompt("Last name"); -- cgit v1.1