diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/RegionProfileServiceProxy.cs | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/OpenSim/Data/RegionProfileServiceProxy.cs b/OpenSim/Data/RegionProfileServiceProxy.cs deleted file mode 100644 index 20d7df0..0000000 --- a/OpenSim/Data/RegionProfileServiceProxy.cs +++ /dev/null | |||
@@ -1,119 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using Nwc.XmlRpc; | ||
33 | using OpenMetaverse; | ||
34 | using OpenSim.Framework; | ||
35 | |||
36 | namespace OpenSim.Data | ||
37 | { | ||
38 | public class RegionProfileServiceProxy : IRegionProfileRouter | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// Request sim data based on arbitrary key/value | ||
42 | /// </summary> | ||
43 | private RegionProfileData RequestSimData(Uri gridserverUrl, string gridserverSendkey, string keyField, string keyValue) | ||
44 | { | ||
45 | Hashtable requestData = new Hashtable(); | ||
46 | requestData[keyField] = keyValue; | ||
47 | requestData["authkey"] = gridserverSendkey; | ||
48 | ArrayList SendParams = new ArrayList(); | ||
49 | SendParams.Add(requestData); | ||
50 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | ||
51 | XmlRpcResponse GridResp = GridReq.Send(gridserverUrl.ToString(), 3000); | ||
52 | |||
53 | Hashtable responseData = (Hashtable) GridResp.Value; | ||
54 | |||
55 | RegionProfileData simData = null; | ||
56 | |||
57 | if (!responseData.ContainsKey("error")) | ||
58 | { | ||
59 | uint locX = Convert.ToUInt32((string)responseData["region_locx"]); | ||
60 | uint locY = Convert.ToUInt32((string)responseData["region_locy"]); | ||
61 | string externalHostName = (string)responseData["sim_ip"]; | ||
62 | uint simPort = Convert.ToUInt32((string)responseData["sim_port"]); | ||
63 | uint httpPort = Convert.ToUInt32((string)responseData["http_port"]); | ||
64 | uint remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); | ||
65 | string serverUri = (string)responseData["server_uri"]; | ||
66 | UUID regionID = new UUID((string)responseData["region_UUID"]); | ||
67 | string regionName = (string)responseData["region_name"]; | ||
68 | byte access = Convert.ToByte((string)responseData["access"]); | ||
69 | |||
70 | simData = RegionProfileData.Create(regionID, regionName, locX, locY, externalHostName, simPort, httpPort, remotingPort, serverUri, access); | ||
71 | } | ||
72 | |||
73 | return simData; | ||
74 | } | ||
75 | |||
76 | /// <summary> | ||
77 | /// Request sim profile information from a grid server, by Region UUID | ||
78 | /// </summary> | ||
79 | /// <param name="regionId">The region UUID to look for</param> | ||
80 | /// <param name="gridserverUrl"></param> | ||
81 | /// <param name="gridserverSendkey"></param> | ||
82 | /// <param name="gridserverRecvkey"></param> | ||
83 | /// <returns>The sim profile. Null if there was a request failure</returns> | ||
84 | /// <remarks>This method should be statics</remarks> | ||
85 | public RegionProfileData RequestSimProfileData(UUID regionId, Uri gridserverUrl, | ||
86 | string gridserverSendkey, string gridserverRecvkey) | ||
87 | { | ||
88 | return RequestSimData(gridserverUrl, gridserverSendkey, "region_UUID", regionId.Guid.ToString()); | ||
89 | } | ||
90 | |||
91 | /// <summary> | ||
92 | /// Request sim profile information from a grid server, by Region Handle | ||
93 | /// </summary> | ||
94 | /// <param name="regionHandle">the region handle to look for</param> | ||
95 | /// <param name="gridserverUrl"></param> | ||
96 | /// <param name="gridserverSendkey"></param> | ||
97 | /// <param name="gridserverRecvkey"></param> | ||
98 | /// <returns>The sim profile. Null if there was a request failure</returns> | ||
99 | public RegionProfileData RequestSimProfileData(ulong regionHandle, Uri gridserverUrl, | ||
100 | string gridserverSendkey, string gridserverRecvkey) | ||
101 | { | ||
102 | return RequestSimData(gridserverUrl, gridserverSendkey, "region_handle", regionHandle.ToString()); | ||
103 | } | ||
104 | |||
105 | /// <summary> | ||
106 | /// Request sim profile information from a grid server, by Region Name | ||
107 | /// </summary> | ||
108 | /// <param name="regionName">the region name to look for</param> | ||
109 | /// <param name="gridserverUrl"></param> | ||
110 | /// <param name="gridserverSendkey"></param> | ||
111 | /// <param name="gridserverRecvkey"></param> | ||
112 | /// <returns>The sim profile. Null if there was a request failure</returns> | ||
113 | public RegionProfileData RequestSimProfileData(string regionName, Uri gridserverUrl, | ||
114 | string gridserverSendkey, string gridserverRecvkey) | ||
115 | { | ||
116 | return RequestSimData(gridserverUrl, gridserverSendkey, "region_name_search", regionName); | ||
117 | } | ||
118 | } | ||
119 | } | ||