aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
diff options
context:
space:
mode:
authorDr Scofield2008-08-28 09:34:47 +0000
committerDr Scofield2008-08-28 09:34:47 +0000
commit0921dafddf965745fdf483f2f41ef4833a0e2caa (patch)
treedee0579185e5a40de33c677aab992a8885f41cd7 /OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
parent* Added hack so that if the default OpenSimulator ParentEstateId(100) is bein... (diff)
downloadopensim-SC-0921dafddf965745fdf483f2f41ef4833a0e2caa.zip
opensim-SC-0921dafddf965745fdf483f2f41ef4833a0e2caa.tar.gz
opensim-SC-0921dafddf965745fdf483f2f41ef4833a0e2caa.tar.bz2
opensim-SC-0921dafddf965745fdf483f2f41ef4833a0e2caa.tar.xz
adds XmlRcpLoadOAR support to RemoteAdminPlugin.cs
Diffstat (limited to 'OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs96
1 files changed, 96 insertions, 0 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 4dc63fd..3bd80f5 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -39,6 +39,7 @@ using OpenSim.Framework;
39using OpenSim.Framework.Servers; 39using OpenSim.Framework.Servers;
40using OpenSim.Region.Environment.Modules.World.Terrain; 40using OpenSim.Region.Environment.Modules.World.Terrain;
41using OpenSim.Region.Environment.Scenes; 41using OpenSim.Region.Environment.Scenes;
42using OpenSim.Region.Environment.Modules.World.Archiver;
42 43
43namespace OpenSim.ApplicationPlugins.RemoteController 44namespace OpenSim.ApplicationPlugins.RemoteController
44{ 45{
@@ -88,6 +89,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
88 m_httpd.AddXmlRPCHandler("admin_create_user", XmlRpcCreateUserMethod); 89 m_httpd.AddXmlRPCHandler("admin_create_user", XmlRpcCreateUserMethod);
89 m_httpd.AddXmlRPCHandler("admin_update_user", XmlRpcUpdateUserAccountMethod); 90 m_httpd.AddXmlRPCHandler("admin_update_user", XmlRpcUpdateUserAccountMethod);
90 m_httpd.AddXmlRPCHandler("admin_load_xml", XmlRpcLoadXMLMethod); 91 m_httpd.AddXmlRPCHandler("admin_load_xml", XmlRpcLoadXMLMethod);
92 m_httpd.AddXmlRPCHandler("admin_load_oar", XmlRpcLoadOARMethod);
91 } 93 }
92 } 94 }
93 catch (NullReferenceException) 95 catch (NullReferenceException)
@@ -685,6 +687,99 @@ namespace OpenSim.ApplicationPlugins.RemoteController
685 return response; 687 return response;
686 } 688 }
687 689
690 /// <summary>
691 /// Load an OAR file into a region..
692 /// <summary>
693 /// <param name="request">incoming XML RPC request</param>
694 /// <remarks>
695 /// XmlRpcLoadOARMethod takes the following XMLRPC
696 /// parameters
697 /// <list type="table">
698 /// <listheader><term>parameter name</term><description>description</description></listheader>
699 /// <item><term>password</term>
700 /// <description>admin password as set in OpenSim.ini</description></item>
701 /// <item><term>filename</term>
702 /// <description>file name of the OAR file</description></item>
703 /// <item><term>region_uuid</term>
704 /// <description>UUID of the region</description></item>
705 /// <item><term>region_name</term>
706 /// <description>region name</description></item>
707 /// </list>
708 ///
709 /// <code>region_uuid</code> takes precedence over
710 /// <code>region_name</code> if both are present; one of both
711 /// must be present.
712 ///
713 /// XmlRpcLoadOARMethod returns
714 /// <list type="table">
715 /// <listheader><term>name</term><description>description</description></listheader>
716 /// <item><term>success</term>
717 /// <description>true or false</description></item>
718 /// <item><term>error</term>
719 /// <description>error message if success is false</description></item>
720 /// </list>
721 /// </remarks>
722 public XmlRpcResponse XmlRpcLoadOARMethod(XmlRpcRequest request)
723 {
724 m_log.Info("[RADMIN]: Received Load OAR Administrator Request");
725 XmlRpcResponse response = new XmlRpcResponse();
726 Hashtable responseData = new Hashtable();
727
728 try
729 {
730 Hashtable requestData = (Hashtable) request.Params[0];
731
732 // check completeness
733 foreach (string p in new string[] { "password", "filename" })
734 {
735 if (!requestData.Contains(p))
736 throw new Exception(String.Format("missing parameter {0}", p));
737 if (String.IsNullOrEmpty((string)requestData[p]))
738 throw new Exception(String.Format("parameter {0} is empty"));
739 }
740
741 // check password
742 if (!String.IsNullOrEmpty(requiredPassword) &&
743 (string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
744
745 string filename = (string)requestData["filename"];
746 Scene scene = null;
747 if (requestData.Contains("region_uuid"))
748 {
749 LLUUID region_uuid = (string)requestData["region_uuid"];
750 if (!m_app.SceneManager.TryGetScene(region_uuid, out scene))
751 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
752 }
753 else if (requestData.Contains("region_name"))
754 {
755 string region_name = (string)requestData["region_name"];
756 if (!m_app.SceneManager.TryGetScene(region_name, out scene))
757 throw new Exception(String.Format("failed to switch to region {0}", region_name));
758 }
759 else throw new Exception("neither region_name nor region_uuid given");
760
761 responseData["switched"] = "true";
762
763 new ArchiveReadRequest(scene, filename);
764 responseData["loaded"] = "true";
765
766 response.Value = responseData;
767 }
768 catch (Exception e)
769 {
770 m_log.InfoFormat("[RADMIN] LoadOAR: {0}", e.Message);
771 m_log.DebugFormat("[RADMIN] LoadOAR: {0}", e.ToString());
772
773 responseData["loaded"] = "false";
774 responseData["switched"] = "false";
775 responseData["error"] = e.Message;
776
777 response.Value = responseData;
778 }
779
780 return response;
781 }
782
688 public XmlRpcResponse XmlRpcLoadXMLMethod(XmlRpcRequest request) 783 public XmlRpcResponse XmlRpcLoadXMLMethod(XmlRpcRequest request)
689 { 784 {
690 m_log.Info("[RADMIN]: Received Load XML Administrator Request"); 785 m_log.Info("[RADMIN]: Received Load XML Administrator Request");
@@ -766,6 +861,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
766 return response; 861 return response;
767 } 862 }
768 863
864
769 public void Dispose() 865 public void Dispose()
770 { 866 {
771 } 867 }