diff options
Diffstat (limited to '')
-rw-r--r-- | OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs | 147 | ||||
-rw-r--r-- | OpenGridServices/OpenGrid.Framework.Manager/OpenGrid.Framework.Manager.dll.build | 6 |
2 files changed, 79 insertions, 74 deletions
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/" /> |