From b2d588ed1c9068324333ec3c5ab86efe6a36216d Mon Sep 17 00:00:00 2001 From: MW Date: Fri, 25 May 2007 16:27:07 +0000 Subject: Possible my last ever OpenSim/OGS contribution (if I continue to feel like this): Re-added a CLI "create user" command to the userserver, only currently works if using DB4o as the database provider. Added Xml config files to both the UserServer and Gridserver (UserServerConfig.xml and GridServerConfig.xml), so that the database provider can be set in it. (both currently default to DB4o , so maybe Adam will want to change it back to defaulting to MySQL) --- OpenGridServices.sln | 125 ++++++++---------- .../OpenGrid.Config.GridConfigDb4o.dll.build | 4 +- .../OpenGrid.Framework.Data.DB4o/DB4oManager.cs | 2 +- .../OpenGrid.Framework.Data.DB4o/DB4oUserData.cs | 5 + .../OpenGrid.Framework.Data.MySQL/MySQLUserData.cs | 4 + .../OpenGrid.Framework.Data/UserData.cs | 6 + .../GridManagementAgent.cs | 147 +++++++++++---------- .../OpenGrid.Framework.Manager.dll.build | 6 +- .../OpenGridServices.AssetServer.exe.build | 10 +- .../OpenGridServices.GridServer/Main.cs | 81 ++++++++---- .../OpenGridServices.GridServer.csproj | 4 + .../OpenGridServices.GridServer.exe.build | 9 +- .../OpenGridServices.UserServer/Main.cs | 56 +++++--- .../OpenGridServices.UserServer.csproj | 4 + .../OpenGridServices.UserServer.exe.build | 9 +- .../OpenGridServices.UserServer/UserManager.cs | 31 +++++ .../OpenUser.Config.UserConfigDb4o.dll.build | 4 +- prebuild.xml | 2 + 18 files changed, 308 insertions(+), 201 deletions(-) diff --git a/OpenGridServices.sln b/OpenGridServices.sln index 641f710..bc21256 100644 --- a/OpenGridServices.sln +++ b/OpenGridServices.sln @@ -1,5 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 +# Visual C# Express 2005 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenUser.Config.UserConfigDb4o", "OpenGridServices\OpenUser.Config\UserConfigDb4o\OpenUser.Config.UserConfigDb4o.csproj", "{7E494328-0000-0000-0000-000000000000}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGridServices.AssetServer", "OpenGridServices\OpenGridServices.AssetServer\OpenGridServices.AssetServer.csproj", "{0021261B-0000-0000-0000-000000000000}" @@ -25,70 +25,61 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenGrid.Framework.Data.MySQL", "OpenGridServices\OpenGrid.Framework.Data.MySQL\OpenGrid.Framework.Data.MySQL.csproj", "{0F3C3AC1-0000-0000-0000-000000000000}" EndProject Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectDependencies) = postSolution - ({1E3F341A-0000-0000-0000-000000000000}).4 = ({62CDF671-0000-0000-0000-000000000000}) - ({39BD9497-0000-0000-0000-000000000000}).3 = ({62CDF671-0000-0000-0000-000000000000}) - ({21BFC8E2-0000-0000-0000-000000000000}).6 = ({62CDF671-0000-0000-0000-000000000000}) - ({21BFC8E2-0000-0000-0000-000000000000}).7 = ({7924FD35-0000-0000-0000-000000000000}) - ({0A563AC1-0000-0000-0000-000000000000}).3 = ({62CDF671-0000-0000-0000-000000000000}) - ({66591469-0000-0000-0000-000000000000}).5 = ({62CDF671-0000-0000-0000-000000000000}) - ({0F3C3AC1-0000-0000-0000-000000000000}).3 = ({62CDF671-0000-0000-0000-000000000000}) - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7E494328-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7E494328-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7E494328-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7E494328-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {0021261B-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0021261B-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0021261B-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0021261B-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {B0027747-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B0027747-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B0027747-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B0027747-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {1E3F341A-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1E3F341A-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1E3F341A-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1E3F341A-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {39BD9497-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {39BD9497-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {39BD9497-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {39BD9497-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {E141F4EE-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E141F4EE-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E141F4EE-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E141F4EE-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {7924FD35-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7924FD35-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7924FD35-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7924FD35-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {21BFC8E2-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {21BFC8E2-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {21BFC8E2-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {21BFC8E2-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {0A563AC1-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0A563AC1-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0A563AC1-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0A563AC1-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {62CDF671-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {62CDF671-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {62CDF671-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {62CDF671-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {66591469-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {66591469-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {66591469-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {66591469-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {0F3C3AC1-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0F3C3AC1-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0F3C3AC1-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0F3C3AC1-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7E494328-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7E494328-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7E494328-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7E494328-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {0021261B-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0021261B-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0021261B-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0021261B-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {B0027747-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0027747-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0027747-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0027747-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {1E3F341A-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1E3F341A-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1E3F341A-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1E3F341A-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {39BD9497-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {39BD9497-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {39BD9497-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {39BD9497-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {E141F4EE-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E141F4EE-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E141F4EE-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E141F4EE-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {7924FD35-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7924FD35-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7924FD35-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7924FD35-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {21BFC8E2-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {21BFC8E2-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {21BFC8E2-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {21BFC8E2-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {0A563AC1-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0A563AC1-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0A563AC1-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0A563AC1-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {62CDF671-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {62CDF671-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {62CDF671-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {62CDF671-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {66591469-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {66591469-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {66591469-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {66591469-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + {0F3C3AC1-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0F3C3AC1-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0F3C3AC1-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0F3C3AC1-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection EndGlobal diff --git a/OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build b/OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build index 94e924e..cbc8479 100644 --- a/OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build +++ b/OpenGridServices/OpenGrid.Config/GridConfigDb4o/OpenGrid.Config.GridConfigDb4o.dll.build @@ -24,8 +24,8 @@ - - + + diff --git a/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oManager.cs b/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oManager.cs index aaa6e91..b30f889 100644 --- a/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oManager.cs +++ b/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oManager.cs @@ -81,7 +81,7 @@ namespace OpenGrid.Framework.Data.DB4o /// The profile to add /// Successful? public bool AddRow(UserProfileData row) - { + { if (userProfiles.ContainsKey(row.UUID)) { userProfiles[row.UUID] = row; diff --git a/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs b/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs index 7dd4c51..1e8273d 100644 --- a/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs +++ b/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs @@ -66,6 +66,11 @@ namespace OpenGrid.Framework.Data.DB4o } } + public void addNewUserProfile(UserProfileData user) + { + manager.AddRow(user); + } + public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) { return true; diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs index df681eb..61c8288 100644 --- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs +++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs @@ -121,6 +121,10 @@ namespace OpenGrid.Framework.Data.MySQL } } + public void addNewUserProfile(UserProfileData user) + { + } + public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) { return false; diff --git a/OpenGridServices/OpenGrid.Framework.Data/UserData.cs b/OpenGridServices/OpenGrid.Framework.Data/UserData.cs index 1b37957..3ab9b5e 100644 --- a/OpenGridServices/OpenGrid.Framework.Data/UserData.cs +++ b/OpenGridServices/OpenGrid.Framework.Data/UserData.cs @@ -52,6 +52,12 @@ namespace OpenGrid.Framework.Data UserAgentData getAgentByName(string fname, string lname); /// + /// Adds a new User profile to the database + /// + /// UserProfile to add + void addNewUserProfile(UserProfileData user); + + /// /// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES) /// /// The account to transfer from diff --git a/OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs b/OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs index e43ce87..f4483fb 100644 --- a/OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs +++ b/OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs @@ -1,71 +1,76 @@ -using Nwc.XmlRpc; -using OpenSim.Framework; -using OpenSim.Servers; -using System.Collections; -using System.Collections.Generic; -using libsecondlife; - -namespace OpenGrid.Framework.Manager { - - public delegate void GridManagerCallback(string param); - - public class GridManagementAgent { - - private GridManagerCallback thecallback; - private string sendkey; - private string recvkey; - private string component_type; - - private static ArrayList Sessions; - - public GridManagementAgent(BaseHttpServer app_httpd, string component_type, string sendkey, string recvkey, GridManagerCallback thecallback) - { - this.sendkey=sendkey; - this.recvkey=recvkey; - this.component_type=component_type; - this.thecallback=thecallback; - Sessions = new ArrayList(); - - app_httpd.AddXmlRPCHandler("manager_login",XmlRpcLoginMethod); - - switch(component_type) - { - case "gridserver": - GridServerManager.sendkey=this.sendkey; - GridServerManager.recvkey=this.recvkey; - GridServerManager.thecallback=thecallback; - app_httpd.AddXmlRPCHandler("shutdown", GridServerManager.XmlRpcShutdownMethod); - break; - } - } - - public static bool SessionExists(LLUUID sessionID) - { - return Sessions.Contains(sessionID); - } - - public static XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) - { - XmlRpcResponse response = new XmlRpcResponse(); - Hashtable requestData = (Hashtable)request.Params[0]; - Hashtable responseData = new Hashtable(); - - // TODO: Switch this over to using OpenGrid.Framework.Data - if( requestData["username"].Equals("admin") && requestData["password"].Equals("supersecret")) { - response.IsFault=false; - LLUUID new_session=LLUUID.Random(); - Sessions.Add(new_session); - responseData["session_id"]=new_session.ToString(); - responseData["msg"]="Login OK"; - } else { - response.IsFault=true; - responseData["error"]="Invalid username or password"; - } - - response.Value = responseData; - return response; - - } - - } -} +using Nwc.XmlRpc; +using OpenSim.Framework; +using OpenSim.Servers; +using System.Collections; +using System.Collections.Generic; +using libsecondlife; + +namespace OpenGrid.Framework.Manager +{ + + public delegate void GridManagerCallback(string param); + + public class GridManagementAgent + { + + private GridManagerCallback thecallback; + private string sendkey; + private string recvkey; + private string component_type; + + private static ArrayList Sessions; + + public GridManagementAgent(BaseHttpServer app_httpd, string component_type, string sendkey, string recvkey, GridManagerCallback thecallback) + { + this.sendkey = sendkey; + this.recvkey = recvkey; + this.component_type = component_type; + this.thecallback = thecallback; + Sessions = new ArrayList(); + + app_httpd.AddXmlRPCHandler("manager_login", XmlRpcLoginMethod); + + switch (component_type) + { + case "gridserver": + GridServerManager.sendkey = this.sendkey; + GridServerManager.recvkey = this.recvkey; + GridServerManager.thecallback = thecallback; + app_httpd.AddXmlRPCHandler("shutdown", GridServerManager.XmlRpcShutdownMethod); + break; + } + } + + public static bool SessionExists(LLUUID sessionID) + { + return Sessions.Contains(sessionID); + } + + public static XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) + { + XmlRpcResponse response = new XmlRpcResponse(); + Hashtable requestData = (Hashtable)request.Params[0]; + Hashtable responseData = new Hashtable(); + + // TODO: Switch this over to using OpenGrid.Framework.Data + if (requestData["username"].Equals("admin") && requestData["password"].Equals("supersecret")) + { + response.IsFault = false; + LLUUID new_session = LLUUID.Random(); + Sessions.Add(new_session); + responseData["session_id"] = new_session.ToString(); + responseData["msg"] = "Login OK"; + } + else + { + response.IsFault = true; + responseData["error"] = "Invalid username or password"; + } + + response.Value = responseData; + return response; + + } + + } +} diff --git a/OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.dll.build b/OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.dll.build index 1faa190..f8cc80e 100644 --- a/OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.dll.build +++ b/OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.dll.build @@ -20,10 +20,10 @@ - - + + - + diff --git a/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build index 064617e..e889a4d 100644 --- a/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build +++ b/OpenGridServices/OpenGridServices.AssetServer/OpenGridServices.AssetServer.exe.build @@ -23,13 +23,13 @@ - - - - + + + + - + diff --git a/OpenGridServices/OpenGridServices.GridServer/Main.cs b/OpenGridServices/OpenGridServices.GridServer/Main.cs index cad5fae..8baf293 100644 --- a/OpenGridServices/OpenGridServices.GridServer/Main.cs +++ b/OpenGridServices/OpenGridServices.GridServer/Main.cs @@ -41,6 +41,7 @@ using OpenSim.Framework.Sims; using OpenSim.Framework.Console; using OpenSim.Framework.Interfaces; using OpenSim.Servers; +using OpenSim.GenericConfig; namespace OpenGridServices.GridServer { @@ -49,15 +50,17 @@ namespace OpenGridServices.GridServer public class OpenGrid_Main : BaseServer, conscmd_callback { private string ConfigDll = "OpenGrid.Config.GridConfigDb4o.dll"; - private string GridDll = "OpenGrid.Framework.Data.MySQL.dll"; + private string GridDll = "OpenGrid.Framework.Data.DB4o.dll"; public GridConfig Cfg; - + public static OpenGrid_Main thegrid; - public static bool setuponly; - + protected IGenericConfig localXMLConfig; + + public static bool setuponly; + //public LLUUID highestUUID; -// private SimProfileManager m_simProfileManager; + // private SimProfileManager m_simProfileManager; private GridManager m_gridManager; @@ -70,7 +73,7 @@ namespace OpenGridServices.GridServer { if (args[0] == "-setuponly") setuponly = true; } - Console.WriteLine("Starting...\n"); + Console.WriteLine("Starting...\n"); thegrid = new OpenGrid_Main(); thegrid.Startup(); @@ -82,8 +85,8 @@ namespace OpenGridServices.GridServer { while (true) { - Thread.Sleep(5000); - // should flush the DB etc here + Thread.Sleep(5000); + // should flush the DB etc here } } @@ -95,30 +98,37 @@ namespace OpenGridServices.GridServer } - public void managercallback(string cmd) { - switch(cmd) { - case "shutdown": - RunCmd("shutdown",new string[0]); - break; - } - } + public void managercallback(string cmd) + { + switch (cmd) + { + case "shutdown": + RunCmd("shutdown", new string[0]); + break; + } + } public void Startup() { - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Loading configuration"); + this.localXMLConfig = new XmlConfig("GridServerConfig.xml"); + this.localXMLConfig.LoadData(); + this.ConfigDB(this.localXMLConfig); + this.localXMLConfig.Close(); + + m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Loading configuration"); Cfg = this.LoadConfigDll(this.ConfigDll); Cfg.InitConfig(); - if(setuponly) Environment.Exit(0); + if (setuponly) Environment.Exit(0); - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Connecting to Storage Server"); + m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Connecting to Storage Server"); m_gridManager = new GridManager(); m_gridManager.AddPlugin(GridDll); // Made of win m_gridManager.config = Cfg; - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Starting HTTP process"); + m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting HTTP process"); BaseHttpServer httpServer = new BaseHttpServer(8001); - GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer,"gridserver",Cfg.SimSendKey,Cfg.SimRecvKey,managercallback); + GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback); httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcLoginToSimulatorMethod); httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); @@ -127,7 +137,7 @@ namespace OpenGridServices.GridServer httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod); httpServer.AddRestHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod); httpServer.AddRestHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod); - + // lbsa71 : This code snippet taken from old http server. // I have no idea what this was supposed to do - looks like an infinite recursion to me. @@ -145,9 +155,9 @@ namespace OpenGridServices.GridServer httpServer.Start(); - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Starting sim status checker"); + m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting sim status checker"); - System.Timers.Timer simCheckTimer = new System.Timers.Timer( 300000 ); // 5 minutes + System.Timers.Timer simCheckTimer = new System.Timers.Timer(300000); // 5 minutes simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); simCheckTimer.Enabled = true; } @@ -222,7 +232,7 @@ namespace OpenGridServices.GridServer switch (cmd) { case "help": - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"shutdown - shutdown the grid (USE CAUTION!)"); + m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "shutdown - shutdown the grid (USE CAUTION!)"); break; case "shutdown": @@ -235,5 +245,28 @@ namespace OpenGridServices.GridServer public void Show(string ShowWhat) { } + + private void ConfigDB(IGenericConfig configData) + { + try + { + string attri = ""; + attri = configData.GetAttribute("DataBaseProvider"); + if (attri == "") + { + GridDll = "OpenGrid.Framework.Data.DB4o.dll"; + configData.SetAttribute("DataBaseProvider", "OpenGrid.Framework.Data.DB4o.dll"); + } + else + { + GridDll = attri; + } + configData.Commit(); + } + catch (Exception e) + { + + } + } } } diff --git a/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj b/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj index b83c6ba..f4a6ca1 100644 --- a/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj +++ b/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.csproj @@ -82,6 +82,10 @@ OpenSim.Servers.dll False + + OpenSim.GenericConfig.Xml.dll + False + ..\..\bin\libsecondlife.dll False diff --git a/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build b/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build index 8a13f03..9d21edd 100644 --- a/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build +++ b/OpenGridServices/OpenGridServices.GridServer/OpenGridServices.GridServer.exe.build @@ -23,14 +23,15 @@ - - - + + + + - + diff --git a/OpenGridServices/OpenGridServices.UserServer/Main.cs b/OpenGridServices/OpenGridServices.UserServer/Main.cs index 0eb314b..aec80dc 100644 --- a/OpenGridServices/OpenGridServices.UserServer/Main.cs +++ b/OpenGridServices/OpenGridServices.UserServer/Main.cs @@ -40,6 +40,8 @@ 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 { @@ -48,8 +50,9 @@ namespace OpenGridServices.UserServer public class OpenUser_Main : BaseServer, conscmd_callback { private string ConfigDll = "OpenUser.Config.UserConfigDb4o.dll"; - private string StorageDll = "OpenGrid.Framework.Data.MySQL.dll"; + private string StorageDll = "OpenGrid.Framework.Data.DB4o.dll"; private UserConfig Cfg; + protected IGenericConfig localXMLConfig; public UserManager m_userManager; // Replaces below. @@ -88,6 +91,11 @@ namespace OpenGridServices.UserServer public void Startup() { + this.localXMLConfig = new XmlConfig("UserServerConfig.xml"); + this.localXMLConfig.LoadData(); + this.ConfigDB(this.localXMLConfig); + this.localXMLConfig.Close(); + MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Loading configuration"); Cfg = this.LoadConfigDll(this.ConfigDll); Cfg.InitConfig(); @@ -112,33 +120,22 @@ namespace OpenGridServices.UserServer switch (what) { case "user": - m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"Commandline user creation is currently disabled."); - break; - /* 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")); - System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider(); - byte[] bs = System.Text.Encoding.UTF8.GetBytes(tempMD5Passwd); - bs = x.ComputeHash(bs); - System.Text.StringBuilder s = new System.Text.StringBuilder(); - foreach (byte b in bs) - { - s.Append(b.ToString("x2").ToLower()); - } - tempMD5Passwd = s.ToString(); + tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); - UserProfile newuser = m_userProfileManager.CreateNewProfile(tempfirstname, templastname, tempMD5Passwd); - newuser.homelookat = new LLVector3(-0.57343f, -0.819255f, 0f); - newuser.homepos = new LLVector3(128f, 128f, 150f); - m_userProfileManager.SaveUserProfiles(); + m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); break; - */ } } @@ -162,6 +159,29 @@ namespace OpenGridServices.UserServer } } + 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); diff --git a/OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj b/OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj index 16a713b..1bd07fb 100644 --- a/OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj +++ b/OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.csproj @@ -78,6 +78,10 @@ OpenSim.Framework.Console.dll False + + OpenSim.GenericConfig.Xml.dll + False + OpenSim.Servers.dll False diff --git a/OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build b/OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build index 7c5f7e7..5275ef4 100644 --- a/OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build +++ b/OpenGridServices/OpenGridServices.UserServer/OpenGridServices.UserServer.exe.build @@ -23,13 +23,14 @@ - - + + - + + - + diff --git a/OpenGridServices/OpenGridServices.UserServer/UserManager.cs b/OpenGridServices/OpenGridServices.UserServer/UserManager.cs index a312445..fdda63b 100644 --- a/OpenGridServices/OpenGridServices.UserServer/UserManager.cs +++ b/OpenGridServices/OpenGridServices.UserServer/UserManager.cs @@ -53,6 +53,37 @@ namespace OpenGridServices.UserServer } /// + /// + /// + /// + public void AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY) + { + UserProfileData user = new UserProfileData(); + user.homeLocation = new LLVector3(128, 128, 100); + user.UUID = LLUUID.Random(); + user.username = firstName; + user.surname = lastName; + user.passwordHash = pass; + user.passwordSalt = ""; + user.created = Util.UnixTimeSinceEpoch(); + user.homeLookAt = new LLVector3(100, 100, 100); + user.homeRegion = Util.UIntsToLong((regX * 256), (regY * 256)); + + foreach (KeyValuePair plugin in _plugins) + { + try + { + plugin.Value.addNewUserProfile(user); + + } + catch (Exception e) + { + OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); + } + } + } + + /// /// Loads a user profile from a database by UUID /// /// The target UUID diff --git a/OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build b/OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build index 339c49a..2833bce 100644 --- a/OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build +++ b/OpenGridServices/OpenUser.Config/UserConfigDb4o/OpenUser.Config.UserConfigDb4o.dll.build @@ -24,8 +24,8 @@ - - + + diff --git a/prebuild.xml b/prebuild.xml index 314f299..2152f36 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -702,6 +702,7 @@ + @@ -759,6 +760,7 @@ + -- cgit v1.1