From 908d91be78038832945eec5c4d05c71ab64e3680 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Sat, 21 Jun 2008 21:20:59 +0000 Subject: * refactor: Making some of the serialization names consistent, both within their pairings and with the others * This does make some of the names less ideal than others - this should change in the future --- .../Modules/World/Archiver/ArchiveReadRequest.cs | 30 ++++++++++++--------- .../Modules/World/Serialiser/IRegionSerialiser.cs | 31 ++++++++++++++++++++-- .../Modules/World/Serialiser/SceneXmlLoader.cs | 4 +-- .../Modules/World/Serialiser/SerialiserModule.cs | 8 +++--- OpenSim/Region/Environment/Scenes/Scene.cs | 4 +-- 5 files changed, 54 insertions(+), 23 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs index d2b8018..26fc1a6 100644 --- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs @@ -99,24 +99,28 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver } // Reload serialized prims - m_log.InfoFormat("[ARCHIVER]: Loading prim data"); + m_log.InfoFormat("[ARCHIVER]: Loading scene objects"); IRegionSerialiser serialiser = m_scene.RequestModuleInterface(); // Temporary code to read each sog in the file separately, pending actually having these in separate files -// XmlTextReader xtr = new XmlTextReader(new StringReader(serializedPrims)); -// XmlDocument doc = new XmlDocument(); -// reader.WhitespaceHandling = WhitespaceHandling.None; -// doc.Load(xtr); -// xtr.Close(); -// XmlNode sceneNode = doc.FirstChild; -// -// foreach (XmlNode objectNode in sceneNode.ChildNodes) -// { -// CreatePrimFromXml2(m_scene, objectNode.OuterXml); -// } + XmlTextReader xtr = new XmlTextReader(new StringReader(serializedPrims)); + XmlDocument doc = new XmlDocument(); + xtr.WhitespaceHandling = WhitespaceHandling.None; + doc.Load(xtr); + xtr.Close(); + XmlNode sceneNode = doc.FirstChild; + int count = 0; + + foreach (XmlNode objectNode in sceneNode.ChildNodes) + { + serialiser.LoadGroupFromXml2(m_scene, objectNode.OuterXml.ToString()); + count++; + } + + //serialiser.LoadPrimsFromXml2(m_scene, new StringReader(serializedPrims)); - serialiser.LoadPrimsFromXml2(m_scene, new StringReader(serializedPrims)); + m_log.DebugFormat("[ARCHIVER]: Loaded {0} scene objects", count); } } } diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs index e0d2add..e6090a7 100644 --- a/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs +++ b/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs @@ -36,8 +36,20 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser { List SerialiseRegion(Scene scene, string saveDir); + /// + /// Load prims from the xml format + /// + /// + /// + /// + /// void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, LLVector3 loadOffset); + /// + /// Save prims in the xml format + /// + /// + /// void SavePrimsToXml(Scene scene, string fileName); /// @@ -54,10 +66,25 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser /// void LoadPrimsFromXml2(Scene scene, TextReader reader); + /// + /// Save prims in the xml2 format + /// + /// + /// void SavePrimsToXml2(Scene scene, string fileName); - void LoadGroupFromXml2String(Scene scene, string xmlString); + /// + /// Load an individual scene object from the xml2 format + /// + /// + /// + void LoadGroupFromXml2(Scene scene, string xmlString); - string SavePrimGroupToXML2String(SceneObjectGroup grp); + /// + /// Serialize an individual scene object into the xml2 format + /// + /// + /// + string SaveGroupToXml2(SceneObjectGroup grp); } } diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs index 7cc2459..1945fac 100644 --- a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs +++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs @@ -99,12 +99,12 @@ namespace OpenSim.Region.Environment.Scenes file.Close(); } - public static string SavePrimGroupToXML2String(SceneObjectGroup grp) + public static string SaveGroupToXml2(SceneObjectGroup grp) { return grp.ToXmlString2(); } - public static void LoadGroupFromXml2String(Scene scene, string xmlString) + public static void LoadGroupFromXml2(Scene scene, string xmlString) { XmlDocument doc = new XmlDocument(); XmlNode rootNode; diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs index c7c8e39..01f6301 100644 --- a/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs @@ -112,14 +112,14 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser SceneXmlLoader.SavePrimsToXml2(scene, fileName); } - public void LoadGroupFromXml2String(Scene scene, string xmlString) + public void LoadGroupFromXml2(Scene scene, string xmlString) { - SceneXmlLoader.LoadGroupFromXml2String(scene, xmlString); + SceneXmlLoader.LoadGroupFromXml2(scene, xmlString); } - public string SavePrimGroupToXML2String(SceneObjectGroup grp) + public string SaveGroupToXml2(SceneObjectGroup grp) { - return SceneXmlLoader.SavePrimGroupToXML2String(grp); + return SceneXmlLoader.SaveGroupToXml2(grp); } public List SerialiseRegion(Scene scene, string saveDir) diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 4cf1ea4..69981e2 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1821,7 +1821,7 @@ namespace OpenSim.Region.Environment.Scenes successYN = m_sceneGridService.PrimCrossToNeighboringRegion( - newRegionHandle, grp.UUID, m_serialiser.SavePrimGroupToXML2String(grp), primcrossingXMLmethod); + newRegionHandle, grp.UUID, m_serialiser.SaveGroupToXml2(grp), primcrossingXMLmethod); if (successYN) { @@ -1854,7 +1854,7 @@ namespace OpenSim.Region.Environment.Scenes m_log.Warn("{[INTERREGION]: A new prim arrived from a neighbor"); if (XMLMethod == 0) { - m_serialiser.LoadGroupFromXml2String(this, objXMLData); + m_serialiser.LoadGroupFromXml2(this, objXMLData); SceneObjectPart RootPrim = GetSceneObjectPart(primID); if (RootPrim != null) -- cgit v1.1