aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/GridServer/GridMessagingModule.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/GridServer/GridMessagingModule.cs278
1 files changed, 139 insertions, 139 deletions
diff --git a/OpenSim/Grid/GridServer/GridMessagingModule.cs b/OpenSim/Grid/GridServer/GridMessagingModule.cs
index 6d9a723..2a26f24 100644
--- a/OpenSim/Grid/GridServer/GridMessagingModule.cs
+++ b/OpenSim/Grid/GridServer/GridMessagingModule.cs
@@ -1,139 +1,139 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using System.Text; 32using System.Text;
33using Nwc.XmlRpc; 33using Nwc.XmlRpc;
34using log4net; 34using log4net;
35using OpenSim.Framework.Servers; 35using OpenSim.Framework.Servers;
36using OpenSim.Framework; 36using OpenSim.Framework;
37 37
38namespace OpenSim.Grid.GridServer 38namespace OpenSim.Grid.GridServer
39{ 39{
40 public class GridMessagingModule : IGridMessagingModule 40 public class GridMessagingModule : IGridMessagingModule
41 { 41 {
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
43 43
44 protected GridDBService m_gridDBService; 44 protected GridDBService m_gridDBService;
45 protected IUGAIMCore m_gridCore; 45 protected IUGAIMCore m_gridCore;
46 46
47 protected GridConfig m_config; 47 protected GridConfig m_config;
48 48
49 /// <value> 49 /// <value>
50 /// Used to notify old regions as to which OpenSim version to upgrade to 50 /// Used to notify old regions as to which OpenSim version to upgrade to
51 /// </value> 51 /// </value>
52 private string m_opensimVersion; 52 private string m_opensimVersion;
53 53
54 protected BaseHttpServer m_httpServer; 54 protected BaseHttpServer m_httpServer;
55 55
56 // This is here so that the grid server can hand out MessageServer settings to regions on registration 56 // This is here so that the grid server can hand out MessageServer settings to regions on registration
57 private List<MessageServerInfo> _MessageServers = new List<MessageServerInfo>(); 57 private List<MessageServerInfo> _MessageServers = new List<MessageServerInfo>();
58 58
59 public List<MessageServerInfo> MessageServers 59 public List<MessageServerInfo> MessageServers
60 { 60 {
61 get { return _MessageServers; } 61 get { return _MessageServers; }
62 } 62 }
63 63
64 public GridMessagingModule() 64 public GridMessagingModule()
65 { 65 {
66 } 66 }
67 67
68 public void Initialise(string opensimVersion, GridDBService gridDBService, IUGAIMCore gridCore, GridConfig config) 68 public void Initialise(string opensimVersion, GridDBService gridDBService, IUGAIMCore gridCore, GridConfig config)
69 { 69 {
70 m_opensimVersion = opensimVersion; 70 m_opensimVersion = opensimVersion;
71 m_gridDBService = gridDBService; 71 m_gridDBService = gridDBService;
72 m_gridCore = gridCore; 72 m_gridCore = gridCore;
73 m_config = config; 73 m_config = config;
74 RegisterHandlers(); 74 RegisterHandlers();
75 } 75 }
76 76
77 public void PostInitialise() 77 public void PostInitialise()
78 { 78 {
79 79
80 } 80 }
81 81
82 public void RegisterHandlers() 82 public void RegisterHandlers()
83 { 83 {
84 //have these in separate method as some servers restart the http server and reregister all the handlers. 84 //have these in separate method as some servers restart the http server and reregister all the handlers.
85 m_httpServer = m_gridCore.GetHttpServer(); 85 m_httpServer = m_gridCore.GetHttpServer();
86 86
87 m_gridCore.RegisterInterface<IGridMessagingModule>(this); 87 m_gridCore.RegisterInterface<IGridMessagingModule>(this);
88 // Message Server ---> Grid Server 88 // Message Server ---> Grid Server
89 m_httpServer.AddXmlRPCHandler("register_messageserver", XmlRPCRegisterMessageServer); 89 m_httpServer.AddXmlRPCHandler("register_messageserver", XmlRPCRegisterMessageServer);
90 m_httpServer.AddXmlRPCHandler("deregister_messageserver", XmlRPCDeRegisterMessageServer); 90 m_httpServer.AddXmlRPCHandler("deregister_messageserver", XmlRPCDeRegisterMessageServer);
91 } 91 }
92 92
93 public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request) 93 public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request)
94 { 94 {
95 XmlRpcResponse response = new XmlRpcResponse(); 95 XmlRpcResponse response = new XmlRpcResponse();
96 Hashtable requestData = (Hashtable)request.Params[0]; 96 Hashtable requestData = (Hashtable)request.Params[0];
97 Hashtable responseData = new Hashtable(); 97 Hashtable responseData = new Hashtable();
98 98
99 if (requestData.Contains("uri")) 99 if (requestData.Contains("uri"))
100 { 100 {
101 string URI = (string)requestData["URI"]; 101 string URI = (string)requestData["URI"];
102 string sendkey = (string)requestData["sendkey"]; 102 string sendkey = (string)requestData["sendkey"];
103 string recvkey = (string)requestData["recvkey"]; 103 string recvkey = (string)requestData["recvkey"];
104 MessageServerInfo m = new MessageServerInfo(); 104 MessageServerInfo m = new MessageServerInfo();
105 m.URI = URI; 105 m.URI = URI;
106 m.sendkey = sendkey; 106 m.sendkey = sendkey;
107 m.recvkey = recvkey; 107 m.recvkey = recvkey;
108 if (!_MessageServers.Contains(m)) 108 if (!_MessageServers.Contains(m))
109 _MessageServers.Add(m); 109 _MessageServers.Add(m);
110 responseData["responsestring"] = "TRUE"; 110 responseData["responsestring"] = "TRUE";
111 response.Value = responseData; 111 response.Value = responseData;
112 } 112 }
113 return response; 113 return response;
114 } 114 }
115 115
116 public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request) 116 public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request)
117 { 117 {
118 XmlRpcResponse response = new XmlRpcResponse(); 118 XmlRpcResponse response = new XmlRpcResponse();
119 Hashtable requestData = (Hashtable)request.Params[0]; 119 Hashtable requestData = (Hashtable)request.Params[0];
120 Hashtable responseData = new Hashtable(); 120 Hashtable responseData = new Hashtable();
121 121
122 if (requestData.Contains("uri")) 122 if (requestData.Contains("uri"))
123 { 123 {
124 string URI = (string)requestData["uri"]; 124 string URI = (string)requestData["uri"];
125 string sendkey = (string)requestData["sendkey"]; 125 string sendkey = (string)requestData["sendkey"];
126 string recvkey = (string)requestData["recvkey"]; 126 string recvkey = (string)requestData["recvkey"];
127 MessageServerInfo m = new MessageServerInfo(); 127 MessageServerInfo m = new MessageServerInfo();
128 m.URI = URI; 128 m.URI = URI;
129 m.sendkey = sendkey; 129 m.sendkey = sendkey;
130 m.recvkey = recvkey; 130 m.recvkey = recvkey;
131 if (_MessageServers.Contains(m)) 131 if (_MessageServers.Contains(m))
132 _MessageServers.Remove(m); 132 _MessageServers.Remove(m);
133 responseData["responsestring"] = "TRUE"; 133 responseData["responsestring"] = "TRUE";
134 response.Value = responseData; 134 response.Value = responseData;
135 } 135 }
136 return response; 136 return response;
137 } 137 }
138 } 138 }
139} 139}