aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
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
parent* If the SVN build version is not available, state this in the About box expl... (diff)
downloadopensim-SC-dd4100db4c5b221b4feba4f873f40407d50fd4e1.zip
opensim-SC-dd4100db4c5b221b4feba4f873f40407d50fd4e1.tar.gz
opensim-SC-dd4100db4c5b221b4feba4f873f40407d50fd4e1.tar.bz2
opensim-SC-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')
-rw-r--r--OpenSim/Region/Environment/Modules/Grid/Interregion/InterregionModule.cs25
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiverModule.cs56
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/IRegionArchiver.cs8
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs4
5 files changed, 71 insertions, 26 deletions
diff --git a/OpenSim/Region/Environment/Modules/Grid/Interregion/InterregionModule.cs b/OpenSim/Region/Environment/Modules/Grid/Interregion/InterregionModule.cs
index 423f0b5..89ee61a 100644
--- a/OpenSim/Region/Environment/Modules/Grid/Interregion/InterregionModule.cs
+++ b/OpenSim/Region/Environment/Modules/Grid/Interregion/InterregionModule.cs
@@ -152,18 +152,19 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
152 152
153 public void PostInitialise() 153 public void PostInitialise()
154 { 154 {
155 if (m_enabled) 155 // Commenting out to remove 'unreachable code' warning since m_enabled is never true
156 { 156// if (m_enabled)
157 try 157// {
158 { 158// try
159 m_tcpPort = m_config.Configs["Comms"].GetInt("remoting_port", m_tcpPort); 159// {
160 } 160// m_tcpPort = m_config.Configs["Comms"].GetInt("remoting_port", m_tcpPort);
161 catch 161// }
162 { 162// catch
163 } 163// {
164 164// }
165 internal_CreateRemotingObjects(); 165//
166 } 166// internal_CreateRemotingObjects();
167// }
167 } 168 }
168 169
169 public void Close() 170 public void Close()
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}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index a42bad5..60ba898 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1378,7 +1378,7 @@ namespace OpenSim.Region.Environment.Scenes
1378 public void LoadPrimsFromArchive(string filePath) 1378 public void LoadPrimsFromArchive(string filePath)
1379 { 1379 {
1380 IRegionArchiver archiver = RequestModuleInterface<IRegionArchiver>(); 1380 IRegionArchiver archiver = RequestModuleInterface<IRegionArchiver>();
1381 archiver.DearchiveRegion(this, filePath); 1381 archiver.DearchiveRegion(filePath);
1382 } 1382 }
1383 1383
1384 /// <summary> 1384 /// <summary>
@@ -1388,7 +1388,7 @@ namespace OpenSim.Region.Environment.Scenes
1388 public void SavePrimsToArchive(string filePath) 1388 public void SavePrimsToArchive(string filePath)
1389 { 1389 {
1390 IRegionArchiver archiver = RequestModuleInterface<IRegionArchiver>(); 1390 IRegionArchiver archiver = RequestModuleInterface<IRegionArchiver>();
1391 archiver.ArchiveRegion(this, filePath); 1391 archiver.ArchiveRegion(filePath);
1392 } 1392 }
1393 1393
1394 /// <summary> 1394 /// <summary>
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index 2baef9d..eae041b 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -201,7 +201,7 @@ namespace OpenSim.Region.Environment.Scenes
201 /// <param name="filename"></param> 201 /// <param name="filename"></param>
202 public void SaveCurrentSceneToArchive(string filename) 202 public void SaveCurrentSceneToArchive(string filename)
203 { 203 {
204 CurrentOrFirstScene.LoadPrimsFromArchive(filename); 204 CurrentOrFirstScene.SavePrimsToArchive(filename);
205 } 205 }
206 206
207 /// <summary> 207 /// <summary>
@@ -217,7 +217,7 @@ namespace OpenSim.Region.Environment.Scenes
217 [Obsolete("TODO: Remove this warning by 0.7")] 217 [Obsolete("TODO: Remove this warning by 0.7")]
218 public bool RunTerrainCmdOnCurrentScene(string[] cmdparams, ref string result) 218 public bool RunTerrainCmdOnCurrentScene(string[] cmdparams, ref string result)
219 { 219 {
220 m_log.Warn("DEPRECIATED: The terrain engine has been replaced with a new terrain plugin module. Please type 'plugin terrain help' for new commands."); 220 m_log.Warn("DEPRECATED: The terrain engine has been replaced with a new terrain plugin module. Please type 'plugin terrain help' for new commands.");
221 return false; 221 return false;
222 } 222 }
223 223