diff options
author | Mike Mazur | 2009-02-24 23:40:08 +0000 |
---|---|---|
committer | Mike Mazur | 2009-02-24 23:40:08 +0000 |
commit | d81fb565c1f48b013d107651c3bf383bd59e4daa (patch) | |
tree | 78b90903c6ee6dbce33f28b352d64e3b82fe3768 /OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs | |
parent | Close-to-final tweaking with appearance. This time sending *everything*. Addr... (diff) | |
download | opensim-SC-d81fb565c1f48b013d107651c3bf383bd59e4daa.zip opensim-SC-d81fb565c1f48b013d107651c3bf383bd59e4daa.tar.gz opensim-SC-d81fb565c1f48b013d107651c3bf383bd59e4daa.tar.bz2 opensim-SC-d81fb565c1f48b013d107651c3bf383bd59e4daa.tar.xz |
Setting svn:eol-style=native on new files.
Diffstat (limited to 'OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs')
-rw-r--r-- | OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs | 322 |
1 files changed, 161 insertions, 161 deletions
diff --git a/OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs b/OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs index 9c2b5ca..ee38310 100644 --- a/OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs +++ b/OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs | |||
@@ -1,161 +1,161 @@ | |||
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 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Text; | 32 | using System.Text; |
33 | using Nwc.XmlRpc; | 33 | using Nwc.XmlRpc; |
34 | using log4net; | 34 | using log4net; |
35 | using OpenSim.Framework.Servers; | 35 | using OpenSim.Framework.Servers; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Grid.Framework; | 37 | using OpenSim.Grid.Framework; |
38 | 38 | ||
39 | namespace OpenSim.Grid.GridServer.Modules | 39 | namespace OpenSim.Grid.GridServer.Modules |
40 | { | 40 | { |
41 | public class GridMessagingModule : IGridMessagingMapper | 41 | public class GridMessagingModule : IGridMessagingMapper |
42 | { | 42 | { |
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
44 | 44 | ||
45 | protected GridDBService m_gridDBService; | 45 | protected GridDBService m_gridDBService; |
46 | protected IUGAIMCore m_gridCore; | 46 | protected IUGAIMCore m_gridCore; |
47 | 47 | ||
48 | protected GridConfig m_config; | 48 | protected GridConfig m_config; |
49 | 49 | ||
50 | /// <value> | 50 | /// <value> |
51 | /// Used to notify old regions as to which OpenSim version to upgrade to | 51 | /// Used to notify old regions as to which OpenSim version to upgrade to |
52 | /// </value> | 52 | /// </value> |
53 | private string m_opensimVersion; | 53 | private string m_opensimVersion; |
54 | 54 | ||
55 | protected BaseHttpServer m_httpServer; | 55 | protected BaseHttpServer m_httpServer; |
56 | 56 | ||
57 | // This is here so that the grid server can hand out MessageServer settings to regions on registration | 57 | // This is here so that the grid server can hand out MessageServer settings to regions on registration |
58 | private List<MessageServerInfo> m_messageServers = new List<MessageServerInfo>(); | 58 | private List<MessageServerInfo> m_messageServers = new List<MessageServerInfo>(); |
59 | 59 | ||
60 | public GridMessagingModule() | 60 | public GridMessagingModule() |
61 | { | 61 | { |
62 | } | 62 | } |
63 | 63 | ||
64 | public void Initialise(string opensimVersion, GridDBService gridDBService, IUGAIMCore gridCore, GridConfig config) | 64 | public void Initialise(string opensimVersion, GridDBService gridDBService, IUGAIMCore gridCore, GridConfig config) |
65 | { | 65 | { |
66 | m_opensimVersion = opensimVersion; | 66 | m_opensimVersion = opensimVersion; |
67 | m_gridDBService = gridDBService; | 67 | m_gridDBService = gridDBService; |
68 | m_gridCore = gridCore; | 68 | m_gridCore = gridCore; |
69 | m_config = config; | 69 | m_config = config; |
70 | 70 | ||
71 | m_gridCore.RegisterInterface<IGridMessagingMapper>(this); | 71 | m_gridCore.RegisterInterface<IGridMessagingMapper>(this); |
72 | 72 | ||
73 | RegisterHandlers(); | 73 | RegisterHandlers(); |
74 | } | 74 | } |
75 | 75 | ||
76 | public void PostInitialise() | 76 | public void PostInitialise() |
77 | { | 77 | { |
78 | 78 | ||
79 | } | 79 | } |
80 | 80 | ||
81 | public void RegisterHandlers() | 81 | public void RegisterHandlers() |
82 | { | 82 | { |
83 | //have these in separate method as some servers restart the http server and reregister all the handlers. | 83 | //have these in separate method as some servers restart the http server and reregister all the handlers. |
84 | m_httpServer = m_gridCore.GetHttpServer(); | 84 | m_httpServer = m_gridCore.GetHttpServer(); |
85 | 85 | ||
86 | // Message Server ---> Grid Server | 86 | // Message Server ---> Grid Server |
87 | m_httpServer.AddXmlRPCHandler("register_messageserver", XmlRPCRegisterMessageServer); | 87 | m_httpServer.AddXmlRPCHandler("register_messageserver", XmlRPCRegisterMessageServer); |
88 | m_httpServer.AddXmlRPCHandler("deregister_messageserver", XmlRPCDeRegisterMessageServer); | 88 | m_httpServer.AddXmlRPCHandler("deregister_messageserver", XmlRPCDeRegisterMessageServer); |
89 | } | 89 | } |
90 | 90 | ||
91 | public List<MessageServerInfo> GetMessageServersList() | 91 | public List<MessageServerInfo> GetMessageServersList() |
92 | { | 92 | { |
93 | lock (m_messageServers) | 93 | lock (m_messageServers) |
94 | { | 94 | { |
95 | return new List<MessageServerInfo>(m_messageServers); | 95 | return new List<MessageServerInfo>(m_messageServers); |
96 | } | 96 | } |
97 | } | 97 | } |
98 | 98 | ||
99 | public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request) | 99 | public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request) |
100 | { | 100 | { |
101 | XmlRpcResponse response = new XmlRpcResponse(); | 101 | XmlRpcResponse response = new XmlRpcResponse(); |
102 | Hashtable requestData = (Hashtable)request.Params[0]; | 102 | Hashtable requestData = (Hashtable)request.Params[0]; |
103 | Hashtable responseData = new Hashtable(); | 103 | Hashtable responseData = new Hashtable(); |
104 | 104 | ||
105 | if (requestData.Contains("uri")) | 105 | if (requestData.Contains("uri")) |
106 | { | 106 | { |
107 | string URI = (string)requestData["URI"]; | 107 | string URI = (string)requestData["URI"]; |
108 | string sendkey = (string)requestData["sendkey"]; | 108 | string sendkey = (string)requestData["sendkey"]; |
109 | string recvkey = (string)requestData["recvkey"]; | 109 | string recvkey = (string)requestData["recvkey"]; |
110 | MessageServerInfo m = new MessageServerInfo(); | 110 | MessageServerInfo m = new MessageServerInfo(); |
111 | m.URI = URI; | 111 | m.URI = URI; |
112 | m.sendkey = sendkey; | 112 | m.sendkey = sendkey; |
113 | m.recvkey = recvkey; | 113 | m.recvkey = recvkey; |
114 | RegisterMessageServer(m); | 114 | RegisterMessageServer(m); |
115 | responseData["responsestring"] = "TRUE"; | 115 | responseData["responsestring"] = "TRUE"; |
116 | response.Value = responseData; | 116 | response.Value = responseData; |
117 | } | 117 | } |
118 | return response; | 118 | return response; |
119 | } | 119 | } |
120 | 120 | ||
121 | public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request) | 121 | public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request) |
122 | { | 122 | { |
123 | XmlRpcResponse response = new XmlRpcResponse(); | 123 | XmlRpcResponse response = new XmlRpcResponse(); |
124 | Hashtable requestData = (Hashtable)request.Params[0]; | 124 | Hashtable requestData = (Hashtable)request.Params[0]; |
125 | Hashtable responseData = new Hashtable(); | 125 | Hashtable responseData = new Hashtable(); |
126 | 126 | ||
127 | if (requestData.Contains("uri")) | 127 | if (requestData.Contains("uri")) |
128 | { | 128 | { |
129 | string URI = (string)requestData["uri"]; | 129 | string URI = (string)requestData["uri"]; |
130 | string sendkey = (string)requestData["sendkey"]; | 130 | string sendkey = (string)requestData["sendkey"]; |
131 | string recvkey = (string)requestData["recvkey"]; | 131 | string recvkey = (string)requestData["recvkey"]; |
132 | MessageServerInfo m = new MessageServerInfo(); | 132 | MessageServerInfo m = new MessageServerInfo(); |
133 | m.URI = URI; | 133 | m.URI = URI; |
134 | m.sendkey = sendkey; | 134 | m.sendkey = sendkey; |
135 | m.recvkey = recvkey; | 135 | m.recvkey = recvkey; |
136 | DeRegisterMessageServer(m); | 136 | DeRegisterMessageServer(m); |
137 | responseData["responsestring"] = "TRUE"; | 137 | responseData["responsestring"] = "TRUE"; |
138 | response.Value = responseData; | 138 | response.Value = responseData; |
139 | } | 139 | } |
140 | return response; | 140 | return response; |
141 | } | 141 | } |
142 | 142 | ||
143 | public void RegisterMessageServer(MessageServerInfo m) | 143 | public void RegisterMessageServer(MessageServerInfo m) |
144 | { | 144 | { |
145 | lock (m_messageServers) | 145 | lock (m_messageServers) |
146 | { | 146 | { |
147 | if (!m_messageServers.Contains(m)) | 147 | if (!m_messageServers.Contains(m)) |
148 | m_messageServers.Add(m); | 148 | m_messageServers.Add(m); |
149 | } | 149 | } |
150 | } | 150 | } |
151 | 151 | ||
152 | public void DeRegisterMessageServer(MessageServerInfo m) | 152 | public void DeRegisterMessageServer(MessageServerInfo m) |
153 | { | 153 | { |
154 | lock (m_messageServers) | 154 | lock (m_messageServers) |
155 | { | 155 | { |
156 | if (m_messageServers.Contains(m)) | 156 | if (m_messageServers.Contains(m)) |
157 | m_messageServers.Remove(m); | 157 | m_messageServers.Remove(m); |
158 | } | 158 | } |
159 | } | 159 | } |
160 | } | 160 | } |
161 | } | 161 | } |