* 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
0.6.0-stable
Justin Clarke Casey 2008-05-24 19:21:57 +00:00
parent 58e71b8507
commit dd4100db4c
5 changed files with 71 additions and 26 deletions

View File

@ -152,18 +152,19 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
public void PostInitialise()
{
if (m_enabled)
{
try
{
m_tcpPort = m_config.Configs["Comms"].GetInt("remoting_port", m_tcpPort);
}
catch
{
}
internal_CreateRemotingObjects();
}
// Commenting out to remove 'unreachable code' warning since m_enabled is never true
// if (m_enabled)
// {
// try
// {
// m_tcpPort = m_config.Configs["Comms"].GetInt("remoting_port", m_tcpPort);
// }
// catch
// {
// }
//
// internal_CreateRemotingObjects();
// }
}
public void Close()

View File

@ -26,7 +26,9 @@
*/
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Modules.World.Serialiser;
using OpenSim.Region.Environment.Scenes;
using System.Collections.Generic;
using System.Reflection;
using log4net;
using Nini.Config;
@ -40,13 +42,22 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// Scene to which this module belongs
/// </summary>
/// <param name="scene"></param>
/// <param name="source"></param>
private Scene m_scene;
public string Name { get { return "ArchiverModule"; } }
public bool IsSharedModule { get { return true; } }
public bool IsSharedModule { get { return false; } }
public void Initialise(Scene scene, IConfigSource source)
{
scene.RegisterModuleInterface<IRegionArchiver>(this);
m_scene = scene;
m_scene.RegisterModuleInterface<IRegionArchiver>(this);
}
public void PostInitialise()
@ -57,14 +68,49 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
{
}
public void ArchiveRegion(Scene scene, string savePath)
public void ArchiveRegion(string savePath)
{
m_log.Warn("[ARCHIVER]: Archive region not yet implemented");
List<EntityBase> entities = m_scene.GetEntities();
string serEntities = SerializeObjects(entities);
if (serEntities != null && serEntities.Length > 0)
{
m_log.DebugFormat("[ARCHIVER]: Successfully got serialization for {0} entities", entities.Count);
}
}
public void DearchiveRegion(Scene scene, string loadPath)
public void DearchiveRegion(string loadPath)
{
m_log.Warn("[ARCHIVER]: Dearchive region not yet implemented");
}
/// <summary>
/// Get an xml representation of the given scene objects.
/// </summary>
/// <param name="scene"></param>
/// <returns></returns>
private static string SerializeObjects(List<EntityBase> entities)
{
string serialization = "<scene>";
List<string> serObjects = new List<string>();
foreach (EntityBase ent in entities)
{
if (ent is SceneObjectGroup)
{
serObjects.Add(((SceneObjectGroup) ent).ToXmlString2());
}
}
foreach (string serObject in serObjects)
serialization += serObject;
serialization += "</scene>";
return serialization;
}
}
}

View File

@ -35,17 +35,15 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
public interface IRegionArchiver
{
/// <summary>
/// Archive a region to the given path
/// Archive the region to the given path
/// </summary>
/// <param name="scene"></param>
/// <param name="savePath"></param>
void ArchiveRegion(Scene scene, string savePath);
void ArchiveRegion(string savePath);
/// <summary>
/// Dearchive the given region archive into the scene
/// </summary>
/// <param name="scene"></param>
/// <param name="loadPath"></param>
void DearchiveRegion(Scene scene, string loadPath);
void DearchiveRegion(string loadPath);
}
}

View File

@ -1378,7 +1378,7 @@ namespace OpenSim.Region.Environment.Scenes
public void LoadPrimsFromArchive(string filePath)
{
IRegionArchiver archiver = RequestModuleInterface<IRegionArchiver>();
archiver.DearchiveRegion(this, filePath);
archiver.DearchiveRegion(filePath);
}
/// <summary>
@ -1388,7 +1388,7 @@ namespace OpenSim.Region.Environment.Scenes
public void SavePrimsToArchive(string filePath)
{
IRegionArchiver archiver = RequestModuleInterface<IRegionArchiver>();
archiver.ArchiveRegion(this, filePath);
archiver.ArchiveRegion(filePath);
}
/// <summary>

View File

@ -201,7 +201,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="filename"></param>
public void SaveCurrentSceneToArchive(string filename)
{
CurrentOrFirstScene.LoadPrimsFromArchive(filename);
CurrentOrFirstScene.SavePrimsToArchive(filename);
}
/// <summary>
@ -217,7 +217,7 @@ namespace OpenSim.Region.Environment.Scenes
[Obsolete("TODO: Remove this warning by 0.7")]
public bool RunTerrainCmdOnCurrentScene(string[] cmdparams, ref string result)
{
m_log.Warn("DEPRECIATED: The terrain engine has been replaced with a new terrain plugin module. Please type 'plugin terrain help' for new commands.");
m_log.Warn("DEPRECATED: The terrain engine has been replaced with a new terrain plugin module. Please type 'plugin terrain help' for new commands.");
return false;
}