* Get the xml2 entities serialization representation in the archiver module
* Not yet reusing serialization module - this will happen in the future * No user functionality yet0.6.0-stable
parent
58e71b8507
commit
dd4100db4c
|
@ -152,18 +152,19 @@ namespace OpenSim.Region.Environment.Modules.Grid.Interregion
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
{
|
{
|
||||||
if (m_enabled)
|
// Commenting out to remove 'unreachable code' warning since m_enabled is never true
|
||||||
{
|
// if (m_enabled)
|
||||||
try
|
// {
|
||||||
{
|
// try
|
||||||
m_tcpPort = m_config.Configs["Comms"].GetInt("remoting_port", m_tcpPort);
|
// {
|
||||||
}
|
// m_tcpPort = m_config.Configs["Comms"].GetInt("remoting_port", m_tcpPort);
|
||||||
catch
|
// }
|
||||||
{
|
// catch
|
||||||
}
|
// {
|
||||||
|
// }
|
||||||
internal_CreateRemotingObjects();
|
//
|
||||||
}
|
// internal_CreateRemotingObjects();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
|
|
|
@ -26,7 +26,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using OpenSim.Region.Environment.Interfaces;
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
|
using OpenSim.Region.Environment.Modules.World.Serialiser;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
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);
|
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 string Name { get { return "ArchiverModule"; } }
|
||||||
|
|
||||||
public bool IsSharedModule { get { return true; } }
|
public bool IsSharedModule { get { return false; } }
|
||||||
|
|
||||||
public void Initialise(Scene scene, IConfigSource source)
|
public void Initialise(Scene scene, IConfigSource source)
|
||||||
{
|
{
|
||||||
scene.RegisterModuleInterface<IRegionArchiver>(this);
|
m_scene = scene;
|
||||||
|
|
||||||
|
m_scene.RegisterModuleInterface<IRegionArchiver>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
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");
|
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");
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -35,17 +35,15 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
public interface IRegionArchiver
|
public interface IRegionArchiver
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Archive a region to the given path
|
/// Archive the region to the given path
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="scene"></param>
|
|
||||||
/// <param name="savePath"></param>
|
/// <param name="savePath"></param>
|
||||||
void ArchiveRegion(Scene scene, string savePath);
|
void ArchiveRegion(string savePath);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Dearchive the given region archive into the scene
|
/// Dearchive the given region archive into the scene
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="scene"></param>
|
|
||||||
/// <param name="loadPath"></param>
|
/// <param name="loadPath"></param>
|
||||||
void DearchiveRegion(Scene scene, string loadPath);
|
void DearchiveRegion(string loadPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1378,7 +1378,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
public void LoadPrimsFromArchive(string filePath)
|
public void LoadPrimsFromArchive(string filePath)
|
||||||
{
|
{
|
||||||
IRegionArchiver archiver = RequestModuleInterface<IRegionArchiver>();
|
IRegionArchiver archiver = RequestModuleInterface<IRegionArchiver>();
|
||||||
archiver.DearchiveRegion(this, filePath);
|
archiver.DearchiveRegion(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1388,7 +1388,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
public void SavePrimsToArchive(string filePath)
|
public void SavePrimsToArchive(string filePath)
|
||||||
{
|
{
|
||||||
IRegionArchiver archiver = RequestModuleInterface<IRegionArchiver>();
|
IRegionArchiver archiver = RequestModuleInterface<IRegionArchiver>();
|
||||||
archiver.ArchiveRegion(this, filePath);
|
archiver.ArchiveRegion(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -201,7 +201,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="filename"></param>
|
/// <param name="filename"></param>
|
||||||
public void SaveCurrentSceneToArchive(string filename)
|
public void SaveCurrentSceneToArchive(string filename)
|
||||||
{
|
{
|
||||||
CurrentOrFirstScene.LoadPrimsFromArchive(filename);
|
CurrentOrFirstScene.SavePrimsToArchive(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -217,7 +217,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
[Obsolete("TODO: Remove this warning by 0.7")]
|
[Obsolete("TODO: Remove this warning by 0.7")]
|
||||||
public bool RunTerrainCmdOnCurrentScene(string[] cmdparams, ref string result)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue