aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-05-19 02:45:17 +0100
committerJustin Clark-Casey (justincc)2012-05-19 02:45:17 +0100
commit2b60a5c5d64f38caf243119105416c1101c6eb6c (patch)
treeac4ba64c4ef8aa37ff534e3ec7be80281130dc19 /OpenSim/Region/CoreModules
parentEnable FetchInventoryDescendents2 and FetchInventory2 caps by default. This ... (diff)
downloadopensim-SC_OLD-2b60a5c5d64f38caf243119105416c1101c6eb6c.zip
opensim-SC_OLD-2b60a5c5d64f38caf243119105416c1101c6eb6c.tar.gz
opensim-SC_OLD-2b60a5c5d64f38caf243119105416c1101c6eb6c.tar.bz2
opensim-SC_OLD-2b60a5c5d64f38caf243119105416c1101c6eb6c.tar.xz
Add is_megaregion flag into oar control file. Not currently read - for future use. Please do not rely on this remaining here.
An adaptation of part of Garmin's patch from http://opensimulator.org/mantis/view.php?id=5975, thanks! Flag only written if the SW corner OAR is saved - this is the only one that captures object data presently (though not land or terrain data). This adds an IRegionCombinerModule interface and the necessary methods on RegionCombinerModule
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs95
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs20
2 files changed, 74 insertions, 41 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index 5679ad5..838b741 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -67,7 +67,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
67 /// Determine whether this archive will save assets. Default is true. 67 /// Determine whether this archive will save assets. Default is true.
68 /// </summary> 68 /// </summary>
69 public bool SaveAssets { get; set; } 69 public bool SaveAssets { get; set; }
70 70
71 protected ArchiverModule m_module;
71 protected Scene m_scene; 72 protected Scene m_scene;
72 protected Stream m_saveStream; 73 protected Stream m_saveStream;
73 protected Guid m_requestId; 74 protected Guid m_requestId;
@@ -75,13 +76,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
75 /// <summary> 76 /// <summary>
76 /// Constructor 77 /// Constructor
77 /// </summary> 78 /// </summary>
78 /// <param name="scene"></param> 79 /// <param name="module">Calling module</param>
79 /// <param name="savePath">The path to which to save data.</param> 80 /// <param name="savePath">The path to which to save data.</param>
80 /// <param name="requestId">The id associated with this request</param> 81 /// <param name="requestId">The id associated with this request</param>
81 /// <exception cref="System.IO.IOException"> 82 /// <exception cref="System.IO.IOException">
82 /// If there was a problem opening a stream for the file specified by the savePath 83 /// If there was a problem opening a stream for the file specified by the savePath
83 /// </exception> 84 /// </exception>
84 public ArchiveWriteRequestPreparation(Scene scene, string savePath, Guid requestId) : this(scene, requestId) 85 public ArchiveWriteRequestPreparation(ArchiverModule module, string savePath, Guid requestId) : this(module, requestId)
85 { 86 {
86 try 87 try
87 { 88 {
@@ -99,17 +100,23 @@ namespace OpenSim.Region.CoreModules.World.Archiver
99 /// <summary> 100 /// <summary>
100 /// Constructor. 101 /// Constructor.
101 /// </summary> 102 /// </summary>
102 /// <param name="scene"></param> 103 /// <param name="module">Calling module</param>
103 /// <param name="saveStream">The stream to which to save data.</param> 104 /// <param name="saveStream">The stream to which to save data.</param>
104 /// <param name="requestId">The id associated with this request</param> 105 /// <param name="requestId">The id associated with this request</param>
105 public ArchiveWriteRequestPreparation(Scene scene, Stream saveStream, Guid requestId) : this(scene, requestId) 106 public ArchiveWriteRequestPreparation(ArchiverModule module, Stream saveStream, Guid requestId) : this(module, requestId)
106 { 107 {
107 m_saveStream = saveStream; 108 m_saveStream = saveStream;
108 } 109 }
109 110
110 protected ArchiveWriteRequestPreparation(Scene scene, Guid requestId) 111 protected ArchiveWriteRequestPreparation(ArchiverModule module, Guid requestId)
111 { 112 {
112 m_scene = scene; 113 m_module = module;
114
115 // FIXME: This is only here for regression test purposes since they do not supply a module. Need to fix
116 // this.
117 if (m_module != null)
118 m_scene = m_module.Scene;
119
113 m_requestId = requestId; 120 m_requestId = requestId;
114 121
115 SaveAssets = true; 122 SaveAssets = true;
@@ -364,32 +371,56 @@ namespace OpenSim.Region.CoreModules.World.Archiver
364 //if (majorVersion == 1) 371 //if (majorVersion == 1)
365 //{ 372 //{
366 // m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR"); 373 // m_log.WarnFormat("[ARCHIVER]: Please be aware that version 1.0 OARs are not compatible with OpenSim 0.7.0.2 and earlier. Please use the --version=0 option if you want to produce a compatible OAR");
367 //} 374 //}
375
376 String s;
368 377
369 StringWriter sw = new StringWriter(); 378 using (StringWriter sw = new StringWriter())
370 XmlTextWriter xtw = new XmlTextWriter(sw); 379 {
371 xtw.Formatting = Formatting.Indented; 380 using (XmlTextWriter xtw = new XmlTextWriter(sw))
372 xtw.WriteStartDocument(); 381 {
373 xtw.WriteStartElement("archive"); 382 xtw.Formatting = Formatting.Indented;
374 xtw.WriteAttributeString("major_version", majorVersion.ToString()); 383 xtw.WriteStartDocument();
375 xtw.WriteAttributeString("minor_version", minorVersion.ToString()); 384 xtw.WriteStartElement("archive");
376 385 xtw.WriteAttributeString("major_version", majorVersion.ToString());
377 xtw.WriteStartElement("creation_info"); 386 xtw.WriteAttributeString("minor_version", minorVersion.ToString());
378 DateTime now = DateTime.UtcNow; 387
379 TimeSpan t = now - new DateTime(1970, 1, 1); 388 xtw.WriteStartElement("creation_info");
380 xtw.WriteElementString("datetime", ((int)t.TotalSeconds).ToString()); 389 DateTime now = DateTime.UtcNow;
381 xtw.WriteElementString("id", UUID.Random().ToString()); 390 TimeSpan t = now - new DateTime(1970, 1, 1);
382 xtw.WriteEndElement(); 391 xtw.WriteElementString("datetime", ((int)t.TotalSeconds).ToString());
383 392 xtw.WriteElementString("id", UUID.Random().ToString());
384 xtw.WriteElementString("assets_included", SaveAssets.ToString()); 393 xtw.WriteEndElement();
385 394
386 xtw.WriteEndElement(); 395 xtw.WriteElementString("assets_included", SaveAssets.ToString());
387 396
388 xtw.Flush(); 397 bool isMegaregion;
389 xtw.Close(); 398
390 399 // FIXME: This is only here for regression test purposes since they do not supply a module. Need to fix
391 String s = sw.ToString(); 400 // this, possibly by doing control file creation somewhere else.
392 sw.Close(); 401 if (m_module != null && m_module.RegionCombinerModule != null)
402 {
403 IRegionCombinerModule mod = m_module.RegionCombinerModule;
404 isMegaregion = mod.IsMegaregion && mod.IsRootRegion(m_scene.RegionInfo.RegionID);
405 }
406 else
407 {
408 isMegaregion = false;
409 }
410
411 xtw.WriteElementString("is_megaregion", isMegaregion.ToString());
412
413 xtw.WriteEndElement();
414
415 xtw.Flush();
416 xtw.Close();
417 }
418
419 s = sw.ToString();
420 }
421
422// Console.WriteLine(
423// "[ARCHIVE WRITE REQUEST PREPARATION]: Control file for {0} is: {1}", m_scene.RegionInfo.RegionName, s);
393 424
394 return s; 425 return s;
395 } 426 }
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
index f5a5a8d..bf3b124 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
@@ -45,7 +45,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
45 private static readonly ILog m_log = 45 private static readonly ILog m_log =
46 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 47
48 private Scene m_scene; 48 public Scene Scene { get; private set; }
49 public IRegionCombinerModule RegionCombinerModule { get; private set; }
49 50
50 /// <value> 51 /// <value>
51 /// The file used to load and save an opensimulator archive if no filename has been specified 52 /// The file used to load and save an opensimulator archive if no filename has been specified
@@ -70,13 +71,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver
70 71
71 public void AddRegion(Scene scene) 72 public void AddRegion(Scene scene)
72 { 73 {
73 m_scene = scene; 74 Scene = scene;
74 m_scene.RegisterModuleInterface<IRegionArchiverModule>(this); 75 Scene.RegisterModuleInterface<IRegionArchiverModule>(this);
75 //m_log.DebugFormat("[ARCHIVER]: Enabled for region {0}", scene.RegionInfo.RegionName); 76 //m_log.DebugFormat("[ARCHIVER]: Enabled for region {0}", scene.RegionInfo.RegionName);
76 } 77 }
77 78
78 public void RegionLoaded(Scene scene) 79 public void RegionLoaded(Scene scene)
79 { 80 {
81 RegionCombinerModule = scene.RequestModuleInterface<IRegionCombinerModule>();
80 } 82 }
81 83
82 public void RemoveRegion(Scene scene) 84 public void RemoveRegion(Scene scene)
@@ -165,9 +167,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
165 public void ArchiveRegion(string savePath, Guid requestId, Dictionary<string, object> options) 167 public void ArchiveRegion(string savePath, Guid requestId, Dictionary<string, object> options)
166 { 168 {
167 m_log.InfoFormat( 169 m_log.InfoFormat(
168 "[ARCHIVER]: Writing archive for region {0} to {1}", m_scene.RegionInfo.RegionName, savePath); 170 "[ARCHIVER]: Writing archive for region {0} to {1}", Scene.RegionInfo.RegionName, savePath);
169 171
170 new ArchiveWriteRequestPreparation(m_scene, savePath, requestId).ArchiveRegion(options); 172 new ArchiveWriteRequestPreparation(this, savePath, requestId).ArchiveRegion(options);
171 } 173 }
172 174
173 public void ArchiveRegion(Stream saveStream) 175 public void ArchiveRegion(Stream saveStream)
@@ -182,7 +184,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
182 184
183 public void ArchiveRegion(Stream saveStream, Guid requestId, Dictionary<string, object> options) 185 public void ArchiveRegion(Stream saveStream, Guid requestId, Dictionary<string, object> options)
184 { 186 {
185 new ArchiveWriteRequestPreparation(m_scene, saveStream, requestId).ArchiveRegion(options); 187 new ArchiveWriteRequestPreparation(this, saveStream, requestId).ArchiveRegion(options);
186 } 188 }
187 189
188 public void DearchiveRegion(string loadPath) 190 public void DearchiveRegion(string loadPath)
@@ -193,9 +195,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
193 public void DearchiveRegion(string loadPath, bool merge, bool skipAssets, Guid requestId) 195 public void DearchiveRegion(string loadPath, bool merge, bool skipAssets, Guid requestId)
194 { 196 {
195 m_log.InfoFormat( 197 m_log.InfoFormat(
196 "[ARCHIVER]: Loading archive to region {0} from {1}", m_scene.RegionInfo.RegionName, loadPath); 198 "[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath);
197 199
198 new ArchiveReadRequest(m_scene, loadPath, merge, skipAssets, requestId).DearchiveRegion(); 200 new ArchiveReadRequest(Scene, loadPath, merge, skipAssets, requestId).DearchiveRegion();
199 } 201 }
200 202
201 public void DearchiveRegion(Stream loadStream) 203 public void DearchiveRegion(Stream loadStream)
@@ -205,7 +207,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
205 207
206 public void DearchiveRegion(Stream loadStream, bool merge, bool skipAssets, Guid requestId) 208 public void DearchiveRegion(Stream loadStream, bool merge, bool skipAssets, Guid requestId)
207 { 209 {
208 new ArchiveReadRequest(m_scene, loadStream, merge, skipAssets, requestId).DearchiveRegion(); 210 new ArchiveReadRequest(Scene, loadStream, merge, skipAssets, requestId).DearchiveRegion();
209 } 211 }
210 } 212 }
211} 213}