aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMW2009-02-21 18:41:28 +0000
committerMW2009-02-21 18:41:28 +0000
commite77b5d990d275f3a900d844e955bb92f6dba08aa (patch)
tree8dc84f9dbc540e13efc0f243fdb9eed1a7ee6b61 /OpenSim
parentThank you kindly, DoranZemlja for a patch that: (diff)
downloadopensim-SC-e77b5d990d275f3a900d844e955bb92f6dba08aa.zip
opensim-SC-e77b5d990d275f3a900d844e955bb92f6dba08aa.tar.gz
opensim-SC-e77b5d990d275f3a900d844e955bb92f6dba08aa.tar.bz2
opensim-SC-e77b5d990d275f3a900d844e955bb92f6dba08aa.tar.xz
More Grid server refactoring
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/GridServer/GridDBService.cs2
-rw-r--r--OpenSim/Grid/GridServer/GridMessagingModule.cs16
-rw-r--r--OpenSim/Grid/GridServer/GridRestModule.cs15
-rw-r--r--OpenSim/Grid/GridServer/GridServerBase.cs22
-rw-r--r--OpenSim/Grid/GridServer/GridXmlRpcModule.cs27
-rw-r--r--OpenSim/Grid/GridServer/IUGAIMCore.cs (renamed from OpenSim/Grid/GridServer/IGridCore.cs)2
6 files changed, 61 insertions, 23 deletions
diff --git a/OpenSim/Grid/GridServer/GridDBService.cs b/OpenSim/Grid/GridServer/GridDBService.cs
index 94c8dcd..cc244a9 100644
--- a/OpenSim/Grid/GridServer/GridDBService.cs
+++ b/OpenSim/Grid/GridServer/GridDBService.cs
@@ -197,7 +197,7 @@ namespace OpenSim.Grid.GridServer
197 return regions; 197 return regions;
198 } 198 }
199 199
200 public DataResponse LoginRegion(RegionProfileData sim, RegionProfileData existingSim) 200 public DataResponse AddUpdateRegion(RegionProfileData sim, RegionProfileData existingSim)
201 { 201 {
202 DataResponse insertResponse = DataResponse.RESPONSE_ERROR; 202 DataResponse insertResponse = DataResponse.RESPONSE_ERROR;
203 foreach (IGridDataPlugin plugin in _plugins) 203 foreach (IGridDataPlugin plugin in _plugins)
diff --git a/OpenSim/Grid/GridServer/GridMessagingModule.cs b/OpenSim/Grid/GridServer/GridMessagingModule.cs
index 040f4e0..6d9a723 100644
--- a/OpenSim/Grid/GridServer/GridMessagingModule.cs
+++ b/OpenSim/Grid/GridServer/GridMessagingModule.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Grid.GridServer
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 IGridCore m_gridCore; 45 protected IUGAIMCore m_gridCore;
46 46
47 protected GridConfig m_config; 47 protected GridConfig m_config;
48 48
@@ -65,19 +65,29 @@ namespace OpenSim.Grid.GridServer
65 { 65 {
66 } 66 }
67 67
68 public void Initialise(string opensimVersion, GridDBService gridDBService, IGridCore 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();
75 }
76
77 public void PostInitialise()
78 {
79
80 }
81
82 public void RegisterHandlers()
83 {
84 //have these in separate method as some servers restart the http server and reregister all the handlers.
74 m_httpServer = m_gridCore.GetHttpServer(); 85 m_httpServer = m_gridCore.GetHttpServer();
75 86
76 m_gridCore.RegisterInterface<IGridMessagingModule>(this); 87 m_gridCore.RegisterInterface<IGridMessagingModule>(this);
77 // Message Server ---> Grid Server 88 // Message Server ---> Grid Server
78 m_httpServer.AddXmlRPCHandler("register_messageserver", XmlRPCRegisterMessageServer); 89 m_httpServer.AddXmlRPCHandler("register_messageserver", XmlRPCRegisterMessageServer);
79 m_httpServer.AddXmlRPCHandler("deregister_messageserver", XmlRPCDeRegisterMessageServer); 90 m_httpServer.AddXmlRPCHandler("deregister_messageserver", XmlRPCDeRegisterMessageServer);
80
81 } 91 }
82 92
83 public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request) 93 public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request)
diff --git a/OpenSim/Grid/GridServer/GridRestModule.cs b/OpenSim/Grid/GridServer/GridRestModule.cs
index d0bcbe8..5894c4b 100644
--- a/OpenSim/Grid/GridServer/GridRestModule.cs
+++ b/OpenSim/Grid/GridServer/GridRestModule.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Grid.GridServer
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 private GridDBService m_gridDBService; 47 private GridDBService m_gridDBService;
48 private IGridCore m_gridCore; 48 private IUGAIMCore m_gridCore;
49 49
50 protected GridConfig m_config; 50 protected GridConfig m_config;
51 51
@@ -66,12 +66,23 @@ namespace OpenSim.Grid.GridServer
66 { 66 {
67 } 67 }
68 68
69 public void Initialise(string opensimVersion, GridDBService gridDBService, IGridCore gridCore, GridConfig config) 69 public void Initialise(string opensimVersion, GridDBService gridDBService, IUGAIMCore gridCore, GridConfig config)
70 { 70 {
71 m_opensimVersion = opensimVersion; 71 m_opensimVersion = opensimVersion;
72 m_gridDBService = gridDBService; 72 m_gridDBService = gridDBService;
73 m_gridCore = gridCore; 73 m_gridCore = gridCore;
74 m_config = config; 74 m_config = config;
75 RegisterHandlers();
76 }
77
78 public void PostInitialise()
79 {
80
81 }
82
83 public void RegisterHandlers()
84 {
85 //have these in separate method as some servers restart the http server and reregister all the handlers.
75 m_httpServer = m_gridCore.GetHttpServer(); 86 m_httpServer = m_gridCore.GetHttpServer();
76 87
77 m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", RestGetSimMethod)); 88 m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/sims/", RestGetSimMethod));
diff --git a/OpenSim/Grid/GridServer/GridServerBase.cs b/OpenSim/Grid/GridServer/GridServerBase.cs
index 6c3584d..f118c90 100644
--- a/OpenSim/Grid/GridServer/GridServerBase.cs
+++ b/OpenSim/Grid/GridServer/GridServerBase.cs
@@ -39,7 +39,7 @@ namespace OpenSim.Grid.GridServer
39{ 39{
40 /// <summary> 40 /// <summary>
41 /// </summary> 41 /// </summary>
42 public class GridServerBase : BaseOpenSimServer, IGridCore 42 public class GridServerBase : BaseOpenSimServer, IUGAIMCore
43 { 43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
@@ -163,6 +163,10 @@ namespace OpenSim.Grid.GridServer
163 163
164 m_gridRestModule = new GridRestModule(); 164 m_gridRestModule = new GridRestModule();
165 m_gridRestModule.Initialise(m_version, m_gridDBService, this, m_config); 165 m_gridRestModule.Initialise(m_version, m_gridDBService, this, m_config);
166
167 m_gridMessageModule.PostInitialise();
168 m_gridXmlRpcModule.PostInitialise();
169 m_gridRestModule.PostInitialise();
166 } 170 }
167 171
168 public void CheckSims(object sender, ElapsedEventArgs e) 172 public void CheckSims(object sender, ElapsedEventArgs e)
@@ -207,8 +211,8 @@ namespace OpenSim.Grid.GridServer
207 foreach (IGridPlugin plugin in m_plugins) plugin.Dispose(); 211 foreach (IGridPlugin plugin in m_plugins) plugin.Dispose();
208 } 212 }
209 213
210 #region IGridCore 214 #region IUGAIMCore
211 private readonly Dictionary<Type, object> m_gridInterfaces = new Dictionary<Type, object>(); 215 private readonly Dictionary<Type, object> m_moduleInterfaces = new Dictionary<Type, object>();
212 216
213 /// <summary> 217 /// <summary>
214 /// Register an Module interface. 218 /// Register an Module interface.
@@ -217,20 +221,20 @@ namespace OpenSim.Grid.GridServer
217 /// <param name="iface"></param> 221 /// <param name="iface"></param>
218 public void RegisterInterface<T>(T iface) 222 public void RegisterInterface<T>(T iface)
219 { 223 {
220 lock (m_gridInterfaces) 224 lock (m_moduleInterfaces)
221 { 225 {
222 if (!m_gridInterfaces.ContainsKey(typeof(T))) 226 if (!m_moduleInterfaces.ContainsKey(typeof(T)))
223 { 227 {
224 m_gridInterfaces.Add(typeof(T), iface); 228 m_moduleInterfaces.Add(typeof(T), iface);
225 } 229 }
226 } 230 }
227 } 231 }
228 232
229 public bool TryGet<T>(out T iface) 233 public bool TryGet<T>(out T iface)
230 { 234 {
231 if (m_gridInterfaces.ContainsKey(typeof(T))) 235 if (m_moduleInterfaces.ContainsKey(typeof(T)))
232 { 236 {
233 iface = (T)m_gridInterfaces[typeof(T)]; 237 iface = (T)m_moduleInterfaces[typeof(T)];
234 return true; 238 return true;
235 } 239 }
236 iface = default(T); 240 iface = default(T);
@@ -239,7 +243,7 @@ namespace OpenSim.Grid.GridServer
239 243
240 public T Get<T>() 244 public T Get<T>()
241 { 245 {
242 return (T)m_gridInterfaces[typeof(T)]; 246 return (T)m_moduleInterfaces[typeof(T)];
243 } 247 }
244 248
245 public BaseHttpServer GetHttpServer() 249 public BaseHttpServer GetHttpServer()
diff --git a/OpenSim/Grid/GridServer/GridXmlRpcModule.cs b/OpenSim/Grid/GridServer/GridXmlRpcModule.cs
index c2cd1d6..86df81c 100644
--- a/OpenSim/Grid/GridServer/GridXmlRpcModule.cs
+++ b/OpenSim/Grid/GridServer/GridXmlRpcModule.cs
@@ -46,7 +46,7 @@ namespace OpenSim.Grid.GridServer
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 47
48 private GridDBService m_gridDBService; 48 private GridDBService m_gridDBService;
49 private IGridCore m_gridCore; 49 private IUGAIMCore m_gridCore;
50 50
51 protected GridConfig m_config; 51 protected GridConfig m_config;
52 52
@@ -67,12 +67,23 @@ namespace OpenSim.Grid.GridServer
67 { 67 {
68 } 68 }
69 69
70 public void Initialise(string opensimVersion, GridDBService gridDBService, IGridCore gridCore, GridConfig config) 70 public void Initialise(string opensimVersion, GridDBService gridDBService, IUGAIMCore gridCore, GridConfig config)
71 { 71 {
72 m_opensimVersion = opensimVersion; 72 m_opensimVersion = opensimVersion;
73 m_gridDBService = gridDBService; 73 m_gridDBService = gridDBService;
74 m_gridCore = gridCore; 74 m_gridCore = gridCore;
75 m_config = config; 75 m_config = config;
76 RegisterHandlers();
77 }
78
79 public void PostInitialise()
80 {
81
82 }
83
84 public void RegisterHandlers()
85 {
86 //have these in separate method as some servers restart the http server and reregister all the handlers.
76 m_httpServer = m_gridCore.GetHttpServer(); 87 m_httpServer = m_gridCore.GetHttpServer();
77 88
78 m_httpServer.AddXmlRPCHandler("simulator_login", XmlRpcSimulatorLoginMethod); 89 m_httpServer.AddXmlRPCHandler("simulator_login", XmlRpcSimulatorLoginMethod);
@@ -81,7 +92,7 @@ namespace OpenSim.Grid.GridServer
81 m_httpServer.AddXmlRPCHandler("map_block", XmlRpcMapBlockMethod); 92 m_httpServer.AddXmlRPCHandler("map_block", XmlRpcMapBlockMethod);
82 m_httpServer.AddXmlRPCHandler("search_for_region_by_name", XmlRpcSearchForRegionMethod); 93 m_httpServer.AddXmlRPCHandler("search_for_region_by_name", XmlRpcSearchForRegionMethod);
83 } 94 }
84 95
85 /// <summary> 96 /// <summary>
86 /// Returns a XML String containing a list of the neighbouring regions 97 /// Returns a XML String containing a list of the neighbouring regions
87 /// </summary> 98 /// </summary>
@@ -305,7 +316,7 @@ namespace OpenSim.Grid.GridServer
305 return e.XmlRpcErrorResponse; 316 return e.XmlRpcErrorResponse;
306 } 317 }
307 318
308 DataResponse insertResponse = m_gridDBService.LoginRegion(sim, existingSim); 319 DataResponse insertResponse = m_gridDBService.AddUpdateRegion(sim, existingSim);
309 320
310 switch (insertResponse) 321 switch (insertResponse)
311 { 322 {
@@ -557,7 +568,7 @@ namespace OpenSim.Grid.GridServer
557 //TheSim = GetRegion(new UUID((string) requestData["UUID"])); 568 //TheSim = GetRegion(new UUID((string) requestData["UUID"]));
558 uuid = requestData["UUID"].ToString(); 569 uuid = requestData["UUID"].ToString();
559 m_log.InfoFormat("[LOGOUT]: Logging out region: {0}", uuid); 570 m_log.InfoFormat("[LOGOUT]: Logging out region: {0}", uuid);
560// logToDB((new LLUUID((string)requestData["UUID"])).ToString(),"XmlRpcDeleteRegionMethod","", 5,"Attempting delete with UUID."); 571 // logToDB((new LLUUID((string)requestData["UUID"])).ToString(),"XmlRpcDeleteRegionMethod","", 5,"Attempting delete with UUID.");
561 } 572 }
562 else 573 else
563 { 574 {
@@ -849,13 +860,15 @@ namespace OpenSim.Grid.GridServer
849 } 860 }
850 private XmlRpcResponse m_xmlRpcErrorResponse; 861 private XmlRpcResponse m_xmlRpcErrorResponse;
851 862
852 public LoginException(string message, string xmlRpcMessage) : base(message) 863 public LoginException(string message, string xmlRpcMessage)
864 : base(message)
853 { 865 {
854 // FIXME: Might be neater to refactor and put the method inside here 866 // FIXME: Might be neater to refactor and put the method inside here
855 m_xmlRpcErrorResponse = GridXmlRpcModule.ErrorResponse(xmlRpcMessage); 867 m_xmlRpcErrorResponse = GridXmlRpcModule.ErrorResponse(xmlRpcMessage);
856 } 868 }
857 869
858 public LoginException(string message, string xmlRpcMessage, Exception e) : base(message, e) 870 public LoginException(string message, string xmlRpcMessage, Exception e)
871 : base(message, e)
859 { 872 {
860 // FIXME: Might be neater to refactor and put the method inside here 873 // FIXME: Might be neater to refactor and put the method inside here
861 m_xmlRpcErrorResponse = GridXmlRpcModule.ErrorResponse(xmlRpcMessage); 874 m_xmlRpcErrorResponse = GridXmlRpcModule.ErrorResponse(xmlRpcMessage);
diff --git a/OpenSim/Grid/GridServer/IGridCore.cs b/OpenSim/Grid/GridServer/IUGAIMCore.cs
index dd0d140..12cd19b 100644
--- a/OpenSim/Grid/GridServer/IGridCore.cs
+++ b/OpenSim/Grid/GridServer/IUGAIMCore.cs
@@ -3,7 +3,7 @@ using OpenSim.Framework.Servers;
3 3
4namespace OpenSim.Grid.GridServer 4namespace OpenSim.Grid.GridServer
5{ 5{
6 public interface IGridCore 6 public interface IUGAIMCore
7 { 7 {
8 T Get<T>(); 8 T Get<T>();
9 void RegisterInterface<T>(T iface); 9 void RegisterInterface<T>(T iface);