diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs index d812e24f90..35b4d8aeba 100644 --- a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs +++ b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs @@ -44,6 +44,7 @@ using OpenSim.Framework; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; using OpenSim.Framework.Communications; +using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Scenes; using OpenSim.ApplicationPlugins.Rest; @@ -219,7 +220,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions { httpResponse.SendChunked = true; httpResponse.ContentType = "text/xml"; - scene.SavePrimsToXml2(new StreamWriter(httpResponse.OutputStream), min, max); + + IRegionSerialiserModule serialiser = scene.RequestModuleInterface(); + if (serialiser != null) + serialiser.SavePrimsToXml2(scene, new StreamWriter(httpResponse.OutputStream), min, max); + return ""; } } diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs index 73a1b9b826..932f512cb2 100644 --- a/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs +++ b/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs @@ -44,6 +44,7 @@ using OpenSim.Framework; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; using OpenSim.Framework.Communications; +using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Scenes; using OpenSim.ApplicationPlugins.Rest; @@ -120,7 +121,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions public string LoadPrims(string requestBody, OSHttpRequest request, OSHttpResponse response, Scene scene) { - scene.LoadPrimsFromXml2(new StringReader(requestBody), true); + IRegionSerialiserModule serialiser = scene.RequestModuleInterface(); + if (serialiser != null) + serialiser.LoadPrimsFromXml2(scene, new StringReader(requestBody), true); + return ""; } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 7d83ee28ec..eaf04eabdd 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1880,34 +1880,6 @@ namespace OpenSim.Region.Environment.Scenes return false; } - public void LoadPrimsFromXml2(string fileName) - { - m_log.InfoFormat("[SCENE]: Loading prims in xml2 format to region {0} from {1}", RegionInfo.RegionName, fileName); - - m_serialiser.LoadPrimsFromXml2(this, fileName); - } - - public void LoadPrimsFromXml2(TextReader reader, bool startScripts) - { - m_log.InfoFormat("[SCENE]: Loading prims in xml2 format to region {0} from stream", RegionInfo.RegionName); - - m_serialiser.LoadPrimsFromXml2(this, reader, startScripts); - } - - public void SavePrimsToXml2(string fileName) - { - m_log.InfoFormat("[SCENE]: Saving prims in xml2 format for region {0} to {1}", RegionInfo.RegionName, fileName); - - m_serialiser.SavePrimsToXml2(this, fileName); - } - - public void SavePrimsToXml2(TextWriter stream, Vector3 min, Vector3 max) - { - m_log.InfoFormat("[SCENE]: Saving prims in xml2 format for region {0} to stream", RegionInfo.RegionName); - - m_serialiser.SavePrimsToXml2(this, stream, min, max); - } - public void SaveNamedPrimsToXml2(string primName, string fileName) { m_log.InfoFormat( diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index b973ced037..9e83f25650 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs @@ -208,7 +208,9 @@ namespace OpenSim.Region.Environment.Scenes /// public void SaveCurrentSceneToXml2(string filename) { - CurrentOrFirstScene.SavePrimsToXml2(filename); + IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface(); + if (serialiser != null) + serialiser.SavePrimsToXml2(CurrentOrFirstScene, filename); } public void SaveNamedPrimsToXml2(string primName, string filename) @@ -221,7 +223,9 @@ namespace OpenSim.Region.Environment.Scenes /// public void LoadCurrentSceneFromXml2(string filename) { - CurrentOrFirstScene.LoadPrimsFromXml2(filename); + IRegionSerialiserModule serialiser = CurrentOrFirstScene.RequestModuleInterface(); + if (serialiser != null) + serialiser.LoadPrimsFromXml2(CurrentOrFirstScene, filename); } /// diff --git a/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs b/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs index f90c6979d0..ea389d64af 100644 --- a/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs +++ b/OpenSim/Region/Modules/SvnSerialiser/SvnBackupModule.cs @@ -116,11 +116,26 @@ namespace OpenSim.Region.Modules.SvnSerialiser public void LoadRegion(Scene scene) { - scene.LoadPrimsFromXml2(m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID + - Slash.DirectorySeparatorChar + "objects.xml"); - scene.RequestModuleInterface().LoadFromFile(m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID + - Slash.DirectorySeparatorChar + "heightmap.r32"); - m_log.Info("[SVNBACKUP]: Region load successful (" + scene.RegionInfo.RegionName + ")."); + IRegionSerialiserModule serialiser = scene.RequestModuleInterface(); + if (serialiser != null) + { + serialiser.LoadPrimsFromXml2( + scene, + m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID + + Slash.DirectorySeparatorChar + "objects.xml"); + + scene.RequestModuleInterface().LoadFromFile( + m_svndir + Slash.DirectorySeparatorChar + scene.RegionInfo.RegionID + + Slash.DirectorySeparatorChar + "heightmap.r32"); + + m_log.Info("[SVNBACKUP]: Region load successful (" + scene.RegionInfo.RegionName + ")."); + } + else + { + m_log.ErrorFormat( + "[SVNBACKUP]: Region load of {0} failed - no serialisation module available", + scene.RegionInfo.RegionName); + } } private void CheckoutSvn()