From bb28726a8bb14aaba075d6e61317dc7be624ab15 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 22 Oct 2010 18:39:40 +0100
Subject: write IAR control file first in the archive rather than last
---
.../Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | 10 ++++++----
.../World/Archiver/ArchiveWriteRequestPreparation.cs | 3 ++-
2 files changed, 8 insertions(+), 5 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index bae5a7a..f385a2a 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
try
{
- // We're almost done. Just need to write out the control file now
- m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile());
- m_log.InfoFormat("[ARCHIVER]: Added control file to archive.");
m_archiveWriter.Close();
}
catch (Exception e)
@@ -216,7 +213,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
public void Execute()
{
try
- {
+ {
InventoryFolderBase inventoryFolder = null;
InventoryItemBase inventoryItem = null;
InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID);
@@ -277,6 +274,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
m_archiveWriter = new TarArchiveWriter(m_saveStream);
+ // Write out control file. This has to be done first so that subsequent loaders will see this file first
+ // XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this
+ m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile());
+ m_log.InfoFormat("[INVENTORY ARCHIVER]: Added control file to archive.");
+
if (inventoryFolder != null)
{
m_log.DebugFormat(
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
m_log.InfoFormat("[ARCHIVER]: Creating archive file. This may take some time.");
- // Write out control file
+ // Write out control file. This has to be done first so that subsequent loaders will see this file first
+ // XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this
archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile(options));
m_log.InfoFormat("[ARCHIVER]: Added control file to archive.");
--
cgit v1.1
From a5bb7b8a300a9dd0aceb3666423f2827a69e1930 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 22 Oct 2010 18:47:38 +0100
Subject: slightly simplify oar control file loading code
---
.../Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index f1f5258..9192f43 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -483,15 +483,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
///
private void LoadControlFile(string path, byte[] data)
{
- //Create the XmlNamespaceManager.
- NameTable nt = new NameTable();
- XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
-
- // Create the XmlParserContext.
+ XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable());
XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
-
- XmlTextReader xtr
- = new XmlTextReader(Encoding.ASCII.GetString(data), XmlNodeType.Document, context);
+ XmlTextReader xtr = new XmlTextReader(Encoding.ASCII.GetString(data), XmlNodeType.Document, context);
RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings;
@@ -530,10 +524,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
currentRegionSettings.LoadedCreationID = xtr.ReadElementContentAsString();
}
}
-
}
currentRegionSettings.Save();
}
}
-}
+}
\ No newline at end of file
--
cgit v1.1
From 199b61f1b2c48c82c5878032acfa9b69e4898fec Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 22 Oct 2010 19:24:42 +0100
Subject: start parsing iar control file
This change requires a prebuild[.sh|.bat] since a System.Xml.Linq reference is added to prebuild.xml
---
.../Archiver/InventoryArchiveReadRequest.cs | 20 +++++++++++++++++++-
.../CoreModules/World/Archiver/ArchiveReadRequest.cs | 2 +-
2 files changed, 20 insertions(+), 2 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index c1df827..2beea8e 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;
using System.Threading;
using System.Text;
using System.Xml;
+using System.Xml.Linq;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
@@ -133,7 +134,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
{
- if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
+ if (filePath == ArchiveConstants.CONTROL_FILE_PATH)
+ {
+ LoadControlFile(filePath, data);
+ }
+ else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
{
if (LoadAsset(filePath, data))
successfulAssetRestores++;
@@ -461,5 +466,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
return false;
}
}
+
+ ///
+ /// Load control file
+ ///
+ ///
+ ///
+ protected void LoadControlFile(string path, byte[] data)
+ {
+ XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data));
+ XElement archiveElement = doc.Element("archive");
+ int.Parse(archiveElement.Attribute("major_version").Value);
+ int.Parse(archiveElement.Attribute("minor_version").Value);
+ }
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 9192f43..087d3df 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -481,7 +481,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
///
///
///
- private void LoadControlFile(string path, byte[] data)
+ protected void LoadControlFile(string path, byte[] data)
{
XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable());
XmlParserContext context = new XmlParserContext(null, nsmgr, null, XmlSpace.None);
--
cgit v1.1
From 7f2d8449169481f1ec6ee5373bdfeef83c3434bc Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 22 Oct 2010 19:30:15 +0100
Subject: Implement guard against trying to load incompatible version IARs
---
.../Archiver/InventoryArchiveReadRequest.cs | 21 +++++++++++++++++++--
.../World/Archiver/ArchiveReadRequest.cs | 2 +-
2 files changed, 20 insertions(+), 3 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 2beea8e..5500557 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -51,6 +51,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+ ///
+ /// The maximum major version of archive that we can read. Minor versions shouldn't need a max number since version
+ /// bumps here should be compatible.
+ ///
+ public static int MAX_MAJOR_VERSION = 0;
+
protected TarArchiveReader archive;
private UserAccount m_userInfo;
@@ -476,8 +482,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
XDocument doc = XDocument.Parse(Encoding.ASCII.GetString(data));
XElement archiveElement = doc.Element("archive");
- int.Parse(archiveElement.Attribute("major_version").Value);
- int.Parse(archiveElement.Attribute("minor_version").Value);
+ int majorVersion = int.Parse(archiveElement.Attribute("major_version").Value);
+ int minorVersion = int.Parse(archiveElement.Attribute("minor_version").Value);
+ string version = string.Format("{0}.{1}", majorVersion, minorVersion);
+
+ if (majorVersion > MAX_MAJOR_VERSION)
+ {
+ throw new Exception(
+ string.Format(
+ "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",
+ majorVersion, MAX_MAJOR_VERSION));
+ }
+
+ m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version);
}
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 087d3df..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
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
///
- /// The maximum major version of OAR that we can read. Minor versions shouldn't need a number since version
+ /// The maximum major version of OAR that we can read. Minor versions shouldn't need a max number since version
/// bumps here should be compatible.
///
public static int MAX_MAJOR_VERSION = 0;
--
cgit v1.1
From e6019dd6ac16ea3947e127be510bc3084b4bf103 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 22 Oct 2010 19:34:06 +0100
Subject: print IAR version number on console when saving
---
.../Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index f385a2a..249a8b4 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -401,13 +401,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
///
public static string Create0p1ControlFile()
{
+ int majorVersion = 0, minorVersion = 1;
+
+ m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion);
+
StringWriter sw = new StringWriter();
XmlTextWriter xtw = new XmlTextWriter(sw);
xtw.Formatting = Formatting.Indented;
xtw.WriteStartDocument();
xtw.WriteStartElement("archive");
- xtw.WriteAttributeString("major_version", "0");
- xtw.WriteAttributeString("minor_version", "1");
+ xtw.WriteAttributeString("major_version", majorVersion.ToString());
+ xtw.WriteAttributeString("minor_version", minorVersion.ToString());
xtw.WriteEndElement();
xtw.Flush();
--
cgit v1.1
From 1064e743beb3095dcfcfc22ae341f7efba48b648 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 22 Oct 2010 21:12:22 +0100
Subject: Allow OARs and IARs to save and load meshes.
Save and reload appears okay for the duck mesh at https://collada.org/owl/download.php?sess=0&parent=126&expand=1&order=name&curview=0&binary=1&id=698/
However, one attempt at trying to load a more complicated scene failed (errors on console, only triangles appearing in mesh viewer).
Not sure if this is really and OAR load problem. Needs more investigation.
---
OpenSim/Framework/Serialization/ArchiveConstants.cs | 2 ++
1 file changed, 2 insertions(+)
(limited to 'OpenSim')
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
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LostAndFoundFolder] = ASSET_EXTENSION_SEPARATOR + "lostandfoundfolder.txt"; // Not sure if we'll ever see this
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLBytecode] = ASSET_EXTENSION_SEPARATOR + "bytecode.lso";
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLText] = ASSET_EXTENSION_SEPARATOR + "script.lsl";
+ ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Mesh] = ASSET_EXTENSION_SEPARATOR + "mesh.llmesh";
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Notecard] = ASSET_EXTENSION_SEPARATOR + "notecard.txt";
ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Object] = ASSET_EXTENSION_SEPARATOR + "object.xml";
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
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "lostandfoundfolder.txt"] = (sbyte)AssetType.LostAndFoundFolder;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "bytecode.lso"] = (sbyte)AssetType.LSLBytecode;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "script.lsl"] = (sbyte)AssetType.LSLText;
+ EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "mesh.llmesh"] = (sbyte)AssetType.Mesh;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "notecard.txt"] = (sbyte)AssetType.Notecard;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "object.xml"] = (sbyte)AssetType.Object;
EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "rootfolder.txt"] = (sbyte)AssetType.RootFolder;
--
cgit v1.1