aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Services/Connectors/AgentPreferences/AgentPreferencesConnector.cs230
-rw-r--r--OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs119
-rw-r--r--OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs104
-rw-r--r--OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs14
-rw-r--r--OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/Avatar/AvatarServicesConnector.cs17
-rw-r--r--OpenSim/Services/Connectors/BaseServiceConnector.cs33
-rw-r--r--OpenSim/Services/Connectors/Estate/EstateDataConnector.cs338
-rw-r--r--OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs10
-rw-r--r--OpenSim/Services/Connectors/Grid/GridServicesConnector.cs70
-rw-r--r--OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs13
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs31
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs43
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs472
-rw-r--r--OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs283
-rw-r--r--OpenSim/Services/Connectors/Land/LandServicesConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs68
-rw-r--r--OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs34
-rw-r--r--OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs24
-rw-r--r--OpenSim/Services/Connectors/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs4
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs22
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs4
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs133
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs11
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs86
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs2
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs6
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs74
-rw-r--r--OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs54
-rw-r--r--OpenSim/Services/EstateService/EstateDataService.cs (renamed from OpenSim/Services/Connectors/Simulation/EstateDataService.cs)5
-rw-r--r--OpenSim/Services/SimulationService/SimulationDataService.cs (renamed from OpenSim/Services/Connectors/Simulation/SimulationDataService.cs)3
32 files changed, 1633 insertions, 680 deletions
diff --git a/OpenSim/Services/Connectors/AgentPreferences/AgentPreferencesConnector.cs b/OpenSim/Services/Connectors/AgentPreferences/AgentPreferencesConnector.cs
new file mode 100644
index 0000000..1dbc0c8
--- /dev/null
+++ b/OpenSim/Services/Connectors/AgentPreferences/AgentPreferencesConnector.cs
@@ -0,0 +1,230 @@
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.Generic;
31using System.IO;
32using System.Reflection;
33using Nini.Config;
34using OpenSim.Framework;
35using OpenSim.Framework.ServiceAuth;
36using OpenSim.Services.Interfaces;
37using GridRegion = OpenSim.Services.Interfaces.GridRegion;
38using IAvatarService = OpenSim.Services.Interfaces.IAvatarService;
39using OpenSim.Server.Base;
40using OpenMetaverse;
41
42namespace OpenSim.Services.Connectors
43{
44 public class AgentPreferencesServicesConnector : BaseServiceConnector, IAgentPreferencesService
45 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47
48 private string m_ServerURI = String.Empty;
49
50 public AgentPreferencesServicesConnector()
51 {
52 }
53
54 public AgentPreferencesServicesConnector(string serverURI)
55 {
56 m_ServerURI = serverURI.TrimEnd('/');
57 }
58
59 public AgentPreferencesServicesConnector(IConfigSource source)
60 : base(source, "AgentPreferencesService")
61 {
62 Initialise(source);
63 }
64
65 public virtual void Initialise(IConfigSource source)
66 {
67 IConfig gridConfig = source.Configs["AgentPreferencesService"];
68 if (gridConfig == null)
69 {
70 m_log.Error("[AGENT PREFERENCES CONNECTOR]: AgentPreferencesService missing from OpenSim.ini");
71 throw new Exception("Agent Preferences connector init error");
72 }
73
74 string serviceURI = gridConfig.GetString("AgentPreferencesServerURI", String.Empty);
75
76 if (serviceURI == String.Empty)
77 {
78 m_log.Error("[AGENT PREFERENCES CONNECTOR]: No Server URI named in section AgentPreferences");
79 throw new Exception("Agent Preferences connector init error");
80 }
81 m_ServerURI = serviceURI;
82
83 base.Initialise(source, "AgentPreferencesService");
84 }
85
86 #region IAgentPreferencesService
87
88 public AgentPrefs GetAgentPreferences(UUID principalID)
89 {
90 Dictionary<string, object> sendData = new Dictionary<string, object>();
91
92 string reply = string.Empty;
93 string uri = String.Concat(m_ServerURI, "/agentprefs");
94
95 sendData["METHOD"] = "getagentprefs";
96 sendData["UserID"] = principalID;
97 string reqString = ServerUtils.BuildQueryString(sendData);
98 // m_log.DebugFormat("[AGENT PREFS CONNECTOR]: queryString = {0}", reqString);
99
100 try
101 {
102 reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
103 if (String.IsNullOrEmpty(reply))
104 {
105 m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: GetAgentPreferences received null or empty reply");
106 return null;
107 }
108 }
109 catch (Exception e)
110 {
111 m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: Exception when contacting agent preferences server at {0}: {1}", uri, e.Message);
112 }
113
114 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
115 if (replyData != null)
116 {
117 if (replyData.ContainsKey("result") &&
118 (replyData["result"].ToString() == "null" || replyData["result"].ToString() == "Failure"))
119 {
120 m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: GetAgentPreferences received Failure response");
121 return null;
122 }
123 }
124 else
125 {
126 m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: GetAgentPreferences received null response");
127 return null;
128 }
129 AgentPrefs prefs = new AgentPrefs(replyData);
130 return prefs;
131 }
132
133 public bool StoreAgentPreferences(AgentPrefs data)
134 {
135 Dictionary<string, object> sendData = new Dictionary<string, object>();
136
137 sendData["METHOD"] = "setagentprefs";
138
139 sendData["PrincipalID"] = data.PrincipalID.ToString();
140 sendData["AccessPrefs"] = data.AccessPrefs;
141 sendData["HoverHeight"] = data.HoverHeight.ToString();
142 sendData["Language"] = data.Language;
143 sendData["LanguageIsPublic"] = data.LanguageIsPublic.ToString();
144 sendData["PermEveryone"] = data.PermEveryone.ToString();
145 sendData["PermGroup"] = data.PermGroup.ToString();
146 sendData["PermNextOwner"] = data.PermNextOwner.ToString();
147
148 string uri = String.Concat(m_ServerURI, "/agentprefs");
149 string reqString = ServerUtils.BuildQueryString(sendData);
150 // m_log.DebugFormat("[AGENT PREFS CONNECTOR]: queryString = {0}", reqString);
151
152 try
153 {
154 string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
155 if (reply != string.Empty)
156 {
157 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
158
159 if (replyData.ContainsKey("result"))
160 {
161 if (replyData["result"].ToString().ToLower() == "success")
162 return true;
163 else
164 return false;
165 }
166 else
167 {
168 m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: StoreAgentPreferences reply data does not contain result field");
169 }
170
171 }
172 else
173 m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: StoreAgentPreferences received empty reply");
174 }
175 catch (Exception e)
176 {
177 m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: Exception when contacting agent preferences server at {0}: {1}", uri, e.Message);
178 }
179
180 return false;
181 }
182
183 public string GetLang(UUID principalID)
184 {
185 Dictionary<string, object> sendData = new Dictionary<string, object>();
186 string reply = string.Empty;
187
188 sendData["METHOD"] = "getagentlang";
189 sendData["UserID"] = principalID.ToString();
190
191 string uri = String.Concat(m_ServerURI, "/agentprefs");
192 string reqString = ServerUtils.BuildQueryString(sendData);
193
194 try
195 {
196 reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
197 if (String.IsNullOrEmpty(reply))
198 {
199 m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: GetLang received null or empty reply");
200 return "en-us"; // I guess? Gotta return somethin'!
201 }
202 }
203 catch (Exception e)
204 {
205 m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: Exception when contacting agent preferences server at {0}: {1}", uri, e.Message);
206 }
207
208 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
209 if (replyData != null)
210 {
211 if (replyData.ContainsKey("result") &&
212 (replyData["result"].ToString() == "null" || replyData["result"].ToString() == "Failure"))
213 {
214 m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: GetLang received Failure response");
215 return "en-us";
216 }
217 if (replyData.ContainsKey("Language"))
218 return replyData["Language"].ToString();
219 }
220 else
221 {
222 m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: GetLang received null response");
223
224 }
225 return "en-us";
226 }
227
228 #endregion IAgentPreferencesService
229 }
230}
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
index 2c1d946..795ca2e 100644
--- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
@@ -41,7 +41,7 @@ using OpenMetaverse;
41 41
42namespace OpenSim.Services.Connectors 42namespace OpenSim.Services.Connectors
43{ 43{
44 public class AssetServicesConnector : IAssetService 44 public class AssetServicesConnector : BaseServiceConnector, IAssetService
45 { 45 {
46 private static readonly ILog m_log = 46 private static readonly ILog m_log =
47 LogManager.GetLogger( 47 LogManager.GetLogger(
@@ -82,6 +82,7 @@ namespace OpenSim.Services.Connectors
82 } 82 }
83 83
84 public AssetServicesConnector(IConfigSource source) 84 public AssetServicesConnector(IConfigSource source)
85 : base(source, "AssetService")
85 { 86 {
86 Initialise(source); 87 Initialise(source);
87 } 88 }
@@ -221,8 +222,16 @@ namespace OpenSim.Services.Connectors
221 222
222 if (asset == null || asset.Data == null || asset.Data.Length == 0) 223 if (asset == null || asset.Data == null || asset.Data.Length == 0)
223 { 224 {
224 asset = SynchronousRestObjectRequester. 225 // XXX: Commented out for now since this has either never been properly operational or not for some time
225 MakeRequest<int, AssetBase>("GET", uri, 0, m_maxAssetRequestConcurrency); 226 // as m_maxAssetRequestConcurrency was being passed as the timeout, not a concurrency limiting option.
227 // Wasn't noticed before because timeout wasn't actually used.
228 // Not attempting concurrency setting for now as this omission was discovered in release candidate
229 // phase for OpenSimulator 0.8. Need to revisit afterwards.
230// asset
231// = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>(
232// "GET", uri, 0, m_maxAssetRequestConcurrency);
233
234 asset = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, m_Auth);
226 235
227 if (m_Cache != null) 236 if (m_Cache != null)
228 m_Cache.Cache(asset); 237 m_Cache.Cache(asset);
@@ -252,8 +261,7 @@ namespace OpenSim.Services.Connectors
252 261
253 string uri = MapServer(id) + "/assets/" + id + "/metadata"; 262 string uri = MapServer(id) + "/assets/" + id + "/metadata";
254 263
255 AssetMetadata asset = SynchronousRestObjectRequester. 264 AssetMetadata asset = SynchronousRestObjectRequester.MakeRequest<int, AssetMetadata>("GET", uri, 0, m_Auth);
256 MakeRequest<int, AssetMetadata>("GET", uri, 0);
257 return asset; 265 return asset;
258 } 266 }
259 267
@@ -267,29 +275,45 @@ namespace OpenSim.Services.Connectors
267 return fullAsset.Data; 275 return fullAsset.Data;
268 } 276 }
269 277
278<<<<<<< HEAD
279 using (RestClient rc = new RestClient(m_ServerURI))
280 {
281 rc.AddResourcePath("assets");
282 rc.AddResourcePath(id);
283 rc.AddResourcePath("data");
284=======
270 RestClient rc = new RestClient(MapServer(id)); 285 RestClient rc = new RestClient(MapServer(id));
271 rc.AddResourcePath("assets"); 286 rc.AddResourcePath("assets");
272 rc.AddResourcePath(id); 287 rc.AddResourcePath(id);
273 rc.AddResourcePath("data"); 288 rc.AddResourcePath("data");
289>>>>>>> avn/ubitvar
274 290
275 rc.RequestMethod = "GET"; 291 rc.RequestMethod = "GET";
276 292
277 Stream s = rc.Request(); 293 Stream s = rc.Request(m_Auth);
278 294
279 if (s == null) 295 if (s == null)
280 return null; 296 return null;
281 297
282 if (s.Length > 0) 298 if (s.Length > 0)
283 { 299 {
284 byte[] ret = new byte[s.Length]; 300 byte[] ret = new byte[s.Length];
285 s.Read(ret, 0, (int)s.Length); 301 s.Read(ret, 0, (int)s.Length);
286 302
303<<<<<<< HEAD
304 return ret;
305 }
306
307 return null;
308 }
309=======
287 s.Close(); 310 s.Close();
288 return ret; 311 return ret;
289 } 312 }
290 313
291 s.Close(); 314 s.Close();
292 return null; 315 return null;
316>>>>>>> avn/ubitvar
293 } 317 }
294 318
295 private class QueuedAssetRequest 319 private class QueuedAssetRequest
@@ -324,12 +348,24 @@ namespace OpenSim.Services.Connectors
324 List<AssetRetrievedEx> handlers; 348 List<AssetRetrievedEx> handlers;
325 lock (m_AssetHandlers) 349 lock (m_AssetHandlers)
326 { 350 {
351<<<<<<< HEAD
352 if (a != null && m_Cache != null)
353 m_Cache.Cache(a);
354=======
327 handlers = m_AssetHandlers[id]; 355 handlers = m_AssetHandlers[id];
328 m_AssetHandlers.Remove(id); 356 m_AssetHandlers.Remove(id);
329 } 357 }
358>>>>>>> avn/ubitvar
330 359
331 Util.FireAndForget(x => 360 Util.FireAndForget(x =>
332 { 361 {
362<<<<<<< HEAD
363 handlers = m_AssetHandlers[id];
364 m_AssetHandlers.Remove(id);
365 }
366 handlers.Invoke(a);
367 }, m_maxAssetRequestConcurrency, m_Auth);
368=======
333 foreach (AssetRetrievedEx h in handlers) 369 foreach (AssetRetrievedEx h in handlers)
334 { 370 {
335 // Util.FireAndForget(x => 371 // Util.FireAndForget(x =>
@@ -346,6 +382,7 @@ namespace OpenSim.Services.Connectors
346 382
347// if (handlers != null) 383// if (handlers != null)
348// handlers.Clear(); 384// handlers.Clear();
385>>>>>>> avn/ubitvar
349 386
350 success = true; 387 success = true;
351 } 388 }
@@ -413,6 +450,27 @@ namespace OpenSim.Services.Connectors
413 return true; 450 return true;
414 } 451 }
415 452
453 public virtual bool[] AssetsExist(string[] ids)
454 {
455 string uri = m_ServerURI + "/get_assets_exist";
456
457 bool[] exist = null;
458 try
459 {
460 exist = SynchronousRestObjectRequester.MakeRequest<string[], bool[]>("POST", uri, ids, m_Auth);
461 }
462 catch (Exception)
463 {
464 // This is most likely to happen because the server doesn't support this function,
465 // so just silently return "doesn't exist" for all the assets.
466 }
467
468 if (exist == null)
469 exist = new bool[ids.Length];
470
471 return exist;
472 }
473
416 public string Store(AssetBase asset) 474 public string Store(AssetBase asset)
417 { 475 {
418 // Have to assign the asset ID here. This isn't likely to 476 // Have to assign the asset ID here. This isn't likely to
@@ -449,9 +507,35 @@ namespace OpenSim.Services.Connectors
449 507
450 string uri = MapServer(asset.FullID.ToString()) + "/assets/"; 508 string uri = MapServer(asset.FullID.ToString()) + "/assets/";
451 509
452 string newID = string.Empty; 510 string newID;
453 try 511 try
454 { 512 {
513<<<<<<< HEAD
514 newID = SynchronousRestObjectRequester.MakeRequest<AssetBase, string>("POST", uri, asset, m_Auth);
515 }
516 catch (Exception e)
517 {
518 m_log.Warn(string.Format("[ASSET CONNECTOR]: Unable to send asset {0} to asset server. Reason: {1} ", asset.ID, e.Message), e);
519 return string.Empty;
520 }
521
522 // TEMPORARY: SRAS returns 'null' when it's asked to store existing assets
523 if (newID == null)
524 {
525 m_log.DebugFormat("[ASSET CONNECTOR]: Storing of asset {0} returned null; assuming the asset already exists", asset.ID);
526 return asset.ID;
527 }
528
529 if (string.IsNullOrEmpty(newID))
530 return string.Empty;
531
532 asset.ID = newID;
533
534 if (m_Cache != null)
535 m_Cache.Cache(asset);
536
537 return newID;
538=======
455 newID = SynchronousRestObjectRequester. 539 newID = SynchronousRestObjectRequester.
456 MakeRequest<AssetBase, string>("POST", uri, asset, 25); 540 MakeRequest<AssetBase, string>("POST", uri, asset, 25);
457 if (newID == null || newID == "") 541 if (newID == null || newID == "")
@@ -504,6 +588,7 @@ namespace OpenSim.Services.Connectors
504 } 588 }
505 } 589 }
506 return asset.ID; 590 return asset.ID;
591>>>>>>> avn/ubitvar
507 } 592 }
508 593
509 public bool UpdateContent(string id, byte[] data) 594 public bool UpdateContent(string id, byte[] data)
@@ -526,8 +611,7 @@ namespace OpenSim.Services.Connectors
526 611
527 string uri = MapServer(id) + "/assets/" + id; 612 string uri = MapServer(id) + "/assets/" + id;
528 613
529 if (SynchronousRestObjectRequester. 614 if (SynchronousRestObjectRequester.MakeRequest<AssetBase, bool>("POST", uri, asset, m_Auth))
530 MakeRequest<AssetBase, bool>("POST", uri, asset))
531 { 615 {
532 if (m_Cache != null) 616 if (m_Cache != null)
533 m_Cache.Cache(asset); 617 m_Cache.Cache(asset);
@@ -541,8 +625,7 @@ namespace OpenSim.Services.Connectors
541 { 625 {
542 string uri = MapServer(id) + "/assets/" + id; 626 string uri = MapServer(id) + "/assets/" + id;
543 627
544 if (SynchronousRestObjectRequester. 628 if (SynchronousRestObjectRequester.MakeRequest<int, bool>("DELETE", uri, 0, m_Auth))
545 MakeRequest<int, bool>("DELETE", uri, 0))
546 { 629 {
547 if (m_Cache != null) 630 if (m_Cache != null)
548 m_Cache.Expire(id); 631 m_Cache.Expire(id);
diff --git a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
index c395178..3710c86 100644
--- a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
@@ -36,6 +36,7 @@ using OpenSim.Framework;
36using OpenSim.Services.Interfaces; 36using OpenSim.Services.Interfaces;
37using OpenSim.Services.Connectors.Hypergrid; 37using OpenSim.Services.Connectors.Hypergrid;
38using OpenSim.Services.Connectors.SimianGrid; 38using OpenSim.Services.Connectors.SimianGrid;
39using OpenMetaverse;
39 40
40namespace OpenSim.Services.Connectors 41namespace OpenSim.Services.Connectors
41{ 42{
@@ -83,39 +84,6 @@ namespace OpenSim.Services.Connectors
83 } 84 }
84 } 85 }
85 86
86 private bool StringToUrlAndAssetID(string id, out string url, out string assetID)
87 {
88 url = String.Empty;
89 assetID = String.Empty;
90
91 Uri assetUri;
92
93 if (Uri.TryCreate(id, UriKind.Absolute, out assetUri) &&
94 assetUri.Scheme == Uri.UriSchemeHttp)
95 {
96 // Simian
97 if (assetUri.Query != string.Empty)
98 {
99 NameValueCollection qscoll = HttpUtility.ParseQueryString(assetUri.Query);
100 assetID = qscoll["id"];
101 if (assetID != null)
102 url = id.Replace(assetID, ""); // Malformed again, as simian expects
103 else
104 url = id; // !!! best effort
105 }
106 else // robust
107 {
108 url = "http://" + assetUri.Authority;
109 assetID = assetUri.LocalPath.Trim(new char[] { '/' });
110 }
111
112 return true;
113 }
114
115 m_log.DebugFormat("[HG ASSET SERVICE]: Malformed URL {0}", id);
116 return false;
117 }
118
119 private IAssetService GetConnector(string url) 87 private IAssetService GetConnector(string url)
120 { 88 {
121 IAssetService connector = null; 89 IAssetService connector = null;
@@ -149,7 +117,7 @@ namespace OpenSim.Services.Connectors
149 string url = string.Empty; 117 string url = string.Empty;
150 string assetID = string.Empty; 118 string assetID = string.Empty;
151 119
152 if (StringToUrlAndAssetID(id, out url, out assetID)) 120 if (Util.ParseForeignAssetID(id, out url, out assetID))
153 { 121 {
154 IAssetService connector = GetConnector(url); 122 IAssetService connector = GetConnector(url);
155 return connector.Get(assetID); 123 return connector.Get(assetID);
@@ -163,7 +131,7 @@ namespace OpenSim.Services.Connectors
163 string url = string.Empty; 131 string url = string.Empty;
164 string assetID = string.Empty; 132 string assetID = string.Empty;
165 133
166 if (StringToUrlAndAssetID(id, out url, out assetID)) 134 if (Util.ParseForeignAssetID(id, out url, out assetID))
167 { 135 {
168 IAssetService connector = GetConnector(url); 136 IAssetService connector = GetConnector(url);
169 return connector.GetCached(assetID); 137 return connector.GetCached(assetID);
@@ -177,7 +145,7 @@ namespace OpenSim.Services.Connectors
177 string url = string.Empty; 145 string url = string.Empty;
178 string assetID = string.Empty; 146 string assetID = string.Empty;
179 147
180 if (StringToUrlAndAssetID(id, out url, out assetID)) 148 if (Util.ParseForeignAssetID(id, out url, out assetID))
181 { 149 {
182 IAssetService connector = GetConnector(url); 150 IAssetService connector = GetConnector(url);
183 return connector.GetMetadata(assetID); 151 return connector.GetMetadata(assetID);
@@ -196,7 +164,7 @@ namespace OpenSim.Services.Connectors
196 string url = string.Empty; 164 string url = string.Empty;
197 string assetID = string.Empty; 165 string assetID = string.Empty;
198 166
199 if (StringToUrlAndAssetID(id, out url, out assetID)) 167 if (Util.ParseForeignAssetID(id, out url, out assetID))
200 { 168 {
201 IAssetService connector = GetConnector(url); 169 IAssetService connector = GetConnector(url);
202 return connector.Get(assetID, sender, handler); 170 return connector.Get(assetID, sender, handler);
@@ -205,12 +173,72 @@ namespace OpenSim.Services.Connectors
205 return false; 173 return false;
206 } 174 }
207 175
176
177 private struct AssetAndIndex
178 {
179 public UUID assetID;
180 public int index;
181
182 public AssetAndIndex(UUID assetID, int index)
183 {
184 this.assetID = assetID;
185 this.index = index;
186 }
187 }
188
189 public virtual bool[] AssetsExist(string[] ids)
190 {
191 // This method is a bit complicated because it works even if the assets belong to different
192 // servers; that requires sending separate requests to each server.
193
194 // Group the assets by the server they belong to
195
196 var url2assets = new Dictionary<string, List<AssetAndIndex>>();
197
198 for (int i = 0; i < ids.Length; i++)
199 {
200 string url = string.Empty;
201 string assetID = string.Empty;
202
203 if (Util.ParseForeignAssetID(ids[i], out url, out assetID))
204 {
205 if (!url2assets.ContainsKey(url))
206 url2assets.Add(url, new List<AssetAndIndex>());
207 url2assets[url].Add(new AssetAndIndex(UUID.Parse(assetID), i));
208 }
209 }
210
211 // Query each of the servers in turn
212
213 bool[] exist = new bool[ids.Length];
214
215 foreach (string url in url2assets.Keys)
216 {
217 IAssetService connector = GetConnector(url);
218 lock (EndPointLock(connector))
219 {
220 List<AssetAndIndex> curAssets = url2assets[url];
221 string[] assetIDs = curAssets.ConvertAll(a => a.assetID.ToString()).ToArray();
222 bool[] curExist = connector.AssetsExist(assetIDs);
223
224 int i = 0;
225 foreach (AssetAndIndex ai in curAssets)
226 {
227 exist[ai.index] = curExist[i];
228 ++i;
229 }
230 }
231 }
232
233 return exist;
234 }
235
208 public string Store(AssetBase asset) 236 public string Store(AssetBase asset)
209 { 237 {
210 string url = string.Empty; 238 string url = string.Empty;
211 string assetID = string.Empty; 239 string assetID = string.Empty;
212 240
213 if (StringToUrlAndAssetID(asset.ID, out url, out assetID)) 241 if (Util.ParseForeignAssetID(asset.ID, out url, out assetID))
214 { 242 {
215 IAssetService connector = GetConnector(url); 243 IAssetService connector = GetConnector(url);
216 // Restore the assetID to a simple UUID 244 // Restore the assetID to a simple UUID
diff --git a/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs b/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs
index f996aca..0443f5a 100644
--- a/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs
@@ -32,14 +32,14 @@ using System.IO;
32using System.Reflection; 32using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.ServiceAuth;
36using OpenSim.Services.Interfaces; 36using OpenSim.Services.Interfaces;
37using OpenSim.Server.Base; 37using OpenSim.Server.Base;
38using OpenMetaverse; 38using OpenMetaverse;
39 39
40namespace OpenSim.Services.Connectors 40namespace OpenSim.Services.Connectors
41{ 41{
42 public class AuthenticationServicesConnector : IAuthenticationService 42 public class AuthenticationServicesConnector : BaseServiceConnector, IAuthenticationService
43 { 43 {
44 private static readonly ILog m_log = 44 private static readonly ILog m_log =
45 LogManager.GetLogger( 45 LogManager.GetLogger(
@@ -57,6 +57,7 @@ namespace OpenSim.Services.Connectors
57 } 57 }
58 58
59 public AuthenticationServicesConnector(IConfigSource source) 59 public AuthenticationServicesConnector(IConfigSource source)
60 : base(source, "AuthenticationService")
60 { 61 {
61 Initialise(source); 62 Initialise(source);
62 } 63 }
@@ -79,6 +80,8 @@ namespace OpenSim.Services.Connectors
79 throw new Exception("Authentication connector init error"); 80 throw new Exception("Authentication connector init error");
80 } 81 }
81 m_ServerURI = serviceURI; 82 m_ServerURI = serviceURI;
83
84 base.Initialise(source, "AuthenticationService");
82 } 85 }
83 86
84 public string Authenticate(UUID principalID, string password, int lifetime, out UUID realID) 87 public string Authenticate(UUID principalID, string password, int lifetime, out UUID realID)
@@ -99,7 +102,7 @@ namespace OpenSim.Services.Connectors
99 102
100 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 103 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
101 m_ServerURI + "/auth/plain", 104 m_ServerURI + "/auth/plain",
102 ServerUtils.BuildQueryString(sendData)); 105 ServerUtils.BuildQueryString(sendData), m_Auth);
103 106
104 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( 107 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
105 reply); 108 reply);
@@ -112,6 +115,7 @@ namespace OpenSim.Services.Connectors
112 115
113 public bool Verify(UUID principalID, string token, int lifetime) 116 public bool Verify(UUID principalID, string token, int lifetime)
114 { 117 {
118// m_log.Error("[XXX]: Verify");
115 Dictionary<string, object> sendData = new Dictionary<string, object>(); 119 Dictionary<string, object> sendData = new Dictionary<string, object>();
116 sendData["LIFETIME"] = lifetime.ToString(); 120 sendData["LIFETIME"] = lifetime.ToString();
117 sendData["PRINCIPAL"] = principalID.ToString(); 121 sendData["PRINCIPAL"] = principalID.ToString();
@@ -121,7 +125,7 @@ namespace OpenSim.Services.Connectors
121 125
122 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 126 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
123 m_ServerURI + "/auth/plain", 127 m_ServerURI + "/auth/plain",
124 ServerUtils.BuildQueryString(sendData)); 128 ServerUtils.BuildQueryString(sendData), m_Auth);
125 129
126 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( 130 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
127 reply); 131 reply);
@@ -142,7 +146,7 @@ namespace OpenSim.Services.Connectors
142 146
143 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 147 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
144 m_ServerURI + "/auth/plain", 148 m_ServerURI + "/auth/plain",
145 ServerUtils.BuildQueryString(sendData)); 149 ServerUtils.BuildQueryString(sendData), m_Auth);
146 150
147 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( 151 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
148 reply); 152 reply);
diff --git a/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs b/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs
index 35b7109..63730b3 100644
--- a/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs
@@ -105,7 +105,7 @@ namespace OpenSim.Services.Connectors
105 catch (Exception e) 105 catch (Exception e)
106 { 106 {
107 m_log.WarnFormat("[AUTHORIZATION CONNECTOR]: Unable to send authorize {0} for region {1} error thrown during comms with remote server. Reason: {2}", userID, regionID, e.Message); 107 m_log.WarnFormat("[AUTHORIZATION CONNECTOR]: Unable to send authorize {0} for region {1} error thrown during comms with remote server. Reason: {2}", userID, regionID, e.Message);
108 message = ""; 108 message = e.Message;
109 return m_ResponseOnFailure; 109 return m_ResponseOnFailure;
110 } 110 }
111 if (response == null) 111 if (response == null)
diff --git a/OpenSim/Services/Connectors/Avatar/AvatarServicesConnector.cs b/OpenSim/Services/Connectors/Avatar/AvatarServicesConnector.cs
index ddfca57..3f44efa 100644
--- a/OpenSim/Services/Connectors/Avatar/AvatarServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Avatar/AvatarServicesConnector.cs
@@ -32,7 +32,7 @@ using System.IO;
32using System.Reflection; 32using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.ServiceAuth;
36using OpenSim.Services.Interfaces; 36using OpenSim.Services.Interfaces;
37using GridRegion = OpenSim.Services.Interfaces.GridRegion; 37using GridRegion = OpenSim.Services.Interfaces.GridRegion;
38using IAvatarService = OpenSim.Services.Interfaces.IAvatarService; 38using IAvatarService = OpenSim.Services.Interfaces.IAvatarService;
@@ -41,7 +41,7 @@ using OpenMetaverse;
41 41
42namespace OpenSim.Services.Connectors 42namespace OpenSim.Services.Connectors
43{ 43{
44 public class AvatarServicesConnector : IAvatarService 44 public class AvatarServicesConnector : BaseServiceConnector, IAvatarService
45 { 45 {
46 private static readonly ILog m_log = 46 private static readonly ILog m_log =
47 LogManager.GetLogger( 47 LogManager.GetLogger(
@@ -59,6 +59,7 @@ namespace OpenSim.Services.Connectors
59 } 59 }
60 60
61 public AvatarServicesConnector(IConfigSource source) 61 public AvatarServicesConnector(IConfigSource source)
62 : base(source, "AvatarService")
62 { 63 {
63 Initialise(source); 64 Initialise(source);
64 } 65 }
@@ -81,6 +82,8 @@ namespace OpenSim.Services.Connectors
81 throw new Exception("Avatar connector init error"); 82 throw new Exception("Avatar connector init error");
82 } 83 }
83 m_ServerURI = serviceURI; 84 m_ServerURI = serviceURI;
85
86 base.Initialise(source, "AvatarService");
84 } 87 }
85 88
86 89
@@ -114,7 +117,7 @@ namespace OpenSim.Services.Connectors
114 // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); 117 // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
115 try 118 try
116 { 119 {
117 reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); 120 reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
118 if (reply == null || (reply != null && reply == string.Empty)) 121 if (reply == null || (reply != null && reply == string.Empty))
119 { 122 {
120 m_log.DebugFormat("[AVATAR CONNECTOR]: GetAgent received null or empty reply"); 123 m_log.DebugFormat("[AVATAR CONNECTOR]: GetAgent received null or empty reply");
@@ -162,7 +165,7 @@ namespace OpenSim.Services.Connectors
162 //m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); 165 //m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
163 try 166 try
164 { 167 {
165 string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); 168 string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
166 if (reply != string.Empty) 169 if (reply != string.Empty)
167 { 170 {
168 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 171 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@@ -207,7 +210,7 @@ namespace OpenSim.Services.Connectors
207 // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); 210 // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
208 try 211 try
209 { 212 {
210 string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); 213 string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
211 if (reply != string.Empty) 214 if (reply != string.Empty)
212 { 215 {
213 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 216 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@@ -250,7 +253,7 @@ namespace OpenSim.Services.Connectors
250 // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); 253 // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
251 try 254 try
252 { 255 {
253 string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); 256 string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
254 if (reply != string.Empty) 257 if (reply != string.Empty)
255 { 258 {
256 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 259 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@@ -293,7 +296,7 @@ namespace OpenSim.Services.Connectors
293 // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString); 296 // m_log.DebugFormat("[AVATAR CONNECTOR]: queryString = {0}", reqString);
294 try 297 try
295 { 298 {
296 string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); 299 string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
297 if (reply != string.Empty) 300 if (reply != string.Empty)
298 { 301 {
299 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 302 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
diff --git a/OpenSim/Services/Connectors/BaseServiceConnector.cs b/OpenSim/Services/Connectors/BaseServiceConnector.cs
new file mode 100644
index 0000000..98cd489
--- /dev/null
+++ b/OpenSim/Services/Connectors/BaseServiceConnector.cs
@@ -0,0 +1,33 @@
1using System;
2using OpenSim.Framework;
3using OpenSim.Framework.ServiceAuth;
4
5using Nini.Config;
6
7namespace OpenSim.Services.Connectors
8{
9 public class BaseServiceConnector
10 {
11 protected IServiceAuth m_Auth;
12
13 public BaseServiceConnector() { }
14
15 public BaseServiceConnector(IConfigSource config, string section)
16 {
17 Initialise(config, section);
18 }
19
20 public void Initialise(IConfigSource config, string section)
21 {
22 string authType = Util.GetConfigVarFromSections<string>(config, "AuthType", new string[] { "Network", section }, "None");
23
24 switch (authType)
25 {
26 case "BasicHttpAuthentication":
27 m_Auth = new BasicHttpAuthentication(config, section);
28 break;
29 }
30
31 }
32 }
33}
diff --git a/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs b/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs
new file mode 100644
index 0000000..6412bcd
--- /dev/null
+++ b/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs
@@ -0,0 +1,338 @@
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 */
27using System;
28using System.Collections.Generic;
29using System.Net;
30using System.Reflection;
31
32using log4net;
33
34using OpenMetaverse;
35using Nini.Config;
36
37using OpenSim.Framework;
38using OpenSim.Framework.ServiceAuth;
39using OpenSim.Services.Connectors;
40using OpenSim.Services.Interfaces;
41using OpenSim.Server.Base;
42
43namespace OpenSim.Services.Connectors
44{
45 public class EstateDataRemoteConnector : BaseServiceConnector, IEstateDataService
46 {
47 private static readonly ILog m_log =
48 LogManager.GetLogger(
49 MethodBase.GetCurrentMethod().DeclaringType);
50
51 private string m_ServerURI = String.Empty;
52 private ExpiringCache<string, List<EstateSettings>> m_EstateCache = new ExpiringCache<string, List<EstateSettings>>();
53 private const int EXPIRATION = 5 * 60; // 5 minutes in secs
54
55 public EstateDataRemoteConnector(IConfigSource source)
56 {
57 Initialise(source);
58 }
59
60 public virtual void Initialise(IConfigSource source)
61 {
62 IConfig gridConfig = source.Configs["EstateService"];
63 if (gridConfig == null)
64 {
65 m_log.Error("[ESTATE CONNECTOR]: EstateService missing from OpenSim.ini");
66 throw new Exception("Estate connector init error");
67 }
68
69 string serviceURI = gridConfig.GetString("EstateServerURI",
70 String.Empty);
71
72 if (serviceURI == String.Empty)
73 {
74 m_log.Error("[ESTATE CONNECTOR]: No Server URI named in section EstateService");
75 throw new Exception("Estate connector init error");
76 }
77 m_ServerURI = serviceURI;
78
79 base.Initialise(source, "EstateService");
80 }
81
82 #region IEstateDataService
83
84 public List<EstateSettings> LoadEstateSettingsAll()
85 {
86 string reply = string.Empty;
87 string uri = m_ServerURI + "/estates";
88
89 reply = MakeRequest("GET", uri, string.Empty);
90 if (String.IsNullOrEmpty(reply))
91 return new List<EstateSettings>();
92
93 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
94
95 List<EstateSettings> estates = new List<EstateSettings>();
96 if (replyData != null && replyData.Count > 0)
97 {
98 m_log.DebugFormat("[ESTATE CONNECTOR]: LoadEstateSettingsAll returned {0} elements", replyData.Count);
99 Dictionary<string, object>.ValueCollection estateData = replyData.Values;
100 foreach (object r in estateData)
101 {
102 if (r is Dictionary<string, object>)
103 {
104 EstateSettings es = new EstateSettings((Dictionary<string, object>)r);
105 estates.Add(es);
106 }
107 }
108 m_EstateCache.AddOrUpdate("estates", estates, EXPIRATION);
109 }
110 else
111 m_log.DebugFormat("[ESTATE CONNECTOR]: LoadEstateSettingsAll from {0} received null or zero response", uri);
112
113 return estates;
114
115 }
116
117 public List<int> GetEstatesAll()
118 {
119 List<int> eids = new List<int>();
120 // If we don't have them, load them from the server
121 List<EstateSettings> estates = null;
122 if (!m_EstateCache.TryGetValue("estates", out estates))
123 LoadEstateSettingsAll();
124
125 foreach (EstateSettings es in estates)
126 eids.Add((int)es.EstateID);
127
128 return eids;
129 }
130
131 public List<int> GetEstates(string search)
132 {
133 // If we don't have them, load them from the server
134 List<EstateSettings> estates = null;
135 if (!m_EstateCache.TryGetValue("estates", out estates))
136 LoadEstateSettingsAll();
137
138 List<int> eids = new List<int>();
139 foreach (EstateSettings es in estates)
140 if (es.EstateName == search)
141 eids.Add((int)es.EstateID);
142
143 return eids;
144 }
145
146 public List<int> GetEstatesByOwner(UUID ownerID)
147 {
148 // If we don't have them, load them from the server
149 List<EstateSettings> estates = null;
150 if (!m_EstateCache.TryGetValue("estates", out estates))
151 LoadEstateSettingsAll();
152
153 List<int> eids = new List<int>();
154 foreach (EstateSettings es in estates)
155 if (es.EstateOwner == ownerID)
156 eids.Add((int)es.EstateID);
157
158 return eids;
159 }
160
161 public List<UUID> GetRegions(int estateID)
162 {
163 string reply = string.Empty;
164 // /estates/regions/?eid=int
165 string uri = m_ServerURI + "/estates/regions/?eid=" + estateID.ToString();
166
167 reply = MakeRequest("GET", uri, string.Empty);
168 if (String.IsNullOrEmpty(reply))
169 return new List<UUID>();
170
171 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
172
173 List<UUID> regions = new List<UUID>();
174 if (replyData != null && replyData.Count > 0)
175 {
176 m_log.DebugFormat("[ESTATE CONNECTOR]: GetRegions for estate {0} returned {1} elements", estateID, replyData.Count);
177 Dictionary<string, object>.ValueCollection data = replyData.Values;
178 foreach (object r in data)
179 {
180 UUID uuid = UUID.Zero;
181 if (UUID.TryParse(r.ToString(), out uuid))
182 regions.Add(uuid);
183 }
184 }
185 else
186 m_log.DebugFormat("[ESTATE CONNECTOR]: GetRegions from {0} received null or zero response", uri);
187
188 return regions;
189 }
190
191 public EstateSettings LoadEstateSettings(UUID regionID, bool create)
192 {
193 string reply = string.Empty;
194 // /estates/estate/?region=uuid&create=[t|f]
195 string uri = m_ServerURI + string.Format("/estates/estate/?region={0}&create={1}", regionID, create);
196
197 reply = MakeRequest("GET", uri, string.Empty);
198 if (String.IsNullOrEmpty(reply))
199 return null;
200
201 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
202
203 if (replyData != null && replyData.Count > 0)
204 {
205 m_log.DebugFormat("[ESTATE CONNECTOR]: LoadEstateSettings({0}) returned {1} elements", regionID, replyData.Count);
206 EstateSettings es = new EstateSettings(replyData);
207 return es;
208 }
209 else
210 m_log.DebugFormat("[ESTATE CONNECTOR]: LoadEstateSettings(regionID) from {0} received null or zero response", uri);
211
212 return null;
213 }
214
215 public EstateSettings LoadEstateSettings(int estateID)
216 {
217 string reply = string.Empty;
218 // /estates/estate/?eid=int
219 string uri = m_ServerURI + string.Format("/estates/estate/?eid={0}", estateID);
220
221 reply = MakeRequest("GET", uri, string.Empty);
222 if (String.IsNullOrEmpty(reply))
223 return null;
224
225 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
226
227 if (replyData != null && replyData.Count > 0)
228 {
229 m_log.DebugFormat("[ESTATE CONNECTOR]: LoadEstateSettings({0}) returned {1} elements", estateID, replyData.Count);
230 EstateSettings es = new EstateSettings(replyData);
231 return es;
232 }
233 else
234 m_log.DebugFormat("[ESTATE CONNECTOR]: LoadEstateSettings(estateID) from {0} received null or zero response", uri);
235
236 return null;
237 }
238
239 /// <summary>
240 /// Forbidden operation
241 /// </summary>
242 /// <returns></returns>
243 public EstateSettings CreateNewEstate()
244 {
245 // No can do
246 return null;
247 }
248
249 public void StoreEstateSettings(EstateSettings es)
250 {
251 // /estates/estate/
252 string uri = m_ServerURI + ("/estates/estate");
253
254 Dictionary<string, object> formdata = es.ToMap();
255 formdata["OP"] = "STORE";
256
257 PostRequest(uri, formdata);
258 }
259
260 public bool LinkRegion(UUID regionID, int estateID)
261 {
262 // /estates/estate/?eid=int&region=uuid
263 string uri = m_ServerURI + String.Format("/estates/estate/?eid={0}&region={1}", estateID, regionID);
264
265 Dictionary<string, object> formdata = new Dictionary<string, object>();
266 formdata["OP"] = "LINK";
267 return PostRequest(uri, formdata);
268 }
269
270 private bool PostRequest(string uri, Dictionary<string, object> sendData)
271 {
272 string reqString = ServerUtils.BuildQueryString(sendData);
273
274 string reply = MakeRequest("POST", uri, reqString);
275 if (String.IsNullOrEmpty(reply))
276 return false;
277
278 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
279
280 bool result = false;
281 if (replyData != null && replyData.Count > 0)
282 {
283 if (replyData.ContainsKey("Result"))
284 {
285 if (Boolean.TryParse(replyData["Result"].ToString(), out result))
286 m_log.DebugFormat("[ESTATE CONNECTOR]: PostRequest {0} returned {1}", uri, result);
287 }
288 }
289 else
290 m_log.DebugFormat("[ESTATE CONNECTOR]: PostRequest {0} received null or zero response", uri);
291
292 return result;
293 }
294
295 /// <summary>
296 /// Forbidden operation
297 /// </summary>
298 /// <returns></returns>
299 public bool DeleteEstate(int estateID)
300 {
301 return false;
302 }
303
304 #endregion
305
306 private string MakeRequest(string verb, string uri, string formdata)
307 {
308 string reply = string.Empty;
309 try
310 {
311 reply = SynchronousRestFormsRequester.MakeRequest(verb, uri, formdata, m_Auth);
312 }
313 catch (WebException e)
314 {
315 using (HttpWebResponse hwr = (HttpWebResponse)e.Response)
316 {
317 if (hwr != null)
318 {
319 if (hwr.StatusCode == HttpStatusCode.NotFound)
320 m_log.Error(string.Format("[ESTATE CONNECTOR]: Resource {0} not found ", uri));
321 if (hwr.StatusCode == HttpStatusCode.Unauthorized)
322 m_log.Error(string.Format("[ESTATE CONNECTOR]: Web request {0} requires authentication ", uri));
323 }
324 else
325 m_log.Error(string.Format(
326 "[ESTATE CONNECTOR]: WebException for {0} {1} {2} ",
327 verb, uri, formdata, e));
328 }
329 }
330 catch (Exception e)
331 {
332 m_log.DebugFormat("[ESTATE CONNECTOR]: Exception when contacting estate server at {0}: {1}", uri, e.Message);
333 }
334
335 return reply;
336 }
337 }
338}
diff --git a/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs
index b1dd84e..74851a9 100644
--- a/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs
@@ -32,6 +32,7 @@ using System.IO;
32using System.Reflection; 32using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.ServiceAuth;
35using OpenSim.Framework.Communications; 36using OpenSim.Framework.Communications;
36using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
37using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; 38using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
@@ -40,7 +41,7 @@ using OpenMetaverse;
40 41
41namespace OpenSim.Services.Connectors.Friends 42namespace OpenSim.Services.Connectors.Friends
42{ 43{
43 public class FriendsServicesConnector : IFriendsService 44 public class FriendsServicesConnector : BaseServiceConnector, IFriendsService
44 { 45 {
45 private static readonly ILog m_log = 46 private static readonly ILog m_log =
46 LogManager.GetLogger( 47 LogManager.GetLogger(
@@ -80,6 +81,7 @@ namespace OpenSim.Services.Connectors.Friends
80 throw new Exception("Friends connector init error"); 81 throw new Exception("Friends connector init error");
81 } 82 }
82 m_ServerURI = serviceURI; 83 m_ServerURI = serviceURI;
84 base.Initialise(source, "FriendsService");
83 } 85 }
84 86
85 87
@@ -112,7 +114,7 @@ namespace OpenSim.Services.Connectors.Friends
112 114
113 try 115 try
114 { 116 {
115 string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); 117 string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
116 if (reply != string.Empty) 118 if (reply != string.Empty)
117 { 119 {
118 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 120 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@@ -168,7 +170,7 @@ namespace OpenSim.Services.Connectors.Friends
168 string uri = m_ServerURI + "/friends"; 170 string uri = m_ServerURI + "/friends";
169 try 171 try
170 { 172 {
171 reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); 173 reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth);
172 } 174 }
173 catch (Exception e) 175 catch (Exception e)
174 { 176 {
@@ -223,7 +225,7 @@ namespace OpenSim.Services.Connectors.Friends
223 string uri = m_ServerURI + "/friends"; 225 string uri = m_ServerURI + "/friends";
224 try 226 try
225 { 227 {
226 reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); 228 reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth);
227 } 229 }
228 catch (Exception e) 230 catch (Exception e)
229 { 231 {
diff --git a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs
index af91cdb..d208f1e 100644
--- a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs
@@ -33,6 +33,7 @@ using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Framework.ServiceAuth;
36using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
37using GridRegion = OpenSim.Services.Interfaces.GridRegion; 38using GridRegion = OpenSim.Services.Interfaces.GridRegion;
38using OpenSim.Server.Base; 39using OpenSim.Server.Base;
@@ -40,7 +41,7 @@ using OpenMetaverse;
40 41
41namespace OpenSim.Services.Connectors 42namespace OpenSim.Services.Connectors
42{ 43{
43 public class GridServicesConnector : IGridService 44 public class GridServicesConnector : BaseServiceConnector, IGridService
44 { 45 {
45 private static readonly ILog m_log = 46 private static readonly ILog m_log =
46 LogManager.GetLogger( 47 LogManager.GetLogger(
@@ -83,6 +84,8 @@ namespace OpenSim.Services.Connectors
83 throw new Exception("Grid connector init error"); 84 throw new Exception("Grid connector init error");
84 } 85 }
85 m_ServerURI = serviceURI; 86 m_ServerURI = serviceURI;
87
88 base.Initialise(source, "GridService");
86 } 89 }
87 90
88 91
@@ -105,7 +108,7 @@ namespace OpenSim.Services.Connectors
105 // m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString); 108 // m_log.DebugFormat("[GRID CONNECTOR]: queryString = {0}", reqString);
106 try 109 try
107 { 110 {
108 string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); 111 string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
109 if (reply != string.Empty) 112 if (reply != string.Empty)
110 { 113 {
111 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 114 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@@ -161,7 +164,7 @@ namespace OpenSim.Services.Connectors
161 try 164 try
162 { 165 {
163 string reply 166 string reply
164 = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); 167 = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth);
165 168
166 if (reply != string.Empty) 169 if (reply != string.Empty)
167 { 170 {
@@ -198,7 +201,7 @@ namespace OpenSim.Services.Connectors
198 201
199 try 202 try
200 { 203 {
201 reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); 204 reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString, m_Auth);
202 } 205 }
203 catch (Exception e) 206 catch (Exception e)
204 { 207 {
@@ -241,7 +244,7 @@ namespace OpenSim.Services.Connectors
241 string uri = m_ServerURI + "/grid"; 244 string uri = m_ServerURI + "/grid";
242 try 245 try
243 { 246 {
244 reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData)); 247 reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, ServerUtils.BuildQueryString(sendData), m_Auth);
245 } 248 }
246 catch (Exception e) 249 catch (Exception e)
247 { 250 {
@@ -293,7 +296,7 @@ namespace OpenSim.Services.Connectors
293 { 296 {
294 reply = SynchronousRestFormsRequester.MakeRequest("POST", 297 reply = SynchronousRestFormsRequester.MakeRequest("POST",
295 uri, 298 uri,
296 ServerUtils.BuildQueryString(sendData)); 299 ServerUtils.BuildQueryString(sendData), m_Auth);
297 } 300 }
298 catch (Exception e) 301 catch (Exception e)
299 { 302 {
@@ -340,7 +343,7 @@ namespace OpenSim.Services.Connectors
340 { 343 {
341 reply = SynchronousRestFormsRequester.MakeRequest("POST", 344 reply = SynchronousRestFormsRequester.MakeRequest("POST",
342 uri, 345 uri,
343 ServerUtils.BuildQueryString(sendData)); 346 ServerUtils.BuildQueryString(sendData), m_Auth);
344 } 347 }
345 catch (Exception e) 348 catch (Exception e)
346 { 349 {
@@ -384,7 +387,7 @@ namespace OpenSim.Services.Connectors
384 { 387 {
385 reply = SynchronousRestFormsRequester.MakeRequest("POST", 388 reply = SynchronousRestFormsRequester.MakeRequest("POST",
386 uri, 389 uri,
387 ServerUtils.BuildQueryString(sendData)); 390 ServerUtils.BuildQueryString(sendData), m_Auth);
388 } 391 }
389 catch (Exception e) 392 catch (Exception e)
390 { 393 {
@@ -438,7 +441,7 @@ namespace OpenSim.Services.Connectors
438 { 441 {
439 reply = SynchronousRestFormsRequester.MakeRequest("POST", 442 reply = SynchronousRestFormsRequester.MakeRequest("POST",
440 uri, 443 uri,
441 ServerUtils.BuildQueryString(sendData)); 444 ServerUtils.BuildQueryString(sendData), m_Auth);
442 445
443 //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); 446 //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
444 } 447 }
@@ -489,7 +492,7 @@ namespace OpenSim.Services.Connectors
489 { 492 {
490 reply = SynchronousRestFormsRequester.MakeRequest("POST", 493 reply = SynchronousRestFormsRequester.MakeRequest("POST",
491 uri, 494 uri,
492 ServerUtils.BuildQueryString(sendData)); 495 ServerUtils.BuildQueryString(sendData), m_Auth);
493 496
494 //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); 497 //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
495 } 498 }
@@ -540,7 +543,7 @@ namespace OpenSim.Services.Connectors
540 { 543 {
541 reply = SynchronousRestFormsRequester.MakeRequest("POST", 544 reply = SynchronousRestFormsRequester.MakeRequest("POST",
542 uri, 545 uri,
543 ServerUtils.BuildQueryString(sendData)); 546 ServerUtils.BuildQueryString(sendData), m_Auth);
544 547
545 //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); 548 //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
546 } 549 }
@@ -593,7 +596,7 @@ namespace OpenSim.Services.Connectors
593 { 596 {
594 reply = SynchronousRestFormsRequester.MakeRequest("POST", 597 reply = SynchronousRestFormsRequester.MakeRequest("POST",
595 uri, 598 uri,
596 ServerUtils.BuildQueryString(sendData)); 599 ServerUtils.BuildQueryString(sendData), m_Auth);
597 600
598 //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); 601 //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
599 } 602 }
@@ -644,7 +647,7 @@ namespace OpenSim.Services.Connectors
644 { 647 {
645 reply = SynchronousRestFormsRequester.MakeRequest("POST", 648 reply = SynchronousRestFormsRequester.MakeRequest("POST",
646 uri, 649 uri,
647 ServerUtils.BuildQueryString(sendData)); 650 ServerUtils.BuildQueryString(sendData), m_Auth);
648 651
649 //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply); 652 //m_log.DebugFormat("[GRID CONNECTOR]: reply was {0}", reply);
650 } 653 }
@@ -695,7 +698,7 @@ namespace OpenSim.Services.Connectors
695 { 698 {
696 reply = SynchronousRestFormsRequester.MakeRequest("POST", 699 reply = SynchronousRestFormsRequester.MakeRequest("POST",
697 uri, 700 uri,
698 ServerUtils.BuildQueryString(sendData)); 701 ServerUtils.BuildQueryString(sendData), m_Auth);
699 } 702 }
700 catch (Exception e) 703 catch (Exception e)
701 { 704 {
@@ -726,6 +729,45 @@ namespace OpenSim.Services.Connectors
726 return flags; 729 return flags;
727 } 730 }
728 731
732 public Dictionary<string, object> GetExtraFeatures()
733 {
734 Dictionary<string, object> sendData = new Dictionary<string, object>();
735 Dictionary<string, object> extraFeatures = new Dictionary<string, object>();
736
737 sendData["METHOD"] = "get_grid_extra_features";
738
739 string reply = string.Empty;
740 string uri = m_ServerURI + "/grid";
741
742 try
743 {
744 reply = SynchronousRestFormsRequester.MakeRequest("POST",
745 uri,
746 ServerUtils.BuildQueryString(sendData), m_Auth);
747 }
748 catch (Exception e)
749 {
750 m_log.DebugFormat("[GRID CONNECTOR]: GetExtraFeatures - Exception when contacting grid server at {0}: {1}", uri, e.Message);
751 return extraFeatures;
752 }
753
754 if (reply != string.Empty)
755 {
756 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
757
758 if ((replyData != null) && replyData.Count > 0)
759 {
760 foreach (string key in replyData.Keys)
761 {
762 extraFeatures[key] = replyData[key].ToString();
763 }
764 }
765 }
766 else
767 m_log.DebugFormat("[GRID CONNECTOR]: GetExtraServiceURLs received null reply");
768
769 return extraFeatures;
770 }
729 #endregion 771 #endregion
730 772
731 } 773 }
diff --git a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs
index 1a62d2f..ffdd94a 100644
--- a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs
+++ b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs
@@ -33,6 +33,7 @@ using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Framework.ServiceAuth;
36using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
37using GridRegion = OpenSim.Services.Interfaces.GridRegion; 38using GridRegion = OpenSim.Services.Interfaces.GridRegion;
38using OpenSim.Server.Base; 39using OpenSim.Server.Base;
@@ -40,7 +41,7 @@ using OpenMetaverse;
40 41
41namespace OpenSim.Services.Connectors 42namespace OpenSim.Services.Connectors
42{ 43{
43 public class GridUserServicesConnector : IGridUserService 44 public class GridUserServicesConnector : BaseServiceConnector, IGridUserService
44 { 45 {
45 private static readonly ILog m_log = 46 private static readonly ILog m_log =
46 LogManager.GetLogger( 47 LogManager.GetLogger(
@@ -80,6 +81,7 @@ namespace OpenSim.Services.Connectors
80 throw new Exception("GridUser connector init error"); 81 throw new Exception("GridUser connector init error");
81 } 82 }
82 m_ServerURI = serviceURI; 83 m_ServerURI = serviceURI;
84 base.Initialise(source, "GridUserService");
83 } 85 }
84 86
85 87
@@ -162,7 +164,8 @@ namespace OpenSim.Services.Connectors
162 { 164 {
163 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 165 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
164 uri, 166 uri,
165 reqString); 167 reqString,
168 m_Auth);
166 if (reply != string.Empty) 169 if (reply != string.Empty)
167 { 170 {
168 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 171 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@@ -198,7 +201,8 @@ namespace OpenSim.Services.Connectors
198 { 201 {
199 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 202 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
200 uri, 203 uri,
201 reqString); 204 reqString,
205 m_Auth);
202 if (reply != string.Empty) 206 if (reply != string.Empty)
203 { 207 {
204 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 208 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@@ -243,7 +247,8 @@ namespace OpenSim.Services.Connectors
243 { 247 {
244 reply = SynchronousRestFormsRequester.MakeRequest("POST", 248 reply = SynchronousRestFormsRequester.MakeRequest("POST",
245 uri, 249 uri,
246 reqString); 250 reqString,
251 m_Auth);
247 if (reply == null || (reply != null && reply == string.Empty)) 252 if (reply == null || (reply != null && reply == string.Empty))
248 { 253 {
249 m_log.DebugFormat("[GRID USER CONNECTOR]: GetGridUserInfo received null or empty reply"); 254 m_log.DebugFormat("[GRID USER CONNECTOR]: GetGridUserInfo received null or empty reply");
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
index 803cd1b..2340998 100644
--- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
@@ -202,10 +202,16 @@ namespace OpenSim.Services.Connectors.Hypergrid
202 return mapTile; 202 return mapTile;
203 } 203 }
204 204
205 public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID) 205 public GridRegion GetHyperlinkRegion(GridRegion gatekeeper, UUID regionID, UUID agentID, string agentHomeURI, out string message)
206 { 206 {
207 Hashtable hash = new Hashtable(); 207 Hashtable hash = new Hashtable();
208 hash["region_uuid"] = regionID.ToString(); 208 hash["region_uuid"] = regionID.ToString();
209 if (agentID != UUID.Zero)
210 {
211 hash["agent_id"] = agentID.ToString();
212 if (agentHomeURI != null)
213 hash["agent_home_uri"] = agentHomeURI;
214 }
209 215
210 IList paramList = new ArrayList(); 216 IList paramList = new ArrayList();
211 paramList.Add(hash); 217 paramList.Add(hash);
@@ -219,12 +225,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
219 } 225 }
220 catch (Exception e) 226 catch (Exception e)
221 { 227 {
228 message = "Error contacting grid.";
222 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); 229 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message);
223 return null; 230 return null;
224 } 231 }
225 232
226 if (response.IsFault) 233 if (response.IsFault)
227 { 234 {
235 message = "Error contacting grid.";
228 m_log.ErrorFormat("[GATEKEEPER SERVICE CONNECTOR]: remote call returned an error: {0}", response.FaultString); 236 m_log.ErrorFormat("[GATEKEEPER SERVICE CONNECTOR]: remote call returned an error: {0}", response.FaultString);
229 return null; 237 return null;
230 } 238 }
@@ -236,6 +244,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
236 { 244 {
237 bool success = false; 245 bool success = false;
238 Boolean.TryParse((string)hash["result"], out success); 246 Boolean.TryParse((string)hash["result"], out success);
247
248 if (hash["message"] != null)
249 message = (string)hash["message"];
250 else if (success)
251 message = null;
252 else
253 message = "The teleport destination could not be found."; // probably the dest grid is old and doesn't send 'message', but the most common problem is that the region is unavailable
254
239 if (success) 255 if (success)
240 { 256 {
241 GridRegion region = new GridRegion(); 257 GridRegion region = new GridRegion();
@@ -255,6 +271,18 @@ namespace OpenSim.Services.Connectors.Hypergrid
255 region.RegionLocY = n; 271 region.RegionLocY = n;
256 //m_log.Debug(">> HERE, y: " + region.RegionLocY); 272 //m_log.Debug(">> HERE, y: " + region.RegionLocY);
257 } 273 }
274 if (hash["size_x"] != null)
275 {
276 Int32.TryParse((string)hash["size_x"], out n);
277 region.RegionSizeX = n;
278 //m_log.Debug(">> HERE, x: " + region.RegionLocX);
279 }
280 if (hash["size_y"] != null)
281 {
282 Int32.TryParse((string)hash["size_y"], out n);
283 region.RegionSizeY = n;
284 //m_log.Debug(">> HERE, y: " + region.RegionLocY);
285 }
258 if (hash["region_name"] != null) 286 if (hash["region_name"] != null)
259 { 287 {
260 region.RegionName = (string)hash["region_name"]; 288 region.RegionName = (string)hash["region_name"];
@@ -293,6 +321,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
293 } 321 }
294 catch (Exception e) 322 catch (Exception e)
295 { 323 {
324 message = "Error parsing response from grid.";
296 m_log.Error("[GATEKEEPER SERVICE CONNECTOR]: Got exception while parsing hyperlink response " + e.StackTrace); 325 m_log.Error("[GATEKEEPER SERVICE CONNECTOR]: Got exception while parsing hyperlink response " + e.StackTrace);
297 return null; 326 return null;
298 } 327 }
diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs
index 5004d99..b5e6d69 100644
--- a/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs
@@ -47,16 +47,22 @@ namespace OpenSim.Services.Connectors
47 47
48 public HeloServicesConnector(string serverURI) 48 public HeloServicesConnector(string serverURI)
49 { 49 {
50 if (!serverURI.EndsWith("=")) 50 try
51 m_ServerURI = serverURI.TrimEnd('/') + "/helo/";
52 else
53 { 51 {
54 // Simian sends malformed urls like this: 52 Uri uri;
55 // http://valley.virtualportland.org/simtest/Grid/?id= 53
56 // 54 if (!serverURI.EndsWith("="))
57 try 55 {
56 // Let's check if this is a valid URI, because it may not be
57 uri = new Uri(serverURI);
58 m_ServerURI = serverURI.TrimEnd('/') + "/helo/";
59 }
60 else
58 { 61 {
59 Uri uri = new Uri(serverURI + "xxx"); 62 // Simian sends malformed urls like this:
63 // http://valley.virtualportland.org/simtest/Grid/?id=
64 //
65 uri = new Uri(serverURI + "xxx");
60 if (uri.Query == string.Empty) 66 if (uri.Query == string.Empty)
61 m_ServerURI = serverURI.TrimEnd('/') + "/helo/"; 67 m_ServerURI = serverURI.TrimEnd('/') + "/helo/";
62 else 68 else
@@ -66,21 +72,28 @@ namespace OpenSim.Services.Connectors
66 m_ServerURI = m_ServerURI.TrimEnd('/') + "/helo/"; 72 m_ServerURI = m_ServerURI.TrimEnd('/') + "/helo/";
67 } 73 }
68 } 74 }
69 catch (UriFormatException) 75
70 { 76 }
71 m_log.WarnFormat("[HELO SERVICE]: Malformed URL {0}", serverURI); 77 catch (UriFormatException)
72 } 78 {
79 m_log.WarnFormat("[HELO SERVICE]: Malformed URL {0}", serverURI);
73 } 80 }
74 } 81 }
75 82
76 public virtual string Helo() 83 public virtual string Helo()
77 { 84 {
78 HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI); 85 if (String.IsNullOrEmpty(m_ServerURI))
79 // Eventually we need to switch to HEAD 86 {
80 /* req.Method = "HEAD"; */ 87 m_log.WarnFormat("[HELO SERVICE]: Unable to invoke HELO due to empty URL");
88 return String.Empty;
89 }
81 90
82 try 91 try
83 { 92 {
93 HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI);
94 // Eventually we need to switch to HEAD
95 /* req.Method = "HEAD"; */
96
84 using (WebResponse response = req.GetResponse()) 97 using (WebResponse response = req.GetResponse())
85 { 98 {
86 if (response.Headers.Get("X-Handlers-Provided") == null) // just in case this ever returns a null 99 if (response.Headers.Get("X-Handlers-Provided") == null) // just in case this ever returns a null
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
index 32ea4ee..10b8d22 100644
--- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs
@@ -50,6 +50,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
50 LogManager.GetLogger( 50 LogManager.GetLogger(
51 MethodBase.GetCurrentMethod().DeclaringType); 51 MethodBase.GetCurrentMethod().DeclaringType);
52 52
53 private string m_ServerURLHost;
53 private string m_ServerURL; 54 private string m_ServerURL;
54 private GridRegion m_Gatekeeper; 55 private GridRegion m_Gatekeeper;
55 56
@@ -59,7 +60,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
59 60
60 public UserAgentServiceConnector(string url, bool dnsLookup) 61 public UserAgentServiceConnector(string url, bool dnsLookup)
61 { 62 {
62 m_ServerURL = url; 63 m_ServerURL = m_ServerURLHost = url;
63 64
64 if (dnsLookup) 65 if (dnsLookup)
65 { 66 {
@@ -75,10 +76,11 @@ namespace OpenSim.Services.Connectors.Hypergrid
75 } 76 }
76 catch (Exception e) 77 catch (Exception e)
77 { 78 {
78 m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", m_ServerURL, e.Message); 79 m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", url, e.Message);
79 } 80 }
80 } 81 }
81 m_log.DebugFormat("[USER AGENT CONNECTOR]: new connector to {0} ({1})", url, m_ServerURL); 82
83 //m_log.DebugFormat("[USER AGENT CONNECTOR]: new connector to {0} ({1})", url, m_ServerURL);
82 } 84 }
83 85
84 public UserAgentServiceConnector(IConfigSource config) 86 public UserAgentServiceConnector(IConfigSource config)
@@ -98,9 +100,16 @@ namespace OpenSim.Services.Connectors.Hypergrid
98 m_log.Error("[USER AGENT CONNECTOR]: No Server URI named in section UserAgentService"); 100 m_log.Error("[USER AGENT CONNECTOR]: No Server URI named in section UserAgentService");
99 throw new Exception("UserAgent connector init error"); 101 throw new Exception("UserAgent connector init error");
100 } 102 }
103<<<<<<< HEAD
104
105 m_ServerURL = m_ServerURLHost = serviceURI;
106 if (!m_ServerURL.EndsWith("/"))
107 m_ServerURL += "/";
108=======
101 m_ServerURL = serviceURI; 109 m_ServerURL = serviceURI;
110>>>>>>> avn/ubitvar
102 111
103 m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL); 112 //m_log.DebugFormat("[USER AGENT CONNECTOR]: new connector to {0}", m_ServerURL);
104 } 113 }
105 114
106 protected override string AgentPath() 115 protected override string AgentPath()
@@ -111,7 +120,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
111 // The Login service calls this interface with fromLogin=true 120 // The Login service calls this interface with fromLogin=true
112 // Sims call it with fromLogin=false 121 // Sims call it with fromLogin=false
113 // Either way, this is verified by the handler 122 // Either way, this is verified by the handler
114 public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, bool fromLogin, out string reason) 123 public bool LoginAgentToGrid(GridRegion source, AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, bool fromLogin, out string reason)
115 { 124 {
116 reason = String.Empty; 125 reason = String.Empty;
117 126
@@ -133,59 +142,62 @@ namespace OpenSim.Services.Connectors.Hypergrid
133 Console.WriteLine(" >>> LoginAgentToGrid <<< " + home.ServerURI); 142 Console.WriteLine(" >>> LoginAgentToGrid <<< " + home.ServerURI);
134 143
135 uint flags = fromLogin ? (uint)TeleportFlags.ViaLogin : (uint)TeleportFlags.ViaHome; 144 uint flags = fromLogin ? (uint)TeleportFlags.ViaLogin : (uint)TeleportFlags.ViaHome;
136 return CreateAgent(home, aCircuit, flags, out reason); 145 return CreateAgent(source, home, aCircuit, flags, out reason);
137 } 146 }
138 147
139 148
140 // The simulators call this interface 149 // The simulators call this interface
141 public bool LoginAgentToGrid(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason) 150 public bool LoginAgentToGrid(GridRegion source, AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, out string reason)
142 { 151 {
143 return LoginAgentToGrid(aCircuit, gatekeeper, destination, false, out reason); 152 return LoginAgentToGrid(source, aCircuit, gatekeeper, destination, false, out reason);
144 } 153 }
145 154
146 protected override void PackData(OSDMap args, AgentCircuitData aCircuit, GridRegion destination, uint flags) 155 protected override void PackData(OSDMap args, GridRegion source, AgentCircuitData aCircuit, GridRegion destination, uint flags)
147 { 156 {
148 base.PackData(args, aCircuit, destination, flags); 157 base.PackData(args, source, aCircuit, destination, flags);
149 args["gatekeeper_serveruri"] = OSD.FromString(m_Gatekeeper.ServerURI); 158 args["gatekeeper_serveruri"] = OSD.FromString(m_Gatekeeper.ServerURI);
150 args["gatekeeper_host"] = OSD.FromString(m_Gatekeeper.ExternalHostName); 159 args["gatekeeper_host"] = OSD.FromString(m_Gatekeeper.ExternalHostName);
151 args["gatekeeper_port"] = OSD.FromString(m_Gatekeeper.HttpPort.ToString()); 160 args["gatekeeper_port"] = OSD.FromString(m_Gatekeeper.HttpPort.ToString());
152 args["destination_serveruri"] = OSD.FromString(destination.ServerURI); 161 args["destination_serveruri"] = OSD.FromString(destination.ServerURI);
153 } 162 }
154 163
155 protected OSDMap PackCreateAgentArguments(AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, IPEndPoint ipaddress) 164 public void SetClientToken(UUID sessionID, string token)
165 {
166 // no-op
167 }
168
169 private Hashtable CallServer(string methodName, Hashtable hash)
156 { 170 {
157 OSDMap args = null; 171 IList paramList = new ArrayList();
172 paramList.Add(hash);
173
174 XmlRpcRequest request = new XmlRpcRequest(methodName, paramList);
175
176 // Send and get reply
177 XmlRpcResponse response = null;
158 try 178 try
159 { 179 {
160 args = aCircuit.PackAgentCircuitData(); 180 response = request.Send(m_ServerURL, 10000);
161 } 181 }
162 catch (Exception e) 182 catch (Exception e)
163 { 183 {
164 m_log.Debug("[USER AGENT CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message); 184 m_log.DebugFormat("[USER AGENT CONNECTOR]: {0} call to {1} failed: {2}", methodName, m_ServerURLHost, e.Message);
185 throw;
165 } 186 }
166 187
167 // Add the input arguments 188 if (response.IsFault)
168 args["gatekeeper_serveruri"] = OSD.FromString(gatekeeper.ServerURI); 189 {
169 args["gatekeeper_host"] = OSD.FromString(gatekeeper.ExternalHostName); 190 throw new Exception(string.Format("[USER AGENT CONNECTOR]: {0} call to {1} returned an error: {2}", methodName, m_ServerURLHost, response.FaultString));
170 args["gatekeeper_port"] = OSD.FromString(gatekeeper.HttpPort.ToString()); 191 }
171 args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
172 args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
173 args["destination_name"] = OSD.FromString(destination.RegionName);
174 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
175 args["destination_serveruri"] = OSD.FromString(destination.ServerURI);
176 192
177 // 10/3/2010 193 hash = (Hashtable)response.Value;
178 // I added the client_ip up to the regular AgentCircuitData, so this doesn't need to be here.
179 // This need cleaning elsewhere...
180 //if (ipaddress != null)
181 // args["client_ip"] = OSD.FromString(ipaddress.Address.ToString());
182 194
183 return args; 195 if (hash == null)
184 } 196 {
197 throw new Exception(string.Format("[USER AGENT CONNECTOR]: {0} call to {1} returned null", methodName, m_ServerURLHost));
198 }
185 199
186 public void SetClientToken(UUID sessionID, string token) 200 return hash;
187 {
188 // no-op
189 } 201 }
190 202
191 public GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt) 203 public GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt)
@@ -195,89 +207,70 @@ namespace OpenSim.Services.Connectors.Hypergrid
195 Hashtable hash = new Hashtable(); 207 Hashtable hash = new Hashtable();
196 hash["userID"] = userID.ToString(); 208 hash["userID"] = userID.ToString();
197 209
198 IList paramList = new ArrayList(); 210 hash = CallServer("get_home_region", hash);
199 paramList.Add(hash);
200 211
201 XmlRpcRequest request = new XmlRpcRequest("get_home_region", paramList); 212 bool success;
202 XmlRpcResponse response = null; 213 if (!Boolean.TryParse((string)hash["result"], out success) || !success)
203 try 214 return null;
215
216 GridRegion region = new GridRegion();
217
218 UUID.TryParse((string)hash["uuid"], out region.RegionID);
219 //m_log.Debug(">> HERE, uuid: " + region.RegionID);
220 int n = 0;
221 if (hash["x"] != null)
204 { 222 {
205 response = request.Send(m_ServerURL, 10000); 223 Int32.TryParse((string)hash["x"], out n);
224 region.RegionLocX = n;
225 //m_log.Debug(">> HERE, x: " + region.RegionLocX);
206 } 226 }
207 catch (Exception) 227 if (hash["y"] != null)
208 { 228 {
209 return null; 229 Int32.TryParse((string)hash["y"], out n);
230 region.RegionLocY = n;
231 //m_log.Debug(">> HERE, y: " + region.RegionLocY);
210 } 232 }
211 233 if (hash["size_x"] != null)
212 if (response.IsFault)
213 { 234 {
214 return null; 235 Int32.TryParse((string)hash["size_x"], out n);
236 region.RegionSizeX = n;
237 //m_log.Debug(">> HERE, x: " + region.RegionLocX);
215 } 238 }
216 239 if (hash["size_y"] != null)
217 hash = (Hashtable)response.Value;
218 //foreach (Object o in hash)
219 // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
220 try
221 { 240 {
222 bool success = false; 241 Int32.TryParse((string)hash["size_y"], out n);
223 Boolean.TryParse((string)hash["result"], out success); 242 region.RegionSizeY = n;
224 if (success) 243 //m_log.Debug(">> HERE, y: " + region.RegionLocY);
225 {
226 GridRegion region = new GridRegion();
227
228 UUID.TryParse((string)hash["uuid"], out region.RegionID);
229 //m_log.Debug(">> HERE, uuid: " + region.RegionID);
230 int n = 0;
231 if (hash["x"] != null)
232 {
233 Int32.TryParse((string)hash["x"], out n);
234 region.RegionLocX = n;
235 //m_log.Debug(">> HERE, x: " + region.RegionLocX);
236 }
237 if (hash["y"] != null)
238 {
239 Int32.TryParse((string)hash["y"], out n);
240 region.RegionLocY = n;
241 //m_log.Debug(">> HERE, y: " + region.RegionLocY);
242 }
243 if (hash["region_name"] != null)
244 {
245 region.RegionName = (string)hash["region_name"];
246 //m_log.Debug(">> HERE, name: " + region.RegionName);
247 }
248 if (hash["hostname"] != null)
249 region.ExternalHostName = (string)hash["hostname"];
250 if (hash["http_port"] != null)
251 {
252 uint p = 0;
253 UInt32.TryParse((string)hash["http_port"], out p);
254 region.HttpPort = p;
255 }
256 if (hash.ContainsKey("server_uri") && hash["server_uri"] != null)
257 region.ServerURI = (string)hash["server_uri"];
258
259 if (hash["internal_port"] != null)
260 {
261 int p = 0;
262 Int32.TryParse((string)hash["internal_port"], out p);
263 region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p);
264 }
265 if (hash["position"] != null)
266 Vector3.TryParse((string)hash["position"], out position);
267 if (hash["lookAt"] != null)
268 Vector3.TryParse((string)hash["lookAt"], out lookAt);
269
270 // Successful return
271 return region;
272 }
273
274 } 244 }
275 catch (Exception) 245 if (hash["region_name"] != null)
276 { 246 {
277 return null; 247 region.RegionName = (string)hash["region_name"];
248 //m_log.Debug(">> HERE, name: " + region.RegionName);
249 }
250 if (hash["hostname"] != null)
251 region.ExternalHostName = (string)hash["hostname"];
252 if (hash["http_port"] != null)
253 {
254 uint p = 0;
255 UInt32.TryParse((string)hash["http_port"], out p);
256 region.HttpPort = p;
278 } 257 }
258 if (hash.ContainsKey("server_uri") && hash["server_uri"] != null)
259 region.ServerURI = (string)hash["server_uri"];
279 260
280 return null; 261 if (hash["internal_port"] != null)
262 {
263 int p = 0;
264 Int32.TryParse((string)hash["internal_port"], out p);
265 region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p);
266 }
267 if (hash["position"] != null)
268 Vector3.TryParse((string)hash["position"], out position);
269 if (hash["lookAt"] != null)
270 Vector3.TryParse((string)hash["lookAt"], out lookAt);
271
272 // Successful return
273 return region;
281 } 274 }
282 275
283 public bool IsAgentComingHome(UUID sessionID, string thisGridExternalName) 276 public bool IsAgentComingHome(UUID sessionID, string thisGridExternalName)
@@ -364,14 +357,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
364 } 357 }
365 catch 358 catch
366 { 359 {
367 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for StatusNotification", m_ServerURL); 360 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for StatusNotification", m_ServerURLHost);
368// reason = "Exception: " + e.Message; 361// reason = "Exception: " + e.Message;
369 return friendsOnline; 362 return friendsOnline;
370 } 363 }
371 364
372 if (response.IsFault) 365 if (response.IsFault)
373 { 366 {
374 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for StatusNotification returned an error: {1}", m_ServerURL, response.FaultString); 367 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for StatusNotification returned an error: {1}", m_ServerURLHost, response.FaultString);
375// reason = "XMLRPC Fault"; 368// reason = "XMLRPC Fault";
376 return friendsOnline; 369 return friendsOnline;
377 } 370 }
@@ -383,7 +376,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
383 { 376 {
384 if (hash == null) 377 if (hash == null)
385 { 378 {
386 m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetOnlineFriends Got null response from {0}! THIS IS BAAAAD", m_ServerURL); 379 m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetOnlineFriends Got null response from {0}! THIS IS BAAAAD", m_ServerURLHost);
387// reason = "Internal error 1"; 380// reason = "Internal error 1";
388 return friendsOnline; 381 return friendsOnline;
389 } 382 }
@@ -436,14 +429,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
436 } 429 }
437 catch 430 catch
438 { 431 {
439 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetOnlineFriends", m_ServerURL); 432 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetOnlineFriends", m_ServerURLHost);
440// reason = "Exception: " + e.Message; 433// reason = "Exception: " + e.Message;
441 return online; 434 return online;
442 } 435 }
443 436
444 if (response.IsFault) 437 if (response.IsFault)
445 { 438 {
446 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetOnlineFriends returned an error: {1}", m_ServerURL, response.FaultString); 439 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetOnlineFriends returned an error: {1}", m_ServerURLHost, response.FaultString);
447// reason = "XMLRPC Fault"; 440// reason = "XMLRPC Fault";
448 return online; 441 return online;
449 } 442 }
@@ -455,7 +448,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
455 { 448 {
456 if (hash == null) 449 if (hash == null)
457 { 450 {
458 m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetOnlineFriends Got null response from {0}! THIS IS BAAAAD", m_ServerURL); 451 m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetOnlineFriends Got null response from {0}! THIS IS BAAAAD", m_ServerURLHost);
459// reason = "Internal error 1"; 452// reason = "Internal error 1";
460 return online; 453 return online;
461 } 454 }
@@ -486,50 +479,16 @@ namespace OpenSim.Services.Connectors.Hypergrid
486 Hashtable hash = new Hashtable(); 479 Hashtable hash = new Hashtable();
487 hash["userID"] = userID.ToString(); 480 hash["userID"] = userID.ToString();
488 481
489 IList paramList = new ArrayList(); 482 hash = CallServer("get_user_info", hash);
490 paramList.Add(hash);
491
492 XmlRpcRequest request = new XmlRpcRequest("get_user_info", paramList);
493 483
494 Dictionary<string, object> info = new Dictionary<string, object>(); 484 Dictionary<string, object> info = new Dictionary<string, object>();
495 XmlRpcResponse response = null;
496 try
497 {
498 response = request.Send(m_ServerURL, 10000);
499 }
500 catch
501 {
502 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUserInfo", m_ServerURL);
503 return info;
504 }
505
506 if (response.IsFault)
507 {
508 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetServerURLs returned an error: {1}", m_ServerURL, response.FaultString);
509 return info;
510 }
511 485
512 hash = (Hashtable)response.Value; 486 foreach (object key in hash.Keys)
513 try
514 { 487 {
515 if (hash == null) 488 if (hash[key] != null)
516 { 489 {
517 m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUserInfo Got null response from {0}! THIS IS BAAAAD", m_ServerURL); 490 info.Add(key.ToString(), hash[key]);
518 return info;
519 } 491 }
520
521 // Here is the actual response
522 foreach (object key in hash.Keys)
523 {
524 if (hash[key] != null)
525 {
526 info.Add(key.ToString(), hash[key]);
527 }
528 }
529 }
530 catch
531 {
532 m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response.");
533 } 492 }
534 493
535 return info; 494 return info;
@@ -540,60 +499,16 @@ namespace OpenSim.Services.Connectors.Hypergrid
540 Hashtable hash = new Hashtable(); 499 Hashtable hash = new Hashtable();
541 hash["userID"] = userID.ToString(); 500 hash["userID"] = userID.ToString();
542 501
543 IList paramList = new ArrayList(); 502 hash = CallServer("get_server_urls", hash);
544 paramList.Add(hash); 503
545 504 Dictionary<string, object> serverURLs = new Dictionary<string, object>();
546 XmlRpcRequest request = new XmlRpcRequest("get_server_urls", paramList); 505 foreach (object key in hash.Keys)
547// string reason = string.Empty;
548
549 // Send and get reply
550 Dictionary<string, object> serverURLs = new Dictionary<string,object>();
551 XmlRpcResponse response = null;
552 try
553 {
554 response = request.Send(m_ServerURL, 10000);
555 }
556 catch
557 {
558 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetServerURLs for user {1}", m_ServerURL, userID);
559// reason = "Exception: " + e.Message;
560 return serverURLs;
561 }
562
563 if (response.IsFault)
564 {
565 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetServerURLs returned an error: {1}", m_ServerURL, response.FaultString);
566// reason = "XMLRPC Fault";
567 return serverURLs;
568 }
569
570 hash = (Hashtable)response.Value;
571 //foreach (Object o in hash)
572 // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
573 try
574 { 506 {
575 if (hash == null) 507 if (key is string && ((string)key).StartsWith("SRV_") && hash[key] != null)
576 { 508 {
577 m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetServerURLs Got null response from {0}! THIS IS BAAAAD", m_ServerURL); 509 string serverType = key.ToString().Substring(4); // remove "SRV_"
578// reason = "Internal error 1"; 510 serverURLs.Add(serverType, hash[key].ToString());
579 return serverURLs;
580 } 511 }
581
582 // Here is the actual response
583 foreach (object key in hash.Keys)
584 {
585 if (key is string && ((string)key).StartsWith("SRV_") && hash[key] != null)
586 {
587 string serverType = key.ToString().Substring(4); // remove "SRV_"
588 serverURLs.Add(serverType, hash[key].ToString());
589 }
590 }
591
592 }
593 catch
594 {
595 m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response.");
596// reason = "Exception: " + e.Message;
597 } 512 }
598 513
599 return serverURLs; 514 return serverURLs;
@@ -604,55 +519,13 @@ namespace OpenSim.Services.Connectors.Hypergrid
604 Hashtable hash = new Hashtable(); 519 Hashtable hash = new Hashtable();
605 hash["userID"] = userID.ToString(); 520 hash["userID"] = userID.ToString();
606 521
607 IList paramList = new ArrayList(); 522 hash = CallServer("locate_user", hash);
608 paramList.Add(hash);
609
610 XmlRpcRequest request = new XmlRpcRequest("locate_user", paramList);
611// string reason = string.Empty;
612 523
613 // Send and get reply
614 string url = string.Empty; 524 string url = string.Empty;
615 XmlRpcResponse response = null;
616 try
617 {
618 response = request.Send(m_ServerURL, 10000);
619 }
620 catch
621 {
622 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for LocateUser", m_ServerURL);
623// reason = "Exception: " + e.Message;
624 return url;
625 }
626 525
627 if (response.IsFault) 526 // Here's the actual response
628 { 527 if (hash.ContainsKey("URL"))
629 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for LocateUser returned an error: {1}", m_ServerURL, response.FaultString); 528 url = hash["URL"].ToString();
630// reason = "XMLRPC Fault";
631 return url;
632 }
633
634 hash = (Hashtable)response.Value;
635 //foreach (Object o in hash)
636 // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
637 try
638 {
639 if (hash == null)
640 {
641 m_log.ErrorFormat("[USER AGENT CONNECTOR]: LocateUser Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
642// reason = "Internal error 1";
643 return url;
644 }
645
646 // Here's the actual response
647 if (hash.ContainsKey("URL"))
648 url = hash["URL"].ToString();
649
650 }
651 catch
652 {
653 m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on LocateUser response.");
654// reason = "Exception: " + e.Message;
655 }
656 529
657 return url; 530 return url;
658 } 531 }
@@ -663,55 +536,13 @@ namespace OpenSim.Services.Connectors.Hypergrid
663 hash["userID"] = userID.ToString(); 536 hash["userID"] = userID.ToString();
664 hash["targetUserID"] = targetUserID.ToString(); 537 hash["targetUserID"] = targetUserID.ToString();
665 538
666 IList paramList = new ArrayList(); 539 hash = CallServer("get_uui", hash);
667 paramList.Add(hash);
668
669 XmlRpcRequest request = new XmlRpcRequest("get_uui", paramList);
670// string reason = string.Empty;
671 540
672 // Send and get reply
673 string uui = string.Empty; 541 string uui = string.Empty;
674 XmlRpcResponse response = null;
675 try
676 {
677 response = request.Send(m_ServerURL, 10000);
678 }
679 catch
680 {
681 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUUI", m_ServerURL);
682// reason = "Exception: " + e.Message;
683 return uui;
684 }
685 542
686 if (response.IsFault) 543 // Here's the actual response
687 { 544 if (hash.ContainsKey("UUI"))
688 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetUUI returned an error: {1}", m_ServerURL, response.FaultString); 545 uui = hash["UUI"].ToString();
689// reason = "XMLRPC Fault";
690 return uui;
691 }
692
693 hash = (Hashtable)response.Value;
694 //foreach (Object o in hash)
695 // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
696 try
697 {
698 if (hash == null)
699 {
700 m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUUI Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
701// reason = "Internal error 1";
702 return uui;
703 }
704
705 // Here's the actual response
706 if (hash.ContainsKey("UUI"))
707 uui = hash["UUI"].ToString();
708
709 }
710 catch
711 {
712 m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetUUI response.");
713// reason = "Exception: " + e.Message;
714 }
715 546
716 return uui; 547 return uui;
717 } 548 }
@@ -722,54 +553,17 @@ namespace OpenSim.Services.Connectors.Hypergrid
722 hash["first"] = first; 553 hash["first"] = first;
723 hash["last"] = last; 554 hash["last"] = last;
724 555
725 IList paramList = new ArrayList(); 556 hash = CallServer("get_uuid", hash);
726 paramList.Add(hash);
727
728 XmlRpcRequest request = new XmlRpcRequest("get_uuid", paramList);
729 // string reason = string.Empty;
730
731 // Send and get reply
732 UUID uuid = UUID.Zero;
733 XmlRpcResponse response = null;
734 try
735 {
736 response = request.Send(m_ServerURL, 10000);
737 }
738 catch
739 {
740 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUUID", m_ServerURL);
741 // reason = "Exception: " + e.Message;
742 return uuid;
743 }
744 557
745 if (response.IsFault) 558 if (!hash.ContainsKey("UUID"))
746 { 559 {
747 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetUUID returned an error: {1}", m_ServerURL, response.FaultString); 560 throw new Exception(string.Format("[USER AGENT CONNECTOR]: get_uuid call to {0} didn't return a UUID", m_ServerURLHost));
748 // reason = "XMLRPC Fault";
749 return uuid;
750 } 561 }
751 562
752 hash = (Hashtable)response.Value; 563 UUID uuid;
753 //foreach (Object o in hash) 564 if (!UUID.TryParse(hash["UUID"].ToString(), out uuid))
754 // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
755 try
756 {
757 if (hash == null)
758 {
759 m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUUDI Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
760 // reason = "Internal error 1";
761 return uuid;
762 }
763
764 // Here's the actual response
765 if (hash.ContainsKey("UUID"))
766 UUID.TryParse(hash["UUID"].ToString(), out uuid);
767
768 }
769 catch
770 { 565 {
771 m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on UUID response."); 566 throw new Exception(string.Format("[USER AGENT CONNECTOR]: get_uuid call to {0} returned an invalid UUID: {1}", m_ServerURLHost, hash["UUID"].ToString()));
772 // reason = "Exception: " + e.Message;
773 } 567 }
774 568
775 return uuid; 569 return uuid;
@@ -777,7 +571,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
777 571
778 private bool GetBoolResponse(XmlRpcRequest request, out string reason) 572 private bool GetBoolResponse(XmlRpcRequest request, out string reason)
779 { 573 {
780 //m_log.Debug("[USER AGENT CONNECTOR]: GetBoolResponse from/to " + m_ServerURL); 574 //m_log.Debug("[USER AGENT CONNECTOR]: GetBoolResponse from/to " + m_ServerURLHost);
781 XmlRpcResponse response = null; 575 XmlRpcResponse response = null;
782 try 576 try
783 { 577 {
@@ -785,14 +579,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
785 } 579 }
786 catch (Exception e) 580 catch (Exception e)
787 { 581 {
788 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetBoolResponse", m_ServerURL); 582 m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetBoolResponse", m_ServerURLHost);
789 reason = "Exception: " + e.Message; 583 reason = "Exception: " + e.Message;
790 return false; 584 return false;
791 } 585 }
792 586
793 if (response.IsFault) 587 if (response.IsFault)
794 { 588 {
795 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetBoolResponse returned an error: {1}", m_ServerURL, response.FaultString); 589 m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetBoolResponse returned an error: {1}", m_ServerURLHost, response.FaultString);
796 reason = "XMLRPC Fault"; 590 reason = "XMLRPC Fault";
797 return false; 591 return false;
798 } 592 }
@@ -804,7 +598,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
804 { 598 {
805 if (hash == null) 599 if (hash == null)
806 { 600 {
807 m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got null response from {0}! THIS IS BAAAAD", m_ServerURL); 601 m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got null response from {0}! THIS IS BAAAAD", m_ServerURLHost);
808 reason = "Internal error 1"; 602 reason = "Internal error 1";
809 return false; 603 return false;
810 } 604 }
@@ -815,7 +609,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
815 else 609 else
816 { 610 {
817 reason = "Internal error 2"; 611 reason = "Internal error 2";
818 m_log.WarnFormat("[USER AGENT CONNECTOR]: response from {0} does not have expected key 'result'", m_ServerURL); 612 m_log.WarnFormat("[USER AGENT CONNECTOR]: response from {0} does not have expected key 'result'", m_ServerURLHost);
819 } 613 }
820 614
821 return success; 615 return success;
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs
index 36d4ae2..b0615b8 100644
--- a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs
@@ -34,21 +34,36 @@ using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
36using OpenSim.Framework.Communications; 36using OpenSim.Framework.Communications;
37using OpenSim.Framework.Monitoring;
37using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
38using OpenSim.Server.Base; 39using OpenSim.Server.Base;
39using OpenMetaverse; 40using OpenMetaverse;
40 41
41namespace OpenSim.Services.Connectors 42namespace OpenSim.Services.Connectors
42{ 43{
43 public class XInventoryServicesConnector : IInventoryService 44 public class XInventoryServicesConnector : BaseServiceConnector, IInventoryService
44 { 45 {
45 private static readonly ILog m_log = 46 private static readonly ILog m_log =
46 LogManager.GetLogger( 47 LogManager.GetLogger(
47 MethodBase.GetCurrentMethod().DeclaringType); 48 MethodBase.GetCurrentMethod().DeclaringType);
48 49
50 /// <summary>
51 /// Number of requests made to the remote inventory service.
52 /// </summary>
53 public int RequestsMade { get; private set; }
54
49 private string m_ServerURI = String.Empty; 55 private string m_ServerURI = String.Empty;
50 56
51 private object m_Lock = new object(); 57 /// <summary>
58 /// Timeout for remote requests.
59 /// </summary>
60 /// <remarks>
61 /// In this case, -1 is default timeout (100 seconds), not infinite.
62 /// </remarks>
63 private int m_requestTimeoutSecs = -1;
64
65 private const double CACHE_EXPIRATION_SECONDS = 20.0;
66 private static ExpiringCache<UUID, InventoryItemBase> m_ItemCache = new ExpiringCache<UUID,InventoryItemBase>();
52 67
53 public XInventoryServicesConnector() 68 public XInventoryServicesConnector()
54 { 69 {
@@ -60,20 +75,21 @@ namespace OpenSim.Services.Connectors
60 } 75 }
61 76
62 public XInventoryServicesConnector(IConfigSource source) 77 public XInventoryServicesConnector(IConfigSource source)
78 : base(source, "InventoryService")
63 { 79 {
64 Initialise(source); 80 Initialise(source);
65 } 81 }
66 82
67 public virtual void Initialise(IConfigSource source) 83 public virtual void Initialise(IConfigSource source)
68 { 84 {
69 IConfig assetConfig = source.Configs["InventoryService"]; 85 IConfig config = source.Configs["InventoryService"];
70 if (assetConfig == null) 86 if (config == null)
71 { 87 {
72 m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); 88 m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini");
73 throw new Exception("Inventory connector init error"); 89 throw new Exception("Inventory connector init error");
74 } 90 }
75 91
76 string serviceURI = assetConfig.GetString("InventoryServerURI", 92 string serviceURI = config.GetString("InventoryServerURI",
77 String.Empty); 93 String.Empty);
78 94
79 if (serviceURI == String.Empty) 95 if (serviceURI == String.Empty)
@@ -82,6 +98,21 @@ namespace OpenSim.Services.Connectors
82 throw new Exception("Inventory connector init error"); 98 throw new Exception("Inventory connector init error");
83 } 99 }
84 m_ServerURI = serviceURI; 100 m_ServerURI = serviceURI;
101
102 m_requestTimeoutSecs = config.GetInt("RemoteRequestTimeout", m_requestTimeoutSecs);
103
104 StatsManager.RegisterStat(
105 new Stat(
106 "RequestsMade",
107 "Requests made",
108 "Number of requests made to the remove inventory service",
109 "requests",
110 "inventory",
111 serviceURI,
112 StatType.Pull,
113 MeasuresOfInterest.AverageChangeOverTime,
114 s => s.Value = RequestsMade,
115 StatVerbosity.Debug));
85 } 116 }
86 117
87 private bool CheckReturn(Dictionary<string, object> ret) 118 private bool CheckReturn(Dictionary<string, object> ret)
@@ -158,7 +189,7 @@ namespace OpenSim.Services.Connectors
158 return BuildFolder((Dictionary<string, object>)ret["folder"]); 189 return BuildFolder((Dictionary<string, object>)ret["folder"]);
159 } 190 }
160 191
161 public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) 192 public InventoryFolderBase GetFolderForType(UUID principalID, FolderType type)
162 { 193 {
163 Dictionary<string,object> ret = MakeRequest("GETFOLDERFORTYPE", 194 Dictionary<string,object> ret = MakeRequest("GETFOLDERFORTYPE",
164 new Dictionary<string,object> { 195 new Dictionary<string,object> {
@@ -177,7 +208,7 @@ namespace OpenSim.Services.Connectors
177 InventoryCollection inventory = new InventoryCollection(); 208 InventoryCollection inventory = new InventoryCollection();
178 inventory.Folders = new List<InventoryFolderBase>(); 209 inventory.Folders = new List<InventoryFolderBase>();
179 inventory.Items = new List<InventoryItemBase>(); 210 inventory.Items = new List<InventoryItemBase>();
180 inventory.UserID = principalID; 211 inventory.OwnerID = principalID;
181 212
182 try 213 try
183 { 214 {
@@ -190,15 +221,17 @@ namespace OpenSim.Services.Connectors
190 if (!CheckReturn(ret)) 221 if (!CheckReturn(ret))
191 return null; 222 return null;
192 223
193 Dictionary<string,object> folders = 224 Dictionary<string,object> folders = ret.ContainsKey("FOLDERS") ?
194 (Dictionary<string,object>)ret["FOLDERS"]; 225 (Dictionary<string,object>)ret["FOLDERS"] : null;
195 Dictionary<string,object> items = 226 Dictionary<string,object> items = ret.ContainsKey("ITEMS") ?
196 (Dictionary<string,object>)ret["ITEMS"]; 227 (Dictionary<string, object>)ret["ITEMS"] : null;
197 228
198 foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i 229 if (folders != null)
199 inventory.Folders.Add(BuildFolder((Dictionary<string, object>)o)); 230 foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i
200 foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i 231 inventory.Folders.Add(BuildFolder((Dictionary<string, object>)o));
201 inventory.Items.Add(BuildItem((Dictionary<string, object>)o)); 232 if (items != null)
233 foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i
234 inventory.Items.Add(BuildItem((Dictionary<string, object>)o));
202 } 235 }
203 catch (Exception e) 236 catch (Exception e)
204 { 237 {
@@ -207,6 +240,87 @@ namespace OpenSim.Services.Connectors
207 240
208 return inventory; 241 return inventory;
209 } 242 }
243
244 public virtual InventoryCollection[] GetMultipleFoldersContent(UUID principalID, UUID[] folderIDs)
245 {
246 InventoryCollection[] inventoryArr = new InventoryCollection[folderIDs.Length];
247 // m_log.DebugFormat("[XXX]: In GetMultipleFoldersContent {0}", String.Join(",", folderIDs));
248 try
249 {
250 Dictionary<string, object> resultSet = MakeRequest("GETMULTIPLEFOLDERSCONTENT",
251 new Dictionary<string, object> {
252 { "PRINCIPAL", principalID.ToString() },
253 { "FOLDERS", String.Join(",", folderIDs) },
254 { "COUNT", folderIDs.Length.ToString() }
255 });
256
257 if (!CheckReturn(resultSet))
258 return null;
259
260 int i = 0;
261 foreach (KeyValuePair<string, object> kvp in resultSet)
262 {
263 InventoryCollection inventory = new InventoryCollection();
264 if (kvp.Key.StartsWith("F_"))
265 {
266 UUID fid = UUID.Zero;
267 if (UUID.TryParse(kvp.Key.Substring(2), out fid) && fid == folderIDs[i])
268 {
269 inventory.Folders = new List<InventoryFolderBase>();
270 inventory.Items = new List<InventoryItemBase>();
271
272 Dictionary<string, object> ret = (Dictionary<string, object>)kvp.Value;
273
274 if (ret.ContainsKey("FID"))
275 {
276 if (!UUID.TryParse(ret["FID"].ToString(), out inventory.FolderID))
277 m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: Could not parse folder id {0}", ret["FID"].ToString());
278 }
279 else
280 m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: FID key not present in response");
281
282 inventory.Version = -1;
283 if (ret.ContainsKey("VERSION"))
284 Int32.TryParse(ret["VERSION"].ToString(), out inventory.Version);
285 if (ret.ContainsKey("OWNER"))
286 UUID.TryParse(ret["OWNER"].ToString(), out inventory.OwnerID);
287
288 //m_log.DebugFormat("[XXX]: Received {0} ({1}) {2} {3}", inventory.FolderID, fid, inventory.Version, inventory.OwnerID);
289
290 Dictionary<string, object> folders =
291 (Dictionary<string, object>)ret["FOLDERS"];
292 Dictionary<string, object> items =
293 (Dictionary<string, object>)ret["ITEMS"];
294
295 foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i
296 {
297 inventory.Folders.Add(BuildFolder((Dictionary<string, object>)o));
298 }
299 foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i
300 {
301 inventory.Items.Add(BuildItem((Dictionary<string, object>)o));
302 }
303
304 inventoryArr[i] = inventory;
305 }
306 else
307 {
308 m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: Folder id does not match. Expected {0} got {1}",
309 folderIDs[i], fid);
310 m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: {0} {1}", String.Join(",", folderIDs), String.Join(",", resultSet.Keys));
311 }
312
313 i += 1;
314 }
315 }
316 }
317 catch (Exception e)
318 {
319 m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: Exception in GetMultipleFoldersContent: {0}", e.Message);
320 }
321
322 return inventoryArr;
323 }
210 324
211 public List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID) 325 public List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID)
212 { 326 {
@@ -297,9 +411,13 @@ namespace OpenSim.Services.Connectors
297 411
298 public bool AddItem(InventoryItemBase item) 412 public bool AddItem(InventoryItemBase item)
299 { 413 {
414 if (item.Description == null)
415 item.Description = String.Empty;
300 if (item.CreatorData == null) 416 if (item.CreatorData == null)
301 item.CreatorData = String.Empty; 417 item.CreatorData = String.Empty;
302 Dictionary<string,object> ret = MakeRequest("ADDITEM", 418 if (item.CreatorId == null)
419 item.CreatorId = String.Empty;
420 Dictionary<string, object> ret = MakeRequest("ADDITEM",
303 new Dictionary<string,object> { 421 new Dictionary<string,object> {
304 { "AssetID", item.AssetID.ToString() }, 422 { "AssetID", item.AssetID.ToString() },
305 { "AssetType", item.AssetType.ToString() }, 423 { "AssetType", item.AssetType.ToString() },
@@ -398,6 +516,10 @@ namespace OpenSim.Services.Connectors
398 516
399 public InventoryItemBase GetItem(InventoryItemBase item) 517 public InventoryItemBase GetItem(InventoryItemBase item)
400 { 518 {
519 InventoryItemBase retrieved = null;
520 if (m_ItemCache.TryGetValue(item.ID, out retrieved))
521 return retrieved;
522
401 try 523 try
402 { 524 {
403 Dictionary<string, object> ret = MakeRequest("GETITEM", 525 Dictionary<string, object> ret = MakeRequest("GETITEM",
@@ -408,14 +530,78 @@ namespace OpenSim.Services.Connectors
408 if (!CheckReturn(ret)) 530 if (!CheckReturn(ret))
409 return null; 531 return null;
410 532
411 return BuildItem((Dictionary<string, object>)ret["item"]); 533 retrieved = BuildItem((Dictionary<string, object>)ret["item"]);
412 } 534 }
413 catch (Exception e) 535 catch (Exception e)
414 { 536 {
415 m_log.Error("[XINVENTORY SERVICES CONNECTOR]: Exception in GetItem: ", e); 537 m_log.Error("[XINVENTORY SERVICES CONNECTOR]: Exception in GetItem: ", e);
416 } 538 }
417 539
418 return null; 540 m_ItemCache.AddOrUpdate(item.ID, retrieved, CACHE_EXPIRATION_SECONDS);
541
542 return retrieved;
543 }
544
545 public virtual InventoryItemBase[] GetMultipleItems(UUID principalID, UUID[] itemIDs)
546 {
547 //m_log.DebugFormat("[XXX]: In GetMultipleItems {0}", String.Join(",", itemIDs));
548
549 InventoryItemBase[] itemArr = new InventoryItemBase[itemIDs.Length];
550 // Try to get them from the cache
551 List<UUID> pending = new List<UUID>();
552 InventoryItemBase item = null;
553 int i = 0;
554 foreach (UUID id in itemIDs)
555 {
556 if (m_ItemCache.TryGetValue(id, out item))
557 itemArr[i++] = item;
558 else
559 pending.Add(id);
560 }
561
562 if (pending.Count == 0) // we're done, everything was in the cache
563 return itemArr;
564
565 try
566 {
567 Dictionary<string, object> resultSet = MakeRequest("GETMULTIPLEITEMS",
568 new Dictionary<string, object> {
569 { "PRINCIPAL", principalID.ToString() },
570 { "ITEMS", String.Join(",", pending.ToArray()) },
571 { "COUNT", pending.Count.ToString() }
572 });
573
574 if (!CheckReturn(resultSet))
575 {
576 if (i == 0)
577 return null;
578 else
579 return itemArr;
580 }
581
582 // carry over index i where we left above
583 foreach (KeyValuePair<string, object> kvp in resultSet)
584 {
585 InventoryCollection inventory = new InventoryCollection();
586 if (kvp.Key.StartsWith("item_"))
587 {
588 if (kvp.Value is Dictionary<string, object>)
589 {
590 item = BuildItem((Dictionary<string, object>)kvp.Value);
591 m_ItemCache.AddOrUpdate(item.ID, item, CACHE_EXPIRATION_SECONDS);
592 itemArr[i++] = item;
593 }
594 else
595 itemArr[i++] = null;
596 }
597 }
598 }
599 catch (Exception e)
600 {
601 m_log.WarnFormat("[XINVENTORY SERVICES CONNECTOR]: Exception in GetMultipleItems: {0}", e.Message);
602 }
603
604 return itemArr;
419 } 605 }
420 606
421 public InventoryFolderBase GetFolder(InventoryFolderBase folder) 607 public InventoryFolderBase GetFolder(InventoryFolderBase folder)
@@ -484,45 +670,6 @@ namespace OpenSim.Services.Connectors
484 return 0; 670 return 0;
485 } 671 }
486 672
487 public InventoryCollection GetUserInventory(UUID principalID)
488 {
489 InventoryCollection inventory = new InventoryCollection();
490 inventory.Folders = new List<InventoryFolderBase>();
491 inventory.Items = new List<InventoryItemBase>();
492 inventory.UserID = principalID;
493
494 try
495 {
496 Dictionary<string, object> ret = MakeRequest("GETUSERINVENTORY",
497 new Dictionary<string, object> {
498 { "PRINCIPAL", principalID.ToString() }
499 });
500
501 if (!CheckReturn(ret))
502 return null;
503
504 Dictionary<string, object> folders =
505 (Dictionary<string, object>)ret["FOLDERS"];
506 Dictionary<string, object> items =
507 (Dictionary<string, object>)ret["ITEMS"];
508
509 foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i
510 inventory.Folders.Add(BuildFolder((Dictionary<string, object>)o));
511 foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i
512 inventory.Items.Add(BuildItem((Dictionary<string, object>)o));
513 }
514 catch (Exception e)
515 {
516 m_log.Error("[XINVENTORY SERVICES CONNECTOR]: Exception in GetUserInventory: ", e);
517 }
518
519 return inventory;
520 }
521
522 public void GetUserInventory(UUID principalID, InventoryReceiptCallback callback)
523 {
524 }
525
526 public bool HasInventoryForUser(UUID principalID) 673 public bool HasInventoryForUser(UUID principalID)
527 { 674 {
528 return false; 675 return false;
@@ -533,13 +680,19 @@ namespace OpenSim.Services.Connectors
533 private Dictionary<string,object> MakeRequest(string method, 680 private Dictionary<string,object> MakeRequest(string method,
534 Dictionary<string,object> sendData) 681 Dictionary<string,object> sendData)
535 { 682 {
536 sendData["METHOD"] = method; 683 // Add "METHOD" as the first key in the dictionary. This ensures that it will be
684 // visible even when using partial logging ("debug http all 5").
685 Dictionary<string, object> temp = sendData;
686 sendData = new Dictionary<string,object>{ { "METHOD", method } };
687 foreach (KeyValuePair<string, object> kvp in temp)
688 sendData.Add(kvp.Key, kvp.Value);
689
690 RequestsMade++;
537 691
538 string reply = string.Empty; 692 string reply
539 lock (m_Lock) 693 = SynchronousRestFormsRequester.MakeRequest(
540 reply = SynchronousRestFormsRequester.MakeRequest("POST", 694 "POST", m_ServerURI + "/xinventory",
541 m_ServerURI + "/xinventory", 695 ServerUtils.BuildQueryString(sendData), m_requestTimeoutSecs, m_Auth);
542 ServerUtils.BuildQueryString(sendData));
543 696
544 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( 697 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(
545 reply); 698 reply);
@@ -607,4 +760,4 @@ namespace OpenSim.Services.Connectors
607 return item; 760 return item;
608 } 761 }
609 } 762 }
610} \ No newline at end of file 763}
diff --git a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs
index 833e22a..3408f7a 100644
--- a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs
@@ -78,7 +78,7 @@ namespace OpenSim.Services.Connectors
78 try 78 try
79 { 79 {
80 uint xpos = 0, ypos = 0; 80 uint xpos = 0, ypos = 0;
81 Utils.LongToUInts(regionHandle, out xpos, out ypos); 81 Util.RegionHandleToWorldLoc(regionHandle, out xpos, out ypos);
82 GridRegion info = m_GridService.GetRegionByPosition(scopeID, (int)xpos, (int)ypos); 82 GridRegion info = m_GridService.GetRegionByPosition(scopeID, (int)xpos, (int)ypos);
83 if (info != null) // just to be sure 83 if (info != null) // just to be sure
84 { 84 {
diff --git a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs
index ba4c3c5..a0ac5f9 100644
--- a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs
+++ b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs
@@ -36,6 +36,7 @@ using Nini.Config;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Console; 37using OpenSim.Framework.Console;
38using OpenSim.Framework.Communications; 38using OpenSim.Framework.Communications;
39using OpenSim.Framework.ServiceAuth;
39using OpenSim.Server.Base; 40using OpenSim.Server.Base;
40using OpenSim.Services.Interfaces; 41using OpenSim.Services.Interfaces;
41using OpenMetaverse; 42using OpenMetaverse;
@@ -43,7 +44,7 @@ using OpenMetaverse.StructuredData;
43 44
44namespace OpenSim.Services.Connectors 45namespace OpenSim.Services.Connectors
45{ 46{
46 public class MapImageServicesConnector : IMapImageService 47 public class MapImageServicesConnector : BaseServiceConnector, IMapImageService
47 { 48 {
48 private static readonly ILog m_log = 49 private static readonly ILog m_log =
49 LogManager.GetLogger( 50 LogManager.GetLogger(
@@ -84,6 +85,68 @@ namespace OpenSim.Services.Connectors
84 } 85 }
85 m_ServerURI = serviceURI; 86 m_ServerURI = serviceURI;
86 m_ServerURI = serviceURI.TrimEnd('/'); 87 m_ServerURI = serviceURI.TrimEnd('/');
88 base.Initialise(source, "MapImageService");
89 }
90
91 public bool RemoveMapTile(int x, int y, out string reason)
92 {
93 reason = string.Empty;
94 int tickstart = Util.EnvironmentTickCount();
95 Dictionary<string, object> sendData = new Dictionary<string, object>();
96 sendData["X"] = x.ToString();
97 sendData["Y"] = y.ToString();
98
99 string reqString = ServerUtils.BuildQueryString(sendData);
100 string uri = m_ServerURI + "/removemap";
101
102 try
103 {
104 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
105 uri,
106 reqString,
107 m_Auth);
108 if (reply != string.Empty)
109 {
110 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
111
112 if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "success"))
113 {
114 return true;
115 }
116 else if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "failure"))
117 {
118 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Delete failed: {0}", replyData["Message"].ToString());
119 reason = replyData["Message"].ToString();
120 return false;
121 }
122 else if (!replyData.ContainsKey("Result"))
123 {
124 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: reply data does not contain result field");
125 }
126 else
127 {
128 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: unexpected result {0}", replyData["Result"].ToString());
129 reason = "Unexpected result " + replyData["Result"].ToString();
130 }
131
132 }
133 else
134 {
135 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Map post received null reply");
136 }
137 }
138 catch (Exception e)
139 {
140 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Exception when contacting map server at {0}: {1}", uri, e.Message);
141 }
142 finally
143 {
144 // This just dumps a warning for any operation that takes more than 100 ms
145 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
146 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: map tile deleted in {0}ms", tickdiff);
147 }
148
149 return false;
87 } 150 }
88 151
89 public bool RemoveMapTile(int x, int y, UUID scopeID, out string reason) 152 public bool RemoveMapTile(int x, int y, UUID scopeID, out string reason)
@@ -165,7 +228,8 @@ namespace OpenSim.Services.Connectors
165 { 228 {
166 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 229 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
167 uri, 230 uri,
168 reqString); 231 reqString,
232 m_Auth);
169 if (reply != string.Empty) 233 if (reply != string.Empty)
170 { 234 {
171 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 235 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs
index 245703c..e236ec3 100644
--- a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs
@@ -69,7 +69,7 @@ namespace OpenSim.Services.Connectors
69 public virtual GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) 69 public virtual GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
70 { 70 {
71 uint x = 0, y = 0; 71 uint x = 0, y = 0;
72 Utils.LongToUInts(regionHandle, out x, out y); 72 Util.RegionHandleToWorldLoc(regionHandle, out x, out y);
73 GridRegion regInfo = m_GridService.GetRegionByPosition(thisRegion.ScopeID, (int)x, (int)y); 73 GridRegion regInfo = m_GridService.GetRegionByPosition(thisRegion.ScopeID, (int)x, (int)y);
74 if ((regInfo != null) && 74 if ((regInfo != null) &&
75 // Don't remote-call this instance; that's a startup hickup 75 // Don't remote-call this instance; that's a startup hickup
@@ -97,9 +97,9 @@ namespace OpenSim.Services.Connectors
97 } 97 }
98 catch (Exception e) 98 catch (Exception e)
99 { 99 {
100 m_log.WarnFormat( 100 m_log.Warn(string.Format(
101 "[NEIGHBOUR SERVICES CONNECTOR]: Unable to parse uri {0} to send HelloNeighbour from {1} to {2}. Exception {3}{4}", 101 "[NEIGHBOUR SERVICES CONNECTOR]: Unable to parse uri {0} to send HelloNeighbour from {1} to {2}. Exception {3} ",
102 uri, thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace); 102 uri, thisRegion.RegionName, region.RegionName, e.Message), e);
103 103
104 return false; 104 return false;
105 } 105 }
@@ -116,9 +116,9 @@ namespace OpenSim.Services.Connectors
116 } 116 }
117 catch (Exception e) 117 catch (Exception e)
118 { 118 {
119 m_log.WarnFormat( 119 m_log.Warn(string.Format(
120 "[NEIGHBOUR SERVICES CONNECTOR]: PackRegionInfoData failed for HelloNeighbour from {0} to {1}. Exception {2}{3}", 120 "[NEIGHBOUR SERVICES CONNECTOR]: PackRegionInfoData failed for HelloNeighbour from {0} to {1}. Exception {2} ",
121 thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace); 121 thisRegion.RegionName, region.RegionName, e.Message), e);
122 122
123 return false; 123 return false;
124 } 124 }
@@ -136,9 +136,9 @@ namespace OpenSim.Services.Connectors
136 } 136 }
137 catch (Exception e) 137 catch (Exception e)
138 { 138 {
139 m_log.WarnFormat( 139 m_log.Warn(string.Format(
140 "[NEIGHBOUR SERVICES CONNECTOR]: Exception thrown on serialization of HelloNeighbour from {0} to {1}. Exception {2}{3}", 140 "[NEIGHBOUR SERVICES CONNECTOR]: Exception thrown on serialization of HelloNeighbour from {0} to {1}. Exception {2} ",
141 thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace); 141 thisRegion.RegionName, region.RegionName, e.Message), e);
142 142
143 return false; 143 return false;
144 } 144 }
@@ -153,16 +153,22 @@ namespace OpenSim.Services.Connectors
153 } 153 }
154 catch (Exception e) 154 catch (Exception e)
155 { 155 {
156<<<<<<< HEAD
157 m_log.Warn(string.Format(
158 "[NEIGHBOUR SERVICES CONNECTOR]: Unable to send HelloNeighbour from {0} to {1} (uri {2}). Exception {3} ",
159 thisRegion.RegionName, region.RegionName, uri, e.Message), e);
160=======
156// m_log.WarnFormat( 161// m_log.WarnFormat(
157// "[NEIGHBOUR SERVICE CONNCTOR]: Unable to send HelloNeighbour from {0} to {1}. Exception {2}{3}", 162// "[NEIGHBOUR SERVICE CONNCTOR]: Unable to send HelloNeighbour from {0} to {1}. Exception {2}{3}",
158// thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace); 163// thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace);
164>>>>>>> avn/ubitvar
159 165
160 return false; 166 return false;
161 } 167 }
162 finally 168 finally
163 { 169 {
164 if (os != null) 170 if (os != null)
165 os.Close(); 171 os.Dispose();
166 } 172 }
167 173
168 // Let's wait for the response 174 // Let's wait for the response
@@ -192,9 +198,9 @@ namespace OpenSim.Services.Connectors
192 } 198 }
193 catch (Exception e) 199 catch (Exception e)
194 { 200 {
195 m_log.WarnFormat( 201 m_log.Warn(string.Format(
196 "[NEIGHBOUR SERVICES CONNECTOR]: Exception on reply of DoHelloNeighbourCall from {0} back to {1}. Exception {2}{3}", 202 "[NEIGHBOUR SERVICES CONNECTOR]: Exception on reply of DoHelloNeighbourCall from {0} back to {1}. Exception {2} ",
197 region.RegionName, thisRegion.RegionName, e.Message, e.StackTrace); 203 region.RegionName, thisRegion.RegionName, e.Message), e);
198 204
199 return false; 205 return false;
200 } 206 }
diff --git a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs
index 378aab6..e474d41 100644
--- a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs
@@ -33,6 +33,7 @@ using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Framework.ServiceAuth;
36using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
37using GridRegion = OpenSim.Services.Interfaces.GridRegion; 38using GridRegion = OpenSim.Services.Interfaces.GridRegion;
38using OpenSim.Server.Base; 39using OpenSim.Server.Base;
@@ -40,7 +41,7 @@ using OpenMetaverse;
40 41
41namespace OpenSim.Services.Connectors 42namespace OpenSim.Services.Connectors
42{ 43{
43 public class PresenceServicesConnector : IPresenceService 44 public class PresenceServicesConnector : BaseServiceConnector, IPresenceService
44 { 45 {
45 private static readonly ILog m_log = 46 private static readonly ILog m_log =
46 LogManager.GetLogger( 47 LogManager.GetLogger(
@@ -80,6 +81,8 @@ namespace OpenSim.Services.Connectors
80 throw new Exception("Presence connector init error"); 81 throw new Exception("Presence connector init error");
81 } 82 }
82 m_ServerURI = serviceURI; 83 m_ServerURI = serviceURI;
84
85 base.Initialise(source, "PresenceService");
83 } 86 }
84 87
85 88
@@ -104,7 +107,8 @@ namespace OpenSim.Services.Connectors
104 { 107 {
105 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 108 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
106 uri, 109 uri,
107 reqString); 110 reqString,
111 m_Auth);
108 if (reply != string.Empty) 112 if (reply != string.Empty)
109 { 113 {
110 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 114 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@@ -149,7 +153,8 @@ namespace OpenSim.Services.Connectors
149 { 153 {
150 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 154 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
151 uri, 155 uri,
152 reqString); 156 reqString,
157 m_Auth);
153 if (reply != string.Empty) 158 if (reply != string.Empty)
154 { 159 {
155 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 160 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@@ -193,7 +198,8 @@ namespace OpenSim.Services.Connectors
193 { 198 {
194 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 199 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
195 uri, 200 uri,
196 reqString); 201 reqString,
202 m_Auth);
197 if (reply != string.Empty) 203 if (reply != string.Empty)
198 { 204 {
199 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 205 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@@ -238,7 +244,8 @@ namespace OpenSim.Services.Connectors
238 { 244 {
239 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 245 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
240 uri, 246 uri,
241 reqString); 247 reqString,
248 m_Auth);
242 if (reply != string.Empty) 249 if (reply != string.Empty)
243 { 250 {
244 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 251 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@@ -283,7 +290,8 @@ namespace OpenSim.Services.Connectors
283 { 290 {
284 reply = SynchronousRestFormsRequester.MakeRequest("POST", 291 reply = SynchronousRestFormsRequester.MakeRequest("POST",
285 uri, 292 uri,
286 reqString); 293 reqString,
294 m_Auth);
287 if (reply == null || (reply != null && reply == string.Empty)) 295 if (reply == null || (reply != null && reply == string.Empty))
288 { 296 {
289 m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgent received null or empty reply"); 297 m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgent received null or empty reply");
@@ -293,6 +301,7 @@ namespace OpenSim.Services.Connectors
293 catch (Exception e) 301 catch (Exception e)
294 { 302 {
295 m_log.DebugFormat("[PRESENCE CONNECTOR]: Exception when contacting presence server at {0}: {1}", uri, e.Message); 303 m_log.DebugFormat("[PRESENCE CONNECTOR]: Exception when contacting presence server at {0}: {1}", uri, e.Message);
304 return null;
296 } 305 }
297 306
298 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 307 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
@@ -338,7 +347,8 @@ namespace OpenSim.Services.Connectors
338 { 347 {
339 reply = SynchronousRestFormsRequester.MakeRequest("POST", 348 reply = SynchronousRestFormsRequester.MakeRequest("POST",
340 uri, 349 uri,
341 reqString); 350 reqString,
351 m_Auth);
342 if (reply == null || (reply != null && reply == string.Empty)) 352 if (reply == null || (reply != null && reply == string.Empty))
343 { 353 {
344 m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgents received null or empty reply"); 354 m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgents received null or empty reply");
diff --git a/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs b/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs
index bc89f5d..2af2ec1 100644
--- a/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs
+++ b/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
29// Build Number 29// Build Number
30// Revision 30// Revision
31// 31//
32[assembly: AssemblyVersion("0.8.0.*")] 32[assembly: AssemblyVersion("0.8.2.*")]
33 33
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs
index 95e4bab..cd4781d 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs
@@ -69,7 +69,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
69 Util.FireAndForget(delegate(object o) 69 Util.FireAndForget(delegate(object o)
70 { 70 {
71 m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); 71 m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
72 }); 72 }, null, "SimianActivityDetector.SetLastPositionOnMakeRootAgent");
73 } 73 }
74 74
75 public void OnNewClient(IClientAPI client) 75 public void OnNewClient(IClientAPI client)
@@ -94,7 +94,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
94 Util.FireAndForget(delegate(object o) 94 Util.FireAndForget(delegate(object o)
95 { 95 {
96 m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); 96 m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
97 }); 97 }, null, "SimianActivityDetector.SetLastPositionOnEnteringNewParcel");
98 } 98 }
99 } 99 }
100} \ No newline at end of file 100} \ No newline at end of file
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
index 6f8d9ed..9ad4a7a 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
@@ -225,12 +225,32 @@ namespace OpenSim.Services.Connectors.SimianGrid
225 { 225 {
226 AssetBase asset = SimianGetOperation(id); 226 AssetBase asset = SimianGetOperation(id);
227 handler(id, sender, asset); 227 handler(id, sender, asset);
228 } 228 }, null, "SimianAssetServiceConnector.GetFromService"
229 ); 229 );
230 230
231 return true; 231 return true;
232 } 232 }
233 233
234 public bool[] AssetsExist(string[] ids)
235 {
236 if (String.IsNullOrEmpty(m_serverUrl))
237 {
238 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
239 throw new InvalidOperationException();
240 }
241
242 bool[] exist = new bool[ids.Length];
243
244 for (int i = 0; i < ids.Length; i++)
245 {
246 AssetMetadata metadata = GetMetadata(ids[i]);
247 if (metadata != null)
248 exist[i] = true;
249 }
250
251 return exist;
252 }
253
234 /// <summary> 254 /// <summary>
235 /// Creates a new asset 255 /// Creates a new asset
236 /// </summary> 256 /// </summary>
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs
index 9898da9..a35d749 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs
@@ -39,8 +39,8 @@ using OpenSim.Services.Interfaces;
39using OpenMetaverse; 39using OpenMetaverse;
40using OpenMetaverse.StructuredData; 40using OpenMetaverse.StructuredData;
41 41
42[assembly: Addin("SimianGrid", "1.0")] 42[assembly: Addin("SimianGrid", OpenSim.VersionInfo.VersionNumber)]
43[assembly: AddinDependency("OpenSim", "0.5")] 43[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
44 44
45namespace OpenSim.Services.Connectors.SimianGrid 45namespace OpenSim.Services.Connectors.SimianGrid
46{ 46{
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs
index b999509..8375c95 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs
@@ -181,7 +181,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
181 m_log.DebugFormat("[SIMIAN MAPTILE]: upload maptile for {0}",scene.RegionInfo.RegionName); 181 m_log.DebugFormat("[SIMIAN MAPTILE]: upload maptile for {0}",scene.RegionInfo.RegionName);
182 182
183 // Create a PNG map tile and upload it to the AddMapTile API 183 // Create a PNG map tile and upload it to the AddMapTile API
184 byte[] pngData = Utils.EmptyBytes;
185 IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>(); 184 IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>();
186 if (tileGenerator == null) 185 if (tileGenerator == null)
187 { 186 {
@@ -189,93 +188,79 @@ namespace OpenSim.Services.Connectors.SimianGrid
189 return; 188 return;
190 } 189 }
191 190
192 using (Image mapTile = tileGenerator.CreateMapTile()) 191 using (Bitmap mapTile = tileGenerator.CreateMapTile())
193 { 192 {
194 using (MemoryStream stream = new MemoryStream()) 193 if (mapTile != null)
194 {
195 // If the region/maptile is legacy sized, just upload the one tile like it has always been done
196 if (mapTile.Width == Constants.RegionSize && mapTile.Height == Constants.RegionSize)
197 {
198 ConvertAndUploadMaptile(mapTile, scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY);
199 }
200 else
201 {
202 // For larger regions (varregion) we must cut the region image into legacy sized
203 // pieces since that is how the maptile system works.
204 // Note the assumption that varregions are always a multiple of legacy size.
205 for (uint xx = 0; xx < mapTile.Width; xx += Constants.RegionSize)
206 {
207 for (uint yy = 0; yy < mapTile.Height; yy += Constants.RegionSize)
208 {
209 // Images are addressed from the upper left corner so have to do funny
210 // math to pick out the sub-tile since regions are numbered from
211 // the lower left.
212 Rectangle rect = new Rectangle(
213 (int)xx,
214 mapTile.Height - (int)yy - (int)Constants.RegionSize,
215 (int)Constants.RegionSize, (int)Constants.RegionSize);
216
217 using (Bitmap subMapTile = mapTile.Clone(rect, mapTile.PixelFormat))
218 {
219 uint locX = scene.RegionInfo.RegionLocX + (xx / Constants.RegionSize);
220 uint locY = scene.RegionInfo.RegionLocY + (yy / Constants.RegionSize);
221
222 ConvertAndUploadMaptile(subMapTile, locX, locY);
223 }
224 }
225 }
226 }
227 }
228 else
195 { 229 {
196 mapTile.Save(stream, ImageFormat.Png); 230 m_log.WarnFormat("[SIMIAN MAPTILE] Tile image generation failed");
197 pngData = stream.ToArray();
198 } 231 }
199 } 232 }
200 233
234 }
235
236 ///<summary>
237 ///
238 ///</summary>
239 private void ConvertAndUploadMaptile(Image mapTile, uint locX, uint locY)
240 {
241 //m_log.DebugFormat("[SIMIAN MAPTILE]: upload maptile for location {0}, {1}", locX, locY);
242
243 byte[] pngData = Utils.EmptyBytes;
244 using (MemoryStream stream = new MemoryStream())
245 {
246 mapTile.Save(stream, ImageFormat.Png);
247 pngData = stream.ToArray();
248 }
249
201 NameValueCollection requestArgs = new NameValueCollection 250 NameValueCollection requestArgs = new NameValueCollection
202 { 251 {
203 { "RequestMethod", "xAddMapTile" }, 252 { "RequestMethod", "xAddMapTile" },
204 { "X", scene.RegionInfo.RegionLocX.ToString() }, 253 { "X", locX.ToString() },
205 { "Y", scene.RegionInfo.RegionLocY.ToString() }, 254 { "Y", locY.ToString() },
206 { "ContentType", "image/png" }, 255 { "ContentType", "image/png" },
207 { "EncodedData", System.Convert.ToBase64String(pngData) } 256 { "EncodedData", System.Convert.ToBase64String(pngData) }
208 }; 257 };
209 258
210 OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs); 259 OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs);
211 if (! response["Success"].AsBoolean()) 260 if (! response["Success"].AsBoolean())
212 { 261 {
213 m_log.WarnFormat("[SIMIAN MAPTILE] failed to store map tile; {0}",response["Message"].AsString()); 262 m_log.WarnFormat("[SIMIAN MAPTILE] failed to store map tile; {0}",response["Message"].AsString());
214 return;
215 } 263 }
216
217 // List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>()
218 // {
219 // new MultipartForm.Parameter("X", scene.RegionInfo.RegionLocX.ToString()),
220 // new MultipartForm.Parameter("Y", scene.RegionInfo.RegionLocY.ToString()),
221 // new MultipartForm.File("Tile", "tile.png", "image/png", pngData)
222 // };
223
224 // string errorMessage = null;
225 // int tickstart = Util.EnvironmentTickCount();
226
227 // // Make the remote storage request
228 // try
229 // {
230 // HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl);
231 // request.Timeout = 20000;
232 // request.ReadWriteTimeout = 5000;
233
234 // using (HttpWebResponse response = MultipartForm.Post(request, postParameters))
235 // {
236 // using (Stream responseStream = response.GetResponseStream())
237 // {
238 // string responseStr = responseStream.GetStreamString();
239 // OSD responseOSD = OSDParser.Deserialize(responseStr);
240 // if (responseOSD.Type == OSDType.Map)
241 // {
242 // OSDMap responseMap = (OSDMap)responseOSD;
243 // if (responseMap["Success"].AsBoolean())
244 // return;
245
246 // errorMessage = "Upload failed: " + responseMap["Message"].AsString();
247 // }
248 // else
249 // {
250 // errorMessage = "Response format was invalid:\n" + responseStr;
251 // }
252 // }
253 // }
254 // }
255 // catch (WebException we)
256 // {
257 // errorMessage = we.Message;
258 // if (we.Status == WebExceptionStatus.ProtocolError)
259 // {
260 // HttpWebResponse webResponse = (HttpWebResponse)we.Response;
261 // errorMessage = String.Format("[{0}] {1}",
262 // webResponse.StatusCode,webResponse.StatusDescription);
263 // }
264 // }
265 // catch (Exception ex)
266 // {
267 // errorMessage = ex.Message;
268 // }
269 // finally
270 // {
271 // // This just dumps a warning for any operation that takes more than 100 ms
272 // int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
273 // m_log.DebugFormat("[SIMIAN MAPTILE]: map tile uploaded in {0}ms",tickdiff);
274 // }
275
276 // m_log.WarnFormat("[SIMIAN MAPTILE]: Failed to store {0} byte tile for {1}: {2}",
277 // pngData.Length, scene.RegionInfo.RegionName, errorMessage);
278
279 } 264 }
280 } 265 }
281} \ No newline at end of file 266} \ No newline at end of file
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index 312832f..6043b70 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -167,10 +167,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
167 167
168 public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID) 168 public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
169 { 169 {
170 const int NEIGHBOR_RADIUS = 128;
171
172 GridRegion region = GetRegionByUUID(scopeID, regionID); 170 GridRegion region = GetRegionByUUID(scopeID, regionID);
173 171
172 int NEIGHBOR_RADIUS = Math.Max(region.RegionSizeX, region.RegionSizeY) / 2;
173
174 if (region != null) 174 if (region != null)
175 { 175 {
176 List<GridRegion> regions = GetRegionRange(scopeID, 176 List<GridRegion> regions = GetRegionRange(scopeID,
@@ -413,6 +413,13 @@ namespace OpenSim.Services.Connectors.SimianGrid
413 return -1; 413 return -1;
414 } 414 }
415 } 415 }
416
417 public Dictionary<string, object> GetExtraFeatures()
418 {
419 /// See SimulatorFeaturesModule - Need to get map, search and destination guide
420 Dictionary<string, object> extraFeatures = new Dictionary<string, object>();
421 return extraFeatures;
422 }
416 423
417 #endregion IGridService 424 #endregion IGridService
418 425
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
index 97eaabe..e793420 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
@@ -74,6 +74,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
74// private object m_gestureSyncRoot = new object(); 74// private object m_gestureSyncRoot = new object();
75 private bool m_Enabled = false; 75 private bool m_Enabled = false;
76 76
77 private const double CACHE_EXPIRATION_SECONDS = 20.0;
78 private static ExpiringCache<UUID, InventoryItemBase> m_ItemCache;
79
77 #region ISharedRegionModule 80 #region ISharedRegionModule
78 81
79 public Type ReplaceableInterface { get { return null; } } 82 public Type ReplaceableInterface { get { return null; } }
@@ -99,6 +102,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
99 url = url + '/'; 102 url = url + '/';
100 m_serverUrl = url; 103 m_serverUrl = url;
101 104
105 if (m_ItemCache == null)
106 m_ItemCache = new ExpiringCache<UUID, InventoryItemBase>();
107
102 } 108 }
103 109
104 public void Initialise(IConfigSource source) 110 public void Initialise(IConfigSource source)
@@ -132,6 +138,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
132 { 138 {
133 m_userServerUrl = serviceUrl; 139 m_userServerUrl = serviceUrl;
134 m_Enabled = true; 140 m_Enabled = true;
141 if (m_ItemCache == null)
142 m_ItemCache = new ExpiringCache<UUID, InventoryItemBase>();
135 } 143 }
136 } 144 }
137 } 145 }
@@ -197,37 +205,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
197 } 205 }
198 206
199 /// <summary> 207 /// <summary>
200 /// Synchronous inventory fetch.
201 /// </summary>
202 /// <param name="userID"></param>
203 /// <returns></returns>
204 [Obsolete]
205 public InventoryCollection GetUserInventory(UUID userID)
206 {
207 m_log.Error("[SIMIAN INVENTORY CONNECTOR]: Obsolete GetUserInventory called for " + userID);
208
209 InventoryCollection inventory = new InventoryCollection();
210 inventory.UserID = userID;
211 inventory.Folders = new List<InventoryFolderBase>();
212 inventory.Items = new List<InventoryItemBase>();
213
214 return inventory;
215 }
216
217 /// <summary>
218 /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the
219 /// inventory has been received
220 /// </summary>
221 /// <param name="userID"></param>
222 /// <param name="callback"></param>
223 [Obsolete]
224 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
225 {
226 m_log.Error("[SIMIAN INVENTORY CONNECTOR]: Obsolete GetUserInventory called for " + userID);
227 callback(new List<InventoryFolderImpl>(0), new List<InventoryItemBase>(0));
228 }
229
230 /// <summary>
231 /// Retrieve the root inventory folder for the given user. 208 /// Retrieve the root inventory folder for the given user.
232 /// </summary> 209 /// </summary>
233 /// <param name="userID"></param> 210 /// <param name="userID"></param>
@@ -263,7 +240,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
263 /// <param name="userID"></param> 240 /// <param name="userID"></param>
264 /// <param name="type"></param> 241 /// <param name="type"></param>
265 /// <returns></returns> 242 /// <returns></returns>
266 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) 243 public InventoryFolderBase GetFolderForType(UUID userID, FolderType type)
267 { 244 {
268 string contentType = SLUtil.SLAssetTypeToContentType((int)type); 245 string contentType = SLUtil.SLAssetTypeToContentType((int)type);
269 246
@@ -302,6 +279,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
302 /// <returns></returns> 279 /// <returns></returns>
303 public InventoryItemBase GetItem(InventoryItemBase item) 280 public InventoryItemBase GetItem(InventoryItemBase item)
304 { 281 {
282 InventoryItemBase retrieved = null;
283 if (m_ItemCache.TryGetValue(item.ID, out retrieved))
284 return retrieved;
285
305 NameValueCollection requestArgs = new NameValueCollection 286 NameValueCollection requestArgs = new NameValueCollection
306 { 287 {
307 { "RequestMethod", "GetInventoryNode" }, 288 { "RequestMethod", "GetInventoryNode" },
@@ -323,7 +304,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
323 for (int i = 0; i < items.Count; i++) 304 for (int i = 0; i < items.Count; i++)
324 { 305 {
325 if (items[i].ID == item.ID) 306 if (items[i].ID == item.ID)
326 return items[i]; 307 {
308 retrieved = items[i];
309 m_ItemCache.AddOrUpdate(item.ID, retrieved, CACHE_EXPIRATION_SECONDS);
310 return retrieved;
311 }
327 } 312 }
328 } 313 }
329 } 314 }
@@ -332,6 +317,21 @@ namespace OpenSim.Services.Connectors.SimianGrid
332 return null; 317 return null;
333 } 318 }
334 319
320 public InventoryItemBase[] GetMultipleItems(UUID principalID, UUID[] itemIDs)
321 {
322 InventoryItemBase[] result = new InventoryItemBase[itemIDs.Length];
323 int i = 0;
324 InventoryItemBase item = new InventoryItemBase();
325 item.Owner = principalID;
326 foreach (UUID id in itemIDs)
327 {
328 item.ID = id;
329 result[i++] = GetItem(item);
330 }
331
332 return result;
333 }
334
335 /// <summary> 335 /// <summary>
336 /// Get a folder, given by its UUID 336 /// Get a folder, given by its UUID
337 /// </summary> 337 /// </summary>
@@ -371,7 +371,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
371 public InventoryCollection GetFolderContent(UUID userID, UUID folderID) 371 public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
372 { 372 {
373 InventoryCollection inventory = new InventoryCollection(); 373 InventoryCollection inventory = new InventoryCollection();
374 inventory.UserID = userID; 374 inventory.OwnerID = userID;
375 375
376 NameValueCollection requestArgs = new NameValueCollection 376 NameValueCollection requestArgs = new NameValueCollection
377 { 377 {
@@ -402,6 +402,18 @@ namespace OpenSim.Services.Connectors.SimianGrid
402 return inventory; 402 return inventory;
403 } 403 }
404 404
405 public virtual InventoryCollection[] GetMultipleFoldersContent(UUID principalID, UUID[] folderIDs)
406 {
407 InventoryCollection[] invColl = new InventoryCollection[folderIDs.Length];
408 int i = 0;
409 foreach (UUID fid in folderIDs)
410 {
411 invColl[i++] = GetFolderContent(principalID, fid);
412 }
413
414 return invColl;
415 }
416
405 /// <summary> 417 /// <summary>
406 /// Gets the items inside a folder 418 /// Gets the items inside a folder
407 /// </summary> 419 /// </summary>
@@ -411,7 +423,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
411 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) 423 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
412 { 424 {
413 InventoryCollection inventory = new InventoryCollection(); 425 InventoryCollection inventory = new InventoryCollection();
414 inventory.UserID = userID; 426 inventory.OwnerID = userID;
415 427
416 NameValueCollection requestArgs = new NameValueCollection 428 NameValueCollection requestArgs = new NameValueCollection
417 { 429 {
@@ -568,7 +580,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
568 // A folder of UUID.Zero means we need to find the most appropriate home for this item 580 // A folder of UUID.Zero means we need to find the most appropriate home for this item
569 if (item.Folder == UUID.Zero) 581 if (item.Folder == UUID.Zero)
570 { 582 {
571 InventoryFolderBase folder = GetFolderForType(item.Owner, (AssetType)item.AssetType); 583 InventoryFolderBase folder = null;
584 if (Enum.IsDefined(typeof(FolderType), (sbyte)item.AssetType))
585 folder = GetFolderForType(item.Owner, (FolderType)item.AssetType);
572 if (folder != null && folder.ID != UUID.Zero) 586 if (folder != null && folder.ID != UUID.Zero)
573 item.Folder = folder.ID; 587 item.Folder = folder.ID;
574 else 588 else
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
index 684a0db..8fc766d 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
@@ -425,7 +425,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
425 estate.EstateID, admin.Name); 425 estate.EstateID, admin.Name);
426 426
427 estate.EstateOwner = admin.PrincipalID; 427 estate.EstateOwner = admin.PrincipalID;
428 estate.Save(); 428 scene.EstateDataService.StoreEstateSettings(estate);
429 } 429 }
430 else 430 else
431 { 431 {
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index fdc8697..08c5c50 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -191,9 +191,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
191 return accounts; 191 return accounts;
192 } 192 }
193 193
194<<<<<<< HEAD
195 public void InvalidateCache(UUID userID)
196 {
197 m_accountCache.Remove(userID);
198=======
194 public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query) 199 public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query)
195 { 200 {
196 return null; 201 return null;
202>>>>>>> avn/ubitvar
197 } 203 }
198 204
199 public bool StoreUserAccount(UserAccount data) 205 public bool StoreUserAccount(UserAccount data)
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index 75c5b35..28b6de7 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -79,22 +79,32 @@ namespace OpenSim.Services.Connectors.Simulation
79 return "agent/"; 79 return "agent/";
80 } 80 }
81 81
82 protected virtual void PackData(OSDMap args, AgentCircuitData aCircuit, GridRegion destination, uint flags) 82 protected virtual void PackData(OSDMap args, GridRegion source, AgentCircuitData aCircuit, GridRegion destination, uint flags)
83 { 83 {
84 args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString()); 84 if (source != null)
85 args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); 85 {
86 args["destination_name"] = OSD.FromString(destination.RegionName); 86 args["source_x"] = OSD.FromString(source.RegionLocX.ToString());
87 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); 87 args["source_y"] = OSD.FromString(source.RegionLocY.ToString());
88 args["teleport_flags"] = OSD.FromString(flags.ToString()); 88 args["source_name"] = OSD.FromString(source.RegionName);
89 args["source_uuid"] = OSD.FromString(source.RegionID.ToString());
90 if (!String.IsNullOrEmpty(source.RawServerURI))
91 args["source_server_uri"] = OSD.FromString(source.RawServerURI);
92 }
93
94 args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString());
95 args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString());
96 args["destination_name"] = OSD.FromString(destination.RegionName);
97 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
98 args["teleport_flags"] = OSD.FromString(flags.ToString());
89 } 99 }
90 100
91 public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) 101 public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason)
92 { 102 {
93 string tmp = String.Empty; 103 string tmp = String.Empty;
94 return CreateAgent(destination, aCircuit, flags, out tmp, out reason); 104 return CreateAgent(source, destination, aCircuit, flags, out tmp, out reason);
95 } 105 }
96 106
97 public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string myipaddress, out string reason) 107 public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, out string myipaddress, out string reason)
98 { 108 {
99 m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Creating agent at {0}", destination.ServerURI); 109 m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Creating agent at {0}", destination.ServerURI);
100 reason = String.Empty; 110 reason = String.Empty;
@@ -112,7 +122,7 @@ namespace OpenSim.Services.Connectors.Simulation
112 try 122 try
113 { 123 {
114 OSDMap args = aCircuit.PackAgentCircuitData(); 124 OSDMap args = aCircuit.PackAgentCircuitData();
115 PackData(args, aCircuit, destination, flags); 125 PackData(args, source, aCircuit, destination, flags);
116 126
117 OSDMap result = WebUtil.PostToServiceCompressed(uri, args, 30000); 127 OSDMap result = WebUtil.PostToServiceCompressed(uri, args, 30000);
118 bool success = result["success"].AsBoolean(); 128 bool success = result["success"].AsBoolean();
@@ -127,7 +137,7 @@ namespace OpenSim.Services.Connectors.Simulation
127 } 137 }
128 138
129 // Try the old version, uncompressed 139 // Try the old version, uncompressed
130 result = WebUtil.PostToService(uri, args, 30000); 140 result = WebUtil.PostToService(uri, args, 30000, false);
131 141
132 if (result["Success"].AsBoolean()) 142 if (result["Success"].AsBoolean())
133 { 143 {
@@ -273,9 +283,13 @@ namespace OpenSim.Services.Connectors.Simulation
273 } 283 }
274 284
275 285
286<<<<<<< HEAD
287 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string myversion, List<UUID> featuresAvailable, out string version, out string reason)
288=======
276 /// <summary> 289 /// <summary>
277 /// </summary> 290 /// </summary>
278 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string myversion, out string version, out string reason) 291 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string myversion, out string version, out string reason)
292>>>>>>> avn/ubitvar
279 { 293 {
280 reason = "Failed to contact destination"; 294 reason = "Failed to contact destination";
281 version = "Unknown"; 295 version = "Unknown";
@@ -292,12 +306,22 @@ namespace OpenSim.Services.Connectors.Simulation
292 request.Add("viaTeleport", OSD.FromBoolean(viaTeleport)); 306 request.Add("viaTeleport", OSD.FromBoolean(viaTeleport));
293 request.Add("position", OSD.FromString(position.ToString())); 307 request.Add("position", OSD.FromString(position.ToString()));
294 request.Add("my_version", OSD.FromString(myversion)); 308 request.Add("my_version", OSD.FromString(myversion));
309<<<<<<< HEAD
310
311 OSDArray features = new OSDArray();
312 foreach (UUID feature in featuresAvailable)
313 features.Add(OSD.FromString(feature.ToString()));
314
315 request.Add("features", features);
316
317=======
318>>>>>>> avn/ubitvar
295 if (agentHomeURI != null) 319 if (agentHomeURI != null)
296 request.Add("agent_home_uri", OSD.FromString(agentHomeURI)); 320 request.Add("agent_home_uri", OSD.FromString(agentHomeURI));
297 321
298 try 322 try
299 { 323 {
300 OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 30000, false); 324 OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 30000, false, false);
301 bool success = result["success"].AsBoolean(); 325 bool success = result["success"].AsBoolean();
302 if (result.ContainsKey("_Result")) 326 if (result.ContainsKey("_Result"))
303 { 327 {
@@ -342,9 +366,22 @@ namespace OpenSim.Services.Connectors.Simulation
342 return false; 366 return false;
343 } 367 }
344 368
369<<<<<<< HEAD
370
371 featuresAvailable.Clear();
372
373 if (result.ContainsKey("features"))
374 {
375 OSDArray array = (OSDArray)result["features"];
376
377 foreach (OSD o in array)
378 featuresAvailable.Add(new UUID(o.AsString()));
379 }
380=======
345 OSDMap resp = (OSDMap)result["_Result"]; 381 OSDMap resp = (OSDMap)result["_Result"];
346 success = resp["success"].AsBoolean(); 382 success = resp["success"].AsBoolean();
347 reason = resp["reason"].AsString(); 383 reason = resp["reason"].AsString();
384>>>>>>> avn/ubitvar
348 385
349 return success; 386 return success;
350 } 387 }
@@ -364,7 +401,7 @@ namespace OpenSim.Services.Connectors.Simulation
364 401
365 try 402 try
366 { 403 {
367 WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false); 404 WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false, false);
368 } 405 }
369 catch (Exception e) 406 catch (Exception e)
370 { 407 {
@@ -383,7 +420,7 @@ namespace OpenSim.Services.Connectors.Simulation
383 420
384 try 421 try
385 { 422 {
386 WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false); 423 WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false, false);
387 } 424 }
388 catch (Exception e) 425 catch (Exception e)
389 { 426 {
@@ -430,8 +467,17 @@ namespace OpenSim.Services.Connectors.Simulation
430 args["destination_name"] = OSD.FromString(destination.RegionName); 467 args["destination_name"] = OSD.FromString(destination.RegionName);
431 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); 468 args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString());
432 469
470<<<<<<< HEAD
471 OSDMap result = WebUtil.PostToService(uri, args, 40000, false);
472
473 if (result == null)
474 return false;
475 bool success = result["success"].AsBoolean();
476 if (!success)
477=======
433 OSDMap response = WebUtil.PostToService(uri, args, 40000); 478 OSDMap response = WebUtil.PostToService(uri, args, 40000);
434 if (response["Success"] == "False") 479 if (response["Success"] == "False")
480>>>>>>> avn/ubitvar
435 return false; 481 return false;
436 } 482 }
437 catch (Exception e) 483 catch (Exception e)
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs
index 6b2d710..e5fb5a8 100644
--- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs
+++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs
@@ -33,13 +33,14 @@ using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Framework.ServiceAuth;
36using OpenSim.Server.Base; 37using OpenSim.Server.Base;
37using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
38using OpenMetaverse; 39using OpenMetaverse;
39 40
40namespace OpenSim.Services.Connectors 41namespace OpenSim.Services.Connectors
41{ 42{
42 public class UserAccountServicesConnector : IUserAccountService 43 public class UserAccountServicesConnector : BaseServiceConnector, IUserAccountService
43 { 44 {
44 private static readonly ILog m_log = 45 private static readonly ILog m_log =
45 LogManager.GetLogger( 46 LogManager.GetLogger(
@@ -79,6 +80,8 @@ namespace OpenSim.Services.Connectors
79 throw new Exception("User account connector init error"); 80 throw new Exception("User account connector init error");
80 } 81 }
81 m_ServerURI = serviceURI; 82 m_ServerURI = serviceURI;
83
84 base.Initialise(source, "UserAccountService");
82 } 85 }
83 86
84 public virtual UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) 87 public virtual UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName)
@@ -144,7 +147,8 @@ namespace OpenSim.Services.Connectors
144 { 147 {
145 reply = SynchronousRestFormsRequester.MakeRequest("POST", 148 reply = SynchronousRestFormsRequester.MakeRequest("POST",
146 uri, 149 uri,
147 reqString); 150 reqString,
151 m_Auth);
148 if (reply == null || (reply != null && reply == string.Empty)) 152 if (reply == null || (reply != null && reply == string.Empty))
149 { 153 {
150 m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccounts received null or empty reply"); 154 m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccounts received null or empty reply");
@@ -187,9 +191,14 @@ namespace OpenSim.Services.Connectors
187 return accounts; 191 return accounts;
188 } 192 }
189 193
194<<<<<<< HEAD
195 public void InvalidateCache(UUID userID)
196 {
197=======
190 public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where) 198 public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where)
191 { 199 {
192 return null; // Not implemented for regions 200 return null; // Not implemented for regions
201>>>>>>> avn/ubitvar
193 } 202 }
194 203
195 public virtual bool StoreUserAccount(UserAccount data) 204 public virtual bool StoreUserAccount(UserAccount data)
@@ -212,9 +221,39 @@ namespace OpenSim.Services.Connectors
212 sendData[kvp.Key] = kvp.Value.ToString(); 221 sendData[kvp.Key] = kvp.Value.ToString();
213 } 222 }
214 223
215 return SendAndGetBoolReply(sendData); 224 if (SendAndGetReply(sendData) != null)
225 return true;
226 else
227 return false;
216 } 228 }
217 229
230 /// <summary>
231 /// Create user remotely. Note this this is not part of the IUserAccountsService
232 /// </summary>
233 /// <param name="first"></param>
234 /// <param name="last"></param>
235 /// <param name="password"></param>
236 /// <param name="email"></param>
237 /// <param name="scopeID"></param>
238 /// <returns></returns>
239 public virtual UserAccount CreateUser(string first, string last, string password, string email, UUID scopeID)
240 {
241 Dictionary<string, object> sendData = new Dictionary<string, object>();
242 //sendData["SCOPEID"] = scopeID.ToString();
243 sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString();
244 sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString();
245 sendData["METHOD"] = "createuser";
246
247 sendData["FirstName"] = first;
248 sendData["LastName"] = last;
249 sendData["Password"] = password;
250 if (!string.IsNullOrEmpty(email))
251 sendData["Email"] = first;
252 sendData["ScopeID"] = scopeID.ToString();
253
254 return SendAndGetReply(sendData);
255 }
256
218 private UserAccount SendAndGetReply(Dictionary<string, object> sendData) 257 private UserAccount SendAndGetReply(Dictionary<string, object> sendData)
219 { 258 {
220 string reply = string.Empty; 259 string reply = string.Empty;
@@ -225,7 +264,8 @@ namespace OpenSim.Services.Connectors
225 { 264 {
226 reply = SynchronousRestFormsRequester.MakeRequest("POST", 265 reply = SynchronousRestFormsRequester.MakeRequest("POST",
227 uri, 266 uri,
228 reqString); 267 reqString,
268 m_Auth);
229 if (reply == null || (reply != null && reply == string.Empty)) 269 if (reply == null || (reply != null && reply == string.Empty))
230 { 270 {
231 m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccount received null or empty reply"); 271 m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetUserAccount received null or empty reply");
@@ -256,14 +296,16 @@ namespace OpenSim.Services.Connectors
256 { 296 {
257 string reqString = ServerUtils.BuildQueryString(sendData); 297 string reqString = ServerUtils.BuildQueryString(sendData);
258 string uri = m_ServerURI + "/accounts"; 298 string uri = m_ServerURI + "/accounts";
259 // m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString); 299 //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString);
260 try 300 try
261 { 301 {
262 string reply = SynchronousRestFormsRequester.MakeRequest("POST", 302 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
263 uri, 303 uri,
264 reqString); 304 reqString,
305 m_Auth);
265 if (reply != string.Empty) 306 if (reply != string.Empty)
266 { 307 {
308 //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: reply = {0}", reply);
267 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); 309 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
268 310
269 if (replyData.ContainsKey("result")) 311 if (replyData.ContainsKey("result"))
diff --git a/OpenSim/Services/Connectors/Simulation/EstateDataService.cs b/OpenSim/Services/EstateService/EstateDataService.cs
index cdcdecf..f6a8654 100644
--- a/OpenSim/Services/Connectors/Simulation/EstateDataService.cs
+++ b/OpenSim/Services/EstateService/EstateDataService.cs
@@ -29,17 +29,14 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenMetaverse; 30using OpenMetaverse;
31using log4net; 31using log4net;
32using Mono.Addins;
33using Nini.Config; 32using Nini.Config;
34using System.Reflection; 33using System.Reflection;
35using OpenSim.Services.Base; 34using OpenSim.Services.Base;
36using OpenSim.Services.Interfaces; 35using OpenSim.Services.Interfaces;
37using OpenSim.Data; 36using OpenSim.Data;
38using OpenSim.Framework; 37using OpenSim.Framework;
39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes;
41 38
42namespace OpenSim.Services.Connectors 39namespace OpenSim.Services.EstateService
43{ 40{
44 public class EstateDataService : ServiceBase, IEstateDataService 41 public class EstateDataService : ServiceBase, IEstateDataService
45 { 42 {
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs b/OpenSim/Services/SimulationService/SimulationDataService.cs
index 4759838..7a544fa 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs
+++ b/OpenSim/Services/SimulationService/SimulationDataService.cs
@@ -29,7 +29,6 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenMetaverse; 30using OpenMetaverse;
31using log4net; 31using log4net;
32using Mono.Addins;
33using Nini.Config; 32using Nini.Config;
34using System.Reflection; 33using System.Reflection;
35using OpenSim.Services.Base; 34using OpenSim.Services.Base;
@@ -39,7 +38,7 @@ using OpenSim.Framework;
39using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
41 40
42namespace OpenSim.Services.Connectors 41namespace OpenSim.Services.SimulationService
43{ 42{
44 public class SimulationDataService : ServiceBase, ISimulationDataService 43 public class SimulationDataService : ServiceBase, ISimulationDataService
45 { 44 {