diff options
author | Dr Scofield | 2008-10-20 17:53:15 +0000 |
---|---|---|
committer | Dr Scofield | 2008-10-20 17:53:15 +0000 |
commit | 1fc6872f205d76ab08ecc3e0458437d3bb0c85bd (patch) | |
tree | 0053f23911794a85aaffa0d32904daa63a25f8f4 /OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |
parent | cleaning up IRCBridgeModule to allow for configuration from in-world, (diff) | |
download | opensim-SC-1fc6872f205d76ab08ecc3e0458437d3bb0c85bd.zip opensim-SC-1fc6872f205d76ab08ecc3e0458437d3bb0c85bd.tar.gz opensim-SC-1fc6872f205d76ab08ecc3e0458437d3bb0c85bd.tar.bz2 opensim-SC-1fc6872f205d76ab08ecc3e0458437d3bb0c85bd.tar.xz |
actually enabling SaveOAR XmlRpc ;-)
Diffstat (limited to '')
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 97 |
1 files changed, 93 insertions, 4 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 5744867..fed6ecb 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -97,6 +97,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
97 | m_httpd.AddXmlRPCHandler("admin_load_xml", XmlRpcLoadXMLMethod); | 97 | m_httpd.AddXmlRPCHandler("admin_load_xml", XmlRpcLoadXMLMethod); |
98 | m_httpd.AddXmlRPCHandler("admin_save_xml", XmlRpcSaveXMLMethod); | 98 | m_httpd.AddXmlRPCHandler("admin_save_xml", XmlRpcSaveXMLMethod); |
99 | m_httpd.AddXmlRPCHandler("admin_load_oar", XmlRpcLoadOARMethod); | 99 | m_httpd.AddXmlRPCHandler("admin_load_oar", XmlRpcLoadOARMethod); |
100 | m_httpd.AddXmlRPCHandler("admin_save_oar", XmlRpcSaveOARMethod); | ||
100 | m_httpd.AddXmlRPCHandler("admin_region_query", XmlRpcRegionQueryMethod); | 101 | m_httpd.AddXmlRPCHandler("admin_region_query", XmlRpcRegionQueryMethod); |
101 | } | 102 | } |
102 | } | 103 | } |
@@ -901,8 +902,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
901 | } | 902 | } |
902 | else throw new Exception("neither region_name nor region_uuid given"); | 903 | else throw new Exception("neither region_name nor region_uuid given"); |
903 | 904 | ||
904 | responseData["switched"] = "true"; | ||
905 | |||
906 | new ArchiveReadRequest(scene, filename); | 905 | new ArchiveReadRequest(scene, filename); |
907 | responseData["loaded"] = "true"; | 906 | responseData["loaded"] = "true"; |
908 | 907 | ||
@@ -914,7 +913,97 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
914 | m_log.DebugFormat("[RADMIN] LoadOAR: {0}", e.ToString()); | 913 | m_log.DebugFormat("[RADMIN] LoadOAR: {0}", e.ToString()); |
915 | 914 | ||
916 | responseData["loaded"] = "false"; | 915 | responseData["loaded"] = "false"; |
917 | responseData["switched"] = "false"; | 916 | responseData["error"] = e.Message; |
917 | |||
918 | response.Value = responseData; | ||
919 | } | ||
920 | |||
921 | return response; | ||
922 | } | ||
923 | |||
924 | /// <summary> | ||
925 | /// Save a region to an OAR file | ||
926 | /// <summary> | ||
927 | /// <param name="request">incoming XML RPC request</param> | ||
928 | /// <remarks> | ||
929 | /// XmlRpcSaveOARMethod takes the following XMLRPC | ||
930 | /// parameters | ||
931 | /// <list type="table"> | ||
932 | /// <listheader><term>parameter name</term><description>description</description></listheader> | ||
933 | /// <item><term>password</term> | ||
934 | /// <description>admin password as set in OpenSim.ini</description></item> | ||
935 | /// <item><term>filename</term> | ||
936 | /// <description>file name for the OAR file</description></item> | ||
937 | /// <item><term>region_uuid</term> | ||
938 | /// <description>UUID of the region</description></item> | ||
939 | /// <item><term>region_name</term> | ||
940 | /// <description>region name</description></item> | ||
941 | /// </list> | ||
942 | /// | ||
943 | /// <code>region_uuid</code> takes precedence over | ||
944 | /// <code>region_name</code> if both are present; one of both | ||
945 | /// must be present. | ||
946 | /// | ||
947 | /// XmlRpcLoadOARMethod returns | ||
948 | /// <list type="table"> | ||
949 | /// <listheader><term>name</term><description>description</description></listheader> | ||
950 | /// <item><term>success</term> | ||
951 | /// <description>true or false</description></item> | ||
952 | /// <item><term>error</term> | ||
953 | /// <description>error message if success is false</description></item> | ||
954 | /// </list> | ||
955 | /// </remarks> | ||
956 | public XmlRpcResponse XmlRpcSaveOARMethod(XmlRpcRequest request) | ||
957 | { | ||
958 | m_log.Info("[RADMIN]: Received Save OAR Administrator Request"); | ||
959 | XmlRpcResponse response = new XmlRpcResponse(); | ||
960 | Hashtable responseData = new Hashtable(); | ||
961 | |||
962 | try | ||
963 | { | ||
964 | Hashtable requestData = (Hashtable) request.Params[0]; | ||
965 | |||
966 | // check completeness | ||
967 | foreach (string p in new string[] { "password", "filename" }) | ||
968 | { | ||
969 | if (!requestData.Contains(p)) | ||
970 | throw new Exception(String.Format("missing parameter {0}", p)); | ||
971 | if (String.IsNullOrEmpty((string)requestData[p])) | ||
972 | throw new Exception(String.Format("parameter {0} is empty")); | ||
973 | } | ||
974 | |||
975 | // check password | ||
976 | if (!String.IsNullOrEmpty(requiredPassword) && | ||
977 | (string)requestData["password"] != requiredPassword) throw new Exception("wrong password"); | ||
978 | |||
979 | string filename = (string)requestData["filename"]; | ||
980 | Scene scene = null; | ||
981 | if (requestData.Contains("region_uuid")) | ||
982 | { | ||
983 | UUID region_uuid = (UUID)(string)requestData["region_uuid"]; | ||
984 | if (!m_app.SceneManager.TryGetScene(region_uuid, out scene)) | ||
985 | throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); | ||
986 | } | ||
987 | else if (requestData.Contains("region_name")) | ||
988 | { | ||
989 | string region_name = (string)requestData["region_name"]; | ||
990 | if (!m_app.SceneManager.TryGetScene(region_name, out scene)) | ||
991 | throw new Exception(String.Format("failed to switch to region {0}", region_name)); | ||
992 | } | ||
993 | else throw new Exception("neither region_name nor region_uuid given"); | ||
994 | |||
995 | scene.SavePrimsToArchive(filename); | ||
996 | |||
997 | responseData["saved"] = "true"; | ||
998 | |||
999 | response.Value = responseData; | ||
1000 | } | ||
1001 | catch (Exception e) | ||
1002 | { | ||
1003 | m_log.InfoFormat("[RADMIN] SaveOAR: {0}", e.Message); | ||
1004 | m_log.DebugFormat("[RADMIN] SaveOAR: {0}", e.ToString()); | ||
1005 | |||
1006 | responseData["saved"] = "false"; | ||
918 | responseData["error"] = e.Message; | 1007 | responseData["error"] = e.Message; |
919 | 1008 | ||
920 | response.Value = responseData; | 1009 | response.Value = responseData; |
@@ -1087,7 +1176,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1087 | 1176 | ||
1088 | public XmlRpcResponse XmlRpcRegionQueryMethod(XmlRpcRequest request) | 1177 | public XmlRpcResponse XmlRpcRegionQueryMethod(XmlRpcRequest request) |
1089 | { | 1178 | { |
1090 | m_log.Info("[RADMIN]: Received Save XML Administrator Request"); | 1179 | m_log.Info("[RADMIN]: Received Query XML Administrator Request"); |
1091 | XmlRpcResponse response = new XmlRpcResponse(); | 1180 | XmlRpcResponse response = new XmlRpcResponse(); |
1092 | Hashtable responseData = new Hashtable(); | 1181 | Hashtable responseData = new Hashtable(); |
1093 | 1182 | ||