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 private IDictionary<LLUUID, IList<InventoryFolderImpl>> pendingCategorizationFolders
= new Dictionary<LLUUID, IList<InventoryFolderImpl>>(); = 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> /// <summary>
/// Constructor /// Constructor
/// </summary> /// </summary>
@ -325,10 +343,16 @@ namespace OpenSim.Framework.Communications.Cache
createdBaseFolder.Type = createdFolder.Type; createdBaseFolder.Type = createdFolder.Type;
createdBaseFolder.Version = createdFolder.Version; 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 else
{ {
m_log.WarnFormat( m_log.WarnFormat(
@ -379,7 +403,11 @@ namespace OpenSim.Framework.Communications.Cache
baseFolder.Type = (short) type; baseFolder.Type = (short) type;
baseFolder.Version = RootFolder.Version; 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); InventoryFolderImpl folder = RootFolder.FindFolder(folderID);
if (folder != null) if (folder != null)
@ -388,6 +416,7 @@ namespace OpenSim.Framework.Communications.Cache
folder.ParentID = parentID; folder.ParentID = parentID;
} }
} }
}
else else
{ {
AddRequest( AddRequest(
@ -421,15 +450,26 @@ namespace OpenSim.Framework.Communications.Cache
baseFolder.ID = folderID; baseFolder.ID = folderID;
baseFolder.ParentID = parentID; 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); InventoryFolderImpl folder = RootFolder.FindFolder(folderID);
if (folder != null) if (folder != null)
{
folder.ParentID = parentID; folder.ParentID = parentID;
}
return true; return true;
} }
else else
{
return false;
}
}
else
{ {
AddRequest( AddRequest(
new InventoryRequest( new InventoryRequest(
@ -468,13 +508,18 @@ namespace OpenSim.Framework.Communications.Cache
purgedBaseFolder.Type = purgedFolder.Type; purgedBaseFolder.Type = purgedFolder.Type;
purgedBaseFolder.Version = purgedFolder.Version; 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 else
{ {
AddRequest( AddRequest(
@ -505,7 +550,13 @@ namespace OpenSim.Framework.Communications.Cache
item.Folder=RootFolder.ID; item.Folder=RootFolder.ID;
} }
ItemReceive(item); ItemReceive(item);
m_commsManager.InventoryService.AddItem(item);
IInventoryServices invService = GetInventoryService();
if (invService != null)
{
//m_commsManager.InventoryService
invService.AddItem(item);
}
} }
else else
{ {
@ -525,7 +576,12 @@ namespace OpenSim.Framework.Communications.Cache
{ {
if (HasInventory) if (HasInventory)
{ {
m_commsManager.InventoryService.UpdateItem(item); IInventoryServices invService = GetInventoryService();
if (invService != null)
{
//m_commsManager.InventoryService
invService.UpdateItem(item);
}
} }
else else
{ {
@ -564,7 +620,14 @@ namespace OpenSim.Framework.Communications.Cache
if (RootFolder.DeleteItem(item.ID)) 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 else
@ -641,6 +704,13 @@ namespace OpenSim.Framework.Communications.Cache
} }
return null; return null;
} }
public IInventoryServices GetInventoryService()
{
IInventoryServices invService;
m_commsManager.TryGetInventoryService(m_inventoryHost, out invService);
return invService;
}
} }
/// <summary> /// <summary>

View File

@ -119,7 +119,12 @@ namespace OpenSim.Framework.Communications.Cache
CachedUserInfo userInfo = GetUserDetails(userID); CachedUserInfo userInfo = GetUserDetails(userID);
if (userInfo != null) 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 else
{ {

View File

@ -55,12 +55,6 @@ namespace OpenSim.Framework.Communications
get { return m_gridService; } get { return m_gridService; }
} }
protected IInventoryServices m_inventoryService;
public IInventoryServices InventoryService
{
get { return m_inventoryService; }
}
protected IInterRegionCommunications m_interRegion; protected IInterRegionCommunications m_interRegion;
@ -106,6 +100,70 @@ namespace OpenSim.Framework.Communications
// m_transactionsManager = new AgentAssetTransactionsManager(this, dumpAssetsToFile); // 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) public void doCreate(string[] cmmdParams)
{ {
switch (cmmdParams[0]) switch (cmmdParams[0])
@ -167,7 +225,7 @@ namespace OpenSim.Framework.Communications
} }
else else
{ {
m_inventoryService.CreateNewUserInventory(userProf.ID); InventoryService.CreateNewUserInventory(userProf.ID);
m_log.Info("[USERS]: Created new inventory set for " + firstName + " " + lastName); m_log.Info("[USERS]: Created new inventory set for " + firstName + " " + lastName);
return userProf.ID; 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> /// </summary>
public interface IInventoryServices public interface IInventoryServices
{ {
string Host
{
get;
}
/// <summary> /// <summary>
/// Request the inventory for a user. This is an asynchronous operation that will call the callback when the /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the
/// inventory has been received /// 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> /// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
List<FriendListItem> GetUserFriendList(LLUUID friendlistowner); List<FriendListItem> GetUserFriendList(LLUUID friendlistowner);
/// <summary>
/// Get's the User Appearance
AvatarAppearance GetUserAppearance(LLUUID user);
/// <summary> /// <summary>
/// Updates the current region the User is in /// Updates the current region the User is in
/// </summary> /// </summary>
@ -122,6 +118,10 @@ namespace OpenSim.Framework.Communications
/// <param name="retionuuid">User Region the Avatar is IN</param> /// <param name="retionuuid">User Region the Avatar is IN</param>
void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid, ulong regionhandle); 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 UpdateUserAppearance(LLUUID user, AvatarAppearance appearance);
void AddAttachment(LLUUID user, LLUUID attach); void AddAttachment(LLUUID user, LLUUID attach);

View File

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

View File

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

View File

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

View File

@ -41,8 +41,17 @@ namespace OpenSim.Region.Communications.OGS1
m_gridService = gridInterComms; m_gridService = gridInterComms;
m_interRegion = 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); 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); = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private string _inventoryServerUrl; private string _inventoryServerUrl;
private Uri m_Uri;
private Dictionary<LLUUID, InventoryReceiptCallback> m_RequestingInventory private Dictionary<LLUUID, InventoryReceiptCallback> m_RequestingInventory
= new Dictionary<LLUUID, InventoryReceiptCallback>(); = new Dictionary<LLUUID, InventoryReceiptCallback>();
public OGS1InventoryService(string inventoryServerUrl) public OGS1InventoryService(string inventoryServerUrl)
{ {
_inventoryServerUrl = inventoryServerUrl; _inventoryServerUrl = inventoryServerUrl;
m_Uri = new Uri(_inventoryServerUrl);
} }
#region IInventoryServices Members #region IInventoryServices Members
public string Host
{
get { return m_Uri.Host; }
}
/// <summary> /// <summary>
/// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see> /// <see cref="OpenSim.Framework.Communications.IInventoryServices"></see>
/// </summary> /// </summary>

View File

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

View File

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