aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-02-02 20:59:12 +0000
committerJustin Clarke Casey2009-02-02 20:59:12 +0000
commit2c2f10e156c62aa1d95923ff5309f2be7f08faeb (patch)
treec6631296849e076264ce8e034d29ca117750bfa5 /OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs
parent* As per http://opensimulator.org/mantis/view.php?id=3065 (diff)
downloadopensim-SC_OLD-2c2f10e156c62aa1d95923ff5309f2be7f08faeb.zip
opensim-SC_OLD-2c2f10e156c62aa1d95923ff5309f2be7f08faeb.tar.gz
opensim-SC_OLD-2c2f10e156c62aa1d95923ff5309f2be7f08faeb.tar.bz2
opensim-SC_OLD-2c2f10e156c62aa1d95923ff5309f2be7f08faeb.tar.xz
* Establish OnOarFileSaved EventManager event and subscribe to that instead of passing in a waithandle to the archiver
* This matches the existing OnOarFileLoaded event * This brings up the question of how these things can be made generic so that they don't have to be tied into EventManager, but that's a topic for another day
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs31
1 files changed, 15 insertions, 16 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs
index 8eec38d..179b82a 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs
@@ -29,7 +29,6 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Threading;
33using System.Xml; 32using System.Xml;
34using OpenMetaverse; 33using OpenMetaverse;
35using log4net; 34using log4net;
@@ -45,7 +44,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
45 /// Method called when all the necessary assets for an archive request have been received. 44 /// Method called when all the necessary assets for an archive request have been received.
46 /// </summary> 45 /// </summary>
47 public delegate void AssetsRequestCallback(IDictionary<UUID, AssetBase> assetsFound, ICollection<UUID> assetsNotFoundUuids); 46 public delegate void AssetsRequestCallback(IDictionary<UUID, AssetBase> assetsFound, ICollection<UUID> assetsNotFoundUuids);
48 47
49 /// <summary> 48 /// <summary>
50 /// Execute the write of an archive once we have received all the necessary data 49 /// Execute the write of an archive once we have received all the necessary data
51 /// </summary> 50 /// </summary>
@@ -56,27 +55,25 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
56 protected ITerrainModule m_terrainModule; 55 protected ITerrainModule m_terrainModule;
57 protected IRegionSerialiserModule m_serialiser; 56 protected IRegionSerialiserModule m_serialiser;
58 protected List<SceneObjectGroup> m_sceneObjects; 57 protected List<SceneObjectGroup> m_sceneObjects;
59 protected RegionInfo m_regionInfo; 58 protected Scene m_scene;
60 protected Stream m_saveStream; 59 protected Stream m_saveStream;
61 protected EventWaitHandle m_signalWhenDoneEvent;
62 60
63 public ArchiveWriteRequestExecution( 61 public ArchiveWriteRequestExecution(
64 List<SceneObjectGroup> sceneObjects, 62 List<SceneObjectGroup> sceneObjects,
65 ITerrainModule terrainModule, 63 ITerrainModule terrainModule,
66 IRegionSerialiserModule serialiser, 64 IRegionSerialiserModule serialiser,
67 RegionInfo regionInfo, 65 Scene scene,
68 Stream saveStream, 66 Stream saveStream)
69 EventWaitHandle signalWhenDoneEvent)
70 { 67 {
71 m_sceneObjects = sceneObjects; 68 m_sceneObjects = sceneObjects;
72 m_terrainModule = terrainModule; 69 m_terrainModule = terrainModule;
73 m_serialiser = serialiser; 70 m_serialiser = serialiser;
74 m_regionInfo = regionInfo; 71 m_scene = scene;
75 m_saveStream = saveStream; 72 m_saveStream = saveStream;
76 m_signalWhenDoneEvent = signalWhenDoneEvent;
77 } 73 }
78 74
79 protected internal void ReceivedAllAssets(IDictionary<UUID, AssetBase> assetsFound, ICollection<UUID> assetsNotFoundUuids) 75 protected internal void ReceivedAllAssets(
76 IDictionary<UUID, AssetBase> assetsFound, ICollection<UUID> assetsNotFoundUuids)
80 { 77 {
81 foreach (UUID uuid in assetsNotFoundUuids) 78 foreach (UUID uuid in assetsNotFoundUuids)
82 { 79 {
@@ -95,11 +92,14 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
95 archive.AddFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile()); 92 archive.AddFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile());
96 93
97 // Write out region settings 94 // Write out region settings
98 string settingsPath = String.Format("{0}{1}.xml", ArchiveConstants.SETTINGS_PATH, m_regionInfo.RegionName); 95 string settingsPath
99 archive.AddFile(settingsPath, RegionSettingsSerializer.Serialize(m_regionInfo.RegionSettings)); 96 = String.Format("{0}{1}.xml", ArchiveConstants.SETTINGS_PATH, m_scene.RegionInfo.RegionName);
97 archive.AddFile(settingsPath, RegionSettingsSerializer.Serialize(m_scene.RegionInfo.RegionSettings));
100 98
101 // Write out terrain 99 // Write out terrain
102 string terrainPath = String.Format("{0}{1}.r32", ArchiveConstants.TERRAINS_PATH, m_regionInfo.RegionName); 100 string terrainPath
101 = String.Format("{0}{1}.r32", ArchiveConstants.TERRAINS_PATH, m_scene.RegionInfo.RegionName);
102
103 MemoryStream ms = new MemoryStream(); 103 MemoryStream ms = new MemoryStream();
104 m_terrainModule.SaveToStream(terrainPath, ms); 104 m_terrainModule.SaveToStream(terrainPath, ms);
105 archive.AddFile(terrainPath, ms.ToArray()); 105 archive.AddFile(terrainPath, ms.ToArray());
@@ -129,10 +129,9 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
129 129
130 archive.WriteTar(m_saveStream); 130 archive.WriteTar(m_saveStream);
131 131
132 m_log.InfoFormat("[ARCHIVER]: Wrote out OpenSimulator archive for {0}", m_regionInfo.RegionName); 132 m_log.InfoFormat("[ARCHIVER]: Wrote out OpenSimulator archive for {0}", m_scene.RegionInfo.RegionName);
133 133
134 if (m_signalWhenDoneEvent != null) 134 m_scene.EventManager.TriggerOarFileSaved(String.Empty);
135 m_signalWhenDoneEvent.Set();
136 } 135 }
137 136
138 /// <summary> 137 /// <summary>