refactor: replace some uses of iar module reference with scene instead

remotes/origin/0.6.7-post-fixes
Justin Clark-Casey (justincc) 2009-09-06 20:04:18 +01:00
parent 304c78bbbb
commit 8616230fcf
2 changed files with 18 additions and 8 deletions

View File

@ -39,6 +39,7 @@ 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;
@ -59,6 +60,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
protected TarArchiveWriter m_archiveWriter; protected TarArchiveWriter m_archiveWriter;
protected UuidGatherer m_assetGatherer; protected UuidGatherer m_assetGatherer;
/// <value>
/// We only use this to request modules
/// </value>
protected Scene m_scene;
/// <value> /// <value>
/// ID of this request /// ID of this request
/// </value> /// </value>
@ -83,10 +89,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// Constructor /// Constructor
/// </summary> /// </summary>
public InventoryArchiveWriteRequest( public InventoryArchiveWriteRequest(
Guid id, InventoryArchiverModule module, CachedUserInfo userInfo, string invPath, string savePath) Guid id, InventoryArchiverModule module, Scene scene,
CachedUserInfo userInfo, string invPath, string savePath)
: this( : this(
id, id,
module, module,
scene,
userInfo, userInfo,
invPath, invPath,
new GZipStream(new FileStream(savePath, FileMode.Create), CompressionMode.Compress)) new GZipStream(new FileStream(savePath, FileMode.Create), CompressionMode.Compress))
@ -97,10 +105,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// Constructor /// Constructor
/// </summary> /// </summary>
public InventoryArchiveWriteRequest( public InventoryArchiveWriteRequest(
Guid id, InventoryArchiverModule module, CachedUserInfo userInfo, string invPath, Stream saveStream) Guid id, InventoryArchiverModule module, Scene scene,
CachedUserInfo userInfo, string invPath, Stream saveStream)
{ {
m_id = id; m_id = id;
m_module = module; m_module = module;
m_scene = scene;
m_userInfo = userInfo; m_userInfo = userInfo;
m_invPath = invPath; m_invPath = invPath;
m_saveStream = saveStream; m_saveStream = saveStream;
@ -135,7 +145,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
m_userUuids[inventoryItem.CreatorIdAsUuid] = 1; m_userUuids[inventoryItem.CreatorIdAsUuid] = 1;
InventoryItemBase saveItem = (InventoryItemBase)inventoryItem.Clone(); InventoryItemBase saveItem = (InventoryItemBase)inventoryItem.Clone();
saveItem.CreatorId = OspResolver.MakeOspa(saveItem.CreatorIdAsUuid, m_module.CommsManager); saveItem.CreatorId = OspResolver.MakeOspa(saveItem.CreatorIdAsUuid, m_scene.CommsManager);
string serialization = UserInventoryItemSerializer.Serialize(saveItem); string serialization = UserInventoryItemSerializer.Serialize(saveItem);
m_archiveWriter.WriteFile(filename, serialization); m_archiveWriter.WriteFile(filename, serialization);
@ -222,7 +232,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_module.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}",
@ -313,7 +323,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
SaveUsers(); SaveUsers();
new AssetsRequest( new AssetsRequest(
new AssetsArchiver(m_archiveWriter), m_assetUuids.Keys, new AssetsArchiver(m_archiveWriter), m_assetUuids.Keys,
m_module.AssetService, ReceivedAllAssets).Execute(); m_scene.AssetService, ReceivedAllAssets).Execute();
} }
/// <summary> /// <summary>
@ -327,7 +337,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{ {
// Record the creator of this item // Record the creator of this item
CachedUserInfo creator CachedUserInfo creator
= m_module.CommsManager.UserProfileCacheService.GetUserDetails(creatorId); = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(creatorId);
if (creator != null) if (creator != null)
{ {

View File

@ -126,7 +126,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
CachedUserInfo userInfo = GetUserInfo(firstName, lastName); CachedUserInfo userInfo = GetUserInfo(firstName, lastName);
if (userInfo != null) if (userInfo != null)
new InventoryArchiveWriteRequest(id, this, userInfo, invPath, saveStream).Execute(); new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute();
} }
} }
@ -137,7 +137,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
CachedUserInfo userInfo = GetUserInfo(firstName, lastName); CachedUserInfo userInfo = GetUserInfo(firstName, lastName);
if (userInfo != null) if (userInfo != null)
new InventoryArchiveWriteRequest(id, this, userInfo, invPath, savePath).Execute(); new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute();
} }
} }