aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
authorMelanie2010-09-13 16:16:40 +0100
committerMelanie2010-09-13 16:17:38 +0100
commit6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e (patch)
tree1e7bf4fddcf559886c6b2babf13cf4b2ca8829a1 /OpenSim/Services
parentMerge branch 'careminster-presence-refactor' of ssh://melanie@3dhosting.de/va... (diff)
parentFix unit test SceneSetupHelpers to load the mock simulation data store (diff)
downloadopensim-SC_OLD-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.zip
opensim-SC_OLD-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.tar.gz
opensim-SC_OLD-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.tar.bz2
opensim-SC_OLD-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.tar.xz
Merge branch 'master' into careminster-presence-refactor
The modules will need to be updated for this to compile and run again. Please don't use until I do the companion commit to modules later on.
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs23
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs75
-rw-r--r--OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs13
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs35
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs3
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs3
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs6
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs55
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs4
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs21
-rw-r--r--OpenSim/Services/Connectors/Simulation/EstateDataService.cs112
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationDataService.cs140
-rw-r--r--OpenSim/Services/InventoryService/InventoryService.cs4
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs2
-rw-r--r--OpenSim/Services/UserAccountService/UserAccountService.cs24
17 files changed, 426 insertions, 98 deletions
diff --git a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
index 34df54a..5c31639 100644
--- a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
@@ -32,6 +32,8 @@ using System.Collections.Generic;
32using System.Reflection; 32using System.Reflection;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Services.Interfaces; 34using OpenSim.Services.Interfaces;
35using OpenSim.Services.Connectors.Hypergrid;
36using OpenSim.Services.Connectors.SimianGrid;
35 37
36namespace OpenSim.Services.Connectors 38namespace OpenSim.Services.Connectors
37{ 39{
@@ -41,7 +43,7 @@ namespace OpenSim.Services.Connectors
41 LogManager.GetLogger( 43 LogManager.GetLogger(
42 MethodBase.GetCurrentMethod().DeclaringType); 44 MethodBase.GetCurrentMethod().DeclaringType);
43 45
44 private Dictionary<string, AssetServicesConnector> m_connectors = new Dictionary<string, AssetServicesConnector>(); 46 private Dictionary<string, IAssetService> m_connectors = new Dictionary<string, IAssetService>();
45 47
46 public HGAssetServiceConnector(IConfigSource source) 48 public HGAssetServiceConnector(IConfigSource source)
47 { 49 {
@@ -81,7 +83,7 @@ namespace OpenSim.Services.Connectors
81 83
82 private IAssetService GetConnector(string url) 84 private IAssetService GetConnector(string url)
83 { 85 {
84 AssetServicesConnector connector = null; 86 IAssetService connector = null;
85 lock (m_connectors) 87 lock (m_connectors)
86 { 88 {
87 if (m_connectors.ContainsKey(url)) 89 if (m_connectors.ContainsKey(url))
@@ -90,12 +92,17 @@ namespace OpenSim.Services.Connectors
90 } 92 }
91 else 93 else
92 { 94 {
93 // We're instantiating this class explicitly, but this won't 95 // Still not as flexible as I would like this to be,
94 // work in general, because the remote grid may be running 96 // but good enough for now
95 // an asset server that has a different protocol. 97 string connectorType = new HeloServicesConnector(url).Helo();
96 // Eventually we will want a piece of protocol asking 98 m_log.DebugFormat("[HG ASSET SERVICE]: HELO returned {0}", connectorType);
97 // the remote server about its kind. Definitely cool thing to do! 99 if (connectorType == "opensim-simian")
98 connector = new AssetServicesConnector(url); 100 {
101 connector = new SimianAssetServiceConnector(url);
102 }
103 else
104 connector = new AssetServicesConnector(url);
105
99 m_connectors.Add(url, connector); 106 m_connectors.Add(url, connector);
100 } 107 }
101 } 108 }
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
index f5b5982..479a80e 100644
--- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
@@ -86,7 +86,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
86 paramList.Add(hash); 86 paramList.Add(hash);
87 87
88 XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); 88 XmlRpcRequest request = new XmlRpcRequest("link_region", paramList);
89 string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/" ); 89 string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/");
90 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri); 90 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri);
91 XmlRpcResponse response = null; 91 XmlRpcResponse response = null;
92 try 92 try
diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
new file mode 100644
index 0000000..7b166c1
--- /dev/null
+++ b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
@@ -0,0 +1,75 @@
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.Net;
31using System.Reflection;
32using Nini.Config;
33
34namespace OpenSim.Services.Connectors
35{
36 public class HeloServicesConnector
37 {
38 private static readonly ILog m_log =
39 LogManager.GetLogger(
40 MethodBase.GetCurrentMethod().DeclaringType);
41
42 private string m_ServerURI = String.Empty;
43
44 public HeloServicesConnector()
45 {
46 }
47
48 public HeloServicesConnector(string serverURI)
49 {
50 m_ServerURI = serverURI.TrimEnd('/');
51 }
52
53
54 public virtual string Helo()
55 {
56 HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI + "/helo");
57
58 try
59 {
60 WebResponse response = req.GetResponse();
61 if (response.Headers.Get("X-Handlers-Provided") == null) // just in case this ever returns a null
62 return string.Empty;
63 return response.Headers.Get("X-Handlers-Provided");
64 }
65 catch (Exception e)
66 {
67 m_log.DebugFormat("[HELO SERVICE]: Unable to perform HELO request to {0}: {1}", m_ServerURI, e.Message);
68 }
69
70 // fail
71 return string.Empty;
72 }
73
74 }
75}
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
index e25e7eb..403ee15 100644
--- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
@@ -526,7 +526,7 @@ namespace OpenSim.Services.Connectors
526 InventoryFolderBase folder = new InventoryFolderBase(); 526 InventoryFolderBase folder = new InventoryFolderBase();
527 527
528 try 528 try
529 { 529 {
530 folder.ParentID = new UUID(data["ParentID"].ToString()); 530 folder.ParentID = new UUID(data["ParentID"].ToString());
531 folder.Type = short.Parse(data["Type"].ToString()); 531 folder.Type = short.Parse(data["Type"].ToString());
532 folder.Version = ushort.Parse(data["Version"].ToString()); 532 folder.Version = ushort.Parse(data["Version"].ToString());
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs
index a871d07..67a06f3 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs
@@ -26,11 +26,9 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
30using System.Reflection; 29using System.Reflection;
31using OpenSim.Framework; 30using OpenSim.Framework;
32using OpenSim.Region.Framework.Scenes; 31using OpenSim.Region.Framework.Scenes;
33using OpenSim.Services.Interfaces;
34using OpenMetaverse; 32using OpenMetaverse;
35using log4net; 33using log4net;
36 34
@@ -71,7 +69,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
71 public void OnMakeRootAgent(ScenePresence sp) 69 public void OnMakeRootAgent(ScenePresence sp)
72 { 70 {
73 m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName); 71 m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName);
74 m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); 72 Util.FireAndForget(delegate(object o)
73 {
74 m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
75 });
75 } 76 }
76 77
77 public void OnNewClient(IClientAPI client) 78 public void OnNewClient(IClientAPI client)
@@ -107,7 +108,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
107 108
108 void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID) 109 void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID)
109 { 110 {
110 m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); 111 // Asynchronously update the position stored in the session table for this agent
112 Util.FireAndForget(delegate(object o)
113 {
114 m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
115 });
111 } 116 }
112 } 117 }
113} 118}
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
index 6d5b30e..30d3147 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
@@ -84,6 +84,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
84 CommonInit(source); 84 CommonInit(source);
85 } 85 }
86 86
87 public SimianAssetServiceConnector(string url)
88 {
89 m_serverUrl = url;
90 }
91
87 public void Initialise(IConfigSource source) 92 public void Initialise(IConfigSource source)
88 { 93 {
89 IConfig moduleConfig = source.Configs["Modules"]; 94 IConfig moduleConfig = source.Configs["Modules"];
@@ -119,6 +124,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
119 124
120 public AssetBase Get(string id) 125 public AssetBase Get(string id)
121 { 126 {
127 if (String.IsNullOrEmpty(m_serverUrl))
128 {
129 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
130 throw new InvalidOperationException();
131 }
132
122 // Cache fetch 133 // Cache fetch
123 if (m_cache != null) 134 if (m_cache != null)
124 { 135 {
@@ -145,6 +156,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
145 /// <returns></returns> 156 /// <returns></returns>
146 public AssetMetadata GetMetadata(string id) 157 public AssetMetadata GetMetadata(string id)
147 { 158 {
159 if (String.IsNullOrEmpty(m_serverUrl))
160 {
161 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
162 throw new InvalidOperationException();
163 }
164
148 AssetMetadata metadata = null; 165 AssetMetadata metadata = null;
149 166
150 // Cache fetch 167 // Cache fetch
@@ -216,6 +233,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
216 /// <returns>True if the id was parseable, false otherwise</returns> 233 /// <returns>True if the id was parseable, false otherwise</returns>
217 public bool Get(string id, Object sender, AssetRetrieved handler) 234 public bool Get(string id, Object sender, AssetRetrieved handler)
218 { 235 {
236 if (String.IsNullOrEmpty(m_serverUrl))
237 {
238 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
239 throw new InvalidOperationException();
240 }
241
219 // Cache fetch 242 // Cache fetch
220 if (m_cache != null) 243 if (m_cache != null)
221 { 244 {
@@ -246,6 +269,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
246 /// <returns></returns> 269 /// <returns></returns>
247 public string Store(AssetBase asset) 270 public string Store(AssetBase asset)
248 { 271 {
272 if (String.IsNullOrEmpty(m_serverUrl))
273 {
274 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
275 throw new InvalidOperationException();
276 }
277
249 bool storedInCache = false; 278 bool storedInCache = false;
250 string errorMessage = null; 279 string errorMessage = null;
251 280
@@ -378,6 +407,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
378 /// <returns></returns> 407 /// <returns></returns>
379 public bool Delete(string id) 408 public bool Delete(string id)
380 { 409 {
410 if (String.IsNullOrEmpty(m_serverUrl))
411 {
412 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
413 throw new InvalidOperationException();
414 }
415
381 //string errorMessage = String.Empty; 416 //string errorMessage = String.Empty;
382 string url = m_serverUrl + id; 417 string url = m_serverUrl + id;
383 418
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
index 3505c64..4d0d53e 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
@@ -28,8 +28,6 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Collections.Specialized; 30using System.Collections.Specialized;
31using System.IO;
32using System.Net;
33using System.Reflection; 31using System.Reflection;
34using log4net; 32using log4net;
35using Mono.Addins; 33using Mono.Addins;
@@ -37,7 +35,6 @@ using Nini.Config;
37using OpenSim.Framework; 35using OpenSim.Framework;
38using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
40using OpenSim.Server.Base;
41using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
42using OpenMetaverse; 39using OpenMetaverse;
43using OpenMetaverse.StructuredData; 40using OpenMetaverse.StructuredData;
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
index 5b18aef..6f2d735 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
@@ -30,13 +30,10 @@ using System.Collections.Generic;
30using System.Collections.Specialized; 30using System.Collections.Specialized;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Mono.Addins;
34using Nini.Config; 33using Nini.Config;
35using OpenMetaverse; 34using OpenMetaverse;
36using OpenMetaverse.StructuredData; 35using OpenMetaverse.StructuredData;
37using OpenSim.Framework; 36using OpenSim.Framework;
38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
41 38
42using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; 39using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
index 470eccd..21ad4ab 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
@@ -37,7 +37,6 @@ using OpenMetaverse.StructuredData;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Server.Base;
41using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
42 41
43namespace OpenSim.Services.Connectors.SimianGrid 42namespace OpenSim.Services.Connectors.SimianGrid
@@ -91,6 +90,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
91 CommonInit(source); 90 CommonInit(source);
92 } 91 }
93 92
93 public SimianInventoryServiceConnector(string url)
94 {
95 m_serverUrl = url;
96 }
97
94 public void Initialise(IConfigSource source) 98 public void Initialise(IConfigSource source)
95 { 99 {
96 IConfig moduleConfig = source.Configs["Modules"]; 100 IConfig moduleConfig = source.Configs["Modules"];
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
index 077be3c..a344594 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
@@ -28,17 +28,14 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Collections.Specialized; 30using System.Collections.Specialized;
31using System.Net;
32using System.Reflection; 31using System.Reflection;
33using log4net; 32using log4net;
34using Mono.Addins; 33using Mono.Addins;
35using Nini.Config; 34using Nini.Config;
36using OpenSim.Framework; 35using OpenSim.Framework;
37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
41using OpenSim.Server.Base;
42using OpenMetaverse; 39using OpenMetaverse;
43using OpenMetaverse.StructuredData; 40using OpenMetaverse.StructuredData;
44 41
@@ -358,25 +355,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
358 return null; 355 return null;
359 } 356 }
360 357
361// private OSDMap GetSessionData(UUID sessionID)
362// {
363// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for session " + sessionID);
364//
365// NameValueCollection requestArgs = new NameValueCollection
366// {
367// { "RequestMethod", "GetSession" },
368// { "SessionID", sessionID.ToString() }
369// };
370//
371// OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
372// if (response["Success"].AsBoolean())
373// return response;
374// else
375// m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session data for session " + sessionID);
376//
377// return null;
378// }
379
380 private List<PresenceInfo> GetSessions(UUID userID) 358 private List<PresenceInfo> GetSessions(UUID userID)
381 { 359 {
382 List<PresenceInfo> presences = new List<PresenceInfo>(1); 360 List<PresenceInfo> presences = new List<PresenceInfo>(1);
@@ -429,39 +407,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
429 return success; 407 return success;
430 } 408 }
431 409
432 ///// <summary>
433 ///// Fetch the last known avatar location with GetSession and persist it
434 ///// as user data with AddUserData
435 ///// </summary>
436 //private bool SetLastLocation(UUID sessionID)
437 //{
438 // NameValueCollection requestArgs = new NameValueCollection
439 // {
440 // { "RequestMethod", "GetSession" },
441 // { "SessionID", sessionID.ToString() }
442 // };
443
444 // OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
445 // bool success = response["Success"].AsBoolean();
446
447 // if (success)
448 // {
449 // UUID userID = response["UserID"].AsUUID();
450 // UUID sceneID = response["SceneID"].AsUUID();
451 // Vector3 position = response["ScenePosition"].AsVector3();
452 // Vector3 lookAt = response["SceneLookAt"].AsVector3();
453
454 // return SetLastLocation(userID, sceneID, position, lookAt);
455 // }
456 // else
457 // {
458 // m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve presence information for session " + sessionID +
459 // " while saving last location: " + response["Message"].AsString());
460 // }
461
462 // return success;
463 //}
464
465 private PresenceInfo ResponseToPresenceInfo(OSDMap sessionResponse, OSDMap userResponse) 410 private PresenceInfo ResponseToPresenceInfo(OSDMap sessionResponse, OSDMap userResponse)
466 { 411 {
467 if (sessionResponse == null) 412 if (sessionResponse == null)
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
index 0ef4974..b7e8538 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
@@ -291,8 +291,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
291 // Check if the user is online 291 // Check if the user is online
292 if (client.Scene is Scene) 292 if (client.Scene is Scene)
293 { 293 {
294 OpenSim.Services.Interfaces.PresenceInfo[] presences = ((Scene)client.Scene).PresenceService.GetAgents(new string[] { avatarID.ToString() }); 294 OpenSim.Services.Interfaces.PresenceInfo presence = ((Scene)client.Scene).PresenceService.GetAgent(avatarID);
295 if (presences != null && presences.Length > 0) 295 if (presence != null)
296 flags |= ProfileFlags.Online; 296 flags |= ProfileFlags.Online;
297 } 297 }
298 298
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index 694aa72..ddd2322 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -28,7 +28,6 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Collections.Specialized; 30using System.Collections.Specialized;
31using System.IO;
32using System.Reflection; 31using System.Reflection;
33using OpenSim.Framework; 32using OpenSim.Framework;
34using OpenSim.Region.Framework.Interfaces; 33using OpenSim.Region.Framework.Interfaces;
@@ -49,13 +48,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 48 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
50 public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule 49 public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule
51 { 50 {
51 private const double CACHE_EXPIRATION_SECONDS = 120.0;
52
52 private static readonly ILog m_log = 53 private static readonly ILog m_log =
53 LogManager.GetLogger( 54 LogManager.GetLogger(
54 MethodBase.GetCurrentMethod().DeclaringType); 55 MethodBase.GetCurrentMethod().DeclaringType);
55 56
56 private string m_serverUrl = String.Empty; 57 private string m_serverUrl = String.Empty;
57 private ExpiringCache<UUID, UserAccount> m_accountCache; 58 private ExpiringCache<UUID, UserAccount> m_accountCache = new ExpiringCache<UUID,UserAccount>();
58 private bool m_Enabled = false; 59 private bool m_Enabled;
59 60
60 #region ISharedRegionModule 61 #region ISharedRegionModule
61 62
@@ -141,7 +142,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
141 { "UserID", userID.ToString() } 142 { "UserID", userID.ToString() }
142 }; 143 };
143 144
144 return GetUser(requestArgs); 145 account = GetUser(requestArgs);
146
147 if (account == null)
148 {
149 // Store null responses too, to avoid repeated lookups for missing accounts
150 m_accountCache.AddOrUpdate(userID, null, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
151 }
152
153 return account;
145 } 154 }
146 155
147 public List<UserAccount> GetUserAccounts(UUID scopeID, string query) 156 public List<UserAccount> GetUserAccounts(UUID scopeID, string query)
@@ -216,7 +225,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
216 if (success) 225 if (success)
217 { 226 {
218 // Cache the user account info 227 // Cache the user account info
219 m_accountCache.AddOrUpdate(data.PrincipalID, data, DateTime.Now + TimeSpan.FromMinutes(2.0d)); 228 m_accountCache.AddOrUpdate(data.PrincipalID, data, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
220 } 229 }
221 else 230 else
222 { 231 {
@@ -281,7 +290,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
281 GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName); 290 GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName);
282 291
283 // Cache the user account info 292 // Cache the user account info
284 m_accountCache.AddOrUpdate(account.PrincipalID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d)); 293 m_accountCache.AddOrUpdate(account.PrincipalID, account, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
285 294
286 return account; 295 return account;
287 } 296 }
diff --git a/OpenSim/Services/Connectors/Simulation/EstateDataService.cs b/OpenSim/Services/Connectors/Simulation/EstateDataService.cs
new file mode 100644
index 0000000..87c49d3
--- /dev/null
+++ b/OpenSim/Services/Connectors/Simulation/EstateDataService.cs
@@ -0,0 +1,112 @@
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 System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using log4net;
32using Mono.Addins;
33using Nini.Config;
34using System.Reflection;
35using OpenSim.Services.Base;
36using OpenSim.Services.Interfaces;
37using OpenSim.Data;
38using OpenSim.Framework;
39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes;
41
42namespace OpenSim.Services.Connectors
43{
44 public class EstateDataService : ServiceBase, IEstateDataService
45 {
46 private static readonly ILog m_log =
47 LogManager.GetLogger(
48 MethodBase.GetCurrentMethod().DeclaringType);
49
50 protected IEstateDataStore m_database;
51
52 public EstateDataService(IConfigSource config)
53 : base(config)
54 {
55 string dllName = String.Empty;
56 string connString = String.Empty;
57
58 // Try reading the [DatabaseService] section, if it exists
59 IConfig dbConfig = config.Configs["DatabaseService"];
60 if (dbConfig != null)
61 {
62 dllName = dbConfig.GetString("StorageProvider", String.Empty);
63 connString = dbConfig.GetString("EstateConnectionString", String.Empty);
64 if (String.IsNullOrEmpty(connString))
65 connString = dbConfig.GetString("ConnectionString", String.Empty);
66 }
67
68 // We tried, but this doesn't exist. We can't proceed
69 if (dllName == String.Empty)
70 throw new Exception("No StorageProvider configured");
71
72 m_database = LoadPlugin<IEstateDataStore>(dllName, new Object[] { connString });
73 if (m_database == null)
74 throw new Exception("Could not find a storage interface in the given module");
75 }
76
77 public EstateSettings LoadEstateSettings(UUID regionID, bool create)
78 {
79 return m_database.LoadEstateSettings(regionID, create);
80 }
81
82 public EstateSettings LoadEstateSettings(int estateID)
83 {
84 return m_database.LoadEstateSettings(estateID);
85 }
86
87 public void StoreEstateSettings(EstateSettings es)
88 {
89 m_database.StoreEstateSettings(es);
90 }
91
92 public List<int> GetEstates(string search)
93 {
94 return m_database.GetEstates(search);
95 }
96
97 public bool LinkRegion(UUID regionID, int estateID)
98 {
99 return m_database.LinkRegion(regionID, estateID);
100 }
101
102 public List<UUID> GetRegions(int estateID)
103 {
104 return m_database.GetRegions(estateID);
105 }
106
107 public bool DeleteEstate(int estateID)
108 {
109 return m_database.DeleteEstate(estateID);
110 }
111 }
112}
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs
new file mode 100644
index 0000000..946f7e4
--- /dev/null
+++ b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs
@@ -0,0 +1,140 @@
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 System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using log4net;
32using Mono.Addins;
33using Nini.Config;
34using System.Reflection;
35using OpenSim.Services.Base;
36using OpenSim.Services.Interfaces;
37using OpenSim.Data;
38using OpenSim.Framework;
39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes;
41
42namespace OpenSim.Services.Connectors
43{
44 public class SimulationDataService : ServiceBase, ISimulationDataService
45 {
46 private static readonly ILog m_log =
47 LogManager.GetLogger(
48 MethodBase.GetCurrentMethod().DeclaringType);
49
50 protected ISimulationDataStore m_database;
51
52 public SimulationDataService(IConfigSource config)
53 : base(config)
54 {
55 string dllName = String.Empty;
56 string connString = String.Empty;
57
58 // Try reading the [DatabaseService] section, if it exists
59 IConfig dbConfig = config.Configs["DatabaseService"];
60 if (dbConfig != null)
61 {
62 dllName = dbConfig.GetString("StorageProvider", String.Empty);
63 connString = dbConfig.GetString("ConnectionString", String.Empty);
64 }
65
66 // We tried, but this doesn't exist. We can't proceed
67 if (dllName == String.Empty)
68 throw new Exception("No StorageProvider configured");
69
70 m_database = LoadPlugin<ISimulationDataStore>(dllName, new Object[] { connString });
71 if (m_database == null)
72 throw new Exception("Could not find a storage interface in the given module");
73 }
74
75 public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
76 {
77 m_database.StoreObject(obj, regionUUID);
78 }
79
80 public void RemoveObject(UUID uuid, UUID regionUUID)
81 {
82 m_database.RemoveObject(uuid, regionUUID);
83 }
84
85 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
86 {
87 m_database.StorePrimInventory(primID, items);
88 }
89
90 public List<SceneObjectGroup> LoadObjects(UUID regionUUID)
91 {
92 return m_database.LoadObjects(regionUUID);
93 }
94
95 public void StoreTerrain(double[,] terrain, UUID regionID)
96 {
97 m_database.StoreTerrain(terrain, regionID);
98 }
99
100 public double[,] LoadTerrain(UUID regionID)
101 {
102 return m_database.LoadTerrain(regionID);
103 }
104
105 public void StoreLandObject(ILandObject Parcel)
106 {
107 m_database.StoreLandObject(Parcel);
108 }
109
110 public void RemoveLandObject(UUID globalID)
111 {
112 m_database.RemoveLandObject(globalID);
113 }
114
115 public List<LandData> LoadLandObjects(UUID regionUUID)
116 {
117 return m_database.LoadLandObjects(regionUUID);
118 }
119
120 public void StoreRegionSettings(RegionSettings rs)
121 {
122 m_database.StoreRegionSettings(rs);
123 }
124
125 public RegionSettings LoadRegionSettings(UUID regionUUID)
126 {
127 return m_database.LoadRegionSettings(regionUUID);
128 }
129
130 public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
131 {
132 return m_database.LoadRegionWindlightSettings(regionUUID);
133 }
134
135 public void StoreRegionWindlightSettings(RegionLightShareData wl)
136 {
137 m_database.StoreRegionWindlightSettings(wl);
138 }
139 }
140}
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs
index 86bca79..e543337 100644
--- a/OpenSim/Services/InventoryService/InventoryService.cs
+++ b/OpenSim/Services/InventoryService/InventoryService.cs
@@ -276,11 +276,11 @@ namespace OpenSim.Services.InventoryService
276 List<InventoryFolderBase> folders = RequestSubFolders(root.ID); 276 List<InventoryFolderBase> folders = RequestSubFolders(root.ID);
277 277
278 foreach (InventoryFolderBase folder in folders) 278 foreach (InventoryFolderBase folder in folders)
279 { 279 {
280 if (folder.Type == (short)type) 280 if (folder.Type == (short)type)
281 { 281 {
282// m_log.DebugFormat( 282// m_log.DebugFormat(
283// "[INVENTORY SERVICE]: Found folder {0} type {1}", folder.Name, (AssetType)folder.Type); 283// "[INVENTORY SERVICE]: Found folder {0} type {1}", folder.Name, (AssetType)folder.Type);
284 284
285 return folder; 285 return folder;
286 } 286 }
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 5ccb912..1e4b6c2 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -314,7 +314,7 @@ namespace OpenSim.Services.LLLoginService
314 { 314 {
315 // something went wrong, make something up, so that we don't have to test this anywhere else 315 // something went wrong, make something up, so that we don't have to test this anywhere else
316 guinfo = new GridUserInfo(); 316 guinfo = new GridUserInfo();
317 guinfo.LastPosition = guinfo.HomePosition = new Vector3(128, 128, 30); 317 guinfo.LastPosition = guinfo.HomePosition = new Vector3(128, 128, 30);
318 } 318 }
319 319
320 // 320 //
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index 326e502..f376cf8 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -97,10 +97,10 @@ namespace OpenSim.Services.UserAccountService
97 public UserAccount GetUserAccount(UUID scopeID, string firstName, 97 public UserAccount GetUserAccount(UUID scopeID, string firstName,
98 string lastName) 98 string lastName)
99 { 99 {
100// m_log.DebugFormat( 100// m_log.DebugFormat(
101// "[USER ACCOUNT SERVICE]: Retrieving account by username for {0} {1}, scope {2}", 101// "[USER ACCOUNT SERVICE]: Retrieving account by username for {0} {1}, scope {2}",
102// firstName, lastName, scopeID); 102// firstName, lastName, scopeID);
103 103
104 UserAccountData[] d; 104 UserAccountData[] d;
105 105
106 if (scopeID != UUID.Zero) 106 if (scopeID != UUID.Zero)
@@ -235,10 +235,10 @@ namespace OpenSim.Services.UserAccountService
235 235
236 public bool StoreUserAccount(UserAccount data) 236 public bool StoreUserAccount(UserAccount data)
237 { 237 {
238// m_log.DebugFormat( 238// m_log.DebugFormat(
239// "[USER ACCOUNT SERVICE]: Storing user account for {0} {1} {2}, scope {3}", 239// "[USER ACCOUNT SERVICE]: Storing user account for {0} {1} {2}, scope {3}",
240// data.FirstName, data.LastName, data.PrincipalID, data.ScopeID); 240// data.FirstName, data.LastName, data.PrincipalID, data.ScopeID);
241 241
242 UserAccountData d = new UserAccountData(); 242 UserAccountData d = new UserAccountData();
243 243
244 d.FirstName = data.FirstName; 244 d.FirstName = data.FirstName;
@@ -285,7 +285,7 @@ namespace OpenSim.Services.UserAccountService
285 #endregion 285 #endregion
286 286
287 #region Console commands 287 #region Console commands
288 288
289 /// <summary> 289 /// <summary>
290 /// Handle the create user command from the console. 290 /// Handle the create user command from the console.
291 /// </summary> 291 /// </summary>
@@ -297,12 +297,14 @@ namespace OpenSim.Services.UserAccountService
297 string password; 297 string password;
298 string email; 298 string email;
299 299
300 List<char> excluded = new List<char>(new char[]{' '});
301
300 if (cmdparams.Length < 3) 302 if (cmdparams.Length < 3)
301 firstName = MainConsole.Instance.CmdPrompt("First name", "Default"); 303 firstName = MainConsole.Instance.CmdPrompt("First name", "Default", excluded);
302 else firstName = cmdparams[2]; 304 else firstName = cmdparams[2];
303 305
304 if (cmdparams.Length < 4) 306 if (cmdparams.Length < 4)
305 lastName = MainConsole.Instance.CmdPrompt("Last name", "User"); 307 lastName = MainConsole.Instance.CmdPrompt("Last name", "User", excluded);
306 else lastName = cmdparams[3]; 308 else lastName = cmdparams[3];
307 309
308 if (cmdparams.Length < 5) 310 if (cmdparams.Length < 5)