aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-05-30 18:32:18 +0000
committerJustin Clarke Casey2008-05-30 18:32:18 +0000
commitbc56efd1d238de8f990563aec3a77036b1f28fcf (patch)
treefb3e17f8c40bec5e3d38f397469a78fcecdb4079
parent* Refactor: Change multiple requests for a module interface to use a stored r... (diff)
downloadopensim-SC-bc56efd1d238de8f990563aec3a77036b1f28fcf.zip
opensim-SC-bc56efd1d238de8f990563aec3a77036b1f28fcf.tar.gz
opensim-SC-bc56efd1d238de8f990563aec3a77036b1f28fcf.tar.bz2
opensim-SC-bc56efd1d238de8f990563aec3a77036b1f28fcf.tar.xz
* Hook up archive loading to load in prim xml data
* This now has equivalent functionality to load-xml2 - no asset data is restored yet
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs5
-rw-r--r--OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs15
-rw-r--r--OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs51
-rw-r--r--OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs5
4 files changed, 57 insertions, 19 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
index 6ad11ee..d3f0cbc 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
@@ -26,7 +26,9 @@
26 */ 26 */
27 27
28using OpenSim.Region.Environment.Scenes; 28using OpenSim.Region.Environment.Scenes;
29using OpenSim.Region.Environment.Modules.World.Serialiser;
29using System; 30using System;
31using System.IO;
30using System.Reflection; 32using System.Reflection;
31using log4net; 33using log4net;
32 34
@@ -85,7 +87,8 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
85 // Reload serialized prims 87 // Reload serialized prims
86 m_log.InfoFormat("[ARCHIVER]: Loading prim data"); 88 m_log.InfoFormat("[ARCHIVER]: Loading prim data");
87 89
88 //m_scene.LoadPrimsFromXml2( 90 IRegionSerialiser serialiser = m_scene.RequestModuleInterface<IRegionSerialiser>();
91 serialiser.LoadPrimsFromXml2(m_scene, new StringReader(serializedPrims));
89 } 92 }
90 } 93 }
91} 94}
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs
index 752b5b6..b7ed9f9 100644
--- a/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs
+++ b/OpenSim/Region/Environment/Modules/World/Serialiser/IRegionSerialiser.cs
@@ -27,6 +27,7 @@
27 27
28using libsecondlife; 28using libsecondlife;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO;
30using OpenSim.Region.Environment.Scenes; 31using OpenSim.Region.Environment.Scenes;
31 32
32namespace OpenSim.Region.Environment.Modules.World.Serialiser 33namespace OpenSim.Region.Environment.Modules.World.Serialiser
@@ -38,9 +39,21 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
38 void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, LLVector3 loadOffset); 39 void LoadPrimsFromXml(Scene scene, string fileName, bool newIDS, LLVector3 loadOffset);
39 40
40 void SavePrimsToXml(Scene scene, string fileName); 41 void SavePrimsToXml(Scene scene, string fileName);
41 42
43 /// <summary>
44 /// Load prims from the xml2 format
45 /// </summary>
46 /// <param name="scene"></param>
47 /// <param name="fileName"></param>
42 void LoadPrimsFromXml2(Scene scene, string fileName); 48 void LoadPrimsFromXml2(Scene scene, string fileName);
43 49
50 /// <summary>
51 /// Load prims from the xml2 format
52 /// </summary>
53 /// <param name="scene"></param>
54 /// <param name="reader"></param>
55 void LoadPrimsFromXml2(Scene scene, TextReader reader);
56
44 void SavePrimsToXml2(Scene scene, string fileName); 57 void SavePrimsToXml2(Scene scene, string fileName);
45 58
46 void LoadGroupFromXml2String(Scene scene, string xmlString); 59 void LoadGroupFromXml2String(Scene scene, string xmlString);
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
index 7f51b58..2ac0754 100644
--- a/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
+++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SceneXmlLoader.cs
@@ -147,26 +147,43 @@ namespace OpenSim.Region.Environment.Scenes
147 } 147 }
148 } 148 }
149 149
150 /// <summary>
151 /// Load prims from the xml2 format
152 /// </summary>
153 /// <param name="scene"></param>
154 /// <param name="fileName"></param>
150 public static void LoadPrimsFromXml2(Scene scene, string fileName) 155 public static void LoadPrimsFromXml2(Scene scene, string fileName)
151 { 156 {
152 XmlDocument doc = new XmlDocument(); 157 LoadPrimsFromXml2(scene, new XmlTextReader(fileName));
153 XmlNode rootNode; 158 }
154 if (fileName.StartsWith("http:") || File.Exists(fileName)) 159
155 { 160 /// <summary>
156 XmlTextReader reader = new XmlTextReader(fileName); 161 /// Load prims from the xml2 format
157 reader.WhitespaceHandling = WhitespaceHandling.None; 162 /// </summary>
158 doc.Load(reader); 163 /// <param name="scene"></param>
159 reader.Close(); 164 /// <param name="reader"></param>
160 rootNode = doc.FirstChild; 165 public static void LoadPrimsFromXml2(Scene scene, TextReader reader)
161 foreach (XmlNode aPrimNode in rootNode.ChildNodes) 166 {
162 { 167 LoadPrimsFromXml2(scene, new XmlTextReader(reader));
163 CreatePrimFromXml(scene, aPrimNode.OuterXml); 168 }
164 } 169
165 } 170 /// <summary>
166 else 171 /// Load prims from the xml2 format. This method will close the reader
172 /// </summary>
173 /// <param name="scene"></param>
174 /// <param name="reader"></param>
175 protected static void LoadPrimsFromXml2(Scene scene, XmlTextReader reader)
176 {
177 XmlDocument doc = new XmlDocument();
178 reader.WhitespaceHandling = WhitespaceHandling.None;
179 doc.Load(reader);
180 reader.Close();
181 XmlNode rootNode = doc.FirstChild;
182
183 foreach (XmlNode aPrimNode in rootNode.ChildNodes)
167 { 184 {
168 throw new Exception("Could not open file " + fileName + " for reading"); 185 CreatePrimFromXml(scene, aPrimNode.OuterXml);
169 } 186 }
170 } 187 }
171 188
172 public static void CreatePrimFromXml(Scene scene, string xmlData) 189 public static void CreatePrimFromXml(Scene scene, string xmlData)
diff --git a/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs
index bfa0a43..b181fe8 100644
--- a/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Serialiser/SerialiserModule.cs
@@ -101,6 +101,11 @@ namespace OpenSim.Region.Environment.Modules.World.Serialiser
101 { 101 {
102 SceneXmlLoader.LoadPrimsFromXml2(scene, fileName); 102 SceneXmlLoader.LoadPrimsFromXml2(scene, fileName);
103 } 103 }
104
105 public void LoadPrimsFromXml2(Scene scene, TextReader reader)
106 {
107 SceneXmlLoader.LoadPrimsFromXml2(scene, reader);
108 }
104 109
105 public void SavePrimsToXml2(Scene scene, string fileName) 110 public void SavePrimsToXml2(Scene scene, string fileName)
106 { 111 {