diff options
author | Justin Clark-Casey (justincc) | 2009-09-06 20:16:56 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2009-09-06 20:16:56 +0100 |
commit | 79c22651d7673b61a0c62786eb16f8b6433d6928 (patch) | |
tree | db762de6bed694ac70c0262b5781ad8f76b4b329 /OpenSim/Region/CoreModules | |
parent | refactor: replace some uses of iar module reference with scene instead (diff) | |
download | opensim-SC-79c22651d7673b61a0c62786eb16f8b6433d6928.zip opensim-SC-79c22651d7673b61a0c62786eb16f8b6433d6928.tar.gz opensim-SC-79c22651d7673b61a0c62786eb16f8b6433d6928.tar.bz2 opensim-SC-79c22651d7673b61a0c62786eb16f8b6433d6928.tar.xz |
refactor: use direct scene reference in inventory archive read request
Diffstat (limited to 'OpenSim/Region/CoreModules')
4 files changed, 21 insertions, 30 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 38bd149..bb40450 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -42,6 +42,7 @@ using OpenSim.Framework.Communications.Osp; | |||
42 | using OpenSim.Framework.Serialization; | 42 | using OpenSim.Framework.Serialization; |
43 | using OpenSim.Framework.Serialization.External; | 43 | using OpenSim.Framework.Serialization.External; |
44 | using OpenSim.Region.CoreModules.World.Archiver; | 44 | using OpenSim.Region.CoreModules.World.Archiver; |
45 | using OpenSim.Region.Framework.Scenes; | ||
45 | using OpenSim.Services.Interfaces; | 46 | using OpenSim.Services.Interfaces; |
46 | 47 | ||
47 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | 48 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver |
@@ -56,31 +57,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
56 | private string m_invPath; | 57 | private string m_invPath; |
57 | 58 | ||
58 | /// <value> | 59 | /// <value> |
60 | /// We only use this to request modules | ||
61 | /// </value> | ||
62 | protected Scene m_scene; | ||
63 | |||
64 | /// <value> | ||
59 | /// The stream from which the inventory archive will be loaded. | 65 | /// The stream from which the inventory archive will be loaded. |
60 | /// </value> | 66 | /// </value> |
61 | private Stream m_loadStream; | 67 | private Stream m_loadStream; |
62 | 68 | ||
63 | protected CommunicationsManager m_commsManager; | ||
64 | protected IAssetService m_assetService; | ||
65 | |||
66 | public InventoryArchiveReadRequest( | 69 | public InventoryArchiveReadRequest( |
67 | CachedUserInfo userInfo, string invPath, string loadPath, CommunicationsManager commsManager, IAssetService assetService) | 70 | Scene scene, CachedUserInfo userInfo, string invPath, string loadPath) |
68 | : this( | 71 | : this( |
72 | scene, | ||
69 | userInfo, | 73 | userInfo, |
70 | invPath, | 74 | invPath, |
71 | new GZipStream(new FileStream(loadPath, FileMode.Open), CompressionMode.Decompress), | 75 | new GZipStream(new FileStream(loadPath, FileMode.Open), CompressionMode.Decompress)) |
72 | commsManager, assetService) | ||
73 | { | 76 | { |
74 | } | 77 | } |
75 | 78 | ||
76 | public InventoryArchiveReadRequest( | 79 | public InventoryArchiveReadRequest( |
77 | CachedUserInfo userInfo, string invPath, Stream loadStream, CommunicationsManager commsManager, IAssetService assetService) | 80 | Scene scene, CachedUserInfo userInfo, string invPath, Stream loadStream) |
78 | { | 81 | { |
82 | m_scene = scene; | ||
79 | m_userInfo = userInfo; | 83 | m_userInfo = userInfo; |
80 | m_invPath = invPath; | 84 | m_invPath = invPath; |
81 | m_loadStream = loadStream; | 85 | m_loadStream = loadStream; |
82 | m_commsManager = commsManager; | ||
83 | m_assetService = assetService; | ||
84 | } | 86 | } |
85 | 87 | ||
86 | /// <summary> | 88 | /// <summary> |
@@ -106,7 +108,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
106 | // | 108 | // |
107 | // FIXME: FetchInventory should probably be assumed to by async anyway, since even standalones might | 109 | // FIXME: FetchInventory should probably be assumed to by async anyway, since even standalones might |
108 | // use a remote inventory service, though this is vanishingly rare at the moment. | 110 | // use a remote inventory service, though this is vanishingly rare at the moment. |
109 | if (null == m_commsManager.UserAdminService) | 111 | if (null == m_scene.CommsManager.UserAdminService) |
110 | { | 112 | { |
111 | m_log.ErrorFormat( | 113 | m_log.ErrorFormat( |
112 | "[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1}", | 114 | "[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1}", |
@@ -167,7 +169,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
167 | // Don't use the item ID that's in the file | 169 | // Don't use the item ID that's in the file |
168 | item.ID = UUID.Random(); | 170 | item.ID = UUID.Random(); |
169 | 171 | ||
170 | UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_commsManager); | 172 | UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.CommsManager); |
171 | if (UUID.Zero != ospResolvedId) | 173 | if (UUID.Zero != ospResolvedId) |
172 | item.CreatorIdAsUuid = ospResolvedId; | 174 | item.CreatorIdAsUuid = ospResolvedId; |
173 | 175 | ||
@@ -371,7 +373,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
371 | asset.Type = assetType; | 373 | asset.Type = assetType; |
372 | asset.Data = data; | 374 | asset.Data = data; |
373 | 375 | ||
374 | m_assetService.Store(asset); | 376 | m_scene.AssetService.Store(asset); |
375 | 377 | ||
376 | return true; | 378 | return true; |
377 | } | 379 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index da54469..badabe0 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -39,7 +39,6 @@ using OpenSim.Framework.Serialization.External; | |||
39 | using OpenSim.Framework.Communications; | 39 | using OpenSim.Framework.Communications; |
40 | using OpenSim.Framework.Communications.Cache; | 40 | using OpenSim.Framework.Communications.Cache; |
41 | using OpenSim.Framework.Communications.Osp; | 41 | using OpenSim.Framework.Communications.Osp; |
42 | using OpenSim.Region.Framework.Scenes; | ||
43 | using OpenSim.Region.CoreModules.World.Archiver; | 42 | using OpenSim.Region.CoreModules.World.Archiver; |
44 | using OpenSim.Region.Framework.Scenes; | 43 | using OpenSim.Region.Framework.Scenes; |
45 | 44 | ||
@@ -114,7 +113,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
114 | m_userInfo = userInfo; | 113 | m_userInfo = userInfo; |
115 | m_invPath = invPath; | 114 | m_invPath = invPath; |
116 | m_saveStream = saveStream; | 115 | m_saveStream = saveStream; |
117 | m_assetGatherer = new UuidGatherer(m_module.AssetService); | 116 | m_assetGatherer = new UuidGatherer(m_scene.AssetService); |
118 | } | 117 | } |
119 | 118 | ||
120 | protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) | 119 | protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 36e17b4..2c36270 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -69,19 +69,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
69 | /// </value> | 69 | /// </value> |
70 | private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); | 70 | private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); |
71 | private Scene m_aScene; | 71 | private Scene m_aScene; |
72 | |||
73 | /// <value> | ||
74 | /// The comms manager we will use for all comms requests | ||
75 | /// </value> | ||
76 | protected internal CommunicationsManager CommsManager; | ||
77 | protected internal IAssetService AssetService; | ||
78 | 72 | ||
79 | public void Initialise(Scene scene, IConfigSource source) | 73 | public void Initialise(Scene scene, IConfigSource source) |
80 | { | 74 | { |
81 | if (m_scenes.Count == 0) | 75 | if (m_scenes.Count == 0) |
82 | { | 76 | { |
83 | scene.RegisterModuleInterface<IInventoryArchiverModule>(this); | 77 | scene.RegisterModuleInterface<IInventoryArchiverModule>(this); |
84 | CommsManager = scene.CommsManager; | ||
85 | OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted; | 78 | OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted; |
86 | 79 | ||
87 | scene.AddCommand( | 80 | scene.AddCommand( |
@@ -99,11 +92,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
99 | 92 | ||
100 | m_scenes[scene.RegionInfo.RegionID] = scene; | 93 | m_scenes[scene.RegionInfo.RegionID] = scene; |
101 | } | 94 | } |
102 | 95 | ||
103 | public void PostInitialise() | 96 | public void PostInitialise() {} |
104 | { | ||
105 | AssetService = m_aScene.AssetService; | ||
106 | } | ||
107 | 97 | ||
108 | public void Close() {} | 98 | public void Close() {} |
109 | 99 | ||
@@ -150,7 +140,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
150 | if (userInfo != null) | 140 | if (userInfo != null) |
151 | { | 141 | { |
152 | InventoryArchiveReadRequest request = | 142 | InventoryArchiveReadRequest request = |
153 | new InventoryArchiveReadRequest(userInfo, invPath, loadStream, CommsManager, AssetService); | 143 | new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream); |
154 | UpdateClientWithLoadedNodes(userInfo, request.Execute()); | 144 | UpdateClientWithLoadedNodes(userInfo, request.Execute()); |
155 | } | 145 | } |
156 | } | 146 | } |
@@ -165,7 +155,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
165 | if (userInfo != null) | 155 | if (userInfo != null) |
166 | { | 156 | { |
167 | InventoryArchiveReadRequest request = | 157 | InventoryArchiveReadRequest request = |
168 | new InventoryArchiveReadRequest(userInfo, invPath, loadPath, CommsManager, AssetService); | 158 | new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath); |
169 | UpdateClientWithLoadedNodes(userInfo, request.Execute()); | 159 | UpdateClientWithLoadedNodes(userInfo, request.Execute()); |
170 | } | 160 | } |
171 | } | 161 | } |
@@ -261,7 +251,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
261 | /// <returns></returns> | 251 | /// <returns></returns> |
262 | protected CachedUserInfo GetUserInfo(string firstName, string lastName) | 252 | protected CachedUserInfo GetUserInfo(string firstName, string lastName) |
263 | { | 253 | { |
264 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(firstName, lastName); | 254 | CachedUserInfo userInfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(firstName, lastName); |
265 | if (null == userInfo) | 255 | if (null == userInfo) |
266 | { | 256 | { |
267 | m_log.ErrorFormat( | 257 | m_log.ErrorFormat( |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 2ad6f1a..cf9fcaa 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -412,7 +412,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
412 | 412 | ||
413 | Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder); | 413 | Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder); |
414 | 414 | ||
415 | new InventoryArchiveReadRequest(userInfo, null, (Stream)null, null, null) | 415 | new InventoryArchiveReadRequest(scene, userInfo, null, (Stream)null) |
416 | .ReplicateArchivePathToUserInventory( | 416 | .ReplicateArchivePathToUserInventory( |
417 | itemArchivePath, false, userInfo.RootFolder, foldersCreated, nodesLoaded); | 417 | itemArchivePath, false, userInfo.RootFolder, foldersCreated, nodesLoaded); |
418 | 418 | ||