aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/ServiceConnectorsOut
diff options
context:
space:
mode:
authorMelanie2009-08-15 19:00:56 +0100
committerMelanie2009-08-15 19:00:56 +0100
commit973be659459c577433b831c451ff07048aa078be (patch)
tree887f0586edbb936cca2fb8381699d921a2299492 /OpenSim/Region/CoreModules/ServiceConnectorsOut
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
parentChanged FromAssetID to FromItemID (diff)
downloadopensim-SC_OLD-973be659459c577433b831c451ff07048aa078be.zip
opensim-SC_OLD-973be659459c577433b831c451ff07048aa078be.tar.gz
opensim-SC_OLD-973be659459c577433b831c451ff07048aa078be.tar.bz2
opensim-SC_OLD-973be659459c577433b831c451ff07048aa078be.tar.xz
Merge branch 'master' of ../opensim-diva/ into inventory-connector
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs11
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs59
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs28
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs42
5 files changed, 101 insertions, 40 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
index 375faf5..ef5ffe1 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
@@ -82,7 +82,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
82 /// </summary> 82 /// </summary>
83 /// <param name="userID"></param> 83 /// <param name="userID"></param>
84 /// <returns>null if no root folder was found</returns> 84 /// <returns>null if no root folder was found</returns>
85 public abstract InventoryFolderBase GetRootFolder(UUID userID); 85 public InventoryFolderBase GetRootFolder(UUID userID)
86 {
87 // Root folder is here as system type Folder.
88 return m_cache.GetFolderForType(userID, AssetType.Folder);
89 }
86 90
87 public abstract Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID); 91 public abstract Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID);
88 92
@@ -184,9 +188,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
184 /// <returns>true if the item was successfully deleted</returns> 188 /// <returns>true if the item was successfully deleted</returns>
185 public abstract bool DeleteItem(InventoryItemBase item); 189 public abstract bool DeleteItem(InventoryItemBase item);
186 190
187 public abstract InventoryItemBase QueryItem(InventoryItemBase item); 191 public abstract InventoryItemBase GetItem(InventoryItemBase item);
188 192
189 public abstract InventoryFolderBase QueryFolder(InventoryFolderBase folder); 193 public abstract InventoryFolderBase GetFolder(InventoryFolderBase folder);
190 194
191 /// <summary> 195 /// <summary>
192 /// Does the given user have an inventory structure? 196 /// Does the given user have an inventory structure?
@@ -202,5 +206,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
202 /// <returns></returns> 206 /// <returns></returns>
203 public abstract List<InventoryItemBase> GetActiveGestures(UUID userId); 207 public abstract List<InventoryItemBase> GetActiveGestures(UUID userId);
204 208
209 public abstract int GetAssetPermissions(UUID userID, UUID assetID);
205 } 210 }
206} 211}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 62b9bed..59b2019 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -238,7 +238,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
238 public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) 238 public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID)
239 { 239 {
240 if (IsLocalGridUser(userID)) 240 if (IsLocalGridUser(userID))
241 return GetSystemFoldersLocal(userID); 241 {
242 // This is not pretty, but it will have to do for now
243 if (m_GridService is BaseInventoryConnector)
244 {
245 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetSystemsFolders redirected to RemoteInventoryServiceConnector module");
246 return ((BaseInventoryConnector)m_GridService).GetSystemFolders(userID);
247 }
248 else
249 {
250 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetSystemsFolders redirected to GetSystemFoldersLocal");
251 return GetSystemFoldersLocal(userID);
252 }
253 }
242 else 254 else
243 { 255 {
244 UUID sessionID = GetSessionID(userID); 256 UUID sessionID = GetSessionID(userID);
@@ -263,6 +275,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
263 folders[(AssetType)folder.Type] = folder; 275 folders[(AssetType)folder.Type] = folder;
264 } 276 }
265 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: System folders count for {0}: {1}", userID, folders.Count); 277 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: System folders count for {0}: {1}", userID, folders.Count);
278 // Put the root folder there, as type Folder
279 folders[AssetType.Folder] = root;
266 return folders; 280 return folders;
267 } 281 }
268 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Root folder content not found for {0}", userID); 282 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Root folder content not found for {0}", userID);
@@ -387,13 +401,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
387 } 401 }
388 } 402 }
389 403
390 public override InventoryItemBase QueryItem(InventoryItemBase item) 404 public override InventoryItemBase GetItem(InventoryItemBase item)
391 { 405 {
392 if (item == null) 406 if (item == null)
393 return null; 407 return null;
394 408 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetItem {0} for user {1}", item.ID, item.Owner);
395 if (IsLocalGridUser(item.Owner)) 409 if (IsLocalGridUser(item.Owner))
396 return m_GridService.QueryItem(item); 410 return m_GridService.GetItem(item);
397 else 411 else
398 { 412 {
399 UUID sessionID = GetSessionID(item.Owner); 413 UUID sessionID = GetSessionID(item.Owner);
@@ -402,13 +416,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
402 } 416 }
403 } 417 }
404 418
405 public override InventoryFolderBase QueryFolder(InventoryFolderBase folder) 419 public override InventoryFolderBase GetFolder(InventoryFolderBase folder)
406 { 420 {
407 if (folder == null) 421 if (folder == null)
408 return null; 422 return null;
409 423
410 if (IsLocalGridUser(folder.Owner)) 424 if (IsLocalGridUser(folder.Owner))
411 return m_GridService.QueryFolder(folder); 425 return m_GridService.GetFolder(folder);
412 else 426 else
413 { 427 {
414 UUID sessionID = GetSessionID(folder.Owner); 428 UUID sessionID = GetSessionID(folder.Owner);
@@ -422,39 +436,56 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
422 return false; 436 return false;
423 } 437 }
424 438
425 public override InventoryFolderBase GetRootFolder(UUID userID) 439 public override List<InventoryItemBase> GetActiveGestures(UUID userId)
426 { 440 {
427 return null; 441 return new List<InventoryItemBase>();
428 } 442 }
429 443
430 public override List<InventoryItemBase> GetActiveGestures(UUID userId) 444 public override int GetAssetPermissions(UUID userID, UUID assetID)
431 { 445 {
432 return new List<InventoryItemBase>(); 446 if (IsLocalGridUser(userID))
447 return m_GridService.GetAssetPermissions(userID, assetID);
448 else
449 {
450 UUID sessionID = GetSessionID(userID);
451 string uri = GetUserInventoryURI(userID) + "/" + userID.ToString();
452 return m_HGService.GetAssetPermissions(uri, assetID, sessionID);
453 }
433 } 454 }
434 455
435 #endregion 456 #endregion
436 457
437 private UUID GetSessionID(UUID userID) 458 private UUID GetSessionID(UUID userID)
438 { 459 {
439 ScenePresence sp = m_Scene.GetScenePresence(userID); 460 CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID);
440 if (sp != null) 461 if (uinfo != null)
441 return sp.ControllingClient.SessionId; 462 return uinfo.SessionID;
442 463
464 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: user profile for {0} not found", userID);
443 return UUID.Zero; 465 return UUID.Zero;
444 } 466 }
445 467
446 private bool IsLocalGridUser(UUID userID) 468 private bool IsLocalGridUser(UUID userID)
447 { 469 {
448 if (m_UserProfileService == null) 470 if (m_UserProfileService == null)
471 {
472 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, no profile service. Returning false.");
449 return false; 473 return false;
474 }
450 475
451 CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID); 476 CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID);
452 if (uinfo == null) 477 if (uinfo == null)
478 {
479 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, no profile for user {0}. Returning true.", userID);
453 return true; 480 return true;
481 }
454 482
455 string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI); 483 string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI);
484 string uri = m_LocalGridInventoryURI.TrimEnd('/');
485
486 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, comparing {0} to {1}.", userInventoryServerURI, uri);
456 487
457 if ((userInventoryServerURI == m_LocalGridInventoryURI) || (userInventoryServerURI == "")) 488 if ((userInventoryServerURI == uri) || (userInventoryServerURI == ""))
458 { 489 {
459 return true; 490 return true;
460 } 491 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
index c16e92e..c8f04a5 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
@@ -91,6 +91,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
91 Dictionary<AssetType, InventoryFolderBase> folders = m_Connector.GetSystemFolders(presence.UUID); 91 Dictionary<AssetType, InventoryFolderBase> folders = m_Connector.GetSystemFolders(presence.UUID);
92 m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}", 92 m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}",
93 presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count); 93 presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count);
94
94 if (folders.Count > 0) 95 if (folders.Count > 0)
95 lock (m_InventoryCache) 96 lock (m_InventoryCache)
96 m_InventoryCache.Add(presence.UUID, folders); 97 m_InventoryCache.Add(presence.UUID, folders);
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index 6efe903..2fbc5fe 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -201,8 +201,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
201 foreach (InventoryFolderBase folder in content.Folders) 201 foreach (InventoryFolderBase folder in content.Folders)
202 { 202 {
203 if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown)) 203 if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown))
204 {
205 m_log.InfoFormat("[INVENTORY CONNECTOR]: folder type {0} ", folder.Type);
204 folders[(AssetType)folder.Type] = folder; 206 folders[(AssetType)folder.Type] = folder;
207 }
205 } 208 }
209 // Put the root folder there, as type Folder
210 folders[AssetType.Folder] = root;
211 m_log.InfoFormat("[INVENTORY CONNECTOR]: root folder is type {0} ", root.Type);
212
206 return folders; 213 return folders;
207 } 214 }
208 } 215 }
@@ -292,14 +299,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
292 return m_InventoryService.DeleteItem(item); 299 return m_InventoryService.DeleteItem(item);
293 } 300 }
294 301
295 public override InventoryItemBase QueryItem(InventoryItemBase item) 302 public override InventoryItemBase GetItem(InventoryItemBase item)
296 { 303 {
297 return m_InventoryService.QueryItem(item); 304 return m_InventoryService.GetItem(item);
298 } 305 }
299 306
300 public override InventoryFolderBase QueryFolder(InventoryFolderBase folder) 307 public override InventoryFolderBase GetFolder(InventoryFolderBase folder)
301 { 308 {
302 return m_InventoryService.QueryFolder(folder); 309 return m_InventoryService.GetFolder(folder);
303 } 310 }
304 311
305 /// <summary> 312 /// <summary>
@@ -312,19 +319,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
312 return m_InventoryService.HasInventoryForUser(userID); 319 return m_InventoryService.HasInventoryForUser(userID);
313 } 320 }
314 321
315 /// <summary> 322 public override List<InventoryItemBase> GetActiveGestures(UUID userId)
316 /// Retrieve the root inventory folder for the given user.
317 /// </summary>
318 /// <param name="userID"></param>
319 /// <returns>null if no root folder was found</returns>
320 public override InventoryFolderBase GetRootFolder(UUID userID)
321 { 323 {
322 return m_InventoryService.GetRootFolder(userID); 324 return m_InventoryService.GetActiveGestures(userId);
323 } 325 }
324 326
325 public override List<InventoryItemBase> GetActiveGestures(UUID userId) 327 public override int GetAssetPermissions(UUID userID, UUID assetID)
326 { 328 {
327 return m_InventoryService.GetActiveGestures(userId); 329 return m_InventoryService.GetAssetPermissions(userID, assetID);
328 } 330 }
329 #endregion IInventoryService 331 #endregion IInventoryService
330 } 332 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
index f87aab9..bef716b 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
@@ -32,6 +32,7 @@ using System.Reflection;
32using Nini.Config; 32using Nini.Config;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Statistics; 34using OpenSim.Framework.Statistics;
35using OpenSim.Framework.Communications.Cache;
35using OpenSim.Services.Connectors; 36using OpenSim.Services.Connectors;
36using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
@@ -48,6 +49,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
48 private bool m_Enabled = false; 49 private bool m_Enabled = false;
49 private bool m_Initialized = false; 50 private bool m_Initialized = false;
50 private Scene m_Scene; 51 private Scene m_Scene;
52 private UserProfileCacheService m_UserProfileService;
51 private InventoryServicesConnector m_RemoteConnector; 53 private InventoryServicesConnector m_RemoteConnector;
52 54
53 public Type ReplaceableInterface 55 public Type ReplaceableInterface
@@ -104,12 +106,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
104 106
105 public void AddRegion(Scene scene) 107 public void AddRegion(Scene scene)
106 { 108 {
109 m_Scene = scene;
110 m_log.Debug("[XXXX] Adding scene " + m_Scene.RegionInfo.RegionName);
111
107 if (!m_Enabled) 112 if (!m_Enabled)
108 return; 113 return;
109 114
110 if (!m_Initialized) 115 if (!m_Initialized)
111 { 116 {
112 m_Scene = scene;
113 // ugh! 117 // ugh!
114 scene.CommsManager.UserProfileCacheService.SetInventoryService(this); 118 scene.CommsManager.UserProfileCacheService.SetInventoryService(this);
115 scene.CommsManager.UserService.SetInventoryService(this); 119 scene.CommsManager.UserService.SetInventoryService(this);
@@ -130,6 +134,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
130 134
131 public void RegionLoaded(Scene scene) 135 public void RegionLoaded(Scene scene)
132 { 136 {
137 m_UserProfileService = m_Scene.CommsManager.UserProfileCacheService;
138 if (m_UserProfileService != null)
139 m_log.Debug("[XXXX] Set m_UserProfileService in " + m_Scene.RegionInfo.RegionName);
140
133 if (!m_Enabled) 141 if (!m_Enabled)
134 return; 142 return;
135 143
@@ -273,7 +281,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
273 return m_RemoteConnector.DeleteItem(item.Owner.ToString(), item, sessionID); 281 return m_RemoteConnector.DeleteItem(item.Owner.ToString(), item, sessionID);
274 } 282 }
275 283
276 public override InventoryItemBase QueryItem(InventoryItemBase item) 284 public override InventoryItemBase GetItem(InventoryItemBase item)
277 { 285 {
278 if (item == null) 286 if (item == null)
279 return null; 287 return null;
@@ -282,7 +290,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
282 return m_RemoteConnector.QueryItem(item.Owner.ToString(), item, sessionID); 290 return m_RemoteConnector.QueryItem(item.Owner.ToString(), item, sessionID);
283 } 291 }
284 292
285 public override InventoryFolderBase QueryFolder(InventoryFolderBase folder) 293 public override InventoryFolderBase GetFolder(InventoryFolderBase folder)
286 { 294 {
287 if (folder == null) 295 if (folder == null)
288 return null; 296 return null;
@@ -296,25 +304,39 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
296 return false; 304 return false;
297 } 305 }
298 306
299 public override InventoryFolderBase GetRootFolder(UUID userID) 307 public override List<InventoryItemBase> GetActiveGestures(UUID userId)
300 { 308 {
301 return null; 309 return new List<InventoryItemBase>();
302 } 310 }
303 311
304 public override List<InventoryItemBase> GetActiveGestures(UUID userId) 312 public override int GetAssetPermissions(UUID userID, UUID assetID)
305 { 313 {
306 return new List<InventoryItemBase>(); 314 UUID sessionID = GetSessionID(userID);
315 return m_RemoteConnector.GetAssetPermissions(userID.ToString(), assetID, sessionID);
307 } 316 }
308 317
318
309 #endregion 319 #endregion
310 320
311 private UUID GetSessionID(UUID userID) 321 private UUID GetSessionID(UUID userID)
312 { 322 {
313 ScenePresence sp = m_Scene.GetScenePresence(userID); 323 if (m_Scene == null)
314 if (sp != null) 324 {
315 return sp.ControllingClient.SessionId; 325 m_log.Debug("[INVENTORY CONNECTOR]: OOPS! scene is null");
326 }
316 327
328 if (m_UserProfileService == null)
329 {
330 m_log.Debug("[INVENTORY CONNECTOR]: OOPS! UserProfileCacheService is null");
331 return UUID.Zero;
332 }
333
334 CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID);
335 if (uinfo != null)
336 return uinfo.SessionID;
337 m_log.DebugFormat("[INVENTORY CONNECTOR]: user profile for {0} not found", userID);
317 return UUID.Zero; 338 return UUID.Zero;
339
318 } 340 }
319 341
320 } 342 }