aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/World
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-05-24 19:21:57 +0000
committerJustin Clarke Casey2008-05-24 19:21:57 +0000
commitdd4100db4c5b221b4feba4f873f40407d50fd4e1 (patch)
treef9149ae68b3c3e0b6a60f123e0299f588967f8dc /OpenSim/Region/Environment/Modules/World
parent* If the SVN build version is not available, state this in the About box expl... (diff)
downloadopensim-SC_OLD-dd4100db4c5b221b4feba4f873f40407d50fd4e1.zip
opensim-SC_OLD-dd4100db4c5b221b4feba4f873f40407d50fd4e1.tar.gz
opensim-SC_OLD-dd4100db4c5b221b4feba4f873f40407d50fd4e1.tar.bz2
opensim-SC_OLD-dd4100db4c5b221b4feba4f873f40407d50fd4e1.tar.xz
* Get the xml2 entities serialization representation in the archiver module
* Not yet reusing serialization module - this will happen in the future * No user functionality yet
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiverModule.cs56
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/IRegionArchiver.cs8
2 files changed, 54 insertions, 10 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiverModule.cs
index cba04c4..ce78f21 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiverModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiverModule.cs
@@ -26,7 +26,9 @@
26 */ 26 */
27 27
28using OpenSim.Region.Environment.Interfaces; 28using OpenSim.Region.Environment.Interfaces;
29using OpenSim.Region.Environment.Modules.World.Serialiser;
29using OpenSim.Region.Environment.Scenes; 30using OpenSim.Region.Environment.Scenes;
31using System.Collections.Generic;
30using System.Reflection; 32using System.Reflection;
31using log4net; 33using log4net;
32using Nini.Config; 34using Nini.Config;
@@ -39,32 +41,76 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
39 public class ArchiverModule : IRegionModule, IRegionArchiver 41 public class ArchiverModule : IRegionModule, IRegionArchiver
40 { 42 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44
45 /// <summary>
46 /// Scene to which this module belongs
47 /// </summary>
48 /// <param name="scene"></param>
49 /// <param name="source"></param>
50 private Scene m_scene;
42 51
43 public string Name { get { return "ArchiverModule"; } } 52 public string Name { get { return "ArchiverModule"; } }
44 53
45 public bool IsSharedModule { get { return true; } } 54 public bool IsSharedModule { get { return false; } }
46 55
47 public void Initialise(Scene scene, IConfigSource source) 56 public void Initialise(Scene scene, IConfigSource source)
48 { 57 {
49 scene.RegisterModuleInterface<IRegionArchiver>(this); 58 m_scene = scene;
59
60 m_scene.RegisterModuleInterface<IRegionArchiver>(this);
50 } 61 }
51 62
52 public void PostInitialise() 63 public void PostInitialise()
53 { 64 {
54 } 65 }
55 66
56 public void Close() 67 public void Close()
57 { 68 {
58 } 69 }
59 70
60 public void ArchiveRegion(Scene scene, string savePath) 71 public void ArchiveRegion(string savePath)
61 { 72 {
62 m_log.Warn("[ARCHIVER]: Archive region not yet implemented"); 73 m_log.Warn("[ARCHIVER]: Archive region not yet implemented");
74
75 List<EntityBase> entities = m_scene.GetEntities();
76 string serEntities = SerializeObjects(entities);
77
78 if (serEntities != null && serEntities.Length > 0)
79 {
80 m_log.DebugFormat("[ARCHIVER]: Successfully got serialization for {0} entities", entities.Count);
81 }
63 } 82 }
64 83
65 public void DearchiveRegion(Scene scene, string loadPath) 84 public void DearchiveRegion(string loadPath)
66 { 85 {
67 m_log.Warn("[ARCHIVER]: Dearchive region not yet implemented"); 86 m_log.Warn("[ARCHIVER]: Dearchive region not yet implemented");
68 } 87 }
88
89 /// <summary>
90 /// Get an xml representation of the given scene objects.
91 /// </summary>
92 /// <param name="scene"></param>
93 /// <returns></returns>
94 private static string SerializeObjects(List<EntityBase> entities)
95 {
96 string serialization = "<scene>";
97
98 List<string> serObjects = new List<string>();
99
100 foreach (EntityBase ent in entities)
101 {
102 if (ent is SceneObjectGroup)
103 {
104 serObjects.Add(((SceneObjectGroup) ent).ToXmlString2());
105 }
106 }
107
108 foreach (string serObject in serObjects)
109 serialization += serObject;
110
111 serialization += "</scene>";
112
113 return serialization;
114 }
69 } 115 }
70} \ No newline at end of file 116} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/IRegionArchiver.cs b/OpenSim/Region/Environment/Modules/World/Archiver/IRegionArchiver.cs
index 1cebb50..485cf02 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/IRegionArchiver.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/IRegionArchiver.cs
@@ -35,17 +35,15 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
35 public interface IRegionArchiver 35 public interface IRegionArchiver
36 { 36 {
37 /// <summary> 37 /// <summary>
38 /// Archive a region to the given path 38 /// Archive the region to the given path
39 /// </summary> 39 /// </summary>
40 /// <param name="scene"></param>
41 /// <param name="savePath"></param> 40 /// <param name="savePath"></param>
42 void ArchiveRegion(Scene scene, string savePath); 41 void ArchiveRegion(string savePath);
43 42
44 /// <summary> 43 /// <summary>
45 /// Dearchive the given region archive into the scene 44 /// Dearchive the given region archive into the scene
46 /// </summary> 45 /// </summary>
47 /// <param name="scene"></param>
48 /// <param name="loadPath"></param> 46 /// <param name="loadPath"></param>
49 void DearchiveRegion(Scene scene, string loadPath); 47 void DearchiveRegion(string loadPath);
50 } 48 }
51} 49}