From 156604e28e51d0a7e0c8018ce10eb517a9123ce4 Mon Sep 17 00:00:00 2001
From: diva
Date: Thu, 11 Jun 2009 03:00:25 +0000
Subject: InterServiceInventoryService references *almost* completely removed
from the simulator. Only a couple left, not important. Also updated the login
tests -- Justin, this time I was able to fix this by myself :)
---
OpenSim/Client/Linden/LLStandaloneLoginModule.cs | 2 +-
OpenSim/Client/Linden/LLStandaloneLoginService.cs | 5 +-
.../Communications/Services/HGLoginAuthService.cs | 2 +-
.../Communications/Services/LoginService.cs | 27 ++++-
.../Communications/Tests/LoginServiceTests.cs | 125 ++++++++++++++++++++-
.../UserServer.Modules/UserLoginAuthService.cs | 2 +-
.../Grid/UserServer.Modules/UserLoginService.cs | 2 +-
.../Inventory/HGInventoryBroker.cs | 2 +-
8 files changed, 153 insertions(+), 14 deletions(-)
diff --git a/OpenSim/Client/Linden/LLStandaloneLoginModule.cs b/OpenSim/Client/Linden/LLStandaloneLoginModule.cs
index 6474feb..bfafdc3 100644
--- a/OpenSim/Client/Linden/LLStandaloneLoginModule.cs
+++ b/OpenSim/Client/Linden/LLStandaloneLoginModule.cs
@@ -111,7 +111,7 @@ namespace OpenSim.Client.Linden
IHttpServer httpServer = m_firstScene.CommsManager.HttpServer;
//TODO: fix the casting of the user service, maybe by registering the userManagerBase with scenes, or refactoring so we just need a IUserService reference
- m_loginService = new LLStandaloneLoginService((UserManagerBase)m_firstScene.CommsManager.UserAdminService, welcomeMessage, m_firstScene.CommsManager.InterServiceInventoryService, m_firstScene.CommsManager.NetworkServersInfo, authenticate, rootFolder, this);
+ m_loginService = new LLStandaloneLoginService((UserManagerBase)m_firstScene.CommsManager.UserAdminService, welcomeMessage, m_firstScene.InventoryService, m_firstScene.CommsManager.NetworkServersInfo, authenticate, rootFolder, this);
httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);
diff --git a/OpenSim/Client/Linden/LLStandaloneLoginService.cs b/OpenSim/Client/Linden/LLStandaloneLoginService.cs
index 6b217e6..c2de348 100644
--- a/OpenSim/Client/Linden/LLStandaloneLoginService.cs
+++ b/OpenSim/Client/Linden/LLStandaloneLoginService.cs
@@ -42,6 +42,7 @@ using OpenSim.Framework.Communications.Capabilities;
using OpenSim.Framework.Servers;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Services.Interfaces;
namespace OpenSim.Client.Linden
{
@@ -59,7 +60,7 @@ namespace OpenSim.Client.Linden
public LLStandaloneLoginService(
UserManagerBase userManager, string welcomeMess,
- IInterServiceInventoryServices interServiceInventoryService,
+ IInventoryService interServiceInventoryService,
NetworkServersInfo serversInfo,
bool authenticate, LibraryRootFolder libraryRootFolder, ILoginServiceToRegionsConnector regionsConnector)
: base(userManager, libraryRootFolder, welcomeMess)
@@ -69,7 +70,7 @@ namespace OpenSim.Client.Linden
m_defaultHomeY = this.m_serversInfo.DefaultHomeLocY;
m_authUsers = authenticate;
- m_inventoryService = interServiceInventoryService;
+ m_InventoryService = interServiceInventoryService;
m_regionsConnector = regionsConnector;
// Standard behavior: In StandAlone, silent logout of last hung session
m_warn_already_logged = false;
diff --git a/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs b/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs
index 0637a1e..8e0205c 100644
--- a/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs
+++ b/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs
@@ -78,7 +78,7 @@ namespace OpenSim.Framework.Communications.Services
m_interServiceInventoryService = interServiceInventoryService;
m_regionsConnector = regionsConnector;
- m_inventoryService = interServiceInventoryService;
+ m_interInventoryService = interServiceInventoryService;
}
public void SetServersInfo(NetworkServersInfo sinfo)
diff --git a/OpenSim/Framework/Communications/Services/LoginService.cs b/OpenSim/Framework/Communications/Services/LoginService.cs
index 900a3d9..7eb98d7 100644
--- a/OpenSim/Framework/Communications/Services/LoginService.cs
+++ b/OpenSim/Framework/Communications/Services/LoginService.cs
@@ -41,6 +41,7 @@ using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Statistics;
+using OpenSim.Services.Interfaces;
namespace OpenSim.Framework.Communications.Services
{
@@ -66,7 +67,9 @@ namespace OpenSim.Framework.Communications.Services
///
/// Used by the login service to make requests to the inventory service.
///
- protected IInterServiceInventoryServices m_inventoryService;
+ protected IInterServiceInventoryServices m_interInventoryService;
+ // Hack
+ protected IInventoryService m_InventoryService;
///
/// Constructor
@@ -1047,7 +1050,10 @@ namespace OpenSim.Framework.Communications.Services
List gestures = null;
try
{
- gestures = m_inventoryService.GetActiveGestures(theUser.ID);
+ if (m_InventoryService != null)
+ gestures = m_InventoryService.GetActiveGestures(theUser.ID);
+ else
+ gestures = m_interInventoryService.GetActiveGestures(theUser.ID);
}
catch (Exception e)
{
@@ -1076,7 +1082,15 @@ namespace OpenSim.Framework.Communications.Services
/// This will be thrown if there is a problem with the inventory service
protected InventoryData GetInventorySkeleton(UUID userID)
{
- List folders = m_inventoryService.GetInventorySkeleton(userID);
+ List folders = null;
+ if (m_InventoryService != null)
+ {
+ folders = m_InventoryService.GetInventorySkeleton(userID);
+ }
+ else
+ {
+ folders = m_interInventoryService.GetInventorySkeleton(userID);
+ }
// If we have user auth but no inventory folders for some reason, create a new set of folders.
if (folders == null || folders.Count == 0)
@@ -1088,7 +1102,7 @@ namespace OpenSim.Framework.Communications.Services
// tools are creating the user profile directly in the database without creating the inventory. At
// this time we'll accomodate them by lazily creating the user inventory now if it doesn't already
// exist.
- if (!m_inventoryService.CreateNewUserInventory(userID))
+ if ((m_interInventoryService != null) && !m_interInventoryService.CreateNewUserInventory(userID))
{
throw new Exception(
String.Format(
@@ -1099,7 +1113,10 @@ namespace OpenSim.Framework.Communications.Services
m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID);
- folders = m_inventoryService.GetInventorySkeleton(userID);
+ if (m_InventoryService != null)
+ folders = m_InventoryService.GetInventorySkeleton(userID);
+ else
+ folders = m_interInventoryService.GetInventorySkeleton(userID);
if (folders == null || folders.Count == 0)
{
diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
index 7a622ad..d637ef0 100644
--- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
+++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
@@ -39,6 +39,8 @@ using OpenSim.Region.Communications.Local;
using OpenSim.Tests.Common.Mock;
using OpenSim.Client.Linden;
using OpenSim.Tests.Common;
+using OpenSim.Services.Interfaces;
+using OpenMetaverse;
namespace OpenSim.Framework.Communications.Tests
{
@@ -73,7 +75,7 @@ namespace OpenSim.Framework.Communications.Tests
m_localUserServices = (LocalUserServices) m_commsManager.UserService;
m_localUserServices.AddUser(m_firstName,m_lastName,"boingboing","abc@ftw.com",42,43);
- m_loginService = new LLStandaloneLoginService((UserManagerBase) m_localUserServices, "Hello folks", m_commsManager.InterServiceInventoryService,
+ m_loginService = new LLStandaloneLoginService((UserManagerBase) m_localUserServices, "Hello folks", new TestInventoryService(),
m_commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty), m_regionConnector);
m_userProfileData = m_localUserServices.GetUserProfile(m_firstName, m_lastName);
@@ -88,7 +90,7 @@ namespace OpenSim.Framework.Communications.Tests
TestHelper.InMethod();
// We want to use our own LoginService for this test, one that
// doesn't require authentication.
- LoginService loginService = new LLStandaloneLoginService((UserManagerBase)m_commsManager.UserService, "Hello folks", m_commsManager.InterServiceInventoryService,
+ LoginService loginService = new LLStandaloneLoginService((UserManagerBase)m_commsManager.UserService, "Hello folks", new TestInventoryService(),
m_commsManager.NetworkServersInfo, false, new LibraryRootFolder(String.Empty), m_regionConnector);
Hashtable loginParams = new Hashtable();
@@ -440,4 +442,123 @@ namespace OpenSim.Framework.Communications.Tests
#endregion
}
}
+
+ class TestInventoryService : IInventoryService
+ {
+ public TestInventoryService()
+ {
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public bool CreateUserInventory(UUID userId)
+ {
+ return false;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ public List GetInventorySkeleton(UUID userId)
+ {
+ List folders = new List();
+ InventoryFolderBase folder = new InventoryFolderBase();
+ folder.ID = UUID.Random();
+ folder.Owner = userId;
+ folders.Add(folder);
+ return folders;
+ }
+
+ ///
+ /// Returns a list of all the active gestures in a user's inventory.
+ ///
+ ///
+ /// The of the user
+ ///
+ ///
+ /// A flat list of the gesture items.
+ ///
+ public List GetActiveGestures(UUID userId)
+ {
+ return null;
+ }
+
+ public InventoryCollection GetUserInventory(UUID userID)
+ {
+ return null;
+ }
+
+ public void GetUserInventory(UUID userID, OpenSim.Services.Interfaces.InventoryReceiptCallback callback)
+ {
+ }
+
+ public List GetFolderItems(UUID folderID)
+ {
+ return null;
+ }
+
+ public bool AddFolder(InventoryFolderBase folder)
+ {
+ return false;
+ }
+
+ public bool UpdateFolder(InventoryFolderBase folder)
+ {
+ return false;
+ }
+
+ public bool MoveFolder(InventoryFolderBase folder)
+ {
+ return false;
+ }
+
+ public bool PurgeFolder(InventoryFolderBase folder)
+ {
+ return false;
+ }
+
+ public bool AddItem(InventoryItemBase item)
+ {
+ return false;
+ }
+
+ public bool UpdateItem(InventoryItemBase item)
+ {
+ return false;
+ }
+
+ public bool DeleteItem(InventoryItemBase item)
+ {
+ return false;
+ }
+
+ public InventoryItemBase QueryItem(InventoryItemBase item)
+ {
+ return null;
+ }
+
+ public InventoryFolderBase QueryFolder(InventoryFolderBase folder)
+ {
+ return null;
+ }
+
+ public bool HasInventoryForUser(UUID userID)
+ {
+ return false;
+ }
+
+ public InventoryFolderBase RequestRootFolder(UUID userID)
+ {
+ InventoryFolderBase root = new InventoryFolderBase();
+ root.ID = UUID.Random();
+ root.Owner = userID;
+ root.ParentID = UUID.Zero;
+ return root;
+ }
+ }
}
diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs
index 30aea14..c4c82e5 100644
--- a/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs
+++ b/OpenSim/Grid/UserServer.Modules/UserLoginAuthService.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Grid.UserServer.Modules
m_config = config;
m_defaultHomeX = m_config.DefaultX;
m_defaultHomeY = m_config.DefaultY;
- m_inventoryService = inventoryService;
+ m_interInventoryService = inventoryService;
m_regionProfileService = regionProfileService;
NetworkServersInfo serversinfo = new NetworkServersInfo(1000, 1000);
diff --git a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs
index 122ad9d..dff6059 100644
--- a/OpenSim/Grid/UserServer.Modules/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer.Modules/UserLoginService.cs
@@ -74,7 +74,7 @@ namespace OpenSim.Grid.UserServer.Modules
m_config = config;
m_defaultHomeX = m_config.DefaultX;
m_defaultHomeY = m_config.DefaultY;
- m_inventoryService = inventoryService;
+ m_interInventoryService = inventoryService;
m_regionProfileService = regionProfileService;
}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs
index 03b4873..4d741a9 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs
@@ -173,7 +173,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
public List GetInventorySkeleton(UUID userId)
{
- return new List();
+ return m_GridService.GetInventorySkeleton(userId);
}
public InventoryCollection GetUserInventory(UUID userID)
--
cgit v1.1