aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-06-16 17:13:28 +0000
committerJustin Clarke Casey2008-06-16 17:13:28 +0000
commite31de6707fe6296cbfe3ee5765b48eef42828541 (patch)
treedc8536374b079eb29ebc39b3e45fa1cce5924418 /OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs
parentchange some messages on the migrations front to be (diff)
downloadopensim-SC_OLD-e31de6707fe6296cbfe3ee5765b48eef42828541.zip
opensim-SC_OLD-e31de6707fe6296cbfe3ee5765b48eef42828541.tar.gz
opensim-SC_OLD-e31de6707fe6296cbfe3ee5765b48eef42828541.tar.bz2
opensim-SC_OLD-e31de6707fe6296cbfe3ee5765b48eef42828541.tar.xz
* refactor: Fission ArchiveWriteRequest into prepare and execute classes
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs (renamed from OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequest.cs)46
1 files changed, 10 insertions, 36 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs
index 1d7042c..a93e58d 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequest.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -40,31 +40,22 @@ using Nini.Config;
40namespace OpenSim.Region.Environment.Modules.World.Archiver 40namespace OpenSim.Region.Environment.Modules.World.Archiver
41{ 41{
42 /// <summary> 42 /// <summary>
43 /// Method called when all the necessary assets for an archive request have been received. 43 /// Prepare to write out an archive.
44 /// </summary> 44 /// </summary>
45 public delegate void AssetsRequestCallback(IDictionary<LLUUID, AssetBase> assets); 45 public class ArchiveWriteRequestPreparation
46
47 /// <summary>
48 /// Handles an individual archive write request
49 /// </summary>
50 public class ArchiveWriteRequest
51 { 46 {
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 48
54 private Scene m_scene; 49 protected Scene m_scene;
55 private string m_savePath; 50 protected string m_savePath;
56
57 private string m_serializedEntities;
58 51
59 public ArchiveWriteRequest(Scene scene, string savePath) 52 public ArchiveWriteRequestPreparation(Scene scene, string savePath)
60 { 53 {
61 m_scene = scene; 54 m_scene = scene;
62 m_savePath = savePath; 55 m_savePath = savePath;
63
64 ArchiveRegion();
65 } 56 }
66 57
67 protected void ArchiveRegion() 58 public void ArchiveRegion()
68 { 59 {
69 Dictionary<LLUUID, int> assetUuids = new Dictionary<LLUUID, int>(); 60 Dictionary<LLUUID, int> assetUuids = new Dictionary<LLUUID, int>();
70 61
@@ -108,36 +99,19 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
108 } 99 }
109 } 100 }
110 101
111 m_serializedEntities = SerializeObjects(entities); 102 string serializedEntities = SerializeObjects(entities);
112 103
113 if (m_serializedEntities != null && m_serializedEntities.Length > 0) 104 if (serializedEntities != null && serializedEntities.Length > 0)
114 { 105 {
115 m_log.DebugFormat("[ARCHIVER]: Successfully got serialization for {0} entities", entities.Count); 106 m_log.DebugFormat("[ARCHIVER]: Successfully got serialization for {0} entities", entities.Count);
116 m_log.DebugFormat("[ARCHIVER]: Requiring save of {0} textures", assetUuids.Count); 107 m_log.DebugFormat("[ARCHIVER]: Requiring save of {0} textures", assetUuids.Count);
117 108
118 // Asynchronously request all the assets required to perform this archive operation 109 // Asynchronously request all the assets required to perform this archive operation
119 new AssetsRequest(ReceivedAllAssets, m_scene.AssetCache, assetUuids.Keys); 110 ArchiveWriteRequestExecution awre = new ArchiveWriteRequestExecution(serializedEntities, m_savePath);
111 new AssetsRequest(assetUuids.Keys, m_scene.AssetCache, awre.ReceivedAllAssets).Execute();
120 } 112 }
121 } 113 }
122 114
123 protected internal void ReceivedAllAssets(IDictionary<LLUUID, AssetBase> assets)
124 {
125 m_log.DebugFormat("[ARCHIVER]: Received all {0} textures required", assets.Count);
126
127 // XXX: Shouldn't hijack the asset async callback thread like this - this is only temporary
128
129 TarArchiveWriter archive = new TarArchiveWriter();
130
131 archive.AddFile(ArchiveConstants.PRIMS_PATH, m_serializedEntities);
132
133 AssetsArchiver assetsArchiver = new AssetsArchiver(assets);
134 assetsArchiver.Archive(archive);
135
136 archive.WriteTar(m_savePath);
137
138 m_log.InfoFormat("[ARCHIVER]: Wrote out OpenSimulator archive {0}", m_savePath);
139 }
140
141 /// <summary> 115 /// <summary>
142 /// Get an xml representation of the given scene objects. 116 /// Get an xml representation of the given scene objects.
143 /// </summary> 117 /// </summary>