* refactor: Remove archiver module scene wrappers
parent
7271edd684
commit
583fa73126
|
@ -37,9 +37,9 @@ using Nini.Config;
|
||||||
using Nwc.XmlRpc;
|
using Nwc.XmlRpc;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
|
using OpenSim.Region.Environment.Interfaces;
|
||||||
using OpenSim.Region.Environment.Modules.World.Terrain;
|
using OpenSim.Region.Environment.Modules.World.Terrain;
|
||||||
using OpenSim.Region.Environment.Scenes;
|
using OpenSim.Region.Environment.Scenes;
|
||||||
using OpenSim.Region.Environment.Modules.World.Archiver;
|
|
||||||
|
|
||||||
namespace OpenSim.ApplicationPlugins.RemoteController
|
namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
{
|
{
|
||||||
|
@ -1082,9 +1082,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
}
|
}
|
||||||
else throw new Exception("neither region_name nor region_uuid given");
|
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";
|
responseData["loaded"] = "true";
|
||||||
|
|
||||||
response.Value = responseData;
|
response.Value = responseData;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -1173,7 +1178,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
}
|
}
|
||||||
else throw new Exception("neither region_name nor region_uuid given");
|
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";
|
responseData["saved"] = "true";
|
||||||
|
|
||||||
|
|
|
@ -25,14 +25,12 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using OpenSim.Region.Environment.Scenes;
|
namespace OpenSim.Region.Environment.Interfaces
|
||||||
|
|
||||||
namespace OpenSim.Region.Environment.Modules.World.Archiver
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interface to region archive functionality
|
/// Interface to region archive functionality
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IRegionArchiver
|
public interface IRegionArchiverModule
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Archive the region to the given path
|
/// Archive the region to the given path
|
|
@ -40,9 +40,9 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This module loads and saves OpenSimulator archives
|
/// This module loads and saves OpenSimulator archives
|
||||||
/// </summary>
|
/// </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>
|
/// <summary>
|
||||||
/// Scene to which this module belongs
|
/// Scene to which this module belongs
|
||||||
|
@ -58,8 +58,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
public void Initialise(Scene scene, IConfigSource source)
|
public void Initialise(Scene scene, IConfigSource source)
|
||||||
{
|
{
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
|
m_scene.RegisterModuleInterface<IRegionArchiverModule>(this);
|
||||||
m_scene.RegisterModuleInterface<IRegionArchiver>(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PostInitialise()
|
public void PostInitialise()
|
||||||
|
@ -72,11 +71,15 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
|
|
||||||
public void ArchiveRegion(string savePath)
|
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();
|
new ArchiveWriteRequestPreparation(m_scene, savePath).ArchiveRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DearchiveRegion(string loadPath)
|
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);
|
new ArchiveReadRequest(m_scene, loadPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,7 +142,6 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
protected IWorldComm m_worldCommModule;
|
protected IWorldComm m_worldCommModule;
|
||||||
protected IAvatarFactory m_AvatarFactory;
|
protected IAvatarFactory m_AvatarFactory;
|
||||||
protected IConfigSource m_config;
|
protected IConfigSource m_config;
|
||||||
protected IRegionArchiver m_archiver;
|
|
||||||
protected IRegionSerialiser m_serialiser;
|
protected IRegionSerialiser m_serialiser;
|
||||||
|
|
||||||
// Central Update Loop
|
// Central Update Loop
|
||||||
|
@ -729,7 +728,6 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
m_worldCommModule = RequestModuleInterface<IWorldComm>();
|
m_worldCommModule = RequestModuleInterface<IWorldComm>();
|
||||||
XferManager = RequestModuleInterface<IXfer>();
|
XferManager = RequestModuleInterface<IXfer>();
|
||||||
m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
|
m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
|
||||||
m_archiver = RequestModuleInterface<IRegionArchiver>();
|
|
||||||
m_serialiser = RequestModuleInterface<IRegionSerialiser>();
|
m_serialiser = RequestModuleInterface<IRegionSerialiser>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1948,28 +1946,6 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
m_serialiser.SavePrimListToXml2(primList, fileName);
|
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>
|
/// <summary>
|
||||||
/// Move the given scene object into a new region depending on which region its absolute position has moved
|
/// Move the given scene object into a new region depending on which region its absolute position has moved
|
||||||
/// into.
|
/// into.
|
||||||
|
|
|
@ -227,7 +227,9 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="filename"></param>
|
/// <param name="filename"></param>
|
||||||
public void SaveCurrentSceneToArchive(string filename)
|
public void SaveCurrentSceneToArchive(string filename)
|
||||||
{
|
{
|
||||||
CurrentOrFirstScene.SavePrimsToArchive(filename);
|
IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>();
|
||||||
|
if (archiver != null)
|
||||||
|
archiver.ArchiveRegion(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -237,7 +239,9 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// <param name="filename"></param>
|
/// <param name="filename"></param>
|
||||||
public void LoadArchiveToCurrentScene(string filename)
|
public void LoadArchiveToCurrentScene(string filename)
|
||||||
{
|
{
|
||||||
CurrentOrFirstScene.LoadPrimsFromArchive(filename);
|
IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface<IRegionArchiverModule>();
|
||||||
|
if (archiver != null)
|
||||||
|
archiver.DearchiveRegion(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string SaveCurrentSceneMapToXmlString()
|
public string SaveCurrentSceneMapToXmlString()
|
||||||
|
|
Loading…
Reference in New Issue