aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMike Mazur2009-03-16 00:12:25 +0000
committerMike Mazur2009-03-16 00:12:25 +0000
commitf28886e26d32eaf97180d91dcd42fa045990bdd0 (patch)
tree69f36a36c809c9961758897d43c85413b1d4dd77 /OpenSim
parentThis patch improves MXP connect and disconnect functionality. (diff)
downloadopensim-SC-f28886e26d32eaf97180d91dcd42fa045990bdd0.zip
opensim-SC-f28886e26d32eaf97180d91dcd42fa045990bdd0.tar.gz
opensim-SC-f28886e26d32eaf97180d91dcd42fa045990bdd0.tar.bz2
opensim-SC-f28886e26d32eaf97180d91dcd42fa045990bdd0.tar.xz
Rename OpenSim.Framework.Archive to OpenSim.Framework.Serialization
Update using statements and prebuild.xml. Also trim trailing whitespace.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Serialization/ArchiveConstants.cs (renamed from OpenSim/Framework/Archive/ArchiveConstants.cs)2
-rw-r--r--OpenSim/Framework/Serialization/TarArchiveReader.cs (renamed from OpenSim/Framework/Archive/TarArchiveReader.cs)2
-rw-r--r--OpenSim/Framework/Serialization/TarArchiveWriter.cs (renamed from OpenSim/Framework/Archive/TarArchiveWriter.cs)2
-rw-r--r--OpenSim/Grid/AssetInventoryServer/Plugins/InventoryArchivePlugin.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs14
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs10
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs26
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs12
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs154
12 files changed, 115 insertions, 115 deletions
diff --git a/OpenSim/Framework/Archive/ArchiveConstants.cs b/OpenSim/Framework/Serialization/ArchiveConstants.cs
index f830e98..d0a0985 100644
--- a/OpenSim/Framework/Archive/ArchiveConstants.cs
+++ b/OpenSim/Framework/Serialization/ArchiveConstants.cs
@@ -28,7 +28,7 @@
28using System.Collections.Generic; 28using System.Collections.Generic;
29using OpenMetaverse; 29using OpenMetaverse;
30 30
31namespace OpenSim.Framework.Archive 31namespace OpenSim.Framework.Serialization
32{ 32{
33 /// <summary> 33 /// <summary>
34 /// Constants for the archiving module 34 /// Constants for the archiving module
diff --git a/OpenSim/Framework/Archive/TarArchiveReader.cs b/OpenSim/Framework/Serialization/TarArchiveReader.cs
index eee65f5..da5703f 100644
--- a/OpenSim/Framework/Archive/TarArchiveReader.cs
+++ b/OpenSim/Framework/Serialization/TarArchiveReader.cs
@@ -31,7 +31,7 @@ using System.Reflection;
31using System.Text; 31using System.Text;
32using log4net; 32using log4net;
33 33
34namespace OpenSim.Framework.Archive 34namespace OpenSim.Framework.Serialization
35{ 35{
36 /// <summary> 36 /// <summary>
37 /// Temporary code to do the bare minimum required to read a tar archive for our purposes 37 /// Temporary code to do the bare minimum required to read a tar archive for our purposes
diff --git a/OpenSim/Framework/Archive/TarArchiveWriter.cs b/OpenSim/Framework/Serialization/TarArchiveWriter.cs
index 59198b8..d319b0b 100644
--- a/OpenSim/Framework/Archive/TarArchiveWriter.cs
+++ b/OpenSim/Framework/Serialization/TarArchiveWriter.cs
@@ -30,7 +30,7 @@ using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Text; 31using System.Text;
32 32
33namespace OpenSim.Framework.Archive 33namespace OpenSim.Framework.Serialization
34{ 34{
35 /// <summary> 35 /// <summary>
36 /// Temporary code to produce a tar archive in tar v7 format 36 /// Temporary code to produce a tar archive in tar v7 format
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/InventoryArchivePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/InventoryArchivePlugin.cs
index cd02a64..06b0220 100644
--- a/OpenSim/Grid/AssetInventoryServer/Plugins/InventoryArchivePlugin.cs
+++ b/OpenSim/Grid/AssetInventoryServer/Plugins/InventoryArchivePlugin.cs
@@ -33,7 +33,7 @@ using System.Xml;
33using System.Reflection; 33using System.Reflection;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Archive; 36using OpenSim.Framework.Serialization;
37using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
38using log4net; 38using log4net;
39 39
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 4ad9974..8dec2c4 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -35,7 +35,7 @@ using System.Xml;
35using log4net; 35using log4net;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Archive; 38using OpenSim.Framework.Serialization;
39using OpenSim.Framework.Communications; 39using OpenSim.Framework.Communications;
40using OpenSim.Framework.Communications.Cache; 40using OpenSim.Framework.Communications.Cache;
41using OpenSim.Region.CoreModules.World.Archiver; 41using OpenSim.Region.CoreModules.World.Archiver;
@@ -208,19 +208,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
208 failedAssetRestores++; 208 failedAssetRestores++;
209 } 209 }
210 else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH)) 210 else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH))
211 { 211 {
212 string fsPath = filePath.Substring(ArchiveConstants.INVENTORY_PATH.Length); 212 string fsPath = filePath.Substring(ArchiveConstants.INVENTORY_PATH.Length);
213 213
214 // Remove the file portion if we aren't already dealing with a directory path 214 // Remove the file portion if we aren't already dealing with a directory path
215 if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType) 215 if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType)
216 fsPath = fsPath.Remove(fsPath.LastIndexOf("/") + 1); 216 fsPath = fsPath.Remove(fsPath.LastIndexOf("/") + 1);
217 217
218 string originalFsPath = fsPath; 218 string originalFsPath = fsPath;
219 219
220 m_log.DebugFormat("[INVENTORY ARCHIVER]: Loading to folder {0}", fsPath); 220 m_log.DebugFormat("[INVENTORY ARCHIVER]: Loading to folder {0}", fsPath);
221 221
222 InventoryFolderImpl foundFolder = null; 222 InventoryFolderImpl foundFolder = null;
223 223
224 // XXX: Nasty way of dealing with a path that has no directory component 224 // XXX: Nasty way of dealing with a path that has no directory component
225 if (fsPath.Length > 0) 225 if (fsPath.Length > 0)
226 { 226 {
@@ -323,15 +323,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
323 if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType) 323 if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType)
324 { 324 {
325 InventoryItemBase item = LoadInvItem(m_asciiEncoding.GetString(data)); 325 InventoryItemBase item = LoadInvItem(m_asciiEncoding.GetString(data));
326 326
327 if (item != null) 327 if (item != null)
328 { 328 {
329 // Don't use the item ID that's in the file 329 // Don't use the item ID that's in the file
330 item.ID = UUID.Random(); 330 item.ID = UUID.Random();
331 331
332 item.Creator = m_userInfo.UserProfile.ID; 332 item.Creator = m_userInfo.UserProfile.ID;
333 item.Owner = m_userInfo.UserProfile.ID; 333 item.Owner = m_userInfo.UserProfile.ID;
334 334
335 // Reset folder ID to the one in which we want to load it 335 // Reset folder ID to the one in which we want to load it
336 item.Folder = foundFolder.ID; 336 item.Folder = foundFolder.ID;
337 337
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index 364dc28..460fbf5 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -34,7 +34,7 @@ using System.Xml;
34using log4net; 34using log4net;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Archive; 37using OpenSim.Framework.Serialization;
38using OpenSim.Framework.Communications; 38using OpenSim.Framework.Communications;
39using OpenSim.Framework.Communications.Cache; 39using OpenSim.Framework.Communications.Cache;
40using OpenSim.Region.CoreModules.World.Archiver; 40using OpenSim.Region.CoreModules.World.Archiver;
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index ea72f08..bd8d325 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -34,7 +34,7 @@ using NUnit.Framework.SyntaxHelpers;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Data; 35using OpenSim.Data;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Archive; 37using OpenSim.Framework.Serialization;
38using OpenSim.Framework.Communications; 38using OpenSim.Framework.Communications;
39using OpenSim.Framework.Communications.Cache; 39using OpenSim.Framework.Communications.Cache;
40using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; 40using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 69766d4..03e4bce 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -35,7 +35,7 @@ using System.Text;
35using log4net; 35using log4net;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Framework.Archive; 38using OpenSim.Framework.Serialization;
39using OpenSim.Framework.Communications.Cache; 39using OpenSim.Framework.Communications.Cache;
40using OpenSim.Region.CoreModules.World.Terrain; 40using OpenSim.Region.CoreModules.World.Terrain;
41using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.Framework.Interfaces;
@@ -52,14 +52,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver
52 52
53 private static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding(); 53 private static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding();
54 54
55 private Scene m_scene; 55 private Scene m_scene;
56 private Stream m_loadStream; 56 private Stream m_loadStream;
57 private string m_errorMessage; 57 private string m_errorMessage;
58 58
59 /// <value> 59 /// <value>
60 /// Should the archive being loaded be merged with what is already on the region? 60 /// Should the archive being loaded be merged with what is already on the region?
61 /// </value> 61 /// </value>
62 private bool m_merge; 62 private bool m_merge;
63 63
64 /// <summary> 64 /// <summary>
65 /// Used to cache lookups for valid uuids. 65 /// Used to cache lookups for valid uuids.
@@ -109,7 +109,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
109 { 109 {
110 //m_log.DebugFormat( 110 //m_log.DebugFormat(
111 // "[ARCHIVER]: Successfully read {0} ({1} bytes)}", filePath, data.Length); 111 // "[ARCHIVER]: Successfully read {0} ({1} bytes)}", filePath, data.Length);
112 112
113 if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType) 113 if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType)
114 { 114 {
115 m_log.WarnFormat( 115 m_log.WarnFormat(
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
index 34332f8..db74564 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
@@ -33,7 +33,7 @@ using System.Xml;
33using log4net; 33using log4net;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Archive; 36using OpenSim.Framework.Serialization;
37using OpenSim.Region.CoreModules.World.Terrain; 37using OpenSim.Region.CoreModules.World.Terrain;
38using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
@@ -44,7 +44,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
44 /// Method called when all the necessary assets for an archive request have been received. 44 /// Method called when all the necessary assets for an archive request have been received.
45 /// </summary> 45 /// </summary>
46 public delegate void AssetsRequestCallback(IDictionary<UUID, AssetBase> assetsFound, ICollection<UUID> assetsNotFoundUuids); 46 public delegate void AssetsRequestCallback(IDictionary<UUID, AssetBase> assetsFound, ICollection<UUID> assetsNotFoundUuids);
47 47
48 /// <summary> 48 /// <summary>
49 /// Execute the write of an archive once we have received all the necessary data 49 /// Execute the write of an archive once we have received all the necessary data
50 /// </summary> 50 /// </summary>
@@ -81,34 +81,34 @@ namespace OpenSim.Region.CoreModules.World.Archiver
81 } 81 }
82 82
83 m_log.InfoFormat( 83 m_log.InfoFormat(
84 "[ARCHIVER]: Received {0} of {1} assets requested", 84 "[ARCHIVER]: Received {0} of {1} assets requested",
85 assetsFound.Count, assetsFound.Count + assetsNotFoundUuids.Count); 85 assetsFound.Count, assetsFound.Count + assetsNotFoundUuids.Count);
86 86
87 m_log.InfoFormat("[ARCHIVER]: Creating archive file. This may take some time."); 87 m_log.InfoFormat("[ARCHIVER]: Creating archive file. This may take some time.");
88 88
89 TarArchiveWriter archive = new TarArchiveWriter(m_saveStream); 89 TarArchiveWriter archive = new TarArchiveWriter(m_saveStream);
90 90
91 // Write out control file 91 // Write out control file
92 archive.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile()); 92 archive.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile());
93 93
94 m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); 94 m_log.InfoFormat("[ARCHIVER]: Added control file to archive.");
95 95
96 // Write out region settings 96 // Write out region settings
97 string settingsPath 97 string settingsPath
98 = String.Format("{0}{1}.xml", ArchiveConstants.SETTINGS_PATH, m_scene.RegionInfo.RegionName); 98 = String.Format("{0}{1}.xml", ArchiveConstants.SETTINGS_PATH, m_scene.RegionInfo.RegionName);
99 archive.WriteFile(settingsPath, RegionSettingsSerializer.Serialize(m_scene.RegionInfo.RegionSettings)); 99 archive.WriteFile(settingsPath, RegionSettingsSerializer.Serialize(m_scene.RegionInfo.RegionSettings));
100 100
101 m_log.InfoFormat("[ARCHIVER]: Added region settings to archive."); 101 m_log.InfoFormat("[ARCHIVER]: Added region settings to archive.");
102 102
103 // Write out terrain 103 // Write out terrain
104 string terrainPath 104 string terrainPath
105 = String.Format("{0}{1}.r32", ArchiveConstants.TERRAINS_PATH, m_scene.RegionInfo.RegionName); 105 = String.Format("{0}{1}.r32", ArchiveConstants.TERRAINS_PATH, m_scene.RegionInfo.RegionName);
106 106
107 MemoryStream ms = new MemoryStream(); 107 MemoryStream ms = new MemoryStream();
108 m_terrainModule.SaveToStream(terrainPath, ms); 108 m_terrainModule.SaveToStream(terrainPath, ms);
109 archive.WriteFile(terrainPath, ms.ToArray()); 109 archive.WriteFile(terrainPath, ms.ToArray());
110 ms.Close(); 110 ms.Close();
111 111
112 m_log.InfoFormat("[ARCHIVER]: Added terrain information to archive."); 112 m_log.InfoFormat("[ARCHIVER]: Added terrain information to archive.");
113 113
114 // Write out scene object metadata 114 // Write out scene object metadata
@@ -128,7 +128,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
128 128
129 archive.WriteFile(filename, serializedObject); 129 archive.WriteFile(filename, serializedObject);
130 } 130 }
131 131
132 m_log.InfoFormat("[ARCHIVER]: Added scene objects to archive."); 132 m_log.InfoFormat("[ARCHIVER]: Added scene objects to archive.");
133 133
134 // Write out assets 134 // Write out assets
@@ -138,7 +138,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
138 archive.Close(); 138 archive.Close();
139 139
140 m_log.InfoFormat("[ARCHIVER]: Wrote out OpenSimulator archive for {0}", m_scene.RegionInfo.RegionName); 140 m_log.InfoFormat("[ARCHIVER]: Wrote out OpenSimulator archive for {0}", m_scene.RegionInfo.RegionName);
141 141
142 m_scene.EventManager.TriggerOarFileSaved(String.Empty); 142 m_scene.EventManager.TriggerOarFileSaved(String.Empty);
143 } 143 }
144 144
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs
index fb78af9..29d7c5e 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs
@@ -32,7 +32,7 @@ using System.Xml;
32using log4net; 32using log4net;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Archive; 35using OpenSim.Framework.Serialization;
36 36
37namespace OpenSim.Region.CoreModules.World.Archiver 37namespace OpenSim.Region.CoreModules.World.Archiver
38{ 38{
@@ -47,7 +47,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
47 /// Post a message to the log every x assets as a progress bar 47 /// Post a message to the log every x assets as a progress bar
48 /// </value> 48 /// </value>
49 private static int LOG_ASSET_LOAD_NOTIFICATION_INTERVAL = 50; 49 private static int LOG_ASSET_LOAD_NOTIFICATION_INTERVAL = 50;
50 50
51 /// <summary> 51 /// <summary>
52 /// Archive assets 52 /// Archive assets
53 /// </summary> 53 /// </summary>
@@ -122,7 +122,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
122 { 122 {
123 // It appears that gtar, at least, doesn't need the intermediate directory entries in the tar 123 // It appears that gtar, at least, doesn't need the intermediate directory entries in the tar
124 //archive.AddDir("assets"); 124 //archive.AddDir("assets");
125 125
126 int assetsAdded = 0; 126 int assetsAdded = 0;
127 127
128 foreach (UUID uuid in m_assets.Keys) 128 foreach (UUID uuid in m_assets.Keys)
@@ -145,13 +145,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
145 archive.WriteFile( 145 archive.WriteFile(
146 ArchiveConstants.ASSETS_PATH + uuid.ToString() + extension, 146 ArchiveConstants.ASSETS_PATH + uuid.ToString() + extension,
147 asset.Data); 147 asset.Data);
148 148
149 assetsAdded++; 149 assetsAdded++;
150 150
151 if (assetsAdded % LOG_ASSET_LOAD_NOTIFICATION_INTERVAL == 0) 151 if (assetsAdded % LOG_ASSET_LOAD_NOTIFICATION_INTERVAL == 0)
152 m_log.InfoFormat("[ARCHIVER]: Added {0} assets to archive", assetsAdded); 152 m_log.InfoFormat("[ARCHIVER]: Added {0} assets to archive", assetsAdded);
153 } 153 }
154 154
155 if (assetsAdded % LOG_ASSET_LOAD_NOTIFICATION_INTERVAL != 0) 155 if (assetsAdded % LOG_ASSET_LOAD_NOTIFICATION_INTERVAL != 0)
156 m_log.InfoFormat("[ARCHIVER]: Added {0} assets to archive", assetsAdded); 156 m_log.InfoFormat("[ARCHIVER]: Added {0} assets to archive", assetsAdded);
157 } 157 }
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs
index 67562a9..dae9a93 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsDearchiver.cs
@@ -34,7 +34,7 @@ using System.Xml;
34using log4net; 34using log4net;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Archive; 37using OpenSim.Framework.Serialization;
38 38
39namespace OpenSim.Region.CoreModules.World.Archiver 39namespace OpenSim.Region.CoreModules.World.Archiver
40{ 40{
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index f6d0347..6a64ff1 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -34,7 +34,7 @@ using NUnit.Framework;
34using NUnit.Framework.SyntaxHelpers; 34using NUnit.Framework.SyntaxHelpers;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Archive; 37using OpenSim.Framework.Serialization;
38using OpenSim.Region.CoreModules.World.Serialiser; 38using OpenSim.Region.CoreModules.World.Serialiser;
39using OpenSim.Region.CoreModules.World.Terrain; 39using OpenSim.Region.CoreModules.World.Terrain;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
@@ -48,29 +48,29 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
48 private void SaveCompleted(string errorMessage) 48 private void SaveCompleted(string errorMessage)
49 { 49 {
50 lock (this) 50 lock (this)
51 { 51 {
52 System.Console.WriteLine("About to pulse ArchiverTests"); 52 System.Console.WriteLine("About to pulse ArchiverTests");
53 Monitor.PulseAll(this); 53 Monitor.PulseAll(this);
54 } 54 }
55 } 55 }
56 56
57 /// <summary> 57 /// <summary>
58 /// Test saving a V0.2 OpenSim Region Archive. 58 /// Test saving a V0.2 OpenSim Region Archive.
59 /// </summary> 59 /// </summary>
60 [Test] 60 [Test]
61 public void TestSaveOarV0p2() 61 public void TestSaveOarV0p2()
62 { 62 {
63 log4net.Config.XmlConfigurator.Configure(); 63 log4net.Config.XmlConfigurator.Configure();
64 64
65 ArchiverModule archiverModule = new ArchiverModule(); 65 ArchiverModule archiverModule = new ArchiverModule();
66 SerialiserModule serialiserModule = new SerialiserModule(); 66 SerialiserModule serialiserModule = new SerialiserModule();
67 TerrainModule terrainModule = new TerrainModule(); 67 TerrainModule terrainModule = new TerrainModule();
68 68
69 Scene scene = SceneSetupHelpers.SetupScene(); 69 Scene scene = SceneSetupHelpers.SetupScene();
70 SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); 70 SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule);
71 71
72 SceneObjectPart part1; 72 SceneObjectPart part1;
73 73
74 // Create and add prim 1 74 // Create and add prim 1
75 { 75 {
76 string partName = "My Little Pony"; 76 string partName = "My Little Pony";
@@ -79,17 +79,17 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
79 Vector3 groupPosition = new Vector3(10, 20, 30); 79 Vector3 groupPosition = new Vector3(10, 20, 30);
80 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); 80 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
81 Vector3 offsetPosition = new Vector3(5, 10, 15); 81 Vector3 offsetPosition = new Vector3(5, 10, 15);
82 82
83 part1 83 part1
84 = new SceneObjectPart( 84 = new SceneObjectPart(
85 ownerId, shape, groupPosition, rotationOffset, offsetPosition); 85 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
86 part1.Name = partName; 86 part1.Name = partName;
87 87
88 scene.AddNewSceneObject(new SceneObjectGroup(part1), false); 88 scene.AddNewSceneObject(new SceneObjectGroup(part1), false);
89 } 89 }
90 90
91 SceneObjectPart part2; 91 SceneObjectPart part2;
92 92
93 // Create and add prim 2 93 // Create and add prim 2
94 { 94 {
95 string partName = "Action Man"; 95 string partName = "Action Man";
@@ -98,28 +98,28 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
98 Vector3 groupPosition = new Vector3(90, 80, 70); 98 Vector3 groupPosition = new Vector3(90, 80, 70);
99 Quaternion rotationOffset = new Quaternion(60, 70, 80, 90); 99 Quaternion rotationOffset = new Quaternion(60, 70, 80, 90);
100 Vector3 offsetPosition = new Vector3(20, 25, 30); 100 Vector3 offsetPosition = new Vector3(20, 25, 30);
101 101
102 part2 102 part2
103 = new SceneObjectPart( 103 = new SceneObjectPart(
104 ownerId, shape, groupPosition, rotationOffset, offsetPosition); 104 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
105 part2.Name = partName; 105 part2.Name = partName;
106 106
107 scene.AddNewSceneObject(new SceneObjectGroup(part2), false); 107 scene.AddNewSceneObject(new SceneObjectGroup(part2), false);
108 } 108 }
109 109
110 MemoryStream archiveWriteStream = new MemoryStream(); 110 MemoryStream archiveWriteStream = new MemoryStream();
111 scene.EventManager.OnOarFileSaved += SaveCompleted; 111 scene.EventManager.OnOarFileSaved += SaveCompleted;
112 112
113 lock (this) 113 lock (this)
114 { 114 {
115 archiverModule.ArchiveRegion(archiveWriteStream); 115 archiverModule.ArchiveRegion(archiveWriteStream);
116 Monitor.Wait(this, 60000); 116 Monitor.Wait(this, 60000);
117 } 117 }
118 118
119 byte[] archive = archiveWriteStream.ToArray(); 119 byte[] archive = archiveWriteStream.ToArray();
120 MemoryStream archiveReadStream = new MemoryStream(archive); 120 MemoryStream archiveReadStream = new MemoryStream(archive);
121 TarArchiveReader tar = new TarArchiveReader(archiveReadStream); 121 TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
122 122
123 bool gotControlFile = false; 123 bool gotControlFile = false;
124 bool gotObject1File = false; 124 bool gotObject1File = false;
125 bool gotObject2File = false; 125 bool gotObject2File = false;
@@ -132,11 +132,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
132 "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", 132 "{0}_{1:000}-{2:000}-{3:000}__{4}.xml",
133 part2.Name, 133 part2.Name,
134 Math.Round(part2.GroupPosition.X), Math.Round(part2.GroupPosition.Y), Math.Round(part2.GroupPosition.Z), 134 Math.Round(part2.GroupPosition.X), Math.Round(part2.GroupPosition.Y), Math.Round(part2.GroupPosition.Z),
135 part2.UUID); 135 part2.UUID);
136 136
137 string filePath; 137 string filePath;
138 TarArchiveReader.TarEntryType tarEntryType; 138 TarArchiveReader.TarEntryType tarEntryType;
139 139
140 while (tar.ReadEntry(out filePath, out tarEntryType) != null) 140 while (tar.ReadEntry(out filePath, out tarEntryType) != null)
141 { 141 {
142 if (ArchiveConstants.CONTROL_FILE_PATH == filePath) 142 if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
@@ -146,7 +146,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
146 else if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH)) 146 else if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH))
147 { 147 {
148 string fileName = filePath.Remove(0, ArchiveConstants.OBJECTS_PATH.Length); 148 string fileName = filePath.Remove(0, ArchiveConstants.OBJECTS_PATH.Length);
149 149
150 if (fileName.StartsWith(part1.Name)) 150 if (fileName.StartsWith(part1.Name))
151 { 151 {
152 Assert.That(fileName, Is.EqualTo(expectedObject1FileName)); 152 Assert.That(fileName, Is.EqualTo(expectedObject1FileName));
@@ -155,7 +155,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
155 else if (fileName.StartsWith(part2.Name)) 155 else if (fileName.StartsWith(part2.Name))
156 { 156 {
157 Assert.That(fileName, Is.EqualTo(expectedObject2FileName)); 157 Assert.That(fileName, Is.EqualTo(expectedObject2FileName));
158 gotObject2File = true; 158 gotObject2File = true;
159 } 159 }
160 } 160 }
161 } 161 }
@@ -163,7 +163,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
163 Assert.That(gotControlFile, Is.True, "No control file in archive"); 163 Assert.That(gotControlFile, Is.True, "No control file in archive");
164 Assert.That(gotObject1File, Is.True, "No object1 file in archive"); 164 Assert.That(gotObject1File, Is.True, "No object1 file in archive");
165 Assert.That(gotObject2File, Is.True, "No object2 file in archive"); 165 Assert.That(gotObject2File, Is.True, "No object2 file in archive");
166 166
167 // TODO: Test presence of more files and contents of files. 167 // TODO: Test presence of more files and contents of files.
168 // Temporary 168 // Temporary
169 Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); 169 Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
@@ -171,143 +171,143 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
171 171
172 /// <summary> 172 /// <summary>
173 /// Test loading a V0.2 OpenSim Region Archive. 173 /// Test loading a V0.2 OpenSim Region Archive.
174 /// </summary> 174 /// </summary>
175 [Test] 175 [Test]
176 public void TestLoadOarV0p2() 176 public void TestLoadOarV0p2()
177 { 177 {
178 //log4net.Config.XmlConfigurator.Configure(); 178 //log4net.Config.XmlConfigurator.Configure();
179 179
180 MemoryStream archiveWriteStream = new MemoryStream(); 180 MemoryStream archiveWriteStream = new MemoryStream();
181 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); 181 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
182 182
183 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); 183 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile());
184 184
185 string part1Name = "object1"; 185 string part1Name = "object1";
186 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder(); 186 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder();
187 Vector3 groupPosition = new Vector3(90, 80, 70); 187 Vector3 groupPosition = new Vector3(90, 80, 70);
188 Quaternion rotationOffset = new Quaternion(60, 70, 80, 90); 188 Quaternion rotationOffset = new Quaternion(60, 70, 80, 90);
189 Vector3 offsetPosition = new Vector3(20, 25, 30); 189 Vector3 offsetPosition = new Vector3(20, 25, 30);
190 190
191 SceneObjectPart part1 191 SceneObjectPart part1
192 = new SceneObjectPart( 192 = new SceneObjectPart(
193 UUID.Zero, shape, groupPosition, rotationOffset, offsetPosition); 193 UUID.Zero, shape, groupPosition, rotationOffset, offsetPosition);
194 part1.Name = part1Name; 194 part1.Name = part1Name;
195 SceneObjectGroup object1 = new SceneObjectGroup(part1); 195 SceneObjectGroup object1 = new SceneObjectGroup(part1);
196 196
197 string object1FileName = string.Format( 197 string object1FileName = string.Format(
198 "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", 198 "{0}_{1:000}-{2:000}-{3:000}__{4}.xml",
199 part1Name, 199 part1Name,
200 Math.Round(groupPosition.X), Math.Round(groupPosition.Y), Math.Round(groupPosition.Z), 200 Math.Round(groupPosition.X), Math.Round(groupPosition.Y), Math.Round(groupPosition.Z),
201 part1.UUID); 201 part1.UUID);
202 tar.WriteFile(ArchiveConstants.OBJECTS_PATH + object1FileName, object1.ToXmlString2()); 202 tar.WriteFile(ArchiveConstants.OBJECTS_PATH + object1FileName, object1.ToXmlString2());
203 203
204 tar.Close(); 204 tar.Close();
205 205
206 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); 206 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
207 207
208 SerialiserModule serialiserModule = new SerialiserModule(); 208 SerialiserModule serialiserModule = new SerialiserModule();
209 ArchiverModule archiverModule = new ArchiverModule(); 209 ArchiverModule archiverModule = new ArchiverModule();
210 210
211 Scene scene = SceneSetupHelpers.SetupScene(); 211 Scene scene = SceneSetupHelpers.SetupScene();
212 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 212 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
213 213
214 archiverModule.DearchiveRegion(archiveReadStream); 214 archiverModule.DearchiveRegion(archiveReadStream);
215 215
216 SceneObjectPart object1PartLoaded = scene.GetSceneObjectPart(part1Name); 216 SceneObjectPart object1PartLoaded = scene.GetSceneObjectPart(part1Name);
217 217
218 Assert.That(object1PartLoaded, Is.Not.Null, "object1 was not loaded"); 218 Assert.That(object1PartLoaded, Is.Not.Null, "object1 was not loaded");
219 Assert.That(object1PartLoaded.Name, Is.EqualTo(part1Name), "object1 names not identical"); 219 Assert.That(object1PartLoaded.Name, Is.EqualTo(part1Name), "object1 names not identical");
220 Assert.That(object1PartLoaded.GroupPosition, Is.EqualTo(groupPosition), "object1 group position not equal"); 220 Assert.That(object1PartLoaded.GroupPosition, Is.EqualTo(groupPosition), "object1 group position not equal");
221 Assert.That( 221 Assert.That(
222 object1PartLoaded.RotationOffset, Is.EqualTo(rotationOffset), "object1 rotation offset not equal"); 222 object1PartLoaded.RotationOffset, Is.EqualTo(rotationOffset), "object1 rotation offset not equal");
223 Assert.That( 223 Assert.That(
224 object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal"); 224 object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal");
225 225
226 // Temporary 226 // Temporary
227 Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); 227 Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
228 } 228 }
229 229
230 /// <summary> 230 /// <summary>
231 /// Test merging a V0.2 OpenSim Region Archive into an existing scene 231 /// Test merging a V0.2 OpenSim Region Archive into an existing scene
232 /// </summary> 232 /// </summary>
233 ///[Test] 233 ///[Test]
234 public void TestMergeOarV0p2() 234 public void TestMergeOarV0p2()
235 { 235 {
236 //XmlConfigurator.Configure(); 236 //XmlConfigurator.Configure();
237 237
238 MemoryStream archiveWriteStream = new MemoryStream(); 238 MemoryStream archiveWriteStream = new MemoryStream();
239 239
240 string part2Name = "objectMerge"; 240 string part2Name = "objectMerge";
241 PrimitiveBaseShape part2Shape = PrimitiveBaseShape.CreateCylinder(); 241 PrimitiveBaseShape part2Shape = PrimitiveBaseShape.CreateCylinder();
242 Vector3 part2GroupPosition = new Vector3(90, 80, 70); 242 Vector3 part2GroupPosition = new Vector3(90, 80, 70);
243 Quaternion part2RotationOffset = new Quaternion(60, 70, 80, 90); 243 Quaternion part2RotationOffset = new Quaternion(60, 70, 80, 90);
244 Vector3 part2OffsetPosition = new Vector3(20, 25, 30); 244 Vector3 part2OffsetPosition = new Vector3(20, 25, 30);
245 245
246 // Create an oar file that we can use for the merge 246 // Create an oar file that we can use for the merge
247 { 247 {
248 ArchiverModule archiverModule = new ArchiverModule(); 248 ArchiverModule archiverModule = new ArchiverModule();
249 SerialiserModule serialiserModule = new SerialiserModule(); 249 SerialiserModule serialiserModule = new SerialiserModule();
250 TerrainModule terrainModule = new TerrainModule(); 250 TerrainModule terrainModule = new TerrainModule();
251 251
252 Scene scene = SceneSetupHelpers.SetupScene(); 252 Scene scene = SceneSetupHelpers.SetupScene();
253 SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); 253 SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule);
254 254
255 SceneObjectPart part2 255 SceneObjectPart part2
256 = new SceneObjectPart( 256 = new SceneObjectPart(
257 UUID.Zero, part2Shape, part2GroupPosition, part2RotationOffset, part2OffsetPosition); 257 UUID.Zero, part2Shape, part2GroupPosition, part2RotationOffset, part2OffsetPosition);
258 part2.Name = part2Name; 258 part2.Name = part2Name;
259 SceneObjectGroup object2 = new SceneObjectGroup(part2); 259 SceneObjectGroup object2 = new SceneObjectGroup(part2);
260 260
261 scene.AddNewSceneObject(object2, false); 261 scene.AddNewSceneObject(object2, false);
262 262
263 // Write out this scene 263 // Write out this scene
264 scene.EventManager.OnOarFileSaved += SaveCompleted; 264 scene.EventManager.OnOarFileSaved += SaveCompleted;
265 265
266 lock (this) 266 lock (this)
267 { 267 {
268 archiverModule.ArchiveRegion(archiveWriteStream); 268 archiverModule.ArchiveRegion(archiveWriteStream);
269 Monitor.Wait(this, 60000); 269 Monitor.Wait(this, 60000);
270 } 270 }
271 } 271 }
272 272
273 { 273 {
274 ArchiverModule archiverModule = new ArchiverModule(); 274 ArchiverModule archiverModule = new ArchiverModule();
275 SerialiserModule serialiserModule = new SerialiserModule(); 275 SerialiserModule serialiserModule = new SerialiserModule();
276 TerrainModule terrainModule = new TerrainModule(); 276 TerrainModule terrainModule = new TerrainModule();
277 277
278 Scene scene = SceneSetupHelpers.SetupScene(); 278 Scene scene = SceneSetupHelpers.SetupScene();
279 SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); 279 SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule);
280 280
281 string part1Name = "objectExisting"; 281 string part1Name = "objectExisting";
282 PrimitiveBaseShape part1Shape = PrimitiveBaseShape.CreateCylinder(); 282 PrimitiveBaseShape part1Shape = PrimitiveBaseShape.CreateCylinder();
283 Vector3 part1GroupPosition = new Vector3(80, 70, 60); 283 Vector3 part1GroupPosition = new Vector3(80, 70, 60);
284 Quaternion part1RotationOffset = new Quaternion(50, 60, 70, 80); 284 Quaternion part1RotationOffset = new Quaternion(50, 60, 70, 80);
285 Vector3 part1OffsetPosition = new Vector3(15, 20, 25); 285 Vector3 part1OffsetPosition = new Vector3(15, 20, 25);
286 286
287 SceneObjectPart part1 287 SceneObjectPart part1
288 = new SceneObjectPart( 288 = new SceneObjectPart(
289 UUID.Zero, part1Shape, part1GroupPosition, part1RotationOffset, part1OffsetPosition); 289 UUID.Zero, part1Shape, part1GroupPosition, part1RotationOffset, part1OffsetPosition);
290 part1.Name = part1Name; 290 part1.Name = part1Name;
291 SceneObjectGroup object1 = new SceneObjectGroup(part1); 291 SceneObjectGroup object1 = new SceneObjectGroup(part1);
292 292
293 scene.AddNewSceneObject(object1, false); 293 scene.AddNewSceneObject(object1, false);
294 294
295 // Merge in the archive we created earlier 295 // Merge in the archive we created earlier
296 byte[] archive = archiveWriteStream.ToArray(); 296 byte[] archive = archiveWriteStream.ToArray();
297 MemoryStream archiveReadStream = new MemoryStream(archive); 297 MemoryStream archiveReadStream = new MemoryStream(archive);
298 298
299 archiverModule.DearchiveRegion(archiveReadStream, true); 299 archiverModule.DearchiveRegion(archiveReadStream, true);
300 300
301 SceneObjectPart object1Existing = scene.GetSceneObjectPart(part1Name); 301 SceneObjectPart object1Existing = scene.GetSceneObjectPart(part1Name);
302 Assert.That(object1Existing, Is.Not.Null, "object1 was not present after merge"); 302 Assert.That(object1Existing, Is.Not.Null, "object1 was not present after merge");
303 Assert.That(object1Existing.Name, Is.EqualTo(part1Name), "object1 names not identical after merge"); 303 Assert.That(object1Existing.Name, Is.EqualTo(part1Name), "object1 names not identical after merge");
304 Assert.That(object1Existing.GroupPosition, Is.EqualTo(part1GroupPosition), "object1 group position not equal after merge"); 304 Assert.That(object1Existing.GroupPosition, Is.EqualTo(part1GroupPosition), "object1 group position not equal after merge");
305 305
306 SceneObjectPart object2PartMerged = scene.GetSceneObjectPart(part2Name); 306 SceneObjectPart object2PartMerged = scene.GetSceneObjectPart(part2Name);
307 Assert.That(object2PartMerged, Is.Not.Null, "object2 was not present after merge"); 307 Assert.That(object2PartMerged, Is.Not.Null, "object2 was not present after merge");
308 Assert.That(object2PartMerged.Name, Is.EqualTo(part2Name), "object2 names not identical after merge"); 308 Assert.That(object2PartMerged.Name, Is.EqualTo(part2Name), "object2 names not identical after merge");
309 Assert.That(object2PartMerged.GroupPosition, Is.EqualTo(part2GroupPosition), "object2 group position not equal after merge"); 309 Assert.That(object2PartMerged.GroupPosition, Is.EqualTo(part2GroupPosition), "object2 group position not equal after merge");
310 } 310 }
311 } 311 }
312 } 312 }
313} 313}