aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/Connectors/Land/LandServiceConnector.cs')
-rw-r--r--OpenSim/Services/Connectors/Land/LandServiceConnector.cs250
1 files changed, 125 insertions, 125 deletions
diff --git a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
index e9375f5..0243f1f 100644
--- a/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Land/LandServiceConnector.cs
@@ -1,125 +1,125 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
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 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the 12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using log4net; 28using log4net;
29using System; 29using System;
30using System.Collections; 30using System.Collections;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.IO; 32using System.IO;
33using System.Reflection; 33using System.Reflection;
34using Nini.Config; 34using Nini.Config;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Communications; 36using OpenSim.Framework.Communications;
37using OpenSim.Framework.Servers.HttpServer; 37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
39using OpenMetaverse; 39using OpenMetaverse;
40using Nwc.XmlRpc; 40using Nwc.XmlRpc;
41 41
42namespace OpenSim.Services.Connectors 42namespace OpenSim.Services.Connectors
43{ 43{
44 public class LandServicesConnector : ILandService 44 public class LandServicesConnector : ILandService
45 { 45 {
46 private static readonly ILog m_log = 46 private static readonly ILog m_log =
47 LogManager.GetLogger( 47 LogManager.GetLogger(
48 MethodBase.GetCurrentMethod().DeclaringType); 48 MethodBase.GetCurrentMethod().DeclaringType);
49 49
50 protected IGridServices m_MapService = null; 50 protected IGridServices m_MapService = null;
51 51
52 public LandServicesConnector() 52 public LandServicesConnector()
53 { 53 {
54 } 54 }
55 55
56 public LandServicesConnector(IGridServices gridServices) 56 public LandServicesConnector(IGridServices gridServices)
57 { 57 {
58 Initialise(gridServices); 58 Initialise(gridServices);
59 } 59 }
60 60
61 public virtual void Initialise(IGridServices gridServices) 61 public virtual void Initialise(IGridServices gridServices)
62 { 62 {
63 m_MapService = gridServices; 63 m_MapService = gridServices;
64 } 64 }
65 65
66 public virtual LandData GetLandData(ulong regionHandle, uint x, uint y) 66 public virtual LandData GetLandData(ulong regionHandle, uint x, uint y)
67 { 67 {
68 LandData landData = null; 68 LandData landData = null;
69 Hashtable hash = new Hashtable(); 69 Hashtable hash = new Hashtable();
70 hash["region_handle"] = regionHandle.ToString(); 70 hash["region_handle"] = regionHandle.ToString();
71 hash["x"] = x.ToString(); 71 hash["x"] = x.ToString();
72 hash["y"] = y.ToString(); 72 hash["y"] = y.ToString();
73 73
74 IList paramList = new ArrayList(); 74 IList paramList = new ArrayList();
75 paramList.Add(hash); 75 paramList.Add(hash);
76 76
77 try 77 try
78 { 78 {
79 RegionInfo info = m_MapService.RequestNeighbourInfo(regionHandle); 79 RegionInfo info = m_MapService.RequestNeighbourInfo(regionHandle);
80 if (info != null) // just to be sure 80 if (info != null) // just to be sure
81 { 81 {
82 XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); 82 XmlRpcRequest request = new XmlRpcRequest("land_data", paramList);
83 string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/"; 83 string uri = "http://" + info.ExternalEndPoint.Address + ":" + info.HttpPort + "/";
84 XmlRpcResponse response = request.Send(uri, 10000); 84 XmlRpcResponse response = request.Send(uri, 10000);
85 if (response.IsFault) 85 if (response.IsFault)
86 { 86 {
87 m_log.ErrorFormat("[LAND CONNECTOR] remote call returned an error: {0}", response.FaultString); 87 m_log.ErrorFormat("[LAND CONNECTOR] remote call returned an error: {0}", response.FaultString);
88 } 88 }
89 else 89 else
90 { 90 {
91 hash = (Hashtable)response.Value; 91 hash = (Hashtable)response.Value;
92 try 92 try
93 { 93 {
94 landData = new LandData(); 94 landData = new LandData();
95 landData.AABBMax = Vector3.Parse((string)hash["AABBMax"]); 95 landData.AABBMax = Vector3.Parse((string)hash["AABBMax"]);
96 landData.AABBMin = Vector3.Parse((string)hash["AABBMin"]); 96 landData.AABBMin = Vector3.Parse((string)hash["AABBMin"]);
97 landData.Area = Convert.ToInt32(hash["Area"]); 97 landData.Area = Convert.ToInt32(hash["Area"]);
98 landData.AuctionID = Convert.ToUInt32(hash["AuctionID"]); 98 landData.AuctionID = Convert.ToUInt32(hash["AuctionID"]);
99 landData.Description = (string)hash["Description"]; 99 landData.Description = (string)hash["Description"];
100 landData.Flags = Convert.ToUInt32(hash["Flags"]); 100 landData.Flags = Convert.ToUInt32(hash["Flags"]);
101 landData.GlobalID = new UUID((string)hash["GlobalID"]); 101 landData.GlobalID = new UUID((string)hash["GlobalID"]);
102 landData.Name = (string)hash["Name"]; 102 landData.Name = (string)hash["Name"];
103 landData.OwnerID = new UUID((string)hash["OwnerID"]); 103 landData.OwnerID = new UUID((string)hash["OwnerID"]);
104 landData.SalePrice = Convert.ToInt32(hash["SalePrice"]); 104 landData.SalePrice = Convert.ToInt32(hash["SalePrice"]);
105 landData.SnapshotID = new UUID((string)hash["SnapshotID"]); 105 landData.SnapshotID = new UUID((string)hash["SnapshotID"]);
106 landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]); 106 landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]);
107 m_log.DebugFormat("[OGS1 GRID SERVICES] Got land data for parcel {0}", landData.Name); 107 m_log.DebugFormat("[OGS1 GRID SERVICES] Got land data for parcel {0}", landData.Name);
108 } 108 }
109 catch (Exception e) 109 catch (Exception e)
110 { 110 {
111 m_log.Error("[LAND CONNECTOR] Got exception while parsing land-data:", e); 111 m_log.Error("[LAND CONNECTOR] Got exception while parsing land-data:", e);
112 } 112 }
113 } 113 }
114 } 114 }
115 else m_log.WarnFormat("[LAND CONNECTOR] Couldn't find region with handle {0}", regionHandle); 115 else m_log.WarnFormat("[LAND CONNECTOR] Couldn't find region with handle {0}", regionHandle);
116 } 116 }
117 catch (Exception e) 117 catch (Exception e)
118 { 118 {
119 m_log.ErrorFormat("[LAND CONNECTOR] Couldn't contact region {0}: {1}", regionHandle, e); 119 m_log.ErrorFormat("[LAND CONNECTOR] Couldn't contact region {0}: {1}", regionHandle, e);
120 } 120 }
121 121
122 return landData; 122 return landData;
123 } 123 }
124 } 124 }
125} 125}