aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework
diff options
context:
space:
mode:
authordiva2009-03-27 16:13:25 +0000
committerdiva2009-03-27 16:13:25 +0000
commit06ad2244f097a6d02fc5f74bc663b156c11d2c62 (patch)
tree7d2f4c207946d224ca68df4c9d7ad6e0528d5320 /OpenSim/Region/CoreModules/Framework
parentsvn:eol-style property set. (diff)
downloadopensim-SC_OLD-06ad2244f097a6d02fc5f74bc663b156c11d2c62.zip
opensim-SC_OLD-06ad2244f097a6d02fc5f74bc663b156c11d2c62.tar.gz
opensim-SC_OLD-06ad2244f097a6d02fc5f74bc663b156c11d2c62.tar.bz2
opensim-SC_OLD-06ad2244f097a6d02fc5f74bc663b156c11d2c62.tar.xz
svn:eol-style property set.
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r--OpenSim/Region/CoreModules/Framework/Services/RegionMapService.cs416
1 files changed, 208 insertions, 208 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/Services/RegionMapService.cs b/OpenSim/Region/CoreModules/Framework/Services/RegionMapService.cs
index e706c55..d18e320 100644
--- a/OpenSim/Region/CoreModules/Framework/Services/RegionMapService.cs
+++ b/OpenSim/Region/CoreModules/Framework/Services/RegionMapService.cs
@@ -1,208 +1,208 @@
1/** 1/**
2 * Copyright (c) 2008, Contributors. All rights reserved. 2 * Copyright (c) 2008, Contributors. All rights reserved.
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 modification, 5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met: 6 * are permitted provided that the following conditions are met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright notice, 8 * * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright notice, 10 * * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation 11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution. 12 * and/or other materials provided with the distribution.
13 * * Neither the name of the Organizations nor the names of Individual 13 * * Neither the name of the Organizations nor the names of Individual
14 * Contributors may be used to endorse or promote products derived from 14 * Contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission. 15 * this software without specific prior written permission.
16 * 16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
20 * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
22 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 24 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
25 * OF THE POSSIBILITY OF SUCH DAMAGE. 25 * OF THE POSSIBILITY OF SUCH DAMAGE.
26 * 26 *
27 */ 27 */
28 28
29using System; 29using System;
30using System.Collections; 30using System.Collections;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Reflection; 32using System.Reflection;
33using log4net; 33using log4net;
34using Nini.Config; 34using Nini.Config;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenSim.Data; 36using OpenSim.Data;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Communications; 38using OpenSim.Framework.Communications;
39using OpenSim.Framework.Communications.Cache; 39using OpenSim.Framework.Communications.Cache;
40using OpenSim.Framework.Servers.Interfaces; 40using OpenSim.Framework.Servers.Interfaces;
41using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
43 43
44using Nwc.XmlRpc; 44using Nwc.XmlRpc;
45 45
46 46
47namespace OpenSim.Region.CoreModules.Framework.Services 47namespace OpenSim.Region.CoreModules.Framework.Services
48{ 48{
49 public class RegionMapService : IRegionModule 49 public class RegionMapService : IRegionModule
50 { 50 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 private static bool initialized = false; 52 private static bool initialized = false;
53 private static bool enabled = false; 53 private static bool enabled = false;
54 54
55 Scene m_scene; 55 Scene m_scene;
56 //AssetService m_assetService; 56 //AssetService m_assetService;
57 57
58 #region IRegionModule interface 58 #region IRegionModule interface
59 59
60 public void Initialise(Scene scene, IConfigSource config) 60 public void Initialise(Scene scene, IConfigSource config)
61 { 61 {
62 if (!initialized) 62 if (!initialized)
63 { 63 {
64 initialized = true; 64 initialized = true;
65 m_scene = scene; 65 m_scene = scene;
66 66
67 // This module is only on for hypergrid mode 67 // This module is only on for hypergrid mode
68 enabled = config.Configs["Startup"].GetBoolean("hypergrid", false); 68 enabled = config.Configs["Startup"].GetBoolean("hypergrid", false);
69 } 69 }
70 } 70 }
71 71
72 public void PostInitialise() 72 public void PostInitialise()
73 { 73 {
74 if (enabled) 74 if (enabled)
75 { 75 {
76 m_log.Info("[RegionMapService]: Starting..."); 76 m_log.Info("[RegionMapService]: Starting...");
77 77
78 //m_assetService = new AssetService(m_scene); 78 //m_assetService = new AssetService(m_scene);
79 new GridService(m_scene); 79 new GridService(m_scene);
80 } 80 }
81 } 81 }
82 82
83 public void Close() 83 public void Close()
84 { 84 {
85 } 85 }
86 86
87 public string Name 87 public string Name
88 { 88 {
89 get { return "RegionMapService"; } 89 get { return "RegionMapService"; }
90 } 90 }
91 91
92 public bool IsSharedModule 92 public bool IsSharedModule
93 { 93 {
94 get { return true; } 94 get { return true; }
95 } 95 }
96 96
97 #endregion 97 #endregion
98 98
99 } 99 }
100 100
101 public class GridService 101 public class GridService
102 { 102 {
103// private IUserService m_userService; 103// private IUserService m_userService;
104 private IGridServices m_gridService; 104 private IGridServices m_gridService;
105 private bool m_doLookup = false; 105 private bool m_doLookup = false;
106 106
107 public bool DoLookup 107 public bool DoLookup
108 { 108 {
109 get { return m_doLookup; } 109 get { return m_doLookup; }
110 set { m_doLookup = value; } 110 set { m_doLookup = value; }
111 } 111 }
112 private static readonly ILog m_log 112 private static readonly ILog m_log
113 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 113 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
114 114
115 public GridService(Scene m_scene) 115 public GridService(Scene m_scene)
116 { 116 {
117 AddHandlers(m_scene); 117 AddHandlers(m_scene);
118// m_userService = m_scene.CommsManager.UserService; 118// m_userService = m_scene.CommsManager.UserService;
119 m_gridService = m_scene.CommsManager.GridService; 119 m_gridService = m_scene.CommsManager.GridService;
120 } 120 }
121 121
122 protected void AddHandlers(Scene m_scene) 122 protected void AddHandlers(Scene m_scene)
123 { 123 {
124// IAssetDataPlugin m_assetProvider 124// IAssetDataPlugin m_assetProvider
125// = ((AssetServerBase)m_scene.CommsManager.AssetCache.AssetServer).AssetProviderPlugin; 125// = ((AssetServerBase)m_scene.CommsManager.AssetCache.AssetServer).AssetProviderPlugin;
126 126
127 IHttpServer httpServer = m_scene.CommsManager.HttpServer; 127 IHttpServer httpServer = m_scene.CommsManager.HttpServer;
128 httpServer.AddXmlRPCHandler("simulator_data_request", XmlRpcSimulatorDataRequestMethod); 128 httpServer.AddXmlRPCHandler("simulator_data_request", XmlRpcSimulatorDataRequestMethod);
129 //m_httpServer.AddXmlRPCHandler("map_block", XmlRpcMapBlockMethod); 129 //m_httpServer.AddXmlRPCHandler("map_block", XmlRpcMapBlockMethod);
130 //m_httpServer.AddXmlRPCHandler("search_for_region_by_name", XmlRpcSearchForRegionMethod); 130 //m_httpServer.AddXmlRPCHandler("search_for_region_by_name", XmlRpcSearchForRegionMethod);
131 131
132 } 132 }
133 133
134 /// <summary> 134 /// <summary>
135 /// Returns an XML RPC response to a simulator profile request 135 /// Returns an XML RPC response to a simulator profile request
136 /// </summary> 136 /// </summary>
137 /// <param name="request"></param> 137 /// <param name="request"></param>
138 /// <returns></returns> 138 /// <returns></returns>
139 public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request) 139 public XmlRpcResponse XmlRpcSimulatorDataRequestMethod(XmlRpcRequest request)
140 { 140 {
141 Hashtable requestData = (Hashtable)request.Params[0]; 141 Hashtable requestData = (Hashtable)request.Params[0];
142 Hashtable responseData = new Hashtable(); 142 Hashtable responseData = new Hashtable();
143 RegionInfo simData = null; 143 RegionInfo simData = null;
144 if (requestData.ContainsKey("region_UUID")) 144 if (requestData.ContainsKey("region_UUID"))
145 { 145 {
146 UUID regionID = new UUID((string)requestData["region_UUID"]); 146 UUID regionID = new UUID((string)requestData["region_UUID"]);
147 simData = m_gridService.RequestNeighbourInfo(regionID); //.GetRegion(regionID); 147 simData = m_gridService.RequestNeighbourInfo(regionID); //.GetRegion(regionID);
148 if (simData == null) 148 if (simData == null)
149 { 149 {
150 m_log.WarnFormat("[HGGridService] didn't find region for regionID {0} from {1}", 150 m_log.WarnFormat("[HGGridService] didn't find region for regionID {0} from {1}",
151 regionID, request.Params.Count > 1 ? request.Params[1] : "unknwon source"); 151 regionID, request.Params.Count > 1 ? request.Params[1] : "unknwon source");
152 } 152 }
153 } 153 }
154 else if (requestData.ContainsKey("region_handle")) 154 else if (requestData.ContainsKey("region_handle"))
155 { 155 {
156 //CFK: The if/else below this makes this message redundant. 156 //CFK: The if/else below this makes this message redundant.
157 //CFK: m_log.Info("requesting data for region " + (string) requestData["region_handle"]); 157 //CFK: m_log.Info("requesting data for region " + (string) requestData["region_handle"]);
158 ulong regionHandle = Convert.ToUInt64((string)requestData["region_handle"]); 158 ulong regionHandle = Convert.ToUInt64((string)requestData["region_handle"]);
159 simData = m_gridService.RequestNeighbourInfo(regionHandle); //m_gridDBService.GetRegion(regionHandle); 159 simData = m_gridService.RequestNeighbourInfo(regionHandle); //m_gridDBService.GetRegion(regionHandle);
160 if (simData == null) 160 if (simData == null)
161 { 161 {
162 m_log.WarnFormat("[HGGridService] didn't find region for regionHandle {0} from {1}", 162 m_log.WarnFormat("[HGGridService] didn't find region for regionHandle {0} from {1}",
163 regionHandle, request.Params.Count > 1 ? request.Params[1] : "unknwon source"); 163 regionHandle, request.Params.Count > 1 ? request.Params[1] : "unknwon source");
164 } 164 }
165 } 165 }
166 else if (requestData.ContainsKey("region_name_search")) 166 else if (requestData.ContainsKey("region_name_search"))
167 { 167 {
168 string regionName = (string)requestData["region_name_search"]; 168 string regionName = (string)requestData["region_name_search"];
169 List<RegionInfo> regInfos = m_gridService.RequestNamedRegions(regionName, 1);//m_gridDBService.GetRegion(regionName); 169 List<RegionInfo> regInfos = m_gridService.RequestNamedRegions(regionName, 1);//m_gridDBService.GetRegion(regionName);
170 if (regInfos != null) 170 if (regInfos != null)
171 simData = regInfos[0]; 171 simData = regInfos[0];
172 172
173 if (simData == null) 173 if (simData == null)
174 { 174 {
175 m_log.WarnFormat("[HGGridService] didn't find region for regionName {0} from {1}", 175 m_log.WarnFormat("[HGGridService] didn't find region for regionName {0} from {1}",
176 regionName, request.Params.Count > 1 ? request.Params[1] : "unknwon source"); 176 regionName, request.Params.Count > 1 ? request.Params[1] : "unknwon source");
177 } 177 }
178 } 178 }
179 else m_log.Warn("[HGGridService] regionlookup without regionID, regionHandle or regionHame"); 179 else m_log.Warn("[HGGridService] regionlookup without regionID, regionHandle or regionHame");
180 180
181 if (simData == null) 181 if (simData == null)
182 { 182 {
183 //Sim does not exist 183 //Sim does not exist
184 responseData["error"] = "Sim does not exist"; 184 responseData["error"] = "Sim does not exist";
185 } 185 }
186 else 186 else
187 { 187 {
188 m_log.Debug("[HGGridService]: found " + (string)simData.RegionName + " regionHandle = " + 188 m_log.Debug("[HGGridService]: found " + (string)simData.RegionName + " regionHandle = " +
189 (string)requestData["region_handle"]); 189 (string)requestData["region_handle"]);
190 responseData["sim_ip"] = simData.ExternalEndPoint.Address.ToString(); 190 responseData["sim_ip"] = simData.ExternalEndPoint.Address.ToString();
191 responseData["sim_port"] = simData.ExternalEndPoint.Port.ToString(); 191 responseData["sim_port"] = simData.ExternalEndPoint.Port.ToString();
192 //responseData["server_uri"] = simData.serverURI; 192 //responseData["server_uri"] = simData.serverURI;
193 responseData["http_port"] = simData.HttpPort.ToString(); 193 responseData["http_port"] = simData.HttpPort.ToString();
194 //responseData["remoting_port"] = simData.remotingPort.ToString(); 194 //responseData["remoting_port"] = simData.remotingPort.ToString();
195 responseData["region_locx"] = simData.RegionLocX.ToString(); 195 responseData["region_locx"] = simData.RegionLocX.ToString();
196 responseData["region_locy"] = simData.RegionLocY.ToString(); 196 responseData["region_locy"] = simData.RegionLocY.ToString();
197 responseData["region_UUID"] = simData.RegionID.ToString(); 197 responseData["region_UUID"] = simData.RegionID.ToString();
198 responseData["region_name"] = simData.RegionName; 198 responseData["region_name"] = simData.RegionName;
199 responseData["region_secret"] = simData.regionSecret; 199 responseData["region_secret"] = simData.regionSecret;
200 } 200 }
201 201
202 XmlRpcResponse response = new XmlRpcResponse(); 202 XmlRpcResponse response = new XmlRpcResponse();
203 response.Value = responseData; 203 response.Value = responseData;
204 return response; 204 return response;
205 } 205 }
206 206
207 } 207 }
208} 208}