actually enabling SaveOAR XmlRpc ;-)
parent
72a388a7b6
commit
1fc6872f20
|
@ -97,6 +97,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
m_httpd.AddXmlRPCHandler("admin_load_xml", XmlRpcLoadXMLMethod);
|
||||
m_httpd.AddXmlRPCHandler("admin_save_xml", XmlRpcSaveXMLMethod);
|
||||
m_httpd.AddXmlRPCHandler("admin_load_oar", XmlRpcLoadOARMethod);
|
||||
m_httpd.AddXmlRPCHandler("admin_save_oar", XmlRpcSaveOARMethod);
|
||||
m_httpd.AddXmlRPCHandler("admin_region_query", XmlRpcRegionQueryMethod);
|
||||
}
|
||||
}
|
||||
|
@ -901,8 +902,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
else throw new Exception("neither region_name nor region_uuid given");
|
||||
|
||||
responseData["switched"] = "true";
|
||||
|
||||
new ArchiveReadRequest(scene, filename);
|
||||
responseData["loaded"] = "true";
|
||||
|
||||
|
@ -914,7 +913,97 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
m_log.DebugFormat("[RADMIN] LoadOAR: {0}", e.ToString());
|
||||
|
||||
responseData["loaded"] = "false";
|
||||
responseData["switched"] = "false";
|
||||
responseData["error"] = e.Message;
|
||||
|
||||
response.Value = responseData;
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Save a region to an OAR file
|
||||
/// <summary>
|
||||
/// <param name="request">incoming XML RPC request</param>
|
||||
/// <remarks>
|
||||
/// XmlRpcSaveOARMethod takes the following XMLRPC
|
||||
/// parameters
|
||||
/// <list type="table">
|
||||
/// <listheader><term>parameter name</term><description>description</description></listheader>
|
||||
/// <item><term>password</term>
|
||||
/// <description>admin password as set in OpenSim.ini</description></item>
|
||||
/// <item><term>filename</term>
|
||||
/// <description>file name for the OAR file</description></item>
|
||||
/// <item><term>region_uuid</term>
|
||||
/// <description>UUID of the region</description></item>
|
||||
/// <item><term>region_name</term>
|
||||
/// <description>region name</description></item>
|
||||
/// </list>
|
||||
///
|
||||
/// <code>region_uuid</code> takes precedence over
|
||||
/// <code>region_name</code> if both are present; one of both
|
||||
/// must be present.
|
||||
///
|
||||
/// XmlRpcLoadOARMethod returns
|
||||
/// <list type="table">
|
||||
/// <listheader><term>name</term><description>description</description></listheader>
|
||||
/// <item><term>success</term>
|
||||
/// <description>true or false</description></item>
|
||||
/// <item><term>error</term>
|
||||
/// <description>error message if success is false</description></item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public XmlRpcResponse XmlRpcSaveOARMethod(XmlRpcRequest request)
|
||||
{
|
||||
m_log.Info("[RADMIN]: Received Save OAR Administrator Request");
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable responseData = new Hashtable();
|
||||
|
||||
try
|
||||
{
|
||||
Hashtable requestData = (Hashtable) request.Params[0];
|
||||
|
||||
// check completeness
|
||||
foreach (string p in new string[] { "password", "filename" })
|
||||
{
|
||||
if (!requestData.Contains(p))
|
||||
throw new Exception(String.Format("missing parameter {0}", p));
|
||||
if (String.IsNullOrEmpty((string)requestData[p]))
|
||||
throw new Exception(String.Format("parameter {0} is empty"));
|
||||
}
|
||||
|
||||
// check password
|
||||
if (!String.IsNullOrEmpty(requiredPassword) &&
|
||||
(string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
|
||||
|
||||
string filename = (string)requestData["filename"];
|
||||
Scene scene = null;
|
||||
if (requestData.Contains("region_uuid"))
|
||||
{
|
||||
UUID region_uuid = (UUID)(string)requestData["region_uuid"];
|
||||
if (!m_app.SceneManager.TryGetScene(region_uuid, out scene))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
|
||||
}
|
||||
else if (requestData.Contains("region_name"))
|
||||
{
|
||||
string region_name = (string)requestData["region_name"];
|
||||
if (!m_app.SceneManager.TryGetScene(region_name, out scene))
|
||||
throw new Exception(String.Format("failed to switch to region {0}", region_name));
|
||||
}
|
||||
else throw new Exception("neither region_name nor region_uuid given");
|
||||
|
||||
scene.SavePrimsToArchive(filename);
|
||||
|
||||
responseData["saved"] = "true";
|
||||
|
||||
response.Value = responseData;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.InfoFormat("[RADMIN] SaveOAR: {0}", e.Message);
|
||||
m_log.DebugFormat("[RADMIN] SaveOAR: {0}", e.ToString());
|
||||
|
||||
responseData["saved"] = "false";
|
||||
responseData["error"] = e.Message;
|
||||
|
||||
response.Value = responseData;
|
||||
|
@ -1087,7 +1176,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
public XmlRpcResponse XmlRpcRegionQueryMethod(XmlRpcRequest request)
|
||||
{
|
||||
m_log.Info("[RADMIN]: Received Save XML Administrator Request");
|
||||
m_log.Info("[RADMIN]: Received Query XML Administrator Request");
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable responseData = new Hashtable();
|
||||
|
||||
|
|
Loading…
Reference in New Issue