aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Application/OpenSim.cs6
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs11
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs28
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs54
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs5
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs11
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs26
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs42
9 files changed, 114 insertions, 79 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 6127c2d..ae2d836 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -265,10 +265,10 @@ namespace OpenSim
265 LoadOar); 265 LoadOar);
266 266
267 m_console.Commands.AddCommand("region", false, "save oar", 267 m_console.Commands.AddCommand("region", false, "save oar",
268 "save oar [-v|--version=N] [-p|--profile=url] [<OAR path>]", 268 "save oar [-v|--version=<N>] [-p|--profile=<url>] [<OAR path>]",
269 "Save a region's data to an OAR archive.", 269 "Save a region's data to an OAR archive.",
270 "-v|--version=N generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine 270 "-v|--version=<N> generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine
271 + "-p|--profile=url adds the url of the profile service to the saved user information" + Environment.NewLine 271 + "-p|--profile=<url> adds the url of the profile service to the saved user information" + Environment.NewLine
272 + "The OAR path must be a filesystem path." 272 + "The OAR path must be a filesystem path."
273 + " If this is not given then the oar is saved to region.oar in the current directory.", 273 + " If this is not given then the oar is saved to region.oar in the current directory.",
274 SaveOar); 274 SaveOar);
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 046b05f..870ead2 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -37,12 +37,11 @@ using System.Xml.Linq;
37using log4net; 37using log4net;
38using OpenMetaverse; 38using OpenMetaverse;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Framework.Communications;
41using OpenSim.Framework.Communications.Osp;
42using OpenSim.Framework.Serialization; 40using OpenSim.Framework.Serialization;
43using OpenSim.Framework.Serialization.External; 41using OpenSim.Framework.Serialization.External;
44using OpenSim.Region.CoreModules.World.Archiver; 42using OpenSim.Region.CoreModules.World.Archiver;
45using OpenSim.Region.Framework.Scenes; 43using OpenSim.Region.Framework.Scenes;
44using OpenSim.Region.Framework.Interfaces;
46using OpenSim.Services.Interfaces; 45using OpenSim.Services.Interfaces;
47 46
48namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver 47namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
@@ -398,16 +397,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
398 // Don't use the item ID that's in the file 397 // Don't use the item ID that's in the file
399 item.ID = UUID.Random(); 398 item.ID = UUID.Random();
400 399
401 UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.UserAccountService); 400 UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.UserAccountService);
402 if (UUID.Zero != ospResolvedId) 401 if (UUID.Zero != ospResolvedId) // The user exists in this grid
403 { 402 {
404 item.CreatorIdAsUuid = ospResolvedId; 403 item.CreatorIdAsUuid = ospResolvedId;
405 404
406 // XXX: For now, don't preserve the OSPA in the creator id (which actually gets persisted to the 405 // XXX: For now, don't preserve the OSPA in the creator id (which actually gets persisted to the
407 // database). Instead, replace with the UUID that we found. 406 // database). Instead, replace with the UUID that we found.
408 item.CreatorId = ospResolvedId.ToString(); 407 item.CreatorId = ospResolvedId.ToString();
408
409 item.CreatorData = string.Empty;
409 } 410 }
410 else 411 else if (item.CreatorData == null || item.CreatorData == String.Empty)
411 { 412 {
412 item.CreatorIdAsUuid = m_userInfo.PrincipalID; 413 item.CreatorIdAsUuid = m_userInfo.PrincipalID;
413 } 414 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index d81703a..cab341d 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -36,8 +36,6 @@ using OpenMetaverse;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Serialization; 37using OpenSim.Framework.Serialization;
38using OpenSim.Framework.Serialization.External; 38using OpenSim.Framework.Serialization.External;
39using OpenSim.Framework.Communications;
40using OpenSim.Framework.Communications.Osp;
41using OpenSim.Region.CoreModules.World.Archiver; 39using OpenSim.Region.CoreModules.World.Archiver;
42using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
43using OpenSim.Services.Interfaces; 41using OpenSim.Services.Interfaces;
@@ -139,20 +137,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
139 m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException); 137 m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException);
140 } 138 }
141 139
142 protected void SaveInvItem(InventoryItemBase inventoryItem, string path) 140 protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService)
143 { 141 {
144 string filename = path + CreateArchiveItemName(inventoryItem); 142 string filename = path + CreateArchiveItemName(inventoryItem);
145 143
146 // Record the creator of this item for user record purposes (which might go away soon) 144 // Record the creator of this item for user record purposes (which might go away soon)
147 m_userUuids[inventoryItem.CreatorIdAsUuid] = 1; 145 m_userUuids[inventoryItem.CreatorIdAsUuid] = 1;
148 146
149 InventoryItemBase saveItem = (InventoryItemBase)inventoryItem.Clone(); 147 string serialization = UserInventoryItemSerializer.Serialize(inventoryItem, options, userAccountService);
150 saveItem.CreatorId = OspResolver.MakeOspa(saveItem.CreatorIdAsUuid, m_scene.UserAccountService);
151
152 string serialization = UserInventoryItemSerializer.Serialize(saveItem);
153 m_archiveWriter.WriteFile(filename, serialization); 148 m_archiveWriter.WriteFile(filename, serialization);
154 149
155 m_assetGatherer.GatherAssetUuids(saveItem.AssetID, (AssetType)saveItem.AssetType, m_assetUuids); 150 m_assetGatherer.GatherAssetUuids(inventoryItem.AssetID, (AssetType)inventoryItem.AssetType, m_assetUuids);
156 } 151 }
157 152
158 /// <summary> 153 /// <summary>
@@ -161,7 +156,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
161 /// <param name="inventoryFolder">The inventory folder to save</param> 156 /// <param name="inventoryFolder">The inventory folder to save</param>
162 /// <param name="path">The path to which the folder should be saved</param> 157 /// <param name="path">The path to which the folder should be saved</param>
163 /// <param name="saveThisFolderItself">If true, save this folder itself. If false, only saves contents</param> 158 /// <param name="saveThisFolderItself">If true, save this folder itself. If false, only saves contents</param>
164 protected void SaveInvFolder(InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself) 159 protected void SaveInvFolder(InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, Dictionary<string, object> options, IUserAccountService userAccountService)
165 { 160 {
166 if (saveThisFolderItself) 161 if (saveThisFolderItself)
167 { 162 {
@@ -176,19 +171,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
176 171
177 foreach (InventoryFolderBase childFolder in contents.Folders) 172 foreach (InventoryFolderBase childFolder in contents.Folders)
178 { 173 {
179 SaveInvFolder(childFolder, path, true); 174 SaveInvFolder(childFolder, path, true, options, userAccountService);
180 } 175 }
181 176
182 foreach (InventoryItemBase item in contents.Items) 177 foreach (InventoryItemBase item in contents.Items)
183 { 178 {
184 SaveInvItem(item, path); 179 SaveInvItem(item, path, options, userAccountService);
185 } 180 }
186 } 181 }
187 182
188 /// <summary> 183 /// <summary>
189 /// Execute the inventory write request 184 /// Execute the inventory write request
190 /// </summary> 185 /// </summary>
191 public void Execute() 186 public void Execute(Dictionary<string, object> options, IUserAccountService userAccountService)
192 { 187 {
193 try 188 try
194 { 189 {
@@ -266,7 +261,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
266 m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath); 261 m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath);
267 262
268 //recurse through all dirs getting dirs and files 263 //recurse through all dirs getting dirs and files
269 SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly); 264 SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly, options, userAccountService);
270 } 265 }
271 else if (inventoryItem != null) 266 else if (inventoryItem != null)
272 { 267 {
@@ -274,14 +269,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
274 "[INVENTORY ARCHIVER]: Found item {0} {1} at {2}", 269 "[INVENTORY ARCHIVER]: Found item {0} {1} at {2}",
275 inventoryItem.Name, inventoryItem.ID, m_invPath); 270 inventoryItem.Name, inventoryItem.ID, m_invPath);
276 271
277 SaveInvItem(inventoryItem, ArchiveConstants.INVENTORY_PATH); 272 SaveInvItem(inventoryItem, ArchiveConstants.INVENTORY_PATH, options, userAccountService);
278 } 273 }
279 274
280 // Don't put all this profile information into the archive right now. 275 // Don't put all this profile information into the archive right now.
281 //SaveUsers(); 276 //SaveUsers();
282 277
283 new AssetsRequest( 278 new AssetsRequest(
284 new AssetsArchiver(m_archiveWriter), m_assetUuids, m_scene.AssetService, ReceivedAllAssets).Execute(); 279 new AssetsArchiver(m_archiveWriter),
280 m_assetUuids, m_scene.AssetService,
281 m_scene.UserAccountService, m_scene.RegionInfo.ScopeID,
282 options, ReceivedAllAssets).Execute();
285 } 283 }
286 catch (Exception) 284 catch (Exception)
287 { 285 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index 2eaca49..421ea30 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -75,6 +75,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
75 private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); 75 private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
76 private Scene m_aScene; 76 private Scene m_aScene;
77 77
78 private IUserAccountService m_UserAccountService;
79 protected IUserAccountService UserAccountService
80 {
81 get
82 {
83 if (m_UserAccountService == null)
84 // What a strange thing to do...
85 foreach (Scene s in m_scenes.Values)
86 {
87 m_UserAccountService = s.RequestModuleInterface<IUserAccountService>();
88 break;
89 }
90
91 return m_UserAccountService;
92 }
93 }
94
95
78 public InventoryArchiverModule() {} 96 public InventoryArchiverModule() {}
79 97
80 public InventoryArchiverModule(bool disablePresenceChecks) 98 public InventoryArchiverModule(bool disablePresenceChecks)
@@ -106,11 +124,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
106 124
107 scene.AddCommand( 125 scene.AddCommand(
108 this, "save iar", 126 this, "save iar",
109 "save iar <first> <last> <inventory path> <password> [<IAR path>]", 127 "save iar <first> <last> <inventory path> <password> [--p|-profile=<url>] [<IAR path>]",
110 "Save user inventory archive (IAR).", 128 "Save user inventory archive (IAR).",
111 "<first> is the user's first name." + Environment.NewLine 129 "<first> is the user's first name." + Environment.NewLine
112 + "<last> is the user's last name." + Environment.NewLine 130 + "<last> is the user's last name." + Environment.NewLine
113 + "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine 131 + "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine
132 + "-p|--profile=<url> adds the url of the profile service to the saved user information." + Environment.NewLine
114 + "<IAR path> is the filesystem path at which to save the IAR." 133 + "<IAR path> is the filesystem path at which to save the IAR."
115 + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME), 134 + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME),
116 HandleSaveInvConsoleCommand); 135 HandleSaveInvConsoleCommand);
@@ -157,7 +176,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
157 { 176 {
158 try 177 try
159 { 178 {
160 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(); 179 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(options, UserAccountService);
161 } 180 }
162 catch (EntryPointNotFoundException e) 181 catch (EntryPointNotFoundException e)
163 { 182 {
@@ -197,7 +216,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
197 { 216 {
198 try 217 try
199 { 218 {
200 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(); 219 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(options, UserAccountService);
201 } 220 }
202 catch (EntryPointNotFoundException e) 221 catch (EntryPointNotFoundException e)
203 { 222 {
@@ -368,10 +387,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
368 protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams) 387 protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams)
369 { 388 {
370 Guid id = Guid.NewGuid(); 389 Guid id = Guid.NewGuid();
371 390
391 Dictionary<string, object> options = new Dictionary<string, object>();
392
393 OptionSet ops = new OptionSet();
394 //ops.Add("v|version=", delegate(string v) { options["version"] = v; });
395 ops.Add("p|profile=", delegate(string v) { options["profile"] = v; });
396
397 List<string> mainParams = ops.Parse(cmdparams);
398
372 try 399 try
373 { 400 {
374 if (cmdparams.Length < 6) 401 if (mainParams.Count < 6)
375 { 402 {
376 m_log.Error( 403 m_log.Error(
377 "[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <user password> [<save file path>]"); 404 "[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <user password> [<save file path>]");
@@ -379,18 +406,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
379 } 406 }
380 407
381 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); 408 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
382 409 if (options.ContainsKey("profile"))
383 string firstName = cmdparams[2]; 410 m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -profile option if you want to produce a compatible IAR");
384 string lastName = cmdparams[3]; 411
385 string invPath = cmdparams[4]; 412 string firstName = mainParams[2];
386 string pass = cmdparams[5]; 413 string lastName = mainParams[3];
387 string savePath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME); 414 string invPath = mainParams[4];
415 string pass = mainParams[5];
416 string savePath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME);
388 417
389 m_log.InfoFormat( 418 m_log.InfoFormat(
390 "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", 419 "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
391 savePath, invPath, firstName, lastName); 420 savePath, invPath, firstName, lastName);
392 421
393 ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>()); 422 ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, options);
394 } 423 }
395 catch (InventoryArchiverException e) 424 catch (InventoryArchiverException e)
396 { 425 {
@@ -518,5 +547,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
518 547
519 return false; 548 return false;
520 } 549 }
550
521 } 551 }
522} 552}
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 938886b2..1e39c39 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -38,7 +38,6 @@ using OpenSim.Framework;
38using OpenSim.Framework.Serialization; 38using OpenSim.Framework.Serialization;
39using OpenSim.Framework.Serialization.External; 39using OpenSim.Framework.Serialization.External;
40using OpenSim.Framework.Communications; 40using OpenSim.Framework.Communications;
41using OpenSim.Framework.Communications.Osp;
42using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; 41using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
43using OpenSim.Region.CoreModules.World.Serialiser; 42using OpenSim.Region.CoreModules.World.Serialiser;
44using OpenSim.Region.Framework.Scenes; 43using OpenSim.Region.Framework.Scenes;
@@ -103,7 +102,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
103 102
104 string item1FileName 103 string item1FileName
105 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); 104 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
106 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); 105 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1, new Dictionary<string, object>(), null));
107 tar.Close(); 106 tar.Close();
108 m_iarStream = new MemoryStream(archiveWriteStream.ToArray()); 107 m_iarStream = new MemoryStream(archiveWriteStream.ToArray());
109 } 108 }
@@ -551,7 +550,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
551 550
552 string item1FileName 551 string item1FileName
553 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); 552 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
554 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); 553 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1, new Dictionary<string,object>(), null));
555 tar.Close(); 554 tar.Close();
556 555
557 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); 556 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 1ff1a47..1ebccd1 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -799,9 +799,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
799 protected virtual InventoryItemBase GetItem(UUID agentID, UUID itemID) 799 protected virtual InventoryItemBase GetItem(UUID agentID, UUID itemID)
800 { 800 {
801 IInventoryService invService = m_Scene.RequestModuleInterface<IInventoryService>(); 801 IInventoryService invService = m_Scene.RequestModuleInterface<IInventoryService>();
802 InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, agentID); 802 InventoryItemBase item = new InventoryItemBase(itemID, agentID);
803 assetRequestItem = invService.GetItem(assetRequestItem); 803 item = invService.GetItem(item);
804 return assetRequestItem; 804
805 if (item.CreatorData != null && item.CreatorData != string.Empty)
806 UserManagementModule.AddUser(item.CreatorIdAsUuid, item.CreatorData);
807
808 return item;
805 } 809 }
806 810
807 #endregion 811 #endregion
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index b987b5a..0699407 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -190,7 +190,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
190 190
191 new AssetsRequest( 191 new AssetsRequest(
192 new AssetsArchiver(archiveWriter), assetUuids, 192 new AssetsArchiver(archiveWriter), assetUuids,
193 m_scene.AssetService, awre.ReceivedAllAssets).Execute(); 193 m_scene.AssetService, m_scene.UserAccountService,
194 m_scene.RegionInfo.ScopeID, options, awre.ReceivedAllAssets).Execute();
194 } 195 }
195 catch (Exception) 196 catch (Exception)
196 { 197 {
@@ -238,10 +239,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
238 } 239 }
239 240
240 m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion); 241 m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion);
241 if (majorVersion == 1) 242 //if (majorVersion == 1)
242 { 243 //{
243 m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR"); 244 // m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR");
244 } 245 //}
245 246
246 StringWriter sw = new StringWriter(); 247 StringWriter sw = new StringWriter();
247 XmlTextWriter xtw = new XmlTextWriter(sw); 248 XmlTextWriter xtw = new XmlTextWriter(sw);
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
index d4a09b4..5da1656 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
@@ -34,6 +34,7 @@ using log4net;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Serialization; 36using OpenSim.Framework.Serialization;
37using OpenSim.Framework.Serialization.External;
37using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
38 39
39namespace OpenSim.Region.CoreModules.World.Archiver 40namespace OpenSim.Region.CoreModules.World.Archiver
@@ -100,17 +101,26 @@ namespace OpenSim.Region.CoreModules.World.Archiver
100 /// Asset service used to request the assets 101 /// Asset service used to request the assets
101 /// </value> 102 /// </value>
102 protected IAssetService m_assetService; 103 protected IAssetService m_assetService;
104 protected IUserAccountService m_userAccountService;
105 protected UUID m_scopeID; // the grid ID
103 106
104 protected AssetsArchiver m_assetsArchiver; 107 protected AssetsArchiver m_assetsArchiver;
105 108
109 protected Dictionary<string, object> m_options;
110
106 protected internal AssetsRequest( 111 protected internal AssetsRequest(
107 AssetsArchiver assetsArchiver, IDictionary<UUID, AssetType> uuids, 112 AssetsArchiver assetsArchiver, IDictionary<UUID, AssetType> uuids,
108 IAssetService assetService, AssetsRequestCallback assetsRequestCallback) 113 IAssetService assetService, IUserAccountService userService,
114 UUID scope, Dictionary<string, object> options,
115 AssetsRequestCallback assetsRequestCallback)
109 { 116 {
110 m_assetsArchiver = assetsArchiver; 117 m_assetsArchiver = assetsArchiver;
111 m_uuids = uuids; 118 m_uuids = uuids;
112 m_assetsRequestCallback = assetsRequestCallback; 119 m_assetsRequestCallback = assetsRequestCallback;
113 m_assetService = assetService; 120 m_assetService = assetService;
121 m_userAccountService = userService;
122 m_scopeID = scope;
123 m_options = options;
114 m_repliesRequired = uuids.Count; 124 m_repliesRequired = uuids.Count;
115 125
116 m_requestCallbackTimer = new System.Timers.Timer(TIMEOUT); 126 m_requestCallbackTimer = new System.Timers.Timer(TIMEOUT);
@@ -241,7 +251,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
241 { 251 {
242// m_log.DebugFormat("[ARCHIVER]: Writing asset {0}", id); 252// m_log.DebugFormat("[ARCHIVER]: Writing asset {0}", id);
243 m_foundAssetUuids.Add(asset.FullID); 253 m_foundAssetUuids.Add(asset.FullID);
244 m_assetsArchiver.WriteAsset(asset); 254
255 m_assetsArchiver.WriteAsset(PostProcess(asset));
245 } 256 }
246 else 257 else
247 { 258 {
@@ -288,5 +299,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver
288 "[ARCHIVER]: Terminating archive creation since asset requster callback failed with {0}", e); 299 "[ARCHIVER]: Terminating archive creation since asset requster callback failed with {0}", e);
289 } 300 }
290 } 301 }
302
303 protected AssetBase PostProcess(AssetBase asset)
304 {
305 if (asset.Type == (sbyte)AssetType.Object && asset.Data != null && m_options.ContainsKey("profile"))
306 {
307 //m_log.DebugFormat("[ARCHIVER]: Rewriting object data for {0}", asset.ID);
308 string xml = ExternalRepresentationUtils.RewriteSOP(Utils.BytesToString(asset.Data), m_options["profile"].ToString(), m_userAccountService, m_scopeID);
309 asset.Data = Utils.StringToBytes(xml);
310 }
311 return asset;
312 }
291 } 313 }
292} 314}
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index da25e80..6c9826f 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -409,7 +409,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
409 #region SOPXmlProcessors 409 #region SOPXmlProcessors
410 private static void ProcessAllowedDrop(SceneObjectPart obj, XmlTextReader reader) 410 private static void ProcessAllowedDrop(SceneObjectPart obj, XmlTextReader reader)
411 { 411 {
412 obj.AllowedDrop = reader.ReadElementContentAsBoolean("AllowedDrop", String.Empty); 412 obj.AllowedDrop = Util.ReadBoolean(reader);
413 } 413 }
414 414
415 private static void ProcessCreatorID(SceneObjectPart obj, XmlTextReader reader) 415 private static void ProcessCreatorID(SceneObjectPart obj, XmlTextReader reader)
@@ -459,7 +459,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
459 459
460 private static void ProcessPassTouches(SceneObjectPart obj, XmlTextReader reader) 460 private static void ProcessPassTouches(SceneObjectPart obj, XmlTextReader reader)
461 { 461 {
462 obj.PassTouches = reader.ReadElementContentAsBoolean("PassTouches", String.Empty); 462 obj.PassTouches = Util.ReadBoolean(reader);
463 } 463 }
464 464
465 private static void ProcessRegionHandle(SceneObjectPart obj, XmlTextReader reader) 465 private static void ProcessRegionHandle(SceneObjectPart obj, XmlTextReader reader)
@@ -654,11 +654,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
654 654
655 private static void ProcessFlags(SceneObjectPart obj, XmlTextReader reader) 655 private static void ProcessFlags(SceneObjectPart obj, XmlTextReader reader)
656 { 656 {
657 string value = reader.ReadElementContentAsString("Flags", String.Empty); 657 obj.Flags = Util.ReadEnum<PrimFlags>(reader, "Flags");
658 // !!!!! to deal with flags without commas
659 if (value.Contains(" ") && !value.Contains(","))
660 value = value.Replace(" ", ", ");
661 obj.Flags = (PrimFlags)Enum.Parse(typeof(PrimFlags), value);
662 } 658 }
663 659
664 private static void ProcessCollisionSound(SceneObjectPart obj, XmlTextReader reader) 660 private static void ProcessCollisionSound(SceneObjectPart obj, XmlTextReader reader)
@@ -808,7 +804,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
808 804
809 private static void ProcessTIOwnerChanged(TaskInventoryItem item, XmlTextReader reader) 805 private static void ProcessTIOwnerChanged(TaskInventoryItem item, XmlTextReader reader)
810 { 806 {
811 item.OwnerChanged = reader.ReadElementContentAsBoolean("OwnerChanged", String.Empty); 807 item.OwnerChanged = Util.ReadBoolean(reader);
812 } 808 }
813 809
814 #endregion 810 #endregion
@@ -932,20 +928,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
932 928
933 private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlTextReader reader) 929 private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlTextReader reader)
934 { 930 {
935 string value = reader.ReadElementContentAsString("ProfileShape", String.Empty); 931 shp.ProfileShape = Util.ReadEnum<ProfileShape>(reader, "ProfileShape");
936 // !!!!! to deal with flags without commas
937 if (value.Contains(" ") && !value.Contains(","))
938 value = value.Replace(" ", ", ");
939 shp.ProfileShape = (ProfileShape)Enum.Parse(typeof(ProfileShape), value);
940 } 932 }
941 933
942 private static void ProcessShpHollowShape(PrimitiveBaseShape shp, XmlTextReader reader) 934 private static void ProcessShpHollowShape(PrimitiveBaseShape shp, XmlTextReader reader)
943 { 935 {
944 string value = reader.ReadElementContentAsString("HollowShape", String.Empty); 936 shp.HollowShape = Util.ReadEnum<HollowShape>(reader, "HollowShape");
945 // !!!!! to deal with flags without commas
946 if (value.Contains(" ") && !value.Contains(","))
947 value = value.Replace(" ", ", ");
948 shp.HollowShape = (HollowShape)Enum.Parse(typeof(HollowShape), value);
949 } 937 }
950 938
951 private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlTextReader reader) 939 private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlTextReader reader)
@@ -1045,17 +1033,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1045 1033
1046 private static void ProcessShpFlexiEntry(PrimitiveBaseShape shp, XmlTextReader reader) 1034 private static void ProcessShpFlexiEntry(PrimitiveBaseShape shp, XmlTextReader reader)
1047 { 1035 {
1048 shp.FlexiEntry = reader.ReadElementContentAsBoolean("FlexiEntry", String.Empty); 1036 shp.FlexiEntry = Util.ReadBoolean(reader);
1049 } 1037 }
1050 1038
1051 private static void ProcessShpLightEntry(PrimitiveBaseShape shp, XmlTextReader reader) 1039 private static void ProcessShpLightEntry(PrimitiveBaseShape shp, XmlTextReader reader)
1052 { 1040 {
1053 shp.LightEntry = reader.ReadElementContentAsBoolean("LightEntry", String.Empty); 1041 shp.LightEntry = Util.ReadBoolean(reader);
1054 } 1042 }
1055 1043
1056 private static void ProcessShpSculptEntry(PrimitiveBaseShape shp, XmlTextReader reader) 1044 private static void ProcessShpSculptEntry(PrimitiveBaseShape shp, XmlTextReader reader)
1057 { 1045 {
1058 shp.SculptEntry = reader.ReadElementContentAsBoolean("SculptEntry", String.Empty); 1046 shp.SculptEntry = Util.ReadBoolean(reader);
1059 } 1047 }
1060 1048
1061 private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlTextReader reader) 1049 private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlTextReader reader)
@@ -1220,16 +1208,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1220 1208
1221 static void WriteFlags(XmlTextWriter writer, string name, string flagsStr, Dictionary<string, object> options) 1209 static void WriteFlags(XmlTextWriter writer, string name, string flagsStr, Dictionary<string, object> options)
1222 { 1210 {
1223 // Older versions of serialization can't cope with commas 1211 // Older versions of serialization can't cope with commas, so we eliminate the commas
1224 if (options.ContainsKey("version")) 1212 writer.WriteElementString(name, flagsStr.Replace(",", ""));
1225 {
1226 float version = 0.5F;
1227 float.TryParse(options["version"].ToString(), out version);
1228 if (version < 0.5)
1229 flagsStr = flagsStr.Replace(",", "");
1230 }
1231
1232 writer.WriteElementString(name, flagsStr);
1233 } 1213 }
1234 1214
1235 static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options, Scene scene) 1215 static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options, Scene scene)