* refactor: Remove archiver module scene wrappers

0.6.1-post-fixes
Justin Clarke Casey 2008-12-19 18:33:03 +00:00
parent 7271edd684
commit 583fa73126
5 changed files with 28 additions and 38 deletions

View File

@ -37,9 +37,9 @@ using Nini.Config;
using Nwc.XmlRpc;
using OpenSim.Framework;
using OpenSim.Framework.Servers;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Modules.World.Terrain;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Modules.World.Archiver;
namespace OpenSim.ApplicationPlugins.RemoteController
{
@ -1082,7 +1082,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
}
else throw new Exception("neither region_name nor region_uuid given");
new ArchiveReadRequest(scene, filename);
IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>();
if (archiver != null)
archiver.DearchiveRegion(filename);
else
throw new Exception("Archiver module not present for scene");
responseData["loaded"] = "true";
response.Value = responseData;
@ -1173,7 +1178,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
}
else throw new Exception("neither region_name nor region_uuid given");
scene.SavePrimsToArchive(filename);
IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>();
if (archiver != null)
archiver.ArchiveRegion(filename);
else
throw new Exception("Archiver module not present for scene");
responseData["saved"] = "true";

View File

@ -25,14 +25,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules.World.Archiver
namespace OpenSim.Region.Environment.Interfaces
{
/// <summary>
/// Interface to region archive functionality
/// </summary>
public interface IRegionArchiver
public interface IRegionArchiverModule
{
/// <summary>
/// Archive the region to the given path

View File

@ -40,9 +40,9 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
/// <summary>
/// This module loads and saves OpenSimulator archives
/// </summary>
public class ArchiverModule : IRegionModule, IRegionArchiver
public class ArchiverModule : IRegionModule, IRegionArchiverModule
{
// 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
@ -58,8 +58,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
public void Initialise(Scene scene, IConfigSource source)
{
m_scene = scene;
m_scene.RegisterModuleInterface<IRegionArchiver>(this);
m_scene.RegisterModuleInterface<IRegionArchiverModule>(this);
}
public void PostInitialise()
@ -72,11 +71,15 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
public void ArchiveRegion(string savePath)
{
m_log.InfoFormat("[SCENE]: Writing archive for region {0} to {1}", m_scene.RegionInfo.RegionName, savePath);
new ArchiveWriteRequestPreparation(m_scene, savePath).ArchiveRegion();
}
public void DearchiveRegion(string loadPath)
{
m_log.InfoFormat("[SCENE]: Loading archive to region {0} from {1}", m_scene.RegionInfo.RegionName, loadPath);
new ArchiveReadRequest(m_scene, loadPath);
}
}

View File

@ -142,7 +142,6 @@ namespace OpenSim.Region.Environment.Scenes
protected IWorldComm m_worldCommModule;
protected IAvatarFactory m_AvatarFactory;
protected IConfigSource m_config;
protected IRegionArchiver m_archiver;
protected IRegionSerialiser m_serialiser;
// Central Update Loop
@ -729,7 +728,6 @@ namespace OpenSim.Region.Environment.Scenes
m_worldCommModule = RequestModuleInterface<IWorldComm>();
XferManager = RequestModuleInterface<IXfer>();
m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
m_archiver = RequestModuleInterface<IRegionArchiver>();
m_serialiser = RequestModuleInterface<IRegionSerialiser>();
}
@ -1948,28 +1946,6 @@ namespace OpenSim.Region.Environment.Scenes
m_serialiser.SavePrimListToXml2(primList, fileName);
}
/// <summary>
/// Load a prim archive into the scene. This loads both prims and their assets.
/// </summary>
/// <param name="filePath"></param>
public void LoadPrimsFromArchive(string filePath)
{
m_log.InfoFormat("[SCENE]: Loading archive to region {0} from {1}", RegionInfo.RegionName, filePath);
m_archiver.DearchiveRegion(filePath);
}
/// <summary>
/// Save the prims in the scene to an archive. This saves both prims and their assets.
/// </summary>
/// <param name="filePath"></param>
public void SavePrimsToArchive(string filePath)
{
m_log.InfoFormat("[SCENE]: Writing archive for region {0} to {1}", RegionInfo.RegionName, filePath);
m_archiver.ArchiveRegion(filePath);
}
/// <summary>
/// Move the given scene object into a new region depending on which region its absolute position has moved
/// into.

View File

@ -227,7 +227,9 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="filename"></param>
public void SaveCurrentSceneToArchive(string filename)
{
CurrentOrFirstScene.SavePrimsToArchive(filename);
IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>();
if (archiver != null)
archiver.ArchiveRegion(filename);
}
/// <summary>
@ -237,7 +239,9 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="filename"></param>
public void LoadArchiveToCurrentScene(string filename)
{
CurrentOrFirstScene.LoadPrimsFromArchive(filename);
IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>();
if (archiver != null)
archiver.DearchiveRegion(filename);
}
public string SaveCurrentSceneMapToXmlString()