From 4bae547ecb67fcf74981ad85c02872dedc99f94a Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 14 Jan 2010 06:36:39 -0800 Subject: Added the 2 missing methods in the grid service remote connections. --- .../Server/Handlers/Grid/GridServerPostHandler.cs | 77 ++++++++++++++++++++++ 1 file changed, 77 insertions(+) (limited to 'OpenSim/Server/Handlers') diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs index d99b791..1601575 100644 --- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs @@ -103,6 +103,12 @@ namespace OpenSim.Server.Handlers.Grid case "get_region_range": return GetRegionRange(request); + case "get_default_regions": + return GetDefaultRegions(request); + + case "get_fallback_regions": + return GetFallbackRegions(request); + } m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method); } @@ -404,6 +410,77 @@ namespace OpenSim.Server.Handlers.Grid return encoding.GetBytes(xmlString); } + byte[] GetDefaultRegions(Dictionary request) + { + //m_log.DebugFormat("[GRID HANDLER]: GetDefaultRegions"); + UUID scopeID = UUID.Zero; + if (request.ContainsKey("SCOPEID")) + UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); + else + m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region range"); + + List rinfos = m_GridService.GetDefaultRegions(scopeID); + + Dictionary result = new Dictionary(); + if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0))) + result["result"] = "null"; + else + { + int i = 0; + foreach (GridRegion rinfo in rinfos) + { + Dictionary rinfoDict = rinfo.ToKeyValuePairs(); + result["region" + i] = rinfoDict; + i++; + } + } + string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + + byte[] GetFallbackRegions(Dictionary request) + { + //m_log.DebugFormat("[GRID HANDLER]: GetRegionRange"); + UUID scopeID = UUID.Zero; + if (request.ContainsKey("SCOPEID")) + UUID.TryParse(request["SCOPEID"].ToString(), out scopeID); + else + m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get fallback regions"); + + int x = 0, y = 0; + if (request.ContainsKey("X")) + Int32.TryParse(request["X"].ToString(), out x); + else + m_log.WarnFormat("[GRID HANDLER]: no X in request to get fallback regions"); + if (request.ContainsKey("Y")) + Int32.TryParse(request["Y"].ToString(), out y); + else + m_log.WarnFormat("[GRID HANDLER]: no Y in request to get fallback regions"); + + + List rinfos = m_GridService.GetFallbackRegions(scopeID, x, y); + + Dictionary result = new Dictionary(); + if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0))) + result["result"] = "null"; + else + { + int i = 0; + foreach (GridRegion rinfo in rinfos) + { + Dictionary rinfoDict = rinfo.ToKeyValuePairs(); + result["region" + i] = rinfoDict; + i++; + } + } + string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + } + #endregion #region Misc -- cgit v1.1