aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver
diff options
context:
space:
mode:
authorMelanie2011-04-21 16:28:29 +0100
committerMelanie2011-04-21 16:28:29 +0100
commit09b6d717bf7c43b3dc60aba27c1ac085da26e36d (patch)
tree9346746bd392b679a35fbc969c1e46d9c9862745 /OpenSim/Region/CoreModules/Avatar/Inventory/Archiver
parentMerge branch 'master' into careminster-presence-refactor (diff)
parentfix meshing failure on sculpt maps smaller than 64x64 (diff)
downloadopensim-SC_OLD-09b6d717bf7c43b3dc60aba27c1ac085da26e36d.zip
opensim-SC_OLD-09b6d717bf7c43b3dc60aba27c1ac085da26e36d.tar.gz
opensim-SC_OLD-09b6d717bf7c43b3dc60aba27c1ac085da26e36d.tar.bz2
opensim-SC_OLD-09b6d717bf7c43b3dc60aba27c1ac085da26e36d.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs27
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs29
3 files changed, 51 insertions, 9 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 2fff533..a19bbfd 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -77,7 +77,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
77 /// </value> 77 /// </value>
78 private Stream m_loadStream; 78 private Stream m_loadStream;
79 79
80 protected bool m_controlFileLoaded; 80 /// <summary>
81 /// Has the control file been loaded for this archive?
82 /// </summary>
83 public bool ControlFileLoaded { get; private set; }
84
85 /// <summary>
86 /// Do we want to enforce the check. IAR versions before 0.2 and 1.1 do not guarantee this order, so we can't
87 /// enforce.
88 /// </summary>
89 public bool EnforceControlFileCheck { get; private set; }
90
81 protected bool m_assetsLoaded; 91 protected bool m_assetsLoaded;
82 protected bool m_inventoryNodesLoaded; 92 protected bool m_inventoryNodesLoaded;
83 93
@@ -126,6 +136,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
126 m_userInfo = userInfo; 136 m_userInfo = userInfo;
127 m_invPath = invPath; 137 m_invPath = invPath;
128 m_loadStream = loadStream; 138 m_loadStream = loadStream;
139
140 // FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things
141 // (I thought they weren't). We will need to bump the version number and perform this check on all
142 // subsequent IAR versions only
143 ControlFileLoaded = true;
129 } 144 }
130 145
131 /// <summary> 146 /// <summary>
@@ -517,7 +532,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
517 /// </summary> 532 /// </summary>
518 /// <param name="path"></param> 533 /// <param name="path"></param>
519 /// <param name="data"></param> 534 /// <param name="data"></param>
520 protected void LoadControlFile(string path, byte[] data) 535 public void LoadControlFile(string path, byte[] data)
521 { 536 {
522 XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data)); 537 XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data));
523 XElement archiveElement = doc.Element("archive"); 538 XElement archiveElement = doc.Element("archive");
@@ -533,7 +548,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
533 majorVersion, MAX_MAJOR_VERSION)); 548 majorVersion, MAX_MAJOR_VERSION));
534 } 549 }
535 550
536 m_controlFileLoaded = true; 551 ControlFileLoaded = true;
537 m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version); 552 m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version);
538 } 553 }
539 554
@@ -545,7 +560,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
545 /// <param name="data"></param> 560 /// <param name="data"></param>
546 protected void LoadInventoryFile(string path, TarArchiveReader.TarEntryType entryType, byte[] data) 561 protected void LoadInventoryFile(string path, TarArchiveReader.TarEntryType entryType, byte[] data)
547 { 562 {
548 if (!m_controlFileLoaded) 563 if (!ControlFileLoaded)
549 throw new Exception( 564 throw new Exception(
550 string.Format( 565 string.Format(
551 "The IAR you are trying to load does not list {0} before {1}. Aborting load", 566 "The IAR you are trying to load does not list {0} before {1}. Aborting load",
@@ -592,7 +607,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
592 /// <param name="data"></param> 607 /// <param name="data"></param>
593 protected void LoadAssetFile(string path, byte[] data) 608 protected void LoadAssetFile(string path, byte[] data)
594 { 609 {
595 if (!m_controlFileLoaded) 610 if (!ControlFileLoaded)
596 throw new Exception( 611 throw new Exception(
597 string.Format( 612 string.Format(
598 "The IAR you are trying to load does not list {0} before {1}. Aborting load", 613 "The IAR you are trying to load does not list {0} before {1}. Aborting load",
@@ -617,4 +632,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
617 m_assetsLoaded = true; 632 m_assetsLoaded = true;
618 } 633 }
619 } 634 }
620} \ No newline at end of file 635}
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index 5e5f6c0..dd16bfe 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -388,12 +388,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
388 if (options.ContainsKey("profile")) 388 if (options.ContainsKey("profile"))
389 { 389 {
390 majorVersion = 1; 390 majorVersion = 1;
391 minorVersion = 0; 391 minorVersion = 1;
392 } 392 }
393 else 393 else
394 { 394 {
395 majorVersion = 0; 395 majorVersion = 0;
396 minorVersion = 1; 396 minorVersion = 2;
397 } 397 }
398 398
399 m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion); 399 m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion);
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index d03f6da..52232a0 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -94,7 +94,34 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
94 94
95 Assert.That(coaObjects[1].UUID, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000140"))); 95 Assert.That(coaObjects[1].UUID, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000140")));
96 Assert.That(coaObjects[1].AbsolutePosition, Is.EqualTo(new Vector3(25, 50, 75))); 96 Assert.That(coaObjects[1].AbsolutePosition, Is.EqualTo(new Vector3(25, 50, 75)));
97 } 97 }
98
99 /// <summary>
100 /// Test that the IAR has the required files in the right order.
101 /// </summary>
102 /// <remarks>
103 /// At the moment, the only thing that matters is that the control file is the very first one.
104 /// </remarks>
105 [Test]
106 public void TestOrder()
107 {
108 TestHelper.InMethod();
109// log4net.Config.XmlConfigurator.Configure();
110
111 MemoryStream archiveReadStream = new MemoryStream(m_iarStreamBytes);
112 TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
113 string filePath;
114 TarArchiveReader.TarEntryType tarEntryType;
115
116 byte[] data = tar.ReadEntry(out filePath, out tarEntryType);
117 Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH));
118
119 InventoryArchiveReadRequest iarr
120 = new InventoryArchiveReadRequest(null, null, null, (Stream)null, false);
121 iarr.LoadControlFile(filePath, data);
122
123 Assert.That(iarr.ControlFileLoaded, Is.True);
124 }
98 125
99 /// <summary> 126 /// <summary>
100 /// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive 127 /// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive