aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-06-21 23:45:22 +0000
committerJustin Clarke Casey2008-06-21 23:45:22 +0000
commitca88e3580b8ef94cd882d1b6723c37815601e54e (patch)
treef3e2fcb35fff62a3af70e7dae9ff88b69d2db627 /OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs
parentMantis#1580. Thank you kindly, Dmiles for a patch that: (diff)
downloadopensim-SC-ca88e3580b8ef94cd882d1b6723c37815601e54e.zip
opensim-SC-ca88e3580b8ef94cd882d1b6723c37815601e54e.tar.gz
opensim-SC-ca88e3580b8ef94cd882d1b6723c37815601e54e.tar.bz2
opensim-SC-ca88e3580b8ef94cd882d1b6723c37815601e54e.tar.xz
* archive each object as a separate xml file rather than put them all in one single large file
* this is being done for reasons of compositionality
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs34
1 files changed, 28 insertions, 6 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs
index 199539b..3799c57 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs
@@ -25,11 +25,15 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using System.Collections.Generic; 29using System.Collections.Generic;
29using System.Reflection; 30using System.Reflection;
30using libsecondlife; 31using libsecondlife;
31using log4net; 32using log4net;
32using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.Environment.Interfaces;
35using OpenSim.Region.Environment.Modules.World.Serialiser;
36using OpenSim.Region.Environment.Scenes;
33 37
34namespace OpenSim.Region.Environment.Modules.World.Archiver 38namespace OpenSim.Region.Environment.Modules.World.Archiver
35{ 39{
@@ -45,12 +49,15 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
45 { 49 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 51
52 protected IRegionSerialiser m_serialiser;
53 protected List<EntityBase> m_sceneObjects;
48 protected string m_savePath; 54 protected string m_savePath;
49 protected string m_serializedEntities;
50 55
51 public ArchiveWriteRequestExecution(string serializedEntities, string savePath) 56 public ArchiveWriteRequestExecution(
57 List<EntityBase> sceneObjects, IRegionSerialiser serialiser, string savePath)
52 { 58 {
53 m_serializedEntities = serializedEntities; 59 m_sceneObjects = sceneObjects;
60 m_serialiser = serialiser;
54 m_savePath = savePath; 61 m_savePath = savePath;
55 } 62 }
56 63
@@ -59,8 +66,23 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
59 m_log.DebugFormat("[ARCHIVER]: Received all {0} assets required", assets.Count); 66 m_log.DebugFormat("[ARCHIVER]: Received all {0} assets required", assets.Count);
60 67
61 TarArchiveWriter archive = new TarArchiveWriter(); 68 TarArchiveWriter archive = new TarArchiveWriter();
62 69
63 archive.AddFile(ArchiveConstants.PRIMS_PATH, m_serializedEntities); 70 foreach (EntityBase entity in m_sceneObjects)
71 {
72 // FIXME: I'm fairly sure that all entities are in fact SceneObjectGroups... must fix this
73 SceneObjectGroup sceneObject = (SceneObjectGroup)entity;
74 LLVector3 position = sceneObject.AbsolutePosition;
75
76 string serializedObject = m_serialiser.SaveGroupToXml2(sceneObject);
77 string filename
78 = string.Format(
79 "{0}{1}_{2:000}-{3:000}-{4:000}__{5}.xml",
80 ArchiveConstants.OBJECTS_PATH, sceneObject.Name,
81 Math.Round(position.X), Math.Round(position.Y), Math.Round(position.Z),
82 sceneObject.UUID);
83
84 archive.AddFile(filename, serializedObject);
85 }
64 86
65 AssetsArchiver assetsArchiver = new AssetsArchiver(assets); 87 AssetsArchiver assetsArchiver = new AssetsArchiver(assets);
66 assetsArchiver.Archive(archive); 88 assetsArchiver.Archive(archive);
@@ -68,6 +90,6 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
68 archive.WriteTar(m_savePath); 90 archive.WriteTar(m_savePath);
69 91
70 m_log.InfoFormat("[ARCHIVER]: Wrote out OpenSimulator archive {0}", m_savePath); 92 m_log.InfoFormat("[ARCHIVER]: Wrote out OpenSimulator archive {0}", m_savePath);
71 } 93 }
72 } 94 }
73} 95}