refactor: use direct scene reference in inventory archive read request
parent
8616230fcf
commit
79c22651d7
|
@ -42,6 +42,7 @@ using OpenSim.Framework.Communications.Osp;
|
||||||
using OpenSim.Framework.Serialization;
|
using OpenSim.Framework.Serialization;
|
||||||
using OpenSim.Framework.Serialization.External;
|
using OpenSim.Framework.Serialization.External;
|
||||||
using OpenSim.Region.CoreModules.World.Archiver;
|
using OpenSim.Region.CoreModules.World.Archiver;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
|
@ -55,32 +56,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
private CachedUserInfo m_userInfo;
|
private CachedUserInfo m_userInfo;
|
||||||
private string m_invPath;
|
private string m_invPath;
|
||||||
|
|
||||||
|
/// <value>
|
||||||
|
/// We only use this to request modules
|
||||||
|
/// </value>
|
||||||
|
protected Scene m_scene;
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// The stream from which the inventory archive will be loaded.
|
/// The stream from which the inventory archive will be loaded.
|
||||||
/// </value>
|
/// </value>
|
||||||
private Stream m_loadStream;
|
private Stream m_loadStream;
|
||||||
|
|
||||||
protected CommunicationsManager m_commsManager;
|
|
||||||
protected IAssetService m_assetService;
|
|
||||||
|
|
||||||
public InventoryArchiveReadRequest(
|
public InventoryArchiveReadRequest(
|
||||||
CachedUserInfo userInfo, string invPath, string loadPath, CommunicationsManager commsManager, IAssetService assetService)
|
Scene scene, CachedUserInfo userInfo, string invPath, string loadPath)
|
||||||
: this(
|
: this(
|
||||||
|
scene,
|
||||||
userInfo,
|
userInfo,
|
||||||
invPath,
|
invPath,
|
||||||
new GZipStream(new FileStream(loadPath, FileMode.Open), CompressionMode.Decompress),
|
new GZipStream(new FileStream(loadPath, FileMode.Open), CompressionMode.Decompress))
|
||||||
commsManager, assetService)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public InventoryArchiveReadRequest(
|
public InventoryArchiveReadRequest(
|
||||||
CachedUserInfo userInfo, string invPath, Stream loadStream, CommunicationsManager commsManager, IAssetService assetService)
|
Scene scene, CachedUserInfo userInfo, string invPath, Stream loadStream)
|
||||||
{
|
{
|
||||||
|
m_scene = scene;
|
||||||
m_userInfo = userInfo;
|
m_userInfo = userInfo;
|
||||||
m_invPath = invPath;
|
m_invPath = invPath;
|
||||||
m_loadStream = loadStream;
|
m_loadStream = loadStream;
|
||||||
m_commsManager = commsManager;
|
|
||||||
m_assetService = assetService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -106,7 +108,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
//
|
//
|
||||||
// FIXME: FetchInventory should probably be assumed to by async anyway, since even standalones might
|
// FIXME: FetchInventory should probably be assumed to by async anyway, since even standalones might
|
||||||
// use a remote inventory service, though this is vanishingly rare at the moment.
|
// use a remote inventory service, though this is vanishingly rare at the moment.
|
||||||
if (null == m_commsManager.UserAdminService)
|
if (null == m_scene.CommsManager.UserAdminService)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat(
|
m_log.ErrorFormat(
|
||||||
"[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1}",
|
"[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1}",
|
||||||
|
@ -167,7 +169,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
// Don't use the item ID that's in the file
|
// Don't use the item ID that's in the file
|
||||||
item.ID = UUID.Random();
|
item.ID = UUID.Random();
|
||||||
|
|
||||||
UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_commsManager);
|
UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.CommsManager);
|
||||||
if (UUID.Zero != ospResolvedId)
|
if (UUID.Zero != ospResolvedId)
|
||||||
item.CreatorIdAsUuid = ospResolvedId;
|
item.CreatorIdAsUuid = ospResolvedId;
|
||||||
|
|
||||||
|
@ -371,7 +373,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
asset.Type = assetType;
|
asset.Type = assetType;
|
||||||
asset.Data = data;
|
asset.Data = data;
|
||||||
|
|
||||||
m_assetService.Store(asset);
|
m_scene.AssetService.Store(asset);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,6 @@ using OpenSim.Framework.Serialization.External;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
using OpenSim.Framework.Communications.Osp;
|
using OpenSim.Framework.Communications.Osp;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
|
||||||
using OpenSim.Region.CoreModules.World.Archiver;
|
using OpenSim.Region.CoreModules.World.Archiver;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
|
@ -114,7 +113,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
m_userInfo = userInfo;
|
m_userInfo = userInfo;
|
||||||
m_invPath = invPath;
|
m_invPath = invPath;
|
||||||
m_saveStream = saveStream;
|
m_saveStream = saveStream;
|
||||||
m_assetGatherer = new UuidGatherer(m_module.AssetService);
|
m_assetGatherer = new UuidGatherer(m_scene.AssetService);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids)
|
protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids)
|
||||||
|
|
|
@ -70,18 +70,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
|
private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
|
||||||
private Scene m_aScene;
|
private Scene m_aScene;
|
||||||
|
|
||||||
/// <value>
|
|
||||||
/// The comms manager we will use for all comms requests
|
|
||||||
/// </value>
|
|
||||||
protected internal CommunicationsManager CommsManager;
|
|
||||||
protected internal IAssetService AssetService;
|
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource source)
|
public void Initialise(Scene scene, IConfigSource source)
|
||||||
{
|
{
|
||||||
if (m_scenes.Count == 0)
|
if (m_scenes.Count == 0)
|
||||||
{
|
{
|
||||||
scene.RegisterModuleInterface<IInventoryArchiverModule>(this);
|
scene.RegisterModuleInterface<IInventoryArchiverModule>(this);
|
||||||
CommsManager = scene.CommsManager;
|
|
||||||
OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted;
|
OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted;
|
||||||
|
|
||||||
scene.AddCommand(
|
scene.AddCommand(
|
||||||
|
@ -100,10 +93,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
m_scenes[scene.RegionInfo.RegionID] = scene;
|
m_scenes[scene.RegionInfo.RegionID] = scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise() {}
|
||||||
{
|
|
||||||
AssetService = m_aScene.AssetService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Close() {}
|
public void Close() {}
|
||||||
|
|
||||||
|
@ -150,7 +140,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
if (userInfo != null)
|
if (userInfo != null)
|
||||||
{
|
{
|
||||||
InventoryArchiveReadRequest request =
|
InventoryArchiveReadRequest request =
|
||||||
new InventoryArchiveReadRequest(userInfo, invPath, loadStream, CommsManager, AssetService);
|
new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream);
|
||||||
UpdateClientWithLoadedNodes(userInfo, request.Execute());
|
UpdateClientWithLoadedNodes(userInfo, request.Execute());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,7 +155,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
if (userInfo != null)
|
if (userInfo != null)
|
||||||
{
|
{
|
||||||
InventoryArchiveReadRequest request =
|
InventoryArchiveReadRequest request =
|
||||||
new InventoryArchiveReadRequest(userInfo, invPath, loadPath, CommsManager, AssetService);
|
new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath);
|
||||||
UpdateClientWithLoadedNodes(userInfo, request.Execute());
|
UpdateClientWithLoadedNodes(userInfo, request.Execute());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -261,7 +251,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected CachedUserInfo GetUserInfo(string firstName, string lastName)
|
protected CachedUserInfo GetUserInfo(string firstName, string lastName)
|
||||||
{
|
{
|
||||||
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(firstName, lastName);
|
CachedUserInfo userInfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(firstName, lastName);
|
||||||
if (null == userInfo)
|
if (null == userInfo)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat(
|
m_log.ErrorFormat(
|
||||||
|
|
|
@ -412,7 +412,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
|
||||||
|
|
||||||
Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder);
|
Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder);
|
||||||
|
|
||||||
new InventoryArchiveReadRequest(userInfo, null, (Stream)null, null, null)
|
new InventoryArchiveReadRequest(scene, userInfo, null, (Stream)null)
|
||||||
.ReplicateArchivePathToUserInventory(
|
.ReplicateArchivePathToUserInventory(
|
||||||
itemArchivePath, false, userInfo.RootFolder, foldersCreated, nodesLoaded);
|
itemArchivePath, false, userInfo.RootFolder, foldersCreated, nodesLoaded);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue