aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2009-09-06 21:14:42 +0100
committerJustin Clark-Casey (justincc)2009-09-06 21:14:42 +0100
commit881051c8ccef7b49031d0f9a087390336ecc53b5 (patch)
tree1014a53b9923c6aabfa94b0a85ad9bf62664ea3b /OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
parentremove warning (diff)
downloadopensim-SC_OLD-881051c8ccef7b49031d0f9a087390336ecc53b5.zip
opensim-SC_OLD-881051c8ccef7b49031d0f9a087390336ecc53b5.tar.gz
opensim-SC_OLD-881051c8ccef7b49031d0f9a087390336ecc53b5.tar.bz2
opensim-SC_OLD-881051c8ccef7b49031d0f9a087390336ecc53b5.tar.xz
Convert iar write request to use inventory service requests rather than cache
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs30
1 files changed, 18 insertions, 12 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index badabe0..dee4a5d 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -158,7 +158,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
158 /// <param name="inventoryFolder">The inventory folder to save</param> 158 /// <param name="inventoryFolder">The inventory folder to save</param>
159 /// <param name="path">The path to which the folder should be saved</param> 159 /// <param name="path">The path to which the folder should be saved</param>
160 /// <param name="saveThisFolderItself">If true, save this folder itself. If false, only saves contents</param> 160 /// <param name="saveThisFolderItself">If true, save this folder itself. If false, only saves contents</param>
161 protected void SaveInvFolder(InventoryFolderImpl inventoryFolder, string path, bool saveThisFolderItself) 161 protected void SaveInvFolder(InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself)
162 { 162 {
163 if (saveThisFolderItself) 163 if (saveThisFolderItself)
164 { 164 {
@@ -173,15 +173,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
173 m_archiveWriter.WriteDir(path); 173 m_archiveWriter.WriteDir(path);
174 } 174 }
175 175
176 List<InventoryFolderImpl> childFolders = inventoryFolder.RequestListOfFolderImpls(); 176 InventoryCollection contents
177 List<InventoryItemBase> items = inventoryFolder.RequestListOfItems(); 177 = m_scene.InventoryService.GetFolderContent(inventoryFolder.Owner, inventoryFolder.ID);
178 //List<InventoryFolderImpl> childFolders = inventoryFolder.RequestListOfFolderImpls();
179 //List<InventoryItemBase> items = inventoryFolder.RequestListOfItems();
178 180
179 /* 181 /*
180 Dictionary identicalFolderNames = new Dictionary<string, int>(); 182 Dictionary identicalFolderNames = new Dictionary<string, int>();
181 183
182 foreach (InventoryFolderImpl folder in inventories) 184 foreach (InventoryFolderImpl folder in inventories)
183 { 185 {
184
185 if (!identicalFolderNames.ContainsKey(folder.Name)) 186 if (!identicalFolderNames.ContainsKey(folder.Name))
186 identicalFolderNames[folder.Name] = 0; 187 identicalFolderNames[folder.Name] = 0;
187 else 188 else
@@ -197,12 +198,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
197 } 198 }
198 */ 199 */
199 200
200 foreach (InventoryFolderImpl childFolder in childFolders) 201 foreach (InventoryFolderBase childFolder in contents.Folders)
201 { 202 {
202 SaveInvFolder(childFolder, path, true); 203 SaveInvFolder(childFolder, path, true);
203 } 204 }
204 205
205 foreach (InventoryItemBase item in items) 206 foreach (InventoryItemBase item in contents.Items)
206 { 207 {
207 SaveInvItem(item, path); 208 SaveInvItem(item, path);
208 } 209 }
@@ -213,8 +214,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
213 /// </summary> 214 /// </summary>
214 public void Execute() 215 public void Execute()
215 { 216 {
216 InventoryFolderImpl inventoryFolder = null; 217 InventoryFolderBase inventoryFolder = null;
217 InventoryItemBase inventoryItem = null; 218 InventoryItemBase inventoryItem = null;
219 InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.UserProfile.ID);
218 220
219 // XXX: Very temporarily, drop and refetch inventory to make sure we have any newly created items in cache 221 // XXX: Very temporarily, drop and refetch inventory to make sure we have any newly created items in cache
220 // This will disappear very soon once we stop using the old cached inventory. 222 // This will disappear very soon once we stop using the old cached inventory.
@@ -223,6 +225,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
223 m_userInfo.FetchInventory(); 225 m_userInfo.FetchInventory();
224 */ 226 */
225 227
228 /*
226 if (!m_userInfo.HasReceivedInventory) 229 if (!m_userInfo.HasReceivedInventory)
227 { 230 {
228 // If the region server has access to the user admin service (by which users are created), 231 // If the region server has access to the user admin service (by which users are created),
@@ -244,11 +247,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
244 m_userInfo.FetchInventory(); 247 m_userInfo.FetchInventory();
245 } 248 }
246 } 249 }
250 */
247 251
248 bool foundStar = false; 252 bool foundStar = false;
249 253
250 // Eliminate double slashes and any leading / on the path. This might be better done within InventoryFolderImpl 254 // Eliminate double slashes and any leading / on the path.
251 // itself (possibly at a small loss in efficiency).
252 string[] components 255 string[] components
253 = m_invPath.Split( 256 = m_invPath.Split(
254 new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries); 257 new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries);
@@ -273,18 +276,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
273 // Therefore if we still start with a / after the split, then we need the root folder 276 // Therefore if we still start with a / after the split, then we need the root folder
274 if (m_invPath.Length == 0) 277 if (m_invPath.Length == 0)
275 { 278 {
276 inventoryFolder = m_userInfo.RootFolder; 279 inventoryFolder = rootFolder;
277 } 280 }
278 else 281 else
279 { 282 {
280 m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER)); 283 m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER));
281 inventoryFolder = m_userInfo.RootFolder.FindFolderByPath(m_invPath); 284 inventoryFolder
285 = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, rootFolder, m_invPath);
286 //inventoryFolder = m_userInfo.RootFolder.FindFolderByPath(m_invPath);
282 } 287 }
283 288
284 // The path may point to an item instead 289 // The path may point to an item instead
285 if (inventoryFolder == null) 290 if (inventoryFolder == null)
286 { 291 {
287 inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath); 292 inventoryItem = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, rootFolder, m_invPath);
293 //inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath);
288 } 294 }
289 295
290 m_archiveWriter = new TarArchiveWriter(m_saveStream); 296 m_archiveWriter = new TarArchiveWriter(m_saveStream);