aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs')
-rw-r--r--OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs147
1 files changed, 76 insertions, 71 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 @@
1using Nwc.XmlRpc; 1using Nwc.XmlRpc;
2using OpenSim.Framework; 2using OpenSim.Framework;
3using OpenSim.Servers; 3using OpenSim.Servers;
4using System.Collections; 4using System.Collections;
5using System.Collections.Generic; 5using System.Collections.Generic;
6using libsecondlife; 6using libsecondlife;
7 7
8namespace OpenGrid.Framework.Manager { 8namespace 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}