From 88ead9ee63fe87b16d7c24b3a38bf6567f3166f6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 24 Nov 2009 17:28:38 +0000 Subject: pass all command parameters to load/save oar, not just the filename unfortunately, these commands cannot yet be properly relocated to the region modules due to deficiencies in the region module infrastructure --- OpenSim/Region/Application/OpenSim.cs | 18 ++--------- OpenSim/Region/Application/OpenSimBase.cs | 5 --- .../CoreModules/World/Archiver/ArchiverModule.cs | 37 ++++++++++++++++++++++ .../Framework/Interfaces/IRegionArchiverModule.cs | 5 ++- OpenSim/Region/Framework/Scenes/SceneManager.cs | 12 +++---- 5 files changed, 49 insertions(+), 28 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 60c34df..f9be1e2 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -1294,14 +1294,7 @@ namespace OpenSim { try { - if (cmdparams.Length > 2) - { - m_sceneManager.LoadArchiveToCurrentScene(cmdparams[2]); - } - else - { - m_sceneManager.LoadArchiveToCurrentScene(DEFAULT_OAR_BACKUP_FILENAME); - } + m_sceneManager.LoadArchiveToCurrentScene(cmdparams); } catch (Exception e) { @@ -1315,14 +1308,7 @@ namespace OpenSim /// protected void SaveOar(string module, string[] cmdparams) { - if (cmdparams.Length > 2) - { - m_sceneManager.SaveCurrentSceneToArchive(cmdparams[2]); - } - else - { - m_sceneManager.SaveCurrentSceneToArchive(DEFAULT_OAR_BACKUP_FILENAME); - } + m_sceneManager.SaveCurrentSceneToArchive(cmdparams); } private static string CombineParams(string[] commandParams, int pos) diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index cc18f1a..391856b 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -75,11 +75,6 @@ namespace OpenSim /// protected const string DEFAULT_PRIM_BACKUP_FILENAME = "prim-backup.xml"; - /// - /// The file used to load and save an opensimulator archive if no filename has been specified - /// - protected const string DEFAULT_OAR_BACKUP_FILENAME = "region.oar"; - public ConfigSettings ConfigurationSettings { get { return m_configSettings; } diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 8d4f91b..181f4c6 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs @@ -45,6 +45,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver private Scene m_scene; + /// + /// The file used to load and save an opensimulator archive if no filename has been specified + /// + protected const string DEFAULT_OAR_BACKUP_FILENAME = "region.oar"; + public string Name { get { return "RegionArchiverModule"; } @@ -80,6 +85,38 @@ namespace OpenSim.Region.CoreModules.World.Archiver { } + /// + /// Load a whole region from an opensimulator archive. + /// + /// + public void HandleLoadOarConsoleCommand(string module, string[] cmdparams) + { + if (cmdparams.Length > 2) + { + DearchiveRegion(cmdparams[2]); + } + else + { + DearchiveRegion(DEFAULT_OAR_BACKUP_FILENAME); + } + } + + /// + /// Save a region to a file, including all the assets needed to restore it. + /// + /// + public void HandleSaveOarConsoleCommand(string module, string[] cmdparams) + { + if (cmdparams.Length > 2) + { + ArchiveRegion(cmdparams[2]); + } + else + { + ArchiveRegion(DEFAULT_OAR_BACKUP_FILENAME); + } + } + public void ArchiveRegion(string savePath) { ArchiveRegion(savePath, Guid.Empty); diff --git a/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs index 9ad2036..1a8babc 100644 --- a/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs @@ -34,7 +34,10 @@ namespace OpenSim.Region.Framework.Interfaces /// Interface to region archive functionality /// public interface IRegionArchiverModule - { + { + void HandleLoadOarConsoleCommand(string module, string[] cmdparams); + void HandleSaveOarConsoleCommand(string module, string[] cmdparams); + /// /// Archive the region to the given path /// diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index dfaa7ea..c2e3370 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs @@ -241,24 +241,24 @@ namespace OpenSim.Region.Framework.Scenes /// Save the current scene to an OpenSimulator archive. This archive will eventually include the prim's assets /// as well as the details of the prims themselves. /// - /// - public void SaveCurrentSceneToArchive(string filename) + /// + public void SaveCurrentSceneToArchive(string[] cmdparams) { IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface(); if (archiver != null) - archiver.ArchiveRegion(filename); + archiver.HandleSaveOarConsoleCommand(string.Empty, cmdparams); } /// /// Load an OpenSim archive into the current scene. This will load both the shapes of the prims and upload /// their assets to the asset service. /// - /// - public void LoadArchiveToCurrentScene(string filename) + /// + public void LoadArchiveToCurrentScene(string[] cmdparams) { IRegionArchiverModule archiver = CurrentOrFirstScene.RequestModuleInterface(); if (archiver != null) - archiver.DearchiveRegion(filename); + archiver.HandleLoadOarConsoleCommand(string.Empty, cmdparams); } public string SaveCurrentSceneMapToXmlString() -- cgit v1.1