diff options
Diffstat (limited to '')
6 files changed, 58 insertions, 20 deletions
diff --git a/OpenSim/Framework/Serialization/ArchiveConstants.cs b/OpenSim/Framework/Serialization/ArchiveConstants.cs index 7a9b33d..2c5e001 100644 --- a/OpenSim/Framework/Serialization/ArchiveConstants.cs +++ b/OpenSim/Framework/Serialization/ArchiveConstants.cs | |||
@@ -112,6 +112,7 @@ namespace OpenSim.Framework.Serialization | |||
112 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LostAndFoundFolder] = ASSET_EXTENSION_SEPARATOR + "lostandfoundfolder.txt"; // Not sure if we'll ever see this | 112 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LostAndFoundFolder] = ASSET_EXTENSION_SEPARATOR + "lostandfoundfolder.txt"; // Not sure if we'll ever see this |
113 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLBytecode] = ASSET_EXTENSION_SEPARATOR + "bytecode.lso"; | 113 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLBytecode] = ASSET_EXTENSION_SEPARATOR + "bytecode.lso"; |
114 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLText] = ASSET_EXTENSION_SEPARATOR + "script.lsl"; | 114 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLText] = ASSET_EXTENSION_SEPARATOR + "script.lsl"; |
115 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Mesh] = ASSET_EXTENSION_SEPARATOR + "mesh.llmesh"; | ||
115 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Notecard] = ASSET_EXTENSION_SEPARATOR + "notecard.txt"; | 116 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Notecard] = ASSET_EXTENSION_SEPARATOR + "notecard.txt"; |
116 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Object] = ASSET_EXTENSION_SEPARATOR + "object.xml"; | 117 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Object] = ASSET_EXTENSION_SEPARATOR + "object.xml"; |
117 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.RootFolder] = ASSET_EXTENSION_SEPARATOR + "rootfolder.txt"; // Not sure if we'll ever see this | 118 | ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.RootFolder] = ASSET_EXTENSION_SEPARATOR + "rootfolder.txt"; // Not sure if we'll ever see this |
@@ -135,6 +136,7 @@ namespace OpenSim.Framework.Serialization | |||
135 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "lostandfoundfolder.txt"] = (sbyte)AssetType.LostAndFoundFolder; | 136 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "lostandfoundfolder.txt"] = (sbyte)AssetType.LostAndFoundFolder; |
136 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "bytecode.lso"] = (sbyte)AssetType.LSLBytecode; | 137 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "bytecode.lso"] = (sbyte)AssetType.LSLBytecode; |
137 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "script.lsl"] = (sbyte)AssetType.LSLText; | 138 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "script.lsl"] = (sbyte)AssetType.LSLText; |
139 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "mesh.llmesh"] = (sbyte)AssetType.Mesh; | ||
138 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "notecard.txt"] = (sbyte)AssetType.Notecard; | 140 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "notecard.txt"] = (sbyte)AssetType.Notecard; |
139 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "object.xml"] = (sbyte)AssetType.Object; | 141 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "object.xml"] = (sbyte)AssetType.Object; |
140 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "rootfolder.txt"] = (sbyte)AssetType.RootFolder; | 142 | EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "rootfolder.txt"] = (sbyte)AssetType.RootFolder; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index c1df827..5500557 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -33,6 +33,7 @@ using System.Reflection; | |||
33 | using System.Threading; | 33 | using System.Threading; |
34 | using System.Text; | 34 | using System.Text; |
35 | using System.Xml; | 35 | using System.Xml; |
36 | using System.Xml.Linq; | ||
36 | using log4net; | 37 | using log4net; |
37 | using OpenMetaverse; | 38 | using OpenMetaverse; |
38 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
@@ -50,6 +51,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
50 | { | 51 | { |
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | 53 | ||
54 | /// <summary> | ||
55 | /// The maximum major version of archive that we can read. Minor versions shouldn't need a max number since version | ||
56 | /// bumps here should be compatible. | ||
57 | /// </summary> | ||
58 | public static int MAX_MAJOR_VERSION = 0; | ||
59 | |||
53 | protected TarArchiveReader archive; | 60 | protected TarArchiveReader archive; |
54 | 61 | ||
55 | private UserAccount m_userInfo; | 62 | private UserAccount m_userInfo; |
@@ -133,7 +140,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
133 | 140 | ||
134 | while ((data = archive.ReadEntry(out filePath, out entryType)) != null) | 141 | while ((data = archive.ReadEntry(out filePath, out entryType)) != null) |
135 | { | 142 | { |
136 | if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) | 143 | if (filePath == ArchiveConstants.CONTROL_FILE_PATH) |
144 | { | ||
145 | LoadControlFile(filePath, data); | ||
146 | } | ||
147 | else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) | ||
137 | { | 148 | { |
138 | if (LoadAsset(filePath, data)) | 149 | if (LoadAsset(filePath, data)) |
139 | successfulAssetRestores++; | 150 | successfulAssetRestores++; |
@@ -461,5 +472,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
461 | return false; | 472 | return false; |
462 | } | 473 | } |
463 | } | 474 | } |
475 | |||
476 | /// <summary> | ||
477 | /// Load control file | ||
478 | /// </summary> | ||
479 | /// <param name="path"></param> | ||
480 | /// <param name="data"></param> | ||
481 | protected void LoadControlFile(string path, byte[] data) | ||
482 | { | ||
483 | XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data)); | ||
484 | XElement archiveElement = doc.Element("archive"); | ||
485 | int majorVersion = int.Parse(archiveElement.Attribute("major_version").Value); | ||
486 | int minorVersion = int.Parse(archiveElement.Attribute("minor_version").Value); | ||
487 | string version = string.Format("{0}.{1}", majorVersion, minorVersion); | ||
488 | |||
489 | if (majorVersion > MAX_MAJOR_VERSION) | ||
490 | { | ||
491 | throw new Exception( | ||
492 | string.Format( | ||
493 | "The IAR you are trying to load has major version number of {0} but this version of OpenSim can only load IARs with major version number {1} and below", | ||
494 | majorVersion, MAX_MAJOR_VERSION)); | ||
495 | } | ||
496 | |||
497 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version); | ||
498 | } | ||
464 | } | 499 | } |
465 | } \ No newline at end of file | 500 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index bae5a7a..249a8b4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -123,9 +123,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
123 | 123 | ||
124 | try | 124 | try |
125 | { | 125 | { |
126 | // We're almost done. Just need to write out the control file now | ||
127 | m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile()); | ||
128 | m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); | ||
129 | m_archiveWriter.Close(); | 126 | m_archiveWriter.Close(); |
130 | } | 127 | } |
131 | catch (Exception e) | 128 | catch (Exception e) |
@@ -216,7 +213,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
216 | public void Execute() | 213 | public void Execute() |
217 | { | 214 | { |
218 | try | 215 | try |
219 | { | 216 | { |
220 | InventoryFolderBase inventoryFolder = null; | 217 | InventoryFolderBase inventoryFolder = null; |
221 | InventoryItemBase inventoryItem = null; | 218 | InventoryItemBase inventoryItem = null; |
222 | InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID); | 219 | InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID); |
@@ -277,6 +274,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
277 | 274 | ||
278 | m_archiveWriter = new TarArchiveWriter(m_saveStream); | 275 | m_archiveWriter = new TarArchiveWriter(m_saveStream); |
279 | 276 | ||
277 | // Write out control file. This has to be done first so that subsequent loaders will see this file first | ||
278 | // XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this | ||
279 | m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile()); | ||
280 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Added control file to archive."); | ||
281 | |||
280 | if (inventoryFolder != null) | 282 | if (inventoryFolder != null) |
281 | { | 283 | { |
282 | m_log.DebugFormat( | 284 | m_log.DebugFormat( |
@@ -399,13 +401,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
399 | /// <returns></returns> | 401 | /// <returns></returns> |
400 | public static string Create0p1ControlFile() | 402 | public static string Create0p1ControlFile() |
401 | { | 403 | { |
404 | int majorVersion = 0, minorVersion = 1; | ||
405 | |||
406 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion); | ||
407 | |||
402 | StringWriter sw = new StringWriter(); | 408 | StringWriter sw = new StringWriter(); |
403 | XmlTextWriter xtw = new XmlTextWriter(sw); | 409 | XmlTextWriter xtw = new XmlTextWriter(sw); |
404 | xtw.Formatting = Formatting.Indented; | 410 | xtw.Formatting = Formatting.Indented; |
405 | xtw.WriteStartDocument(); | 411 | xtw.WriteStartDocument(); |
406 | xtw.WriteStartElement("archive"); | 412 | xtw.WriteStartElement("archive"); |
407 | xtw.WriteAttributeString("major_version", "0"); | 413 | xtw.WriteAttributeString("major_version", majorVersion.ToString()); |
408 | xtw.WriteAttributeString("minor_version", "1"); | 414 | xtw.WriteAttributeString("minor_version", minorVersion.ToString()); |
409 | xtw.WriteEndElement(); | 415 | xtw.WriteEndElement(); |
410 | 416 | ||
411 | xtw.Flush(); | 417 | xtw.Flush(); |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index f1f5258..117b2fd 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
54 | 54 | ||
55 | /// <summary> | 55 | /// <summary> |
56 | /// The maximum major version of OAR that we can read. Minor versions shouldn't need a number since version | 56 | /// The maximum major version of OAR that we can read. Minor versions shouldn't need a max number since version |
57 | /// bumps here should be compatible. | 57 | /// bumps here should be compatible. |
58 | /// </summary> | 58 | /// </summary> |
59 | public static int MAX_MAJOR_VERSION = 0; | 59 | public static int MAX_MAJOR_VERSION = 0; |
@@ -481,17 +481,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
481 | /// </summary> | 481 | /// </summary> |
482 | /// <param name="path"></param> | 482 | /// <param name="path"></param> |
483 | /// <param name="data"></param> | 483 | /// <param name="data"></param> |
484 | private void LoadControlFile(string path, byte[] data) | 484 | protected void LoadControlFile(string path, byte[] data) |
485 | { | 485 | { |
486 | //Create the XmlNamespaceManager. | 486 | XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable()); |
487 | NameTable nt = new NameTable(); | ||
488 | XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt); | ||
489 | |||
490 | // Create the XmlParserContext. | ||
491 | XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); | 487 | XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None); |
492 | 488 | XmlTextReader xtr = new XmlTextReader(Encoding.ASCII.GetString(data), XmlNodeType.Document, context); | |
493 | XmlTextReader xtr | ||
494 | = new XmlTextReader(Encoding.ASCII.GetString(data), XmlNodeType.Document, context); | ||
495 | 489 | ||
496 | RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings; | 490 | RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings; |
497 | 491 | ||
@@ -530,10 +524,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
530 | currentRegionSettings.LoadedCreationID = xtr.ReadElementContentAsString(); | 524 | currentRegionSettings.LoadedCreationID = xtr.ReadElementContentAsString(); |
531 | } | 525 | } |
532 | } | 526 | } |
533 | |||
534 | } | 527 | } |
535 | 528 | ||
536 | currentRegionSettings.Save(); | 529 | currentRegionSettings.Save(); |
537 | } | 530 | } |
538 | } | 531 | } |
539 | } | 532 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index 43789af..1687d06 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs | |||
@@ -171,7 +171,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
171 | 171 | ||
172 | m_log.InfoFormat("[ARCHIVER]: Creating archive file. This may take some time."); | 172 | m_log.InfoFormat("[ARCHIVER]: Creating archive file. This may take some time."); |
173 | 173 | ||
174 | // Write out control file | 174 | // Write out control file. This has to be done first so that subsequent loaders will see this file first |
175 | // XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this | ||
175 | archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile(options)); | 176 | archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile(options)); |
176 | m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); | 177 | m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); |
177 | 178 | ||
diff --git a/prebuild.xml b/prebuild.xml index b28d226..dd4a576 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -1387,6 +1387,7 @@ | |||
1387 | <Reference name="System"/> | 1387 | <Reference name="System"/> |
1388 | <Reference name="System.Core"/> | 1388 | <Reference name="System.Core"/> |
1389 | <Reference name="System.Xml"/> | 1389 | <Reference name="System.Xml"/> |
1390 | <Reference name="System.Xml.Linq"/> | ||
1390 | <Reference name="System.Drawing"/> | 1391 | <Reference name="System.Drawing"/> |
1391 | <Reference name="System.Web"/> | 1392 | <Reference name="System.Web"/> |
1392 | <Reference name="NDesk.Options" path="../../../bin/"/> | 1393 | <Reference name="NDesk.Options" path="../../../bin/"/> |