aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveRequest.cs
diff options
context:
space:
mode:
authorJeff Ames2008-05-28 03:44:49 +0000
committerJeff Ames2008-05-28 03:44:49 +0000
commit5752c1f5c2ee069e2ff5ffc0ff2f186d7454c5c4 (patch)
treeea980f49f1a6bb40ba037a87581a3d741c3d3c56 /OpenSim/Region/Environment/Modules/World/Archiver/ArchiveRequest.cs
parentThank you kindly, Melanie for a patch that: (diff)
downloadopensim-SC_OLD-5752c1f5c2ee069e2ff5ffc0ff2f186d7454c5c4.zip
opensim-SC_OLD-5752c1f5c2ee069e2ff5ffc0ff2f186d7454c5c4.tar.gz
opensim-SC_OLD-5752c1f5c2ee069e2ff5ffc0ff2f186d7454c5c4.tar.bz2
opensim-SC_OLD-5752c1f5c2ee069e2ff5ffc0ff2f186d7454c5c4.tar.xz
Formatting cleanup.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveRequest.cs68
1 files changed, 34 insertions, 34 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveRequest.cs
index 1579485..ea74941 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveRequest.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveRequest.cs
@@ -37,37 +37,37 @@ using log4net;
37using Nini.Config; 37using Nini.Config;
38 38
39namespace OpenSim.Region.Environment 39namespace OpenSim.Region.Environment
40{ 40{
41 /// <summary> 41 /// <summary>
42 /// Method called when all the necessary assets for an archive request have been received. 42 /// Method called when all the necessary assets for an archive request have been received.
43 /// </summary> 43 /// </summary>
44 public delegate void AssetsRequestCallback(IDictionary<LLUUID, AssetBase> assets); 44 public delegate void AssetsRequestCallback(IDictionary<LLUUID, AssetBase> assets);
45 45
46 /// <summary> 46 /// <summary>
47 /// Handles an individual archive request 47 /// Handles an individual archive request
48 /// </summary> 48 /// </summary>
49 public class ArchiveRequest 49 public class ArchiveRequest
50 { 50 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 52
53 private Scene m_scene; 53 private Scene m_scene;
54 private string m_savePath; 54 private string m_savePath;
55 55
56 private string m_serializedEntities; 56 private string m_serializedEntities;
57 57
58 public ArchiveRequest(Scene scene, string savePath) 58 public ArchiveRequest(Scene scene, string savePath)
59 { 59 {
60 m_scene = scene; 60 m_scene = scene;
61 m_savePath = savePath; 61 m_savePath = savePath;
62 62
63 ArchiveRegion(); 63 ArchiveRegion();
64 } 64 }
65 65
66 protected void ArchiveRegion() 66 protected void ArchiveRegion()
67 { 67 {
68 m_log.Warn("[ARCHIVER]: Archive region not yet implemented"); 68 m_log.Warn("[ARCHIVER]: Archive region not yet implemented");
69 69
70 Dictionary<LLUUID, int> textureUuids = new Dictionary<LLUUID, int>(); 70 Dictionary<LLUUID, int> textureUuids = new Dictionary<LLUUID, int>();
71 71
72 List<EntityBase> entities = m_scene.GetEntities(); 72 List<EntityBase> entities = m_scene.GetEntities();
73 73
@@ -76,14 +76,14 @@ namespace OpenSim.Region.Environment
76 if (entity is SceneObjectGroup) 76 if (entity is SceneObjectGroup)
77 { 77 {
78 SceneObjectGroup sceneObject = (SceneObjectGroup)entity; 78 SceneObjectGroup sceneObject = (SceneObjectGroup)entity;
79 79
80 foreach (SceneObjectPart part in sceneObject.GetParts()) 80 foreach (SceneObjectPart part in sceneObject.GetParts())
81 { 81 {
82 LLUUID texture = new LLUUID(part.Shape.TextureEntry, 0); 82 LLUUID texture = new LLUUID(part.Shape.TextureEntry, 0);
83 textureUuids[texture] = 1; 83 textureUuids[texture] = 1;
84 } 84 }
85 } 85 }
86 } 86 }
87 87
88 m_serializedEntities = SerializeObjects(entities); 88 m_serializedEntities = SerializeObjects(entities);
89 89
@@ -91,30 +91,30 @@ namespace OpenSim.Region.Environment
91 { 91 {
92 m_log.DebugFormat("[ARCHIVER]: Successfully got serialization for {0} entities", entities.Count); 92 m_log.DebugFormat("[ARCHIVER]: Successfully got serialization for {0} entities", entities.Count);
93 m_log.DebugFormat("[ARCHIVER]: Requiring save of {0} textures", textureUuids.Count); 93 m_log.DebugFormat("[ARCHIVER]: Requiring save of {0} textures", textureUuids.Count);
94 94
95 // Asynchronously request all the assets required to perform this archive operation 95 // Asynchronously request all the assets required to perform this archive operation
96 new AssetsRequest(ReceivedAllAssets, m_scene.AssetCache, textureUuids.Keys); 96 new AssetsRequest(ReceivedAllAssets, m_scene.AssetCache, textureUuids.Keys);
97 } 97 }
98 } 98 }
99 99
100 protected internal void ReceivedAllAssets(IDictionary<LLUUID, AssetBase> assets) 100 protected internal void ReceivedAllAssets(IDictionary<LLUUID, AssetBase> assets)
101 { 101 {
102 m_log.DebugFormat("[ARCHIVER]: Received all {0} textures required", assets.Count); 102 m_log.DebugFormat("[ARCHIVER]: Received all {0} textures required", assets.Count);
103 103
104 // XXX: Shouldn't hijack the asset async callback thread like this - this is only temporary 104 // XXX: Shouldn't hijack the asset async callback thread like this - this is only temporary
105 105
106 TarArchive archive = new TarArchive(); 106 TarArchive archive = new TarArchive();
107 107
108 archive.AddFile("prims.xml", m_serializedEntities); 108 archive.AddFile("prims.xml", m_serializedEntities);
109 109
110 foreach (LLUUID uuid in assets.Keys) 110 foreach (LLUUID uuid in assets.Keys)
111 { 111 {
112 archive.AddFile(uuid.ToString() + ".jp2", assets[uuid].Data); 112 archive.AddFile(uuid.ToString() + ".jp2", assets[uuid].Data);
113 } 113 }
114 114
115 archive.WriteTar(m_savePath); 115 archive.WriteTar(m_savePath);
116 } 116 }
117 117
118 /// <summary> 118 /// <summary>
119 /// Get an xml representation of the given scene objects. 119 /// Get an xml representation of the given scene objects.
120 /// </summary> 120 /// </summary>
@@ -152,38 +152,38 @@ namespace OpenSim.Region.Environment
152 /// Callback used when all the assets requested have been received. 152 /// Callback used when all the assets requested have been received.
153 /// </summary> 153 /// </summary>
154 protected AssetsRequestCallback m_assetsRequestCallback; 154 protected AssetsRequestCallback m_assetsRequestCallback;
155 155
156 /// <summary> 156 /// <summary>
157 /// Assets retrieved in this request 157 /// Assets retrieved in this request
158 /// </summary> 158 /// </summary>
159 protected Dictionary<LLUUID, AssetBase> m_assets = new Dictionary<LLUUID, AssetBase>(); 159 protected Dictionary<LLUUID, AssetBase> m_assets = new Dictionary<LLUUID, AssetBase>();
160 160
161 /// <summary> 161 /// <summary>
162 /// Record the number of asset replies required so we know when we've finished 162 /// Record the number of asset replies required so we know when we've finished
163 /// </summary> 163 /// </summary>
164 private int m_repliesRequired; 164 private int m_repliesRequired;
165 165
166 /// <summary> 166 /// <summary>
167 /// Asset cache used to request the assets 167 /// Asset cache used to request the assets
168 /// </summary> 168 /// </summary>
169 protected AssetCache m_assetCache; 169 protected AssetCache m_assetCache;
170 170
171 protected internal AssetsRequest(AssetsRequestCallback assetsRequestCallback, AssetCache assetCache, ICollection<LLUUID> uuids) 171 protected internal AssetsRequest(AssetsRequestCallback assetsRequestCallback, AssetCache assetCache, ICollection<LLUUID> uuids)
172 { 172 {
173 m_assetsRequestCallback = assetsRequestCallback; 173 m_assetsRequestCallback = assetsRequestCallback;
174 m_assetCache = assetCache; 174 m_assetCache = assetCache;
175 m_repliesRequired = uuids.Count; 175 m_repliesRequired = uuids.Count;
176 176
177 // We can stop here if there are no assets to fetch 177 // We can stop here if there are no assets to fetch
178 if (m_repliesRequired == 0) 178 if (m_repliesRequired == 0)
179 m_assetsRequestCallback(m_assets); 179 m_assetsRequestCallback(m_assets);
180 180
181 foreach (LLUUID uuid in uuids) 181 foreach (LLUUID uuid in uuids)
182 { 182 {
183 m_assetCache.GetAsset(uuid, AssetRequestCallback, true); 183 m_assetCache.GetAsset(uuid, AssetRequestCallback, true);
184 } 184 }
185 } 185 }
186 186
187 /// <summary> 187 /// <summary>
188 /// Called back by the asset cache when it has the asset 188 /// Called back by the asset cache when it has the asset
189 /// </summary> 189 /// </summary>
@@ -192,7 +192,7 @@ namespace OpenSim.Region.Environment
192 public void AssetRequestCallback(LLUUID assetID, AssetBase asset) 192 public void AssetRequestCallback(LLUUID assetID, AssetBase asset)
193 { 193 {
194 m_assets[assetID] = asset; 194 m_assets[assetID] = asset;
195 195
196 if (m_assets.Count == m_repliesRequired) 196 if (m_assets.Count == m_repliesRequired)
197 { 197 {
198 m_assetsRequestCallback(m_assets); 198 m_assetsRequestCallback(m_assets);