diff options
author | Homer Horwitz | 2008-10-03 23:00:42 +0000 |
---|---|---|
committer | Homer Horwitz | 2008-10-03 23:00:42 +0000 |
commit | 16d68749a457acf079a6737f4ca9a9adb9e53e2f (patch) | |
tree | 901b2c31e53eeb97f30ac46f2b7f406a01e1755a /OpenSim/Grid/GridServer/GridManager.cs | |
parent | Fix: Mantis#2326: Fix: privilege escalation through attach from ground (diff) | |
download | opensim-SC_OLD-16d68749a457acf079a6737f4ca9a9adb9e53e2f.zip opensim-SC_OLD-16d68749a457acf079a6737f4ca9a9adb9e53e2f.tar.gz opensim-SC_OLD-16d68749a457acf079a6737f4ca9a9adb9e53e2f.tar.bz2 opensim-SC_OLD-16d68749a457acf079a6737f4ca9a9adb9e53e2f.tar.xz |
Add the missing bits for the new region-search:
- Added lookup in the data-layer
- MySQL works
- SQLite doesn't have a grid-db, so it won't work there
- I added MSSQL-code to the best of my knowledge; but I don't know MSSQL :-)
- Added the plumbing up to OGS1GridServices. This speaks with the grid-server
via XMLRPC.
- Modified MapSearchModule to use the new data. It's backward compatible; if
used with an old grid-server, it just returns one found region instead of a
list.
- Refactored a bit.
Note: This updates data, grid-server and region code. No new files.
Diffstat (limited to 'OpenSim/Grid/GridServer/GridManager.cs')
-rw-r--r-- | OpenSim/Grid/GridServer/GridManager.cs | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs index ed474c5..1e8ac00 100644 --- a/OpenSim/Grid/GridServer/GridManager.cs +++ b/OpenSim/Grid/GridServer/GridManager.cs | |||
@@ -188,6 +188,26 @@ namespace OpenSim.Grid.GridServer | |||
188 | return regions; | 188 | return regions; |
189 | } | 189 | } |
190 | 190 | ||
191 | public List<RegionProfileData> GetRegions(string name, int maxNum) | ||
192 | { | ||
193 | List<RegionProfileData> regions = new List<RegionProfileData>(); | ||
194 | foreach (IGridDataPlugin plugin in _plugins) | ||
195 | { | ||
196 | try | ||
197 | { | ||
198 | int num = maxNum - regions.Count; | ||
199 | List <RegionProfileData> profiles = plugin.GetRegionsByName(name, (uint)num); | ||
200 | if (profiles != null) regions.AddRange(profiles); | ||
201 | } | ||
202 | catch | ||
203 | { | ||
204 | m_log.Warn("[storage]: Unable to query regionblock via " + plugin.Name); | ||
205 | } | ||
206 | } | ||
207 | |||
208 | return regions; | ||
209 | } | ||
210 | |||
191 | /// <summary> | 211 | /// <summary> |
192 | /// Returns a XML String containing a list of the neighbouring regions | 212 | /// Returns a XML String containing a list of the neighbouring regions |
193 | /// </summary> | 213 | /// </summary> |
@@ -877,6 +897,56 @@ namespace OpenSim.Grid.GridServer | |||
877 | } | 897 | } |
878 | 898 | ||
879 | /// <summary> | 899 | /// <summary> |
900 | /// Returns up to <code>maxNumber</code> profiles of regions that have a name starting with <code>name</code> | ||
901 | /// </summary> | ||
902 | /// <param name="request"></param> | ||
903 | /// <returns></returns> | ||
904 | public XmlRpcResponse XmlRpcSearchForRegionMethod(XmlRpcRequest request) | ||
905 | { | ||
906 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
907 | |||
908 | if (!requestData.ContainsKey("name") || !requestData.Contains("maxNumber")) | ||
909 | { | ||
910 | m_log.Warn("[DATA] Invalid region-search request; missing name or maxNumber"); | ||
911 | return new XmlRpcResponse(500, "Missing name or maxNumber in region search request"); | ||
912 | } | ||
913 | |||
914 | Hashtable responseData = new Hashtable(); | ||
915 | |||
916 | string name = (string)requestData["name"]; | ||
917 | int maxNumber = Convert.ToInt32((string)requestData["maxNumber"]); | ||
918 | if (maxNumber == 0 || name.Length < 3) | ||
919 | { | ||
920 | // either we didn't want any, or we were too unspecific | ||
921 | responseData["numFound"] = 0; | ||
922 | } | ||
923 | else | ||
924 | { | ||
925 | List<RegionProfileData> sims = GetRegions(name, maxNumber); | ||
926 | |||
927 | responseData["numFound"] = sims.Count; | ||
928 | for (int i = 0; i < sims.Count; ++i) | ||
929 | { | ||
930 | RegionProfileData sim = sims[i]; | ||
931 | string prefix = "region" + i + "."; | ||
932 | responseData[prefix + "region_name"] = sim.regionName; | ||
933 | responseData[prefix + "region_UUID"] = sim.UUID.ToString(); | ||
934 | responseData[prefix + "region_locx"] = sim.regionLocX.ToString(); | ||
935 | responseData[prefix + "region_locy"] = sim.regionLocY.ToString(); | ||
936 | responseData[prefix + "sim_ip"] = sim.serverIP.ToString(); | ||
937 | responseData[prefix + "sim_port"] = sim.serverPort.ToString(); | ||
938 | responseData[prefix + "remoting_port"] = sim.remotingPort.ToString(); | ||
939 | responseData[prefix + "http_port"] = sim.httpPort.ToString(); | ||
940 | responseData[prefix + "map_UUID"] = sim.regionMapTextureID.ToString(); | ||
941 | } | ||
942 | } | ||
943 | |||
944 | XmlRpcResponse response = new XmlRpcResponse(); | ||
945 | response.Value = responseData; | ||
946 | return response; | ||
947 | } | ||
948 | |||
949 | /// <summary> | ||
880 | /// Performs a REST Get Operation | 950 | /// Performs a REST Get Operation |
881 | /// </summary> | 951 | /// </summary> |
882 | /// <param name="request"></param> | 952 | /// <param name="request"></param> |