diff options
author | lbsa71 | 2008-07-29 19:52:58 +0000 |
---|---|---|
committer | lbsa71 | 2008-07-29 19:52:58 +0000 |
commit | 8edab95bad417a4d82cdfb6e9ef3138e8c5f0ab1 (patch) | |
tree | f711c63ba64fea7489189c8d859977115022ac7f /OpenSim | |
parent | * minor: temporarily command out variables to prevent compile warnings (diff) | |
download | opensim-SC-8edab95bad417a4d82cdfb6e9ef3138e8c5f0ab1.zip opensim-SC-8edab95bad417a4d82cdfb6e9ef3138e8c5f0ab1.tar.gz opensim-SC-8edab95bad417a4d82cdfb6e9ef3138e8c5f0ab1.tar.bz2 opensim-SC-8edab95bad417a4d82cdfb6e9ef3138e8c5f0ab1.tar.xz |
* Refactored some heavily duplicated RequestSimProfileData functions
* Changed InventoryUrl and GridServerURL type to Uri instead of string - to address '/' issues.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Data/RegionProfileData.cs | 127 | ||||
-rw-r--r-- | OpenSim/Framework/UserConfig.cs | 25 | ||||
-rw-r--r-- | OpenSim/Grid/Communications/OGS1/OGS1InterServiceInventoryService.cs | 4 |
3 files changed, 61 insertions, 95 deletions
diff --git a/OpenSim/Data/RegionProfileData.cs b/OpenSim/Data/RegionProfileData.cs index 12f3927..f6172b9 100644 --- a/OpenSim/Data/RegionProfileData.cs +++ b/OpenSim/Data/RegionProfileData.cs | |||
@@ -130,51 +130,60 @@ namespace OpenSim.Data | |||
130 | /// </summary> | 130 | /// </summary> |
131 | public LLUUID originUUID; | 131 | public LLUUID originUUID; |
132 | 132 | ||
133 | |||
134 | /// <summary> | 133 | /// <summary> |
135 | /// Request sim profile information from a grid server, by Region UUID | 134 | /// Request sim data based on arbitrary key/value |
136 | /// </summary> | 135 | /// </summary> |
137 | /// <param name="region_uuid">The region UUID to look for</param> | 136 | private static RegionProfileData RequestSimData(Uri gridserver_url, string gridserver_sendkey, string keyField, string keyValue) |
138 | /// <param name="gridserver_url"></param> | ||
139 | /// <param name="gridserver_sendkey"></param> | ||
140 | /// <param name="gridserver_recvkey"></param> | ||
141 | /// <returns>The sim profile. Null if there was a request failure</returns> | ||
142 | /// <remarks>This method should be statics</remarks> | ||
143 | public RegionProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url, | ||
144 | string gridserver_sendkey, string gridserver_recvkey) | ||
145 | { | 137 | { |
146 | Hashtable requestData = new Hashtable(); | 138 | Hashtable requestData = new Hashtable(); |
147 | requestData["region_uuid"] = region_uuid.UUID.ToString(); | 139 | requestData[keyField] = keyValue; |
148 | requestData["authkey"] = gridserver_sendkey; | 140 | requestData["authkey"] = gridserver_sendkey; |
149 | ArrayList SendParams = new ArrayList(); | 141 | ArrayList SendParams = new ArrayList(); |
150 | SendParams.Add(requestData); | 142 | SendParams.Add(requestData); |
151 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | 143 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); |
152 | XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); | 144 | XmlRpcResponse GridResp = GridReq.Send(gridserver_url.ToString(), 3000); |
153 | 145 | ||
154 | Hashtable responseData = (Hashtable) GridResp.Value; | 146 | Hashtable responseData = (Hashtable) GridResp.Value; |
155 | 147 | ||
156 | if (responseData.ContainsKey("error")) | 148 | RegionProfileData simData = null; |
149 | |||
150 | if (!responseData.ContainsKey("error")) | ||
157 | { | 151 | { |
158 | return null; | 152 | simData = new RegionProfileData(); |
153 | simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]); | ||
154 | simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]); | ||
155 | simData.regionHandle = | ||
156 | Helpers.UIntsToLong((simData.regionLocX*Constants.RegionSize), | ||
157 | (simData.regionLocY*Constants.RegionSize)); | ||
158 | simData.serverIP = (string) responseData["sim_ip"]; | ||
159 | simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]); | ||
160 | simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]); | ||
161 | simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); | ||
162 | simData.serverURI = (string) responseData["server_uri"]; | ||
163 | simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; | ||
164 | simData.UUID = new LLUUID((string) responseData["region_UUID"]); | ||
165 | simData.regionName = (string) responseData["region_name"]; | ||
159 | } | 166 | } |
160 | 167 | ||
161 | RegionProfileData simData = new RegionProfileData(); | ||
162 | simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]); | ||
163 | simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]); | ||
164 | simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * Constants.RegionSize), (simData.regionLocY * Constants.RegionSize)); | ||
165 | simData.serverIP = (string) responseData["sim_ip"]; | ||
166 | simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]); | ||
167 | simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]); | ||
168 | simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); | ||
169 | simData.serverURI = (string)responseData["server_uri"]; | ||
170 | simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; | ||
171 | simData.UUID = new LLUUID((string) responseData["region_UUID"]); | ||
172 | simData.regionName = (string) responseData["region_name"]; | ||
173 | |||
174 | return simData; | 168 | return simData; |
175 | } | 169 | } |
176 | 170 | ||
177 | /// <summary> | 171 | /// <summary> |
172 | /// Request sim profile information from a grid server, by Region UUID | ||
173 | /// </summary> | ||
174 | /// <param name="region_uuid">The region UUID to look for</param> | ||
175 | /// <param name="gridserver_url"></param> | ||
176 | /// <param name="gridserver_sendkey"></param> | ||
177 | /// <param name="gridserver_recvkey"></param> | ||
178 | /// <returns>The sim profile. Null if there was a request failure</returns> | ||
179 | /// <remarks>This method should be statics</remarks> | ||
180 | public static RegionProfileData RequestSimProfileData(LLUUID region_uuid, Uri gridserver_url, | ||
181 | string gridserver_sendkey, string gridserver_recvkey) | ||
182 | { | ||
183 | return RequestSimData(gridserver_url, gridserver_sendkey, "region_uuid", region_uuid.UUID.ToString()); | ||
184 | } | ||
185 | |||
186 | /// <summary> | ||
178 | /// Request sim profile information from a grid server, by Region Handle | 187 | /// Request sim profile information from a grid server, by Region Handle |
179 | /// </summary> | 188 | /// </summary> |
180 | /// <param name="region_handle">the region handle to look for</param> | 189 | /// <param name="region_handle">the region handle to look for</param> |
@@ -182,38 +191,10 @@ namespace OpenSim.Data | |||
182 | /// <param name="gridserver_sendkey"></param> | 191 | /// <param name="gridserver_sendkey"></param> |
183 | /// <param name="gridserver_recvkey"></param> | 192 | /// <param name="gridserver_recvkey"></param> |
184 | /// <returns>The sim profile. Null if there was a request failure</returns> | 193 | /// <returns>The sim profile. Null if there was a request failure</returns> |
185 | public static RegionProfileData RequestSimProfileData(ulong region_handle, string gridserver_url, | 194 | public static RegionProfileData RequestSimProfileData(ulong region_handle, Uri gridserver_url, |
186 | string gridserver_sendkey, string gridserver_recvkey) | 195 | string gridserver_sendkey, string gridserver_recvkey) |
187 | { | 196 | { |
188 | Hashtable requestData = new Hashtable(); | 197 | return RequestSimData(gridserver_url, gridserver_sendkey, "region_handle", region_handle.ToString()); |
189 | requestData["region_handle"] = region_handle.ToString(); | ||
190 | requestData["authkey"] = gridserver_sendkey; | ||
191 | ArrayList SendParams = new ArrayList(); | ||
192 | SendParams.Add(requestData); | ||
193 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | ||
194 | XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); | ||
195 | |||
196 | Hashtable responseData = (Hashtable) GridResp.Value; | ||
197 | |||
198 | if (responseData.ContainsKey("error")) | ||
199 | { | ||
200 | return null; | ||
201 | } | ||
202 | |||
203 | RegionProfileData simData = new RegionProfileData(); | ||
204 | simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]); | ||
205 | simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]); | ||
206 | simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * Constants.RegionSize), (simData.regionLocY * Constants.RegionSize)); | ||
207 | simData.serverIP = (string) responseData["sim_ip"]; | ||
208 | simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]); | ||
209 | simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]); | ||
210 | simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); | ||
211 | simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; | ||
212 | simData.serverURI = (string)responseData["server_uri"]; | ||
213 | simData.UUID = new LLUUID((string) responseData["region_UUID"]); | ||
214 | simData.regionName = (string) responseData["region_name"]; | ||
215 | |||
216 | return simData; | ||
217 | } | 198 | } |
218 | 199 | ||
219 | /// <summary> | 200 | /// <summary> |
@@ -224,38 +205,10 @@ namespace OpenSim.Data | |||
224 | /// <param name="gridserver_sendkey"></param> | 205 | /// <param name="gridserver_sendkey"></param> |
225 | /// <param name="gridserver_recvkey"></param> | 206 | /// <param name="gridserver_recvkey"></param> |
226 | /// <returns>The sim profile. Null if there was a request failure</returns> | 207 | /// <returns>The sim profile. Null if there was a request failure</returns> |
227 | public static RegionProfileData RequestSimProfileData(string regionName, string gridserver_url, | 208 | public static RegionProfileData RequestSimProfileData(string regionName, Uri gridserver_url, |
228 | string gridserver_sendkey, string gridserver_recvkey) | 209 | string gridserver_sendkey, string gridserver_recvkey) |
229 | { | 210 | { |
230 | Hashtable requestData = new Hashtable(); | 211 | return RequestSimData(gridserver_url, gridserver_sendkey, "region_name_search", regionName ); |
231 | requestData["region_name_search"] = regionName; | ||
232 | requestData["authkey"] = gridserver_sendkey; | ||
233 | ArrayList SendParams = new ArrayList(); | ||
234 | SendParams.Add(requestData); | ||
235 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | ||
236 | XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000); | ||
237 | |||
238 | Hashtable responseData = (Hashtable)GridResp.Value; | ||
239 | |||
240 | if (responseData.ContainsKey("error")) | ||
241 | { | ||
242 | return null; | ||
243 | } | ||
244 | |||
245 | RegionProfileData simData = new RegionProfileData(); | ||
246 | simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]); | ||
247 | simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]); | ||
248 | simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * Constants.RegionSize), (simData.regionLocY * Constants.RegionSize)); | ||
249 | simData.serverIP = (string)responseData["sim_ip"]; | ||
250 | simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]); | ||
251 | simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]); | ||
252 | simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); | ||
253 | simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; | ||
254 | simData.serverURI = (string)responseData["server_uri"]; | ||
255 | simData.UUID = new LLUUID((string)responseData["region_UUID"]); | ||
256 | simData.regionName = (string)responseData["region_name"]; | ||
257 | |||
258 | return simData; | ||
259 | } | 212 | } |
260 | } | 213 | } |
261 | } | 214 | } |
diff --git a/OpenSim/Framework/UserConfig.cs b/OpenSim/Framework/UserConfig.cs index d8c83be..6cf526c 100644 --- a/OpenSim/Framework/UserConfig.cs +++ b/OpenSim/Framework/UserConfig.cs | |||
@@ -44,21 +44,34 @@ namespace OpenSim.Framework | |||
44 | public uint DefaultY = 1000; | 44 | public uint DefaultY = 1000; |
45 | public string GridRecvKey = String.Empty; | 45 | public string GridRecvKey = String.Empty; |
46 | public string GridSendKey = String.Empty; | 46 | public string GridSendKey = String.Empty; |
47 | public string GridServerURL = String.Empty; | ||
48 | public uint HttpPort = DefaultHttpPort; | 47 | public uint HttpPort = DefaultHttpPort; |
49 | public bool HttpSSL = DefaultHttpSSL; | 48 | public bool HttpSSL = DefaultHttpSSL; |
50 | 49 | ||
51 | private Uri m_inventoryUrl; | 50 | private Uri m_inventoryUrl; |
52 | 51 | ||
53 | public string InventoryUrl | 52 | public Uri InventoryUrl |
54 | { | 53 | { |
55 | get | 54 | get |
56 | { | 55 | { |
57 | return m_inventoryUrl.ToString(); | 56 | return m_inventoryUrl; |
58 | } | 57 | } |
59 | set | 58 | set |
60 | { | 59 | { |
61 | m_inventoryUrl = new Uri(value); | 60 | m_inventoryUrl = value; |
61 | } | ||
62 | } | ||
63 | |||
64 | private Uri m_gridServerURL; | ||
65 | |||
66 | public Uri GridServerURL | ||
67 | { | ||
68 | get | ||
69 | { | ||
70 | return m_gridServerURL; | ||
71 | } | ||
72 | set | ||
73 | { | ||
74 | m_gridServerURL = value; | ||
62 | } | 75 | } |
63 | } | 76 | } |
64 | 77 | ||
@@ -120,7 +133,7 @@ namespace OpenSim.Framework | |||
120 | DefaultStartupMsg = (string) configuration_result; | 133 | DefaultStartupMsg = (string) configuration_result; |
121 | break; | 134 | break; |
122 | case "default_grid_server": | 135 | case "default_grid_server": |
123 | GridServerURL = (string) configuration_result; | 136 | GridServerURL = new Uri( (string) configuration_result ); |
124 | break; | 137 | break; |
125 | case "grid_send_key": | 138 | case "grid_send_key": |
126 | GridSendKey = (string) configuration_result; | 139 | GridSendKey = (string) configuration_result; |
@@ -129,7 +142,7 @@ namespace OpenSim.Framework | |||
129 | GridRecvKey = (string) configuration_result; | 142 | GridRecvKey = (string) configuration_result; |
130 | break; | 143 | break; |
131 | case "default_inventory_server": | 144 | case "default_inventory_server": |
132 | InventoryUrl = (string) configuration_result; | 145 | InventoryUrl = new Uri((string) configuration_result); |
133 | break; | 146 | break; |
134 | case "database_provider": | 147 | case "database_provider": |
135 | DatabaseProvider = (string) configuration_result; | 148 | DatabaseProvider = (string) configuration_result; |
diff --git a/OpenSim/Grid/Communications/OGS1/OGS1InterServiceInventoryService.cs b/OpenSim/Grid/Communications/OGS1/OGS1InterServiceInventoryService.cs index 6aa1440..eed4621 100644 --- a/OpenSim/Grid/Communications/OGS1/OGS1InterServiceInventoryService.cs +++ b/OpenSim/Grid/Communications/OGS1/OGS1InterServiceInventoryService.cs | |||
@@ -39,9 +39,9 @@ namespace OpenSim.Grid.Communications.OGS1 | |||
39 | /// </summary> | 39 | /// </summary> |
40 | public class OGS1InterServiceInventoryService : IInterServiceInventoryServices | 40 | public class OGS1InterServiceInventoryService : IInterServiceInventoryServices |
41 | { | 41 | { |
42 | protected string m_inventoryServerUrl; | 42 | protected Uri m_inventoryServerUrl; |
43 | 43 | ||
44 | public OGS1InterServiceInventoryService(string inventoryServerUrl) | 44 | public OGS1InterServiceInventoryService(Uri inventoryServerUrl) |
45 | { | 45 | { |
46 | m_inventoryServerUrl = inventoryServerUrl; | 46 | m_inventoryServerUrl = inventoryServerUrl; |
47 | } | 47 | } |