plumbing for multiple inventory servers. Mostly done on the region server side.

TODO next is to make the login server read/write a users inventory from the correct server (the inventory url set in a userprofile)
On the region side, although not tested with multiple servers it should work if that inventory url was set, and the inventory servers urls have been added to the CommunicationsManager, using CommunicationsManager.AddInventoryService(string hostUrl)
0.6.0-stable
MW 2008-06-28 15:13:17 +00:00
parent 42e892140c
commit 86defd0a69
13 changed files with 217 additions and 35 deletions

View File

@ -87,6 +87,24 @@ namespace OpenSim.Framework.Communications.Cache
private IDictionary<LLUUID, IList<InventoryFolderImpl>> pendingCategorizationFolders
= new Dictionary<LLUUID, IList<InventoryFolderImpl>>();
private string m_inventoryHost
{
get
{
if (m_userProfile != null)
{
if (m_userProfile.UserInventoryURI != String.Empty)
{
Uri uri = new Uri(m_userProfile.UserInventoryURI);
return uri.Host;
}
}
return "";
}
}
/// <summary>
/// Constructor
/// </summary>
@ -325,9 +343,15 @@ namespace OpenSim.Framework.Communications.Cache
createdBaseFolder.Type = createdFolder.Type;
createdBaseFolder.Version = createdFolder.Version;
m_commsManager.InventoryService.AddFolder(createdBaseFolder);
IInventoryServices invService = GetInventoryService();
if (invService != null)
{
//m_commsManager.InventoryService
invService.AddFolder(createdBaseFolder);
return true;
}
return true;
return false;
}
else
{
@ -379,14 +403,19 @@ namespace OpenSim.Framework.Communications.Cache
baseFolder.Type = (short) type;
baseFolder.Version = RootFolder.Version;
m_commsManager.InventoryService.UpdateFolder(baseFolder);
IInventoryServices invService = GetInventoryService();
if (invService != null)
{
//m_commsManager.InventoryService.
invService.UpdateFolder(baseFolder);
InventoryFolderImpl folder=RootFolder.FindFolder(folderID);
if(folder != null)
{
folder.Name = name;
folder.ParentID = parentID;
}
InventoryFolderImpl folder = RootFolder.FindFolder(folderID);
if (folder != null)
{
folder.Name = name;
folder.ParentID = parentID;
}
}
}
else
{
@ -421,13 +450,24 @@ namespace OpenSim.Framework.Communications.Cache
baseFolder.ID = folderID;
baseFolder.ParentID = parentID;
m_commsManager.InventoryService.MoveFolder(baseFolder);
IInventoryServices invService = GetInventoryService();
if (invService != null)
{
// m_commsManager.InventoryService
invService.MoveFolder(baseFolder);
InventoryFolderImpl folder=RootFolder.FindFolder(folderID);
if(folder != null)
folder.ParentID = parentID;
InventoryFolderImpl folder = RootFolder.FindFolder(folderID);
if (folder != null)
{
folder.ParentID = parentID;
}
return true;
return true;
}
else
{
return false;
}
}
else
{
@ -468,11 +508,16 @@ namespace OpenSim.Framework.Communications.Cache
purgedBaseFolder.Type = purgedFolder.Type;
purgedBaseFolder.Version = purgedFolder.Version;
m_commsManager.InventoryService.PurgeFolder(purgedBaseFolder);
IInventoryServices invService = GetInventoryService();
if (invService != null)
{
//m_commsManager.InventoryService
invService.PurgeFolder(purgedBaseFolder);
purgedFolder.Purge();
purgedFolder.Purge();
return true;
return true;
}
}
}
else
@ -505,7 +550,13 @@ namespace OpenSim.Framework.Communications.Cache
item.Folder=RootFolder.ID;
}
ItemReceive(item);
m_commsManager.InventoryService.AddItem(item);
IInventoryServices invService = GetInventoryService();
if (invService != null)
{
//m_commsManager.InventoryService
invService.AddItem(item);
}
}
else
{
@ -525,7 +576,12 @@ namespace OpenSim.Framework.Communications.Cache
{
if (HasInventory)
{
m_commsManager.InventoryService.UpdateItem(item);
IInventoryServices invService = GetInventoryService();
if (invService != null)
{
//m_commsManager.InventoryService
invService.UpdateItem(item);
}
}
else
{
@ -564,7 +620,14 @@ namespace OpenSim.Framework.Communications.Cache
if (RootFolder.DeleteItem(item.ID))
{
return m_commsManager.InventoryService.DeleteItem(item);
IInventoryServices invService = GetInventoryService();
if (invService != null)
{
//return m_commsManager.InventoryService
return invService.DeleteItem(item);
}
return false;
}
}
else
@ -641,6 +704,13 @@ namespace OpenSim.Framework.Communications.Cache
}
return null;
}
public IInventoryServices GetInventoryService()
{
IInventoryServices invService;
m_commsManager.TryGetInventoryService(m_inventoryHost, out invService);
return invService;
}
}
/// <summary>

View File

@ -119,7 +119,12 @@ namespace OpenSim.Framework.Communications.Cache
CachedUserInfo userInfo = GetUserDetails(userID);
if (userInfo != null)
{
m_commsManager.InventoryService.RequestInventoryForUser(userID, userInfo.InventoryReceive);
//m_commsManager.InventoryService.RequestInventoryForUser(userID, userInfo.InventoryReceive);
IInventoryServices invService = userInfo.GetInventoryService();
if (invService != null)
{
invService.RequestInventoryForUser(userID, userInfo.InventoryReceive);
}
}
else
{

View File

@ -55,12 +55,6 @@ namespace OpenSim.Framework.Communications
get { return m_gridService; }
}
protected IInventoryServices m_inventoryService;
public IInventoryServices InventoryService
{
get { return m_inventoryService; }
}
protected IInterRegionCommunications m_interRegion;
@ -106,6 +100,70 @@ namespace OpenSim.Framework.Communications
// m_transactionsManager = new AgentAssetTransactionsManager(this, dumpAssetsToFile);
}
#region Inventory
protected string m_defaultInventoryHost = "default";
protected List<IInventoryServices> m_inventoryServices = new List<IInventoryServices>();
// protected IInventoryServices m_inventoryService;
public IInventoryServices InventoryService
{
get
{
if (m_inventoryServices.Count > 0)
{
// return m_inventoryServices[0];
IInventoryServices invService;
if (TryGetInventoryService(m_defaultInventoryHost, out invService))
{
return invService;
}
}
return null;
}
}
public bool TryGetInventoryService(string host, out IInventoryServices inventoryService)
{
if ((host == string.Empty) | (host == "default"))
{
host = m_defaultInventoryHost;
}
lock (m_inventoryServices)
{
foreach (IInventoryServices service in m_inventoryServices)
{
if (service.Host == host)
{
inventoryService = service;
return true;
}
}
}
inventoryService = null;
return false;
}
public virtual void AddInventoryService(string hostUrl)
{
}
public virtual void AddInventoryService(IInventoryServices service)
{
lock (m_inventoryServices)
{
m_inventoryServices.Add(service);
}
}
#endregion
public void doCreate(string[] cmmdParams)
{
switch (cmmdParams[0])
@ -167,7 +225,7 @@ namespace OpenSim.Framework.Communications
}
else
{
m_inventoryService.CreateNewUserInventory(userProf.ID);
InventoryService.CreateNewUserInventory(userProf.ID);
m_log.Info("[USERS]: Created new inventory set for " + firstName + " " + lastName);
return userProf.ID;
}

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
namespace OpenSim.Framework.Communications
{
public interface IAvatarService
{
/// Get's the User Appearance
AvatarAppearance GetUserAppearance(LLUUID user);
void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance);
void AddAttachment(LLUUID user, LLUUID attach);
void RemoveAttachment(LLUUID user, LLUUID attach);
List<LLUUID> GetAttachments(LLUUID user);
}
}

View File

@ -42,6 +42,10 @@ namespace OpenSim.Framework.Communications
/// </summary>
public interface IInventoryServices
{
string Host
{
get;
}
/// <summary>
/// Request the inventory for a user. This is an asynchronous operation that will call the callback when the
/// inventory has been received

View File

@ -111,10 +111,6 @@ namespace OpenSim.Framework.Communications
/// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
List<FriendListItem> GetUserFriendList(LLUUID friendlistowner);
/// <summary>
/// Get's the User Appearance
AvatarAppearance GetUserAppearance(LLUUID user);
/// <summary>
/// Updates the current region the User is in
/// </summary>
@ -122,6 +118,10 @@ namespace OpenSim.Framework.Communications
/// <param name="retionuuid">User Region the Avatar is IN</param>
void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle);
/// <summary>
/// Get's the User Appearance
AvatarAppearance GetUserAppearance(LLUUID user);
void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance);
void AddAttachment(LLUUID user, LLUUID attach);

View File

@ -81,6 +81,11 @@ namespace OpenSim.Framework.Communications
#region IInventoryServices methods
public string Host
{
get { return "default"; }
}
// See IInventoryServices
public List<InventoryFolderBase> GetInventorySkeleton(LLUUID userId)
{

View File

@ -173,7 +173,7 @@ namespace OpenSim
{
if (File.Exists("OpenSim.xml"))
{
//chech for a xml config file
//check for a xml config file
Application.iniFilePath = "OpenSim.xml";
m_config.Source = new XmlConfigSource();
m_config.Source.Merge(new XmlConfigSource(Application.iniFilePath));

View File

@ -44,7 +44,8 @@ namespace OpenSim.Region.Communications.Local
IGridServices gridService, bool dumpAssetsToFile)
: base(serversInfo, httpServer, assetCache, dumpAssetsToFile)
{
m_inventoryService = inventoryService;
AddInventoryService( inventoryService);
m_defaultInventoryHost = inventoryService.Host;
m_userService = userService;
m_gridService = gridService;
m_interRegion = interRegionService;

View File

@ -41,8 +41,17 @@ namespace OpenSim.Region.Communications.OGS1
m_gridService = gridInterComms;
m_interRegion = gridInterComms;
m_inventoryService = new OGS1InventoryService(serversInfo.InventoryURL);
OGS1InventoryService invService = new OGS1InventoryService(serversInfo.InventoryURL);
AddInventoryService(invService);
m_defaultInventoryHost = invService.Host;
m_userService = new OGS1UserServices(this);
}
public override void AddInventoryService(string hostUrl)
{
OGS1InventoryService invService = new OGS1InventoryService(hostUrl);
AddInventoryService(invService);
}
}
}

View File

@ -45,16 +45,23 @@ namespace OpenSim.Region.Communications.OGS1
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private string _inventoryServerUrl;
private Uri m_Uri;
private Dictionary<LLUUID, InventoryReceiptCallback> m_RequestingInventory
= new Dictionary<LLUUID, InventoryReceiptCallback>();
public OGS1InventoryService(string inventoryServerUrl)
{
_inventoryServerUrl = inventoryServerUrl;
m_Uri = new Uri(_inventoryServerUrl);
}
#region IInventoryServices Members
public string Host
{
get { return m_Uri.Host; }
}
/// <summary>
/// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
/// </summary>

View File

@ -696,5 +696,6 @@ namespace OpenSim.Region.Environment.Scenes
{
return m_commsProvider.GenerateAgentPickerRequestResponse(queryID, query);
}
}
}

View File

@ -66,6 +66,7 @@ namespace OpenSim.Region.Modules.AvatarFactory
appearance = CreateDefault(avatarId);
m_log.InfoFormat("[APPEARANCE] appearance not found for {0}, creating default", avatarId.ToString());
return false;
}
private AvatarAppearance CreateDefault(LLUUID avatarId)