aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/GridServer/GridMessagingModule.cs
diff options
context:
space:
mode:
authorMW2009-02-21 13:44:03 +0000
committerMW2009-02-21 13:44:03 +0000
commit25661b611d241534e5e8d7ce1731de8506481a7d (patch)
treed61ae89bcb909225c6aef295bf6bddb21668b718 /OpenSim/Grid/GridServer/GridMessagingModule.cs
parentAllow entry of '?' in http URIs. If the field being typed begins with (diff)
downloadopensim-SC_OLD-25661b611d241534e5e8d7ce1731de8506481a7d.zip
opensim-SC_OLD-25661b611d241534e5e8d7ce1731de8506481a7d.tar.gz
opensim-SC_OLD-25661b611d241534e5e8d7ce1731de8506481a7d.tar.bz2
opensim-SC_OLD-25661b611d241534e5e8d7ce1731de8506481a7d.tar.xz
Refactored the GridServer into a GridDBService and a set of "modules".
Currently they aren't plugin modules as the support for dynamically loading them isn't complete.
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/GridServer/GridMessagingModule.cs101
1 files changed, 101 insertions, 0 deletions
diff --git a/OpenSim/Grid/GridServer/GridMessagingModule.cs b/OpenSim/Grid/GridServer/GridMessagingModule.cs
new file mode 100644
index 0000000..348e56c
--- /dev/null
+++ b/OpenSim/Grid/GridServer/GridMessagingModule.cs
@@ -0,0 +1,101 @@
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Reflection;
5using System.Text;
6using Nwc.XmlRpc;
7using log4net;
8using OpenSim.Framework.Servers;
9using OpenSim.Framework;
10
11namespace OpenSim.Grid.GridServer
12{
13 public class GridMessagingModule : IGridMessagingModule
14 {
15 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
16
17 protected GridDBService m_gridDBService;
18 protected IGridCore m_gridCore;
19
20 protected GridConfig m_config;
21
22 /// <value>
23 /// Used to notify old regions as to which OpenSim version to upgrade to
24 /// </value>
25 private string m_opensimVersion;
26
27 protected BaseHttpServer m_httpServer;
28
29 // This is here so that the grid server can hand out MessageServer settings to regions on registration
30 private List<MessageServerInfo> _MessageServers = new List<MessageServerInfo>();
31
32 public List<MessageServerInfo> MessageServers
33 {
34 get { return _MessageServers; }
35 }
36
37 public GridMessagingModule(string opensimVersion, GridDBService gridDBService, IGridCore gridCore, GridConfig config)
38 {
39 m_opensimVersion = opensimVersion;
40 m_gridDBService = gridDBService;
41 m_gridCore = gridCore;
42 m_config = config;
43 m_httpServer = m_gridCore.GetHttpServer();
44 }
45
46 public void Initialise()
47 {
48 m_gridCore.RegisterInterface<IGridMessagingModule>(this);
49 // Message Server ---> Grid Server
50 m_httpServer.AddXmlRPCHandler("register_messageserver", XmlRPCRegisterMessageServer);
51 m_httpServer.AddXmlRPCHandler("deregister_messageserver", XmlRPCDeRegisterMessageServer);
52
53 }
54
55 public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request)
56 {
57 XmlRpcResponse response = new XmlRpcResponse();
58 Hashtable requestData = (Hashtable)request.Params[0];
59 Hashtable responseData = new Hashtable();
60
61 if (requestData.Contains("uri"))
62 {
63 string URI = (string)requestData["URI"];
64 string sendkey = (string)requestData["sendkey"];
65 string recvkey = (string)requestData["recvkey"];
66 MessageServerInfo m = new MessageServerInfo();
67 m.URI = URI;
68 m.sendkey = sendkey;
69 m.recvkey = recvkey;
70 if (!_MessageServers.Contains(m))
71 _MessageServers.Add(m);
72 responseData["responsestring"] = "TRUE";
73 response.Value = responseData;
74 }
75 return response;
76 }
77
78 public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request)
79 {
80 XmlRpcResponse response = new XmlRpcResponse();
81 Hashtable requestData = (Hashtable)request.Params[0];
82 Hashtable responseData = new Hashtable();
83
84 if (requestData.Contains("uri"))
85 {
86 string URI = (string)requestData["uri"];
87 string sendkey = (string)requestData["sendkey"];
88 string recvkey = (string)requestData["recvkey"];
89 MessageServerInfo m = new MessageServerInfo();
90 m.URI = URI;
91 m.sendkey = sendkey;
92 m.recvkey = recvkey;
93 if (_MessageServers.Contains(m))
94 _MessageServers.Remove(m);
95 responseData["responsestring"] = "TRUE";
96 response.Value = responseData;
97 }
98 return response;
99 }
100 }
101}