aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs
diff options
context:
space:
mode:
authorMW2007-05-24 12:35:32 +0000
committerMW2007-05-24 12:35:32 +0000
commitf95b6081cba084d1b067acea99c0effa2b3bf42c (patch)
tree7a7ab4aa037f75afa54f403c701a735acb101575 /OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs
parentDie ServiceManager! (Not really Gareth, just the old directory, new directory... (diff)
downloadopensim-SC_OLD-f95b6081cba084d1b067acea99c0effa2b3bf42c.zip
opensim-SC_OLD-f95b6081cba084d1b067acea99c0effa2b3bf42c.tar.gz
opensim-SC_OLD-f95b6081cba084d1b067acea99c0effa2b3bf42c.tar.bz2
opensim-SC_OLD-f95b6081cba084d1b067acea99c0effa2b3bf42c.tar.xz
Renamed the new Directories. (removed the "-Source" from the end of them)
Diffstat (limited to 'OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs')
-rw-r--r--OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs71
1 files changed, 71 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..e43ce87
--- /dev/null
+++ b/OpenGridServices/OpenGrid.Framework.Manager/GridManagementAgent.cs
@@ -0,0 +1,71 @@
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 public delegate void GridManagerCallback(string param);
11
12 public class GridManagementAgent {
13
14 private GridManagerCallback thecallback;
15 private string sendkey;
16 private string recvkey;
17 private string component_type;
18
19 private static ArrayList Sessions;
20
21 public GridManagementAgent(BaseHttpServer app_httpd, string component_type, string sendkey, string recvkey, GridManagerCallback thecallback)
22 {
23 this.sendkey=sendkey;
24 this.recvkey=recvkey;
25 this.component_type=component_type;
26 this.thecallback=thecallback;
27 Sessions = new ArrayList();
28
29 app_httpd.AddXmlRPCHandler("manager_login",XmlRpcLoginMethod);
30
31 switch(component_type)
32 {
33 case "gridserver":
34 GridServerManager.sendkey=this.sendkey;
35 GridServerManager.recvkey=this.recvkey;
36 GridServerManager.thecallback=thecallback;
37 app_httpd.AddXmlRPCHandler("shutdown", GridServerManager.XmlRpcShutdownMethod);
38 break;
39 }
40 }
41
42 public static bool SessionExists(LLUUID sessionID)
43 {
44 return Sessions.Contains(sessionID);
45 }
46
47 public static XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request)
48 {
49 XmlRpcResponse response = new XmlRpcResponse();
50 Hashtable requestData = (Hashtable)request.Params[0];
51 Hashtable responseData = new Hashtable();
52
53 // TODO: Switch this over to using OpenGrid.Framework.Data
54 if( requestData["username"].Equals("admin") && requestData["password"].Equals("supersecret")) {
55 response.IsFault=false;
56 LLUUID new_session=LLUUID.Random();
57 Sessions.Add(new_session);
58 responseData["session_id"]=new_session.ToString();
59 responseData["msg"]="Login OK";
60 } else {
61 response.IsFault=true;
62 responseData["error"]="Invalid username or password";
63 }
64
65 response.Value = responseData;
66 return response;
67
68 }
69
70 }
71}