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 :)

0.6.6-post-fixes
diva 2009-06-11 03:00:25 +00:00
parent e533f58733
commit 156604e28e
8 changed files with 153 additions and 14 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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)

View File

@ -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
/// <summary>
/// Used by the login service to make requests to the inventory service.
/// </summary>
protected IInterServiceInventoryServices m_inventoryService;
protected IInterServiceInventoryServices m_interInventoryService;
// Hack
protected IInventoryService m_InventoryService;
/// <summary>
/// Constructor
@ -1047,7 +1050,10 @@ namespace OpenSim.Framework.Communications.Services
List<InventoryItemBase> 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
/// <exception cref='System.Exception'>This will be thrown if there is a problem with the inventory service</exception>
protected InventoryData GetInventorySkeleton(UUID userID)
{
List<InventoryFolderBase> folders = m_inventoryService.GetInventorySkeleton(userID);
List<InventoryFolderBase> 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)
{

View File

@ -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()
{
}
/// <summary>
/// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/>
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public bool CreateUserInventory(UUID userId)
{
return false;
}
/// <summary>
/// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/>
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
{
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
InventoryFolderBase folder = new InventoryFolderBase();
folder.ID = UUID.Random();
folder.Owner = userId;
folders.Add(folder);
return folders;
}
/// <summary>
/// Returns a list of all the active gestures in a user's inventory.
/// </summary>
/// <param name="userId">
/// The <see cref="UUID"/> of the user
/// </param>
/// <returns>
/// A flat list of the gesture items.
/// </returns>
public List<InventoryItemBase> GetActiveGestures(UUID userId)
{
return null;
}
public InventoryCollection GetUserInventory(UUID userID)
{
return null;
}
public void GetUserInventory(UUID userID, OpenSim.Services.Interfaces.InventoryReceiptCallback callback)
{
}
public List<InventoryItemBase> 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;
}
}
}

View File

@ -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);

View File

@ -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;
}

View File

@ -173,7 +173,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
{
return new List<InventoryFolderBase>();
return m_GridService.GetInventorySkeleton(userId);
}
public InventoryCollection GetUserInventory(UUID userID)