aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-06-29 19:53:33 +0000
committerJustin Clarke Casey2008-06-29 19:53:33 +0000
commitf8d9ccc70ec894e4cecfe24f35067ccc80ecfe50 (patch)
treef6dfc8cbe583b590924cbd628873379a9cc55035 /OpenSim/Region/Environment/Modules
parentAdd minor comments. (diff)
downloadopensim-SC_OLD-f8d9ccc70ec894e4cecfe24f35067ccc80ecfe50.zip
opensim-SC_OLD-f8d9ccc70ec894e4cecfe24f35067ccc80ecfe50.tar.gz
opensim-SC_OLD-f8d9ccc70ec894e4cecfe24f35067ccc80ecfe50.tar.bz2
opensim-SC_OLD-f8d9ccc70ec894e4cecfe24f35067ccc80ecfe50.tar.xz
* Save terrain information in archive
* Not yet reloading * Terrain saving will be optional a little further down the line
Diffstat (limited to 'OpenSim/Region/Environment/Modules')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs7
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs21
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs7
3 files changed, 32 insertions, 3 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs
index f4586b0..0115d8d 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveConstants.cs
@@ -43,12 +43,17 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
43 /// <summary> 43 /// <summary>
44 /// Path for the assets metadata file 44 /// Path for the assets metadata file
45 /// </summary> 45 /// </summary>
46 public static readonly string ASSETS_METADATA_PATH = "assets.xml"; 46 //public static readonly string ASSETS_METADATA_PATH = "assets.xml";
47 47
48 /// <summary> 48 /// <summary>
49 /// Path for the prims file 49 /// Path for the prims file
50 /// </summary> 50 /// </summary>
51 public static readonly string OBJECTS_PATH = "objects/"; 51 public static readonly string OBJECTS_PATH = "objects/";
52
53 /// <summary>
54 /// Path for terrains. Technically these may be assets, but I think it's quite nice to split them out.
55 /// </summary>
56 public static readonly string TERRAINS_PATH = "terrains/";
52 57
53 /// <summary> 58 /// <summary>
54 /// Extensions used for asset types in the archive 59 /// Extensions used for asset types in the archive
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs
index 3ef8149..2c43ffd 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs
@@ -27,12 +27,14 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO;
30using System.Reflection; 31using System.Reflection;
31using libsecondlife; 32using libsecondlife;
32using log4net; 33using log4net;
33using OpenSim.Framework; 34using OpenSim.Framework;
34using OpenSim.Region.Environment.Interfaces; 35using OpenSim.Region.Environment.Interfaces;
35using OpenSim.Region.Environment.Modules.World.Serialiser; 36using OpenSim.Region.Environment.Modules.World.Serialiser;
37using OpenSim.Region.Environment.Modules.World.Terrain;
36using OpenSim.Region.Environment.Scenes; 38using OpenSim.Region.Environment.Scenes;
37 39
38namespace OpenSim.Region.Environment.Modules.World.Archiver 40namespace OpenSim.Region.Environment.Modules.World.Archiver
@@ -49,15 +51,23 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
49 { 51 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 53
54 protected ITerrainModule m_terrainModule;
52 protected IRegionSerialiser m_serialiser; 55 protected IRegionSerialiser m_serialiser;
53 protected List<SceneObjectGroup> m_sceneObjects; 56 protected List<SceneObjectGroup> m_sceneObjects;
57 protected string m_sceneName;
54 protected string m_savePath; 58 protected string m_savePath;
55 59
56 public ArchiveWriteRequestExecution( 60 public ArchiveWriteRequestExecution(
57 List<SceneObjectGroup> sceneObjects, IRegionSerialiser serialiser, string savePath) 61 List<SceneObjectGroup> sceneObjects,
62 ITerrainModule terrainModule,
63 IRegionSerialiser serialiser,
64 string sceneName,
65 string savePath)
58 { 66 {
59 m_sceneObjects = sceneObjects; 67 m_sceneObjects = sceneObjects;
68 m_terrainModule = terrainModule;
60 m_serialiser = serialiser; 69 m_serialiser = serialiser;
70 m_sceneName = sceneName;
61 m_savePath = savePath; 71 m_savePath = savePath;
62 } 72 }
63 73
@@ -67,6 +77,14 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
67 77
68 TarArchiveWriter archive = new TarArchiveWriter(); 78 TarArchiveWriter archive = new TarArchiveWriter();
69 79
80 // Write out terrain
81 string terrainPath = String.Format("{0}{1}.png", ArchiveConstants.TERRAINS_PATH, m_sceneName);
82 MemoryStream ms = new MemoryStream();
83 m_terrainModule.SaveToStream(terrainPath, ms);
84 archive.AddFile(terrainPath, ms.ToArray());
85 ms.Close();
86
87 // Write out scene object metadata
70 foreach (SceneObjectGroup sceneObject in m_sceneObjects) 88 foreach (SceneObjectGroup sceneObject in m_sceneObjects)
71 { 89 {
72 //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType()); 90 //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType());
@@ -84,6 +102,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
84 archive.AddFile(filename, serializedObject); 102 archive.AddFile(filename, serializedObject);
85 } 103 }
86 104
105 // Write out assets
87 AssetsArchiver assetsArchiver = new AssetsArchiver(assets); 106 AssetsArchiver assetsArchiver = new AssetsArchiver(assets);
88 assetsArchiver.Archive(archive); 107 assetsArchiver.Archive(archive);
89 108
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs
index bed30b0..cc60cff 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -29,6 +29,7 @@ using OpenSim.Framework;
29using OpenSim.Framework.Communications.Cache; 29using OpenSim.Framework.Communications.Cache;
30using OpenSim.Region.Environment.Interfaces; 30using OpenSim.Region.Environment.Interfaces;
31using OpenSim.Region.Environment.Modules.World.Serialiser; 31using OpenSim.Region.Environment.Modules.World.Serialiser;
32using OpenSim.Region.Environment.Modules.World.Terrain;
32using OpenSim.Region.Environment.Scenes; 33using OpenSim.Region.Environment.Scenes;
33using System.Collections.Generic; 34using System.Collections.Generic;
34using System.Reflection; 35using System.Reflection;
@@ -187,7 +188,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
187 // Asynchronously request all the assets required to perform this archive operation 188 // Asynchronously request all the assets required to perform this archive operation
188 ArchiveWriteRequestExecution awre 189 ArchiveWriteRequestExecution awre
189 = new ArchiveWriteRequestExecution( 190 = new ArchiveWriteRequestExecution(
190 sceneObjects, m_scene.RequestModuleInterface<IRegionSerialiser>(), m_savePath); 191 sceneObjects,
192 m_scene.RequestModuleInterface<ITerrainModule>(),
193 m_scene.RequestModuleInterface<IRegionSerialiser>(),
194 m_scene.RegionInfo.RegionName,
195 m_savePath);
191 new AssetsRequest(assetUuids.Keys, m_scene.AssetCache, awre.ReceivedAllAssets).Execute(); 196 new AssetsRequest(assetUuids.Keys, m_scene.AssetCache, awre.ReceivedAllAssets).Execute();
192 } 197 }
193 } 198 }