aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/Land
diff options
context:
space:
mode:
authordiva2009-06-14 23:00:23 +0000
committerdiva2009-06-14 23:00:23 +0000
commit380f59d0ffc3a1ec8cc20972b2475faf76f341fb (patch)
tree0ead6998ce29f9c885f6a943ee95f69a8f1f910f /OpenSim/Services/Connectors/Land
parentFormatting cleanup. (diff)
downloadopensim-SC-380f59d0ffc3a1ec8cc20972b2475faf76f341fb.zip
opensim-SC-380f59d0ffc3a1ec8cc20972b2475faf76f341fb.tar.gz
opensim-SC-380f59d0ffc3a1ec8cc20972b2475faf76f341fb.tar.bz2
opensim-SC-380f59d0ffc3a1ec8cc20972b2475faf76f341fb.tar.xz
Factoring out "land_data" / RequestLandData that was hanging off of IGridServices, erroneously. Not sure when this is used, but now it is implemented in the new model of service connectors. Hopefully it works.
Diffstat (limited to 'OpenSim/Services/Connectors/Land')
-rw-r--r--OpenSim/Services/Connectors/Land/LandServiceConnector.cs125
1 files changed, 125 insertions, 0 deletions
diff --git a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
new file mode 100644
index 0000000..e9375f5
--- /dev/null
+++ b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
@@ -0,0 +1,125 @@
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
28using log4net;
29using System;
30using System.Collections;
31using System.Collections.Generic;
32using System.IO;
33using System.Reflection;
34using Nini.Config;
35using OpenSim.Framework;
36using OpenSim.Framework.Communications;
37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Services.Interfaces;
39using OpenMetaverse;
40using Nwc.XmlRpc;
41
42namespace OpenSim.Services.Connectors
43{
44 public class LandServicesConnector : ILandService
45 {
46 private static readonly ILog m_log =
47 LogManager.GetLogger(
48 MethodBase.GetCurrentMethod().DeclaringType);
49
50 protected IGridServices m_MapService = null;
51
52 public LandServicesConnector()
53 {
54 }
55
56 public LandServicesConnector(IGridServices gridServices)
57 {
58 Initialise(gridServices);
59 }
60
61 public virtual void Initialise(IGridServices gridServices)
62 {
63 m_MapService = gridServices;
64 }
65
66 public virtual LandData GetLandData(ulong regionHandle, uint x, uint y)
67 {
68 LandData landData = null;
69 Hashtable hash = new Hashtable();
70 hash["region_handle"] = regionHandle.ToString();
71 hash["x"] = x.ToString();
72 hash["y"] = y.ToString();
73
74 IList paramList = new ArrayList();
75 paramList.Add(hash);
76
77 try
78 {
79 RegionInfo info = m_MapService.RequestNeighbourInfo(regionHandle);
80 if (info != null) // just to be sure
81 {
82 XmlRpcRequest request = new XmlRpcRequest("land_data", paramList);
83 string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/";
84 XmlRpcResponse response = request.Send(uri, 10000);
85 if (response.IsFault)
86 {
87 m_log.ErrorFormat("[LAND CONNECTOR] remote call returned an error: {0}", response.FaultString);
88 }
89 else
90 {
91 hash = (Hashtable)response.Value;
92 try
93 {
94 landData = new LandData();
95 landData.AABBMax = Vector3.Parse((string)hash["AABBMax"]);
96 landData.AABBMin = Vector3.Parse((string)hash["AABBMin"]);
97 landData.Area = Convert.ToInt32(hash["Area"]);
98 landData.AuctionID = Convert.ToUInt32(hash["AuctionID"]);
99 landData.Description = (string)hash["Description"];
100 landData.Flags = Convert.ToUInt32(hash["Flags"]);
101 landData.GlobalID = new UUID((string)hash["GlobalID"]);
102 landData.Name = (string)hash["Name"];
103 landData.OwnerID = new UUID((string)hash["OwnerID"]);
104 landData.SalePrice = Convert.ToInt32(hash["SalePrice"]);
105 landData.SnapshotID = new UUID((string)hash["SnapshotID"]);
106 landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]);
107 m_log.DebugFormat("[OGS1 GRID SERVICES] Got land data for parcel {0}", landData.Name);
108 }
109 catch (Exception e)
110 {
111 m_log.Error("[LAND CONNECTOR] Got exception while parsing land-data:", e);
112 }
113 }
114 }
115 else m_log.WarnFormat("[LAND CONNECTOR] Couldn't find region with handle {0}", regionHandle);
116 }
117 catch (Exception e)
118 {
119 m_log.ErrorFormat("[LAND CONNECTOR] Couldn't contact region {0}: {1}", regionHandle, e);
120 }
121
122 return landData;
123 }
124 }
125}