* refactor: break out inter grid inventory services further

* more to follow
0.6.0-stable
Justin Clarke Casey 2008-07-23 22:18:09 +00:00
parent 1c9551eaae
commit 9af05d0bc3
10 changed files with 49 additions and 49 deletions

View File

@ -36,68 +36,77 @@ using OpenSim.Framework.Servers;
namespace OpenSim.Framework.Communications namespace OpenSim.Framework.Communications
{ {
/// <summary>
/// This class manages references to OpenSim non-region services (asset, inventory, user, etc.)
/// </summary>
public class CommunicationsManager public class CommunicationsManager
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected IUserService m_userService;
protected Dictionary<LLUUID, string[]> m_nameRequestCache = new Dictionary<LLUUID, string[]>(); protected Dictionary<LLUUID, string[]> m_nameRequestCache = new Dictionary<LLUUID, string[]>();
public IUserService UserService public IUserService UserService
{ {
get { return m_userService; } get { return m_userService; }
} }
protected IUserService m_userService;
protected IGridServices m_gridService;
public IGridServices GridService public IGridServices GridService
{ {
get { return m_gridService; } get { return m_gridService; }
} }
protected IGridServices m_gridService;
protected IInterRegionCommunications m_interRegion;
public IInterRegionCommunications InterRegion public IInterRegionCommunications InterRegion
{ {
get { return m_interRegion; } get { return m_interRegion; }
} }
protected IInterRegionCommunications m_interRegion;
protected UserProfileCacheService m_userProfileCacheService;
public UserProfileCacheService UserProfileCacheService public UserProfileCacheService UserProfileCacheService
{ {
get { return m_userProfileCacheService; } get { return m_userProfileCacheService; }
} }
protected UserProfileCacheService m_userProfileCacheService;
// protected AgentAssetTransactionsManager m_transactionsManager; // protected AgentAssetTransactionsManager m_transactionsManager;
// public AgentAssetTransactionsManager TransactionsManager // public AgentAssetTransactionsManager TransactionsManager
// { // {
// get { return m_transactionsManager; } // get { return m_transactionsManager; }
// } // }
protected IAvatarService m_avatarService;
public IAvatarService AvatarService public IAvatarService AvatarService
{ {
get { return m_avatarService; } get { return m_avatarService; }
} }
protected IAvatarService m_avatarService;
protected AssetCache m_assetCache;
public AssetCache AssetCache public AssetCache AssetCache
{ {
get { return m_assetCache; } get { return m_assetCache; }
} }
protected AssetCache m_assetCache;
protected NetworkServersInfo m_networkServersInfo;
public IInterGridInventoryServices InterGridInventoryService
{
get { return m_interGridInventoryService; }
}
protected IInterGridInventoryServices m_interGridInventoryService;
public NetworkServersInfo NetworkServersInfo public NetworkServersInfo NetworkServersInfo
{ {
get { return m_networkServersInfo; } get { return m_networkServersInfo; }
} }
protected NetworkServersInfo m_networkServersInfo;
/// <summary>
/// Constructor
/// </summary>
/// <param name="serversInfo"></param>
/// <param name="httpServer"></param>
/// <param name="assetCache"></param>
/// <param name="dumpAssetsToFile"></param>
public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache,
bool dumpAssetsToFile) bool dumpAssetsToFile)
{ {

View File

@ -34,12 +34,7 @@ namespace OpenSim.Framework.Communications
/// Inventory operations used between grid services. /// Inventory operations used between grid services.
/// </summary> /// </summary>
public interface IInterGridInventoryServices public interface IInterGridInventoryServices
{ {
string Host
{
get;
}
/// <summary> /// <summary>
/// Create a new inventory for the given user. /// Create a new inventory for the given user.
/// </summary> /// </summary>

View File

@ -42,6 +42,11 @@ namespace OpenSim.Framework.Communications
/// </summary> /// </summary>
public interface IInventoryServices : IInterGridInventoryServices public interface IInventoryServices : IInterGridInventoryServices
{ {
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

@ -31,7 +31,6 @@ using OpenSim.Framework.Communications.Cache;
namespace OpenSim.Framework.Communications namespace OpenSim.Framework.Communications
{ {
/// <summary> /// <summary>
/// Defines all the operations one can perform on a user's inventory. /// Defines all the operations one can perform on a user's inventory.
/// </summary> /// </summary>
@ -41,6 +40,7 @@ namespace OpenSim.Framework.Communications
{ {
get; 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
@ -105,21 +105,11 @@ namespace OpenSim.Framework.Communications
/// <returns>true if the inventory was successfully created, false otherwise</returns> /// <returns>true if the inventory was successfully created, false otherwise</returns>
bool CreateNewUserInventory(LLUUID user); bool CreateNewUserInventory(LLUUID user);
bool HasInventoryForUser(LLUUID userID);
/// <summary> /// <summary>
/// Retrieve the root inventory folder for the given user. /// Does the given user have an inventory structure?
/// </summary> /// </summary>
/// <param name="userID"></param> /// <param name="userID"></param>
/// <returns>null if no root folder was found</returns> /// <returns></returns>
InventoryFolderBase RequestRootFolder(LLUUID userID); bool HasInventoryForUser(LLUUID userID);
/// <summary>
/// Returns a list of all the folders in a given user's inventory.
/// </summary>
/// <param name="userId"></param>
/// <returns>A flat list of the user's inventory folder tree,
/// null if there is no inventory for this user</returns>
List<InventoryFolderBase> GetInventorySkeleton(LLUUID userId);
} }
} }

View File

@ -38,7 +38,7 @@ namespace OpenSim.Framework.Communications
/// <summary> /// <summary>
/// Abstract base class used by local and grid implementations of an inventory service. /// Abstract base class used by local and grid implementations of an inventory service.
/// </summary> /// </summary>
public abstract class InventoryServiceBase : IInventoryServices public abstract class InventoryServiceBase : IInventoryServices, IInterGridInventoryServices
{ {
private static readonly ILog m_log private static readonly ILog m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

View File

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

View File

@ -85,7 +85,7 @@ namespace OpenSim.Region.Communications.Local
profile = m_userManager.GetUserProfile(firstname, lastname); profile = m_userManager.GetUserProfile(firstname, lastname);
if (profile != null) if (profile != null)
{ {
m_Parent.InventoryService.CreateNewUserInventory(profile.ID); m_Parent.InterGridInventoryService.CreateNewUserInventory(profile.ID);
} }
return profile; return profile;
@ -260,13 +260,13 @@ namespace OpenSim.Region.Communications.Local
// See LoginService // See LoginService
protected override InventoryData GetInventorySkeleton(LLUUID userID, string serverUrl) protected override InventoryData GetInventorySkeleton(LLUUID userID, string serverUrl)
{ {
List<InventoryFolderBase> folders = m_Parent.InventoryService.GetInventorySkeleton(userID); List<InventoryFolderBase> folders = m_Parent.InterGridInventoryService.GetInventorySkeleton(userID);
// If we have user auth but no inventory folders for some reason, create a new set of folders. // If we have user auth but no inventory folders for some reason, create a new set of folders.
if (null == folders || 0 == folders.Count) if (null == folders || 0 == folders.Count)
{ {
m_Parent.InventoryService.CreateNewUserInventory(userID); m_Parent.InterGridInventoryService.CreateNewUserInventory(userID);
folders = m_Parent.InventoryService.GetInventorySkeleton(userID); folders = m_Parent.InterGridInventoryService.GetInventorySkeleton(userID);
} }
LLUUID rootID = LLUUID.Zero; LLUUID rootID = LLUUID.Zero;

View File

@ -37,7 +37,7 @@ namespace OpenSim.Region.Communications.Local
// private readonly NetworkServersInfo m_serversInfo; // private readonly NetworkServersInfo m_serversInfo;
private readonly uint m_defaultHomeX; private readonly uint m_defaultHomeX;
private readonly uint m_defaultHomeY; private readonly uint m_defaultHomeY;
private IInventoryServices m_inventoryService; private IInterGridInventoryServices m_interGridInventoryService;
/// <summary> /// <summary>
/// ///
@ -48,14 +48,14 @@ namespace OpenSim.Region.Communications.Local
/// <param name="inventoryService"></param> /// <param name="inventoryService"></param>
/// <param name="statsCollector">Can be null if stats collection is not required.</param> /// <param name="statsCollector">Can be null if stats collection is not required.</param>
public LocalUserServices(NetworkServersInfo serversInfo, uint defaultHomeLocX, uint defaultHomeLocY, public LocalUserServices(NetworkServersInfo serversInfo, uint defaultHomeLocX, uint defaultHomeLocY,
IInventoryServices inventoryService) IInterGridInventoryServices interGridInventoryService)
{ {
// m_serversInfo = serversInfo; // m_serversInfo = serversInfo;
m_defaultHomeX = defaultHomeLocX; m_defaultHomeX = defaultHomeLocX;
m_defaultHomeY = defaultHomeLocY; m_defaultHomeY = defaultHomeLocY;
m_inventoryService = inventoryService; m_interGridInventoryService = interGridInventoryService;
} }
public override UserProfileData SetupMasterUser(string firstName, string lastName) public override UserProfileData SetupMasterUser(string firstName, string lastName)
@ -82,7 +82,7 @@ namespace OpenSim.Region.Communications.Local
} }
else else
{ {
m_inventoryService.CreateNewUserInventory(profile.ID); m_interGridInventoryService.CreateNewUserInventory(profile.ID);
} }
return profile; return profile;

View File

@ -39,7 +39,7 @@ using OpenSim.Framework.Statistics;
namespace OpenSim.Region.Communications.OGS1 namespace OpenSim.Region.Communications.OGS1
{ {
public class OGS1InventoryService : IInventoryServices public class OGS1InventoryService : IInventoryServices, IInterGridInventoryServices
{ {
private static readonly ILog m_log private static readonly ILog m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

View File

@ -39,7 +39,7 @@ using OpenSim.Framework.Statistics;
namespace OpenSim.Region.Communications.OGS1 namespace OpenSim.Region.Communications.OGS1
{ {
public class OGS1SecureInventoryService : ISecureInventoryService public class OGS1SecureInventoryService : ISecureInventoryService, IInterGridInventoryServices
{ {
private static readonly ILog m_log private static readonly ILog m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);