aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs
diff options
context:
space:
mode:
authorMW2007-05-26 13:40:19 +0000
committerMW2007-05-26 13:40:19 +0000
commit3436961bb5c01d659d09be134368f4f69460cef9 (patch)
tree3753ba4d7818df2a6bce0bbe863ff033cdfd568a /OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs
downloadopensim-SC_OLD-3436961bb5c01d659d09be134368f4f69460cef9.zip
opensim-SC_OLD-3436961bb5c01d659d09be134368f4f69460cef9.tar.gz
opensim-SC_OLD-3436961bb5c01d659d09be134368f4f69460cef9.tar.bz2
opensim-SC_OLD-3436961bb5c01d659d09be134368f4f69460cef9.tar.xz
Start of rewrite 5279!
Diffstat (limited to 'OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs')
-rw-r--r--OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs76
1 files changed, 76 insertions, 0 deletions
diff --git a/OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs b/OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs
new file mode 100644
index 0000000..f4483fb
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs
@@ -0,0 +1,76 @@
1using Nwc.XmlRpc;
2using OpenSim.Framework;
3using OpenSim.Servers;
4using System.Collections;
5using System.Collections.Generic;
6using libsecondlife;
7
8namespace OpenGrid.Framework.Manager
9{
10
11 public delegate void GridManagerCallback(string param);
12
13 public class GridManagementAgent
14 {
15
16 private GridManagerCallback thecallback;
17 private string sendkey;
18 private string recvkey;
19 private string component_type;
20
21 private static ArrayList Sessions;
22
23 public GridManagementAgent(BaseHttpServer app_httpd, string component_type, string sendkey, string recvkey, GridManagerCallback thecallback)
24 {
25 this.sendkey = sendkey;
26 this.recvkey = recvkey;
27 this.component_type = component_type;
28 this.thecallback = thecallback;
29 Sessions = new ArrayList();
30
31 app_httpd.AddXmlRPCHandler("manager_login", XmlRpcLoginMethod);
32
33 switch (component_type)
34 {
35 case "gridserver":
36 GridServerManager.sendkey = this.sendkey;
37 GridServerManager.recvkey = this.recvkey;
38 GridServerManager.thecallback = thecallback;
39 app_httpd.AddXmlRPCHandler("shutdown", GridServerManager.XmlRpcShutdownMethod);
40 break;
41 }
42 }
43
44 public static bool SessionExists(LLUUID sessionID)
45 {
46 return Sessions.Contains(sessionID);
47 }
48
49 public static XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
50 {
51 XmlRpcResponse response = new XmlRpcResponse();
52 Hashtable requestData = (Hashtable)request.Params[0];
53 Hashtable responseData = new Hashtable();
54
55 // TODO: Switch this over to using OpenGrid.Framework.Data
56 if (requestData["username"].Equals("admin") && requestData["password"].Equals("supersecret"))
57 {
58 response.IsFault = false;
59 LLUUID new_session = LLUUID.Random();
60 Sessions.Add(new_session);
61 responseData["session_id"] = new_session.ToString();
62 responseData["msg"] = "Login OK";
63 }
64 else
65 {
66 response.IsFault = true;
67 responseData["error"] = "Invalid username or password";
68 }
69
70 response.Value = responseData;
71 return response;
72
73 }
74
75 }
76}