diff options
author | MW | 2007-05-25 16:27:07 +0000 |
---|---|---|
committer | MW | 2007-05-25 16:27:07 +0000 |
commit | b2d588ed1c9068324333ec3c5ab86efe6a36216d (patch) | |
tree | 950442d2af673e1df34e85ca5b8265ddd6c99906 /OpenGridServices | |
parent | Oops (diff) | |
download | opensim-SC_OLD-b2d588ed1c9068324333ec3c5ab86efe6a36216d.zip opensim-SC_OLD-b2d588ed1c9068324333ec3c5ab86efe6a36216d.tar.gz opensim-SC_OLD-b2d588ed1c9068324333ec3c5ab86efe6a36216d.tar.bz2 opensim-SC_OLD-b2d588ed1c9068324333ec3c5ab86efe6a36216d.tar.xz |
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)
Diffstat (limited to 'OpenGridServices')
16 files changed, 248 insertions, 134 deletions
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 @@ | |||
24 | <include name="System.Xml.dll" /> | 24 | <include name="System.Xml.dll" /> |
25 | <include name="../../../bin/libsecondlife.dll" /> | 25 | <include name="../../../bin/libsecondlife.dll" /> |
26 | <include name="../../../bin/Db4objects.Db4o.dll" /> | 26 | <include name="../../../bin/Db4objects.Db4o.dll" /> |
27 | <include name="OpenSim.Framework.dll" /> | 27 | <include name="../../../bin/OpenSim.Framework.dll" /> |
28 | <include name="OpenSim.Framework.Console.dll" /> | 28 | <include name="../../../bin/OpenSim.Framework.Console.dll" /> |
29 | </references> | 29 | </references> |
30 | </csc> | 30 | </csc> |
31 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" /> | 31 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" /> |
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 | |||
81 | /// <param name="row">The profile to add</param> | 81 | /// <param name="row">The profile to add</param> |
82 | /// <returns>Successful?</returns> | 82 | /// <returns>Successful?</returns> |
83 | public bool AddRow(UserProfileData row) | 83 | public bool AddRow(UserProfileData row) |
84 | { | 84 | { |
85 | if (userProfiles.ContainsKey(row.UUID)) | 85 | if (userProfiles.ContainsKey(row.UUID)) |
86 | { | 86 | { |
87 | userProfiles[row.UUID] = row; | 87 | 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 | |||
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | public void addNewUserProfile(UserProfileData user) | ||
70 | { | ||
71 | manager.AddRow(user); | ||
72 | } | ||
73 | |||
69 | public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) | 74 | public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) |
70 | { | 75 | { |
71 | return true; | 76 | 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 | |||
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | public void addNewUserProfile(UserProfileData user) | ||
125 | { | ||
126 | } | ||
127 | |||
124 | public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) | 128 | public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) |
125 | { | 129 | { |
126 | return false; | 130 | 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 | |||
52 | UserAgentData getAgentByName(string fname, string lname); | 52 | UserAgentData getAgentByName(string fname, string lname); |
53 | 53 | ||
54 | /// <summary> | 54 | /// <summary> |
55 | /// Adds a new User profile to the database | ||
56 | /// </summary> | ||
57 | /// <param name="user">UserProfile to add</param> | ||
58 | void addNewUserProfile(UserProfileData user); | ||
59 | |||
60 | /// <summary> | ||
55 | /// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES) | 61 | /// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES) |
56 | /// </summary> | 62 | /// </summary> |
57 | /// <param name="from">The account to transfer from</param> | 63 | /// <param name="from">The account to transfer from</param> |
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 @@ | |||
1 | using Nwc.XmlRpc; | 1 | using Nwc.XmlRpc; |
2 | using OpenSim.Framework; | 2 | using OpenSim.Framework; |
3 | using OpenSim.Servers; | 3 | using OpenSim.Servers; |
4 | using System.Collections; | 4 | using System.Collections; |
5 | using System.Collections.Generic; | 5 | using System.Collections.Generic; |
6 | using libsecondlife; | 6 | using libsecondlife; |
7 | 7 | ||
8 | namespace OpenGrid.Framework.Manager { | 8 | namespace OpenGrid.Framework.Manager |
9 | 9 | { | |
10 | public delegate void GridManagerCallback(string param); | 10 | |
11 | 11 | public delegate void GridManagerCallback(string param); | |
12 | public class GridManagementAgent { | 12 | |
13 | 13 | public class GridManagementAgent | |
14 | private GridManagerCallback thecallback; | 14 | { |
15 | private string sendkey; | 15 | |
16 | private string recvkey; | 16 | private GridManagerCallback thecallback; |
17 | private string component_type; | 17 | private string sendkey; |
18 | 18 | private string recvkey; | |
19 | private static ArrayList Sessions; | 19 | private string component_type; |
20 | 20 | ||
21 | public GridManagementAgent(BaseHttpServer app_httpd, string component_type, string sendkey, string recvkey, GridManagerCallback thecallback) | 21 | private static ArrayList Sessions; |
22 | { | 22 | |
23 | this.sendkey=sendkey; | 23 | public GridManagementAgent(BaseHttpServer app_httpd, string component_type, string sendkey, string recvkey, GridManagerCallback thecallback) |
24 | this.recvkey=recvkey; | 24 | { |
25 | this.component_type=component_type; | 25 | this.sendkey = sendkey; |
26 | this.thecallback=thecallback; | 26 | this.recvkey = recvkey; |
27 | Sessions = new ArrayList(); | 27 | this.component_type = component_type; |
28 | 28 | this.thecallback = thecallback; | |
29 | app_httpd.AddXmlRPCHandler("manager_login",XmlRpcLoginMethod); | 29 | Sessions = new ArrayList(); |
30 | 30 | ||
31 | switch(component_type) | 31 | app_httpd.AddXmlRPCHandler("manager_login", XmlRpcLoginMethod); |
32 | { | 32 | |
33 | case "gridserver": | 33 | switch (component_type) |
34 | GridServerManager.sendkey=this.sendkey; | 34 | { |
35 | GridServerManager.recvkey=this.recvkey; | 35 | case "gridserver": |
36 | GridServerManager.thecallback=thecallback; | 36 | GridServerManager.sendkey = this.sendkey; |
37 | app_httpd.AddXmlRPCHandler("shutdown", GridServerManager.XmlRpcShutdownMethod); | 37 | GridServerManager.recvkey = this.recvkey; |
38 | break; | 38 | GridServerManager.thecallback = thecallback; |
39 | } | 39 | app_httpd.AddXmlRPCHandler("shutdown", GridServerManager.XmlRpcShutdownMethod); |
40 | } | 40 | break; |
41 | 41 | } | |
42 | public static bool SessionExists(LLUUID sessionID) | 42 | } |
43 | { | 43 | |
44 | return Sessions.Contains(sessionID); | 44 | public static bool SessionExists(LLUUID sessionID) |
45 | } | 45 | { |
46 | 46 | return Sessions.Contains(sessionID); | |
47 | public static XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) | 47 | } |
48 | { | 48 | |
49 | XmlRpcResponse response = new XmlRpcResponse(); | 49 | public static XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) |
50 | Hashtable requestData = (Hashtable)request.Params[0]; | 50 | { |
51 | Hashtable responseData = new Hashtable(); | 51 | XmlRpcResponse response = new XmlRpcResponse(); |
52 | 52 | Hashtable requestData = (Hashtable)request.Params[0]; | |
53 | // TODO: Switch this over to using OpenGrid.Framework.Data | 53 | Hashtable responseData = new Hashtable(); |
54 | if( requestData["username"].Equals("admin") && requestData["password"].Equals("supersecret")) { | 54 | |
55 | response.IsFault=false; | 55 | // TODO: Switch this over to using OpenGrid.Framework.Data |
56 | LLUUID new_session=LLUUID.Random(); | 56 | if (requestData["username"].Equals("admin") && requestData["password"].Equals("supersecret")) |
57 | Sessions.Add(new_session); | 57 | { |
58 | responseData["session_id"]=new_session.ToString(); | 58 | response.IsFault = false; |
59 | responseData["msg"]="Login OK"; | 59 | LLUUID new_session = LLUUID.Random(); |
60 | } else { | 60 | Sessions.Add(new_session); |
61 | response.IsFault=true; | 61 | responseData["session_id"] = new_session.ToString(); |
62 | responseData["error"]="Invalid username or password"; | 62 | responseData["msg"] = "Login OK"; |
63 | } | 63 | } |
64 | 64 | else | |
65 | response.Value = responseData; | 65 | { |
66 | return response; | 66 | response.IsFault = true; |
67 | 67 | responseData["error"] = "Invalid username or password"; | |
68 | } | 68 | } |
69 | 69 | ||
70 | } | 70 | response.Value = responseData; |
71 | } | 71 | return response; |
72 | |||
73 | } | ||
74 | |||
75 | } | ||
76 | } | ||
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 @@ | |||
20 | <include name="${project::get-base-directory()}/${build.dir}" /> | 20 | <include name="${project::get-base-directory()}/${build.dir}" /> |
21 | </lib> | 21 | </lib> |
22 | <include name="System.dll" /> | 22 | <include name="System.dll" /> |
23 | <include name="OpenSim.Framework.dll" /> | 23 | <include name="../../bin/OpenSim.Framework.dll" /> |
24 | <include name="OpenSim.Servers.dll" /> | 24 | <include name="../../bin/OpenSim.Servers.dll" /> |
25 | <include name="../../bin/libsecondlife.dll" /> | 25 | <include name="../../bin/libsecondlife.dll" /> |
26 | <include name="XMLRPC.dll" /> | 26 | <include name="../../bin/XMLRPC.dll" /> |
27 | </references> | 27 | </references> |
28 | </csc> | 28 | </csc> |
29 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" /> | 29 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" /> |
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 @@ | |||
23 | <include name="System.dll" /> | 23 | <include name="System.dll" /> |
24 | <include name="System.Data.dll" /> | 24 | <include name="System.Data.dll" /> |
25 | <include name="System.Xml.dll" /> | 25 | <include name="System.Xml.dll" /> |
26 | <include name="OpenSim.Framework.dll" /> | 26 | <include name="../../bin/OpenSim.Framework.dll" /> |
27 | <include name="OpenSim.Framework.Console.dll" /> | 27 | <include name="../../bin/OpenSim.Framework.Console.dll" /> |
28 | <include name="OpenSim.GridInterfaces.Local.dll" /> | 28 | <include name="../../bin/OpenSim.GridInterfaces.Local.dll" /> |
29 | <include name="OpenSim.Servers.dll" /> | 29 | <include name="../../bin/OpenSim.Servers.dll" /> |
30 | <include name="../../bin/libsecondlife.dll" /> | 30 | <include name="../../bin/libsecondlife.dll" /> |
31 | <include name="../../bin/Db4objects.Db4o.dll" /> | 31 | <include name="../../bin/Db4objects.Db4o.dll" /> |
32 | <include name="XMLRPC.dll" /> | 32 | <include name="../../bin/XMLRPC.dll" /> |
33 | </references> | 33 | </references> |
34 | </csc> | 34 | </csc> |
35 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" /> | 35 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" /> |
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; | |||
41 | using OpenSim.Framework.Console; | 41 | using OpenSim.Framework.Console; |
42 | using OpenSim.Framework.Interfaces; | 42 | using OpenSim.Framework.Interfaces; |
43 | using OpenSim.Servers; | 43 | using OpenSim.Servers; |
44 | using OpenSim.GenericConfig; | ||
44 | 45 | ||
45 | namespace OpenGridServices.GridServer | 46 | namespace OpenGridServices.GridServer |
46 | { | 47 | { |
@@ -49,15 +50,17 @@ namespace OpenGridServices.GridServer | |||
49 | public class OpenGrid_Main : BaseServer, conscmd_callback | 50 | public class OpenGrid_Main : BaseServer, conscmd_callback |
50 | { | 51 | { |
51 | private string ConfigDll = "OpenGrid.Config.GridConfigDb4o.dll"; | 52 | private string ConfigDll = "OpenGrid.Config.GridConfigDb4o.dll"; |
52 | private string GridDll = "OpenGrid.Framework.Data.MySQL.dll"; | 53 | private string GridDll = "OpenGrid.Framework.Data.DB4o.dll"; |
53 | public GridConfig Cfg; | 54 | public GridConfig Cfg; |
54 | 55 | ||
55 | public static OpenGrid_Main thegrid; | 56 | public static OpenGrid_Main thegrid; |
56 | public static bool setuponly; | 57 | protected IGenericConfig localXMLConfig; |
57 | 58 | ||
59 | public static bool setuponly; | ||
60 | |||
58 | //public LLUUID highestUUID; | 61 | //public LLUUID highestUUID; |
59 | 62 | ||
60 | // private SimProfileManager m_simProfileManager; | 63 | // private SimProfileManager m_simProfileManager; |
61 | 64 | ||
62 | private GridManager m_gridManager; | 65 | private GridManager m_gridManager; |
63 | 66 | ||
@@ -70,7 +73,7 @@ namespace OpenGridServices.GridServer | |||
70 | { | 73 | { |
71 | if (args[0] == "-setuponly") setuponly = true; | 74 | if (args[0] == "-setuponly") setuponly = true; |
72 | } | 75 | } |
73 | Console.WriteLine("Starting...\n"); | 76 | Console.WriteLine("Starting...\n"); |
74 | 77 | ||
75 | thegrid = new OpenGrid_Main(); | 78 | thegrid = new OpenGrid_Main(); |
76 | thegrid.Startup(); | 79 | thegrid.Startup(); |
@@ -82,8 +85,8 @@ namespace OpenGridServices.GridServer | |||
82 | { | 85 | { |
83 | while (true) | 86 | while (true) |
84 | { | 87 | { |
85 | Thread.Sleep(5000); | 88 | Thread.Sleep(5000); |
86 | // should flush the DB etc here | 89 | // should flush the DB etc here |
87 | } | 90 | } |
88 | } | 91 | } |
89 | 92 | ||
@@ -95,30 +98,37 @@ namespace OpenGridServices.GridServer | |||
95 | 98 | ||
96 | } | 99 | } |
97 | 100 | ||
98 | public void managercallback(string cmd) { | 101 | public void managercallback(string cmd) |
99 | switch(cmd) { | 102 | { |
100 | case "shutdown": | 103 | switch (cmd) |
101 | RunCmd("shutdown",new string[0]); | 104 | { |
102 | break; | 105 | case "shutdown": |
103 | } | 106 | RunCmd("shutdown", new string[0]); |
104 | } | 107 | break; |
108 | } | ||
109 | } | ||
105 | 110 | ||
106 | 111 | ||
107 | public void Startup() | 112 | public void Startup() |
108 | { | 113 | { |
109 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Loading configuration"); | 114 | this.localXMLConfig = new XmlConfig("GridServerConfig.xml"); |
115 | this.localXMLConfig.LoadData(); | ||
116 | this.ConfigDB(this.localXMLConfig); | ||
117 | this.localXMLConfig.Close(); | ||
118 | |||
119 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Loading configuration"); | ||
110 | Cfg = this.LoadConfigDll(this.ConfigDll); | 120 | Cfg = this.LoadConfigDll(this.ConfigDll); |
111 | Cfg.InitConfig(); | 121 | Cfg.InitConfig(); |
112 | if(setuponly) Environment.Exit(0); | 122 | if (setuponly) Environment.Exit(0); |
113 | 123 | ||
114 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Connecting to Storage Server"); | 124 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Connecting to Storage Server"); |
115 | m_gridManager = new GridManager(); | 125 | m_gridManager = new GridManager(); |
116 | m_gridManager.AddPlugin(GridDll); // Made of win | 126 | m_gridManager.AddPlugin(GridDll); // Made of win |
117 | m_gridManager.config = Cfg; | 127 | m_gridManager.config = Cfg; |
118 | 128 | ||
119 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Starting HTTP process"); | 129 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting HTTP process"); |
120 | BaseHttpServer httpServer = new BaseHttpServer(8001); | 130 | BaseHttpServer httpServer = new BaseHttpServer(8001); |
121 | GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer,"gridserver",Cfg.SimSendKey,Cfg.SimRecvKey,managercallback); | 131 | GridManagementAgent GridManagerAgent = new GridManagementAgent(httpServer, "gridserver", Cfg.SimSendKey, Cfg.SimRecvKey, managercallback); |
122 | 132 | ||
123 | httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcLoginToSimulatorMethod); | 133 | httpServer.AddXmlRPCHandler("simulator_login", m_gridManager.XmlRpcLoginToSimulatorMethod); |
124 | httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); | 134 | httpServer.AddXmlRPCHandler("map_block", m_gridManager.XmlRpcMapBlockMethod); |
@@ -127,7 +137,7 @@ namespace OpenGridServices.GridServer | |||
127 | httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod); | 137 | httpServer.AddRestHandler("POST", "/sims/", m_gridManager.RestSetSimMethod); |
128 | httpServer.AddRestHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod); | 138 | httpServer.AddRestHandler("GET", "/regions/", m_gridManager.RestGetRegionMethod); |
129 | httpServer.AddRestHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod); | 139 | httpServer.AddRestHandler("POST", "/regions/", m_gridManager.RestSetRegionMethod); |
130 | 140 | ||
131 | 141 | ||
132 | // lbsa71 : This code snippet taken from old http server. | 142 | // lbsa71 : This code snippet taken from old http server. |
133 | // I have no idea what this was supposed to do - looks like an infinite recursion to me. | 143 | // I have no idea what this was supposed to do - looks like an infinite recursion to me. |
@@ -145,9 +155,9 @@ namespace OpenGridServices.GridServer | |||
145 | 155 | ||
146 | httpServer.Start(); | 156 | httpServer.Start(); |
147 | 157 | ||
148 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Starting sim status checker"); | 158 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting sim status checker"); |
149 | 159 | ||
150 | System.Timers.Timer simCheckTimer = new System.Timers.Timer( 300000 ); // 5 minutes | 160 | System.Timers.Timer simCheckTimer = new System.Timers.Timer(300000); // 5 minutes |
151 | simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); | 161 | simCheckTimer.Elapsed += new ElapsedEventHandler(CheckSims); |
152 | simCheckTimer.Enabled = true; | 162 | simCheckTimer.Enabled = true; |
153 | } | 163 | } |
@@ -222,7 +232,7 @@ namespace OpenGridServices.GridServer | |||
222 | switch (cmd) | 232 | switch (cmd) |
223 | { | 233 | { |
224 | case "help": | 234 | case "help": |
225 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"shutdown - shutdown the grid (USE CAUTION!)"); | 235 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "shutdown - shutdown the grid (USE CAUTION!)"); |
226 | break; | 236 | break; |
227 | 237 | ||
228 | case "shutdown": | 238 | case "shutdown": |
@@ -235,5 +245,28 @@ namespace OpenGridServices.GridServer | |||
235 | public void Show(string ShowWhat) | 245 | public void Show(string ShowWhat) |
236 | { | 246 | { |
237 | } | 247 | } |
248 | |||
249 | private void ConfigDB(IGenericConfig configData) | ||
250 | { | ||
251 | try | ||
252 | { | ||
253 | string attri = ""; | ||
254 | attri = configData.GetAttribute("DataBaseProvider"); | ||
255 | if (attri == "") | ||
256 | { | ||
257 | GridDll = "OpenGrid.Framework.Data.DB4o.dll"; | ||
258 | configData.SetAttribute("DataBaseProvider", "OpenGrid.Framework.Data.DB4o.dll"); | ||
259 | } | ||
260 | else | ||
261 | { | ||
262 | GridDll = attri; | ||
263 | } | ||
264 | configData.Commit(); | ||
265 | } | ||
266 | catch (Exception e) | ||
267 | { | ||
268 | |||
269 | } | ||
270 | } | ||
238 | } | 271 | } |
239 | } | 272 | } |
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 @@ | |||
82 | <HintPath>OpenSim.Servers.dll</HintPath> | 82 | <HintPath>OpenSim.Servers.dll</HintPath> |
83 | <Private>False</Private> | 83 | <Private>False</Private> |
84 | </Reference> | 84 | </Reference> |
85 | <Reference Include="OpenSim.GenericConfig.Xml" > | ||
86 | <HintPath>OpenSim.GenericConfig.Xml.dll</HintPath> | ||
87 | <Private>False</Private> | ||
88 | </Reference> | ||
85 | <Reference Include="libsecondlife.dll" > | 89 | <Reference Include="libsecondlife.dll" > |
86 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> | 90 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> |
87 | <Private>False</Private> | 91 | <Private>False</Private> |
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 @@ | |||
23 | <include name="System.dll" /> | 23 | <include name="System.dll" /> |
24 | <include name="System.Data.dll" /> | 24 | <include name="System.Data.dll" /> |
25 | <include name="System.Xml.dll" /> | 25 | <include name="System.Xml.dll" /> |
26 | <include name="OpenSim.Framework.dll" /> | 26 | <include name="../../bin/OpenSim.Framework.dll" /> |
27 | <include name="OpenSim.Framework.Console.dll" /> | 27 | <include name="../../bin/OpenSim.Framework.Console.dll" /> |
28 | <include name="OpenSim.Servers.dll" /> | 28 | <include name="../../bin/OpenSim.Servers.dll" /> |
29 | <include name="../../bin/OpenGrid.Framework.Data.dll" /> | 29 | <include name="../../bin/OpenGrid.Framework.Data.dll" /> |
30 | <include name="../../bin/OpenGrid.Framework.Manager.dll" /> | 30 | <include name="../../bin/OpenGrid.Framework.Manager.dll" /> |
31 | <include name="../../bin/OpenSim.GenericConfig.Xml.dll" /> | ||
31 | <include name="../../bin/libsecondlife.dll" /> | 32 | <include name="../../bin/libsecondlife.dll" /> |
32 | <include name="../../bin/Db4objects.Db4o.dll" /> | 33 | <include name="../../bin/Db4objects.Db4o.dll" /> |
33 | <include name="XMLRPC.dll" /> | 34 | <include name="../../bin/XMLRPC.dll" /> |
34 | </references> | 35 | </references> |
35 | </csc> | 36 | </csc> |
36 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" /> | 37 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" /> |
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; | |||
40 | using OpenSim.Framework.Interfaces; | 40 | using OpenSim.Framework.Interfaces; |
41 | using OpenSim.Framework.Console; | 41 | using OpenSim.Framework.Console; |
42 | using OpenSim.Servers; | 42 | using OpenSim.Servers; |
43 | using OpenSim.Framework.Utilities; | ||
44 | using OpenSim.GenericConfig; | ||
43 | 45 | ||
44 | namespace OpenGridServices.UserServer | 46 | namespace OpenGridServices.UserServer |
45 | { | 47 | { |
@@ -48,8 +50,9 @@ namespace OpenGridServices.UserServer | |||
48 | public class OpenUser_Main : BaseServer, conscmd_callback | 50 | public class OpenUser_Main : BaseServer, conscmd_callback |
49 | { | 51 | { |
50 | private string ConfigDll = "OpenUser.Config.UserConfigDb4o.dll"; | 52 | private string ConfigDll = "OpenUser.Config.UserConfigDb4o.dll"; |
51 | private string StorageDll = "OpenGrid.Framework.Data.MySQL.dll"; | 53 | private string StorageDll = "OpenGrid.Framework.Data.DB4o.dll"; |
52 | private UserConfig Cfg; | 54 | private UserConfig Cfg; |
55 | protected IGenericConfig localXMLConfig; | ||
53 | 56 | ||
54 | public UserManager m_userManager; // Replaces below. | 57 | public UserManager m_userManager; // Replaces below. |
55 | 58 | ||
@@ -88,6 +91,11 @@ namespace OpenGridServices.UserServer | |||
88 | 91 | ||
89 | public void Startup() | 92 | public void Startup() |
90 | { | 93 | { |
94 | this.localXMLConfig = new XmlConfig("UserServerConfig.xml"); | ||
95 | this.localXMLConfig.LoadData(); | ||
96 | this.ConfigDB(this.localXMLConfig); | ||
97 | this.localXMLConfig.Close(); | ||
98 | |||
91 | MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Loading configuration"); | 99 | MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Loading configuration"); |
92 | Cfg = this.LoadConfigDll(this.ConfigDll); | 100 | Cfg = this.LoadConfigDll(this.ConfigDll); |
93 | Cfg.InitConfig(); | 101 | Cfg.InitConfig(); |
@@ -112,33 +120,22 @@ namespace OpenGridServices.UserServer | |||
112 | switch (what) | 120 | switch (what) |
113 | { | 121 | { |
114 | case "user": | 122 | case "user": |
115 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"Commandline user creation is currently disabled."); | ||
116 | break; | ||
117 | /* | ||
118 | string tempfirstname; | 123 | string tempfirstname; |
119 | string templastname; | 124 | string templastname; |
120 | string tempMD5Passwd; | 125 | string tempMD5Passwd; |
126 | uint regX = 997; | ||
127 | uint regY = 996; | ||
121 | 128 | ||
122 | tempfirstname = m_console.CmdPrompt("First name"); | 129 | tempfirstname = m_console.CmdPrompt("First name"); |
123 | templastname = m_console.CmdPrompt("Last name"); | 130 | templastname = m_console.CmdPrompt("Last name"); |
124 | tempMD5Passwd = m_console.PasswdPrompt("Password"); | 131 | tempMD5Passwd = m_console.PasswdPrompt("Password"); |
132 | regX = Convert.ToUInt32(m_console.CmdPrompt("Start Region X")); | ||
133 | regY = Convert.ToUInt32(m_console.CmdPrompt("Start Region Y")); | ||
125 | 134 | ||
126 | System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider(); | 135 | tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + ""); |
127 | byte[] bs = System.Text.Encoding.UTF8.GetBytes(tempMD5Passwd); | ||
128 | bs = x.ComputeHash(bs); | ||
129 | System.Text.StringBuilder s = new System.Text.StringBuilder(); | ||
130 | foreach (byte b in bs) | ||
131 | { | ||
132 | s.Append(b.ToString("x2").ToLower()); | ||
133 | } | ||
134 | tempMD5Passwd = s.ToString(); | ||
135 | 136 | ||
136 | UserProfile newuser = m_userProfileManager.CreateNewProfile(tempfirstname, templastname, tempMD5Passwd); | 137 | m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); |
137 | newuser.homelookat = new LLVector3(-0.57343f, -0.819255f, 0f); | ||
138 | newuser.homepos = new LLVector3(128f, 128f, 150f); | ||
139 | m_userProfileManager.SaveUserProfiles(); | ||
140 | break; | 138 | break; |
141 | */ | ||
142 | } | 139 | } |
143 | } | 140 | } |
144 | 141 | ||
@@ -162,6 +159,29 @@ namespace OpenGridServices.UserServer | |||
162 | } | 159 | } |
163 | } | 160 | } |
164 | 161 | ||
162 | private void ConfigDB(IGenericConfig configData) | ||
163 | { | ||
164 | try | ||
165 | { | ||
166 | string attri = ""; | ||
167 | attri = configData.GetAttribute("DataBaseProvider"); | ||
168 | if (attri == "") | ||
169 | { | ||
170 | StorageDll = "OpenGrid.Framework.Data.DB4o.dll"; | ||
171 | configData.SetAttribute("DataBaseProvider", "OpenGrid.Framework.Data.DB4o.dll"); | ||
172 | } | ||
173 | else | ||
174 | { | ||
175 | StorageDll = attri; | ||
176 | } | ||
177 | configData.Commit(); | ||
178 | } | ||
179 | catch (Exception e) | ||
180 | { | ||
181 | |||
182 | } | ||
183 | } | ||
184 | |||
165 | private UserConfig LoadConfigDll(string dllName) | 185 | private UserConfig LoadConfigDll(string dllName) |
166 | { | 186 | { |
167 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | 187 | 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 @@ | |||
78 | <HintPath>OpenSim.Framework.Console.dll</HintPath> | 78 | <HintPath>OpenSim.Framework.Console.dll</HintPath> |
79 | <Private>False</Private> | 79 | <Private>False</Private> |
80 | </Reference> | 80 | </Reference> |
81 | <Reference Include="OpenSim.GenericConfig.Xml" > | ||
82 | <HintPath>OpenSim.GenericConfig.Xml.dll</HintPath> | ||
83 | <Private>False</Private> | ||
84 | </Reference> | ||
81 | <Reference Include="OpenSim.Servers" > | 85 | <Reference Include="OpenSim.Servers" > |
82 | <HintPath>OpenSim.Servers.dll</HintPath> | 86 | <HintPath>OpenSim.Servers.dll</HintPath> |
83 | <Private>False</Private> | 87 | <Private>False</Private> |
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 @@ | |||
23 | <include name="System.dll" /> | 23 | <include name="System.dll" /> |
24 | <include name="System.Data.dll" /> | 24 | <include name="System.Data.dll" /> |
25 | <include name="System.Xml.dll" /> | 25 | <include name="System.Xml.dll" /> |
26 | <include name="OpenSim.Framework.dll" /> | 26 | <include name="../../bin/OpenSim.Framework.dll" /> |
27 | <include name="OpenSim.Framework.Console.dll" /> | 27 | <include name="../../bin/OpenSim.Framework.Console.dll" /> |
28 | <include name="../../bin/OpenGrid.Framework.Data.dll" /> | 28 | <include name="../../bin/OpenGrid.Framework.Data.dll" /> |
29 | <include name="OpenSim.Servers.dll" /> | 29 | <include name="../../bin/OpenSim.GenericConfig.Xml.dll" /> |
30 | <include name="../../bin/OpenSim.Servers.dll" /> | ||
30 | <include name="../../bin/libsecondlife.dll" /> | 31 | <include name="../../bin/libsecondlife.dll" /> |
31 | <include name="../../bin/Db4objects.Db4o.dll" /> | 32 | <include name="../../bin/Db4objects.Db4o.dll" /> |
32 | <include name="XMLRPC.dll" /> | 33 | <include name="../../bin/XMLRPC.dll" /> |
33 | </references> | 34 | </references> |
34 | </csc> | 35 | </csc> |
35 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" /> | 36 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" /> |
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 | |||
53 | } | 53 | } |
54 | 54 | ||
55 | /// <summary> | 55 | /// <summary> |
56 | /// | ||
57 | /// </summary> | ||
58 | /// <param name="user"></param> | ||
59 | public void AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY) | ||
60 | { | ||
61 | UserProfileData user = new UserProfileData(); | ||
62 | user.homeLocation = new LLVector3(128, 128, 100); | ||
63 | user.UUID = LLUUID.Random(); | ||
64 | user.username = firstName; | ||
65 | user.surname = lastName; | ||
66 | user.passwordHash = pass; | ||
67 | user.passwordSalt = ""; | ||
68 | user.created = Util.UnixTimeSinceEpoch(); | ||
69 | user.homeLookAt = new LLVector3(100, 100, 100); | ||
70 | user.homeRegion = Util.UIntsToLong((regX * 256), (regY * 256)); | ||
71 | |||
72 | foreach (KeyValuePair<string, IUserData> plugin in _plugins) | ||
73 | { | ||
74 | try | ||
75 | { | ||
76 | plugin.Value.addNewUserProfile(user); | ||
77 | |||
78 | } | ||
79 | catch (Exception e) | ||
80 | { | ||
81 | OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Unable to find user via " + plugin.Key + "(" + e.ToString() + ")"); | ||
82 | } | ||
83 | } | ||
84 | } | ||
85 | |||
86 | /// <summary> | ||
56 | /// Loads a user profile from a database by UUID | 87 | /// Loads a user profile from a database by UUID |
57 | /// </summary> | 88 | /// </summary> |
58 | /// <param name="uuid">The target UUID</param> | 89 | /// <param name="uuid">The target UUID</param> |
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 @@ | |||
24 | <include name="System.Xml.dll" /> | 24 | <include name="System.Xml.dll" /> |
25 | <include name="../../../bin/libsecondlife.dll" /> | 25 | <include name="../../../bin/libsecondlife.dll" /> |
26 | <include name="../../../bin/Db4objects.Db4o.dll" /> | 26 | <include name="../../../bin/Db4objects.Db4o.dll" /> |
27 | <include name="OpenSim.Framework.dll" /> | 27 | <include name="../../../bin/OpenSim.Framework.dll" /> |
28 | <include name="OpenSim.Framework.Console.dll" /> | 28 | <include name="../../../bin/OpenSim.Framework.Console.dll" /> |
29 | </references> | 29 | </references> |
30 | </csc> | 30 | </csc> |
31 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" /> | 31 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../../bin/" /> |