aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs94
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs31
2 files changed, 125 insertions, 0 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 23b1cc9..9950534 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -107,6 +107,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
107 Dictionary<string, XmlRpcMethod> availableMethods = new Dictionary<string, XmlRpcMethod>(); 107 Dictionary<string, XmlRpcMethod> availableMethods = new Dictionary<string, XmlRpcMethod>();
108 availableMethods["admin_create_region"] = XmlRpcCreateRegionMethod; 108 availableMethods["admin_create_region"] = XmlRpcCreateRegionMethod;
109 availableMethods["admin_delete_region"] = XmlRpcDeleteRegionMethod; 109 availableMethods["admin_delete_region"] = XmlRpcDeleteRegionMethod;
110 availableMethods["admin_close_region"] = XmlRpcCloseRegionMethod;
110 availableMethods["admin_modify_region"] = XmlRpcModifyRegionMethod; 111 availableMethods["admin_modify_region"] = XmlRpcModifyRegionMethod;
111 availableMethods["admin_region_query"] = XmlRpcRegionQueryMethod; 112 availableMethods["admin_region_query"] = XmlRpcRegionQueryMethod;
112 availableMethods["admin_shutdown"] = XmlRpcShutdownMethod; 113 availableMethods["admin_shutdown"] = XmlRpcShutdownMethod;
@@ -507,6 +508,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
507 RegionInfo region = new RegionInfo(); 508 RegionInfo region = new RegionInfo();
508 509
509 region.RegionID = regionID; 510 region.RegionID = regionID;
511 region.originRegionID = regionID;
510 region.RegionName = (string) requestData["region_name"]; 512 region.RegionName = (string) requestData["region_name"];
511 region.RegionLocX = Convert.ToUInt32(requestData["region_x"]); 513 region.RegionLocX = Convert.ToUInt32(requestData["region_x"]);
512 region.RegionLocY = Convert.ToUInt32(requestData["region_y"]); 514 region.RegionLocY = Convert.ToUInt32(requestData["region_y"]);
@@ -735,6 +737,98 @@ namespace OpenSim.ApplicationPlugins.RemoteController
735 return response; 737 return response;
736 } 738 }
737 } 739 }
740
741 /// <summary>
742 /// Close a region.
743 /// <summary>
744 /// <param name="request">incoming XML RPC request</param>
745 /// <remarks>
746 /// XmlRpcCloseRegionMethod takes the following XMLRPC
747 /// parameters
748 /// <list type="table">
749 /// <listheader><term>parameter name</term><description>description</description></listheader>
750 /// <item><term>password</term>
751 /// <description>admin password as set in OpenSim.ini</description></item>
752 /// <item><term>region_name</term>
753 /// <description>desired region name</description></item>
754 /// <item><term>region_id</term>
755 /// <description>(optional) desired region UUID</description></item>
756 /// </list>
757 ///
758 /// XmlRpcShutdownRegionMethod returns
759 /// <list type="table">
760 /// <listheader><term>name</term><description>description</description></listheader>
761 /// <item><term>success</term>
762 /// <description>true or false</description></item>
763 /// <item><term>region_name</term>
764 /// <description>the region name if success is true</description></item>
765 /// <item><term>error</term>
766 /// <description>error message if success is false</description></item>
767 /// </list>
768 /// </remarks>
769 public XmlRpcResponse XmlRpcCloseRegionMethod(XmlRpcRequest request, IPEndPoint remoteClient)
770 {
771 m_log.Info("[RADMIN]: CloseRegion: new request");
772 XmlRpcResponse response = new XmlRpcResponse();
773 Hashtable responseData = new Hashtable();
774 Scene scene = null;
775
776 lock (rslock)
777 {
778 try
779 {
780 Hashtable requestData = (Hashtable) request.Params[0];
781 checkStringParameters(request, new string[] {"password"});
782
783 if (requestData.ContainsKey("region_id") &&
784 !String.IsNullOrEmpty((string) requestData["region_id"]))
785 {
786 // Region specified by UUID
787 UUID regionID = (UUID) (string) requestData["region_id"];
788 if (!m_app.SceneManager.TryGetScene(regionID, out scene))
789 throw new Exception(String.Format("region \"{0}\" does not exist", regionID));
790
791 m_app.CloseRegion(scene);
792
793 responseData["success"] = true;
794 responseData["region_id"] = regionID;
795
796 response.Value = responseData;
797 }
798 else if (requestData.ContainsKey("region_name") &&
799 !String.IsNullOrEmpty((string) requestData["region_name"]))
800 {
801 // Region specified by name
802
803 string regionName = (string) requestData["region_name"];
804 if (!m_app.SceneManager.TryGetScene(regionName, out scene))
805 throw new Exception(String.Format("region \"{0}\" does not exist", regionName));
806
807 m_app.CloseRegion(scene);
808
809 responseData["success"] = true;
810 responseData["region_name"] = regionName;
811
812 response.Value = responseData;
813 }
814 else
815 throw new Exception("no region specified");
816 }
817 catch (Exception e)
818 {
819 m_log.ErrorFormat("[RADMIN] CloseRegion: failed {0}", e.Message);
820 m_log.DebugFormat("[RADMIN] CloseRegion: failed {0}", e.ToString());
821
822 responseData["success"] = false;
823 responseData["error"] = e.Message;
824
825 response.Value = responseData;
826 }
827
828 m_log.Info("[RADMIN]: CloseRegion: request complete");
829 return response;
830 }
831 }
738 832
739 /// <summary> 833 /// <summary>
740 /// Change characteristics of an existing region. 834 /// Change characteristics of an existing region.
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 9e3dafb..a42fd3d 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -504,6 +504,37 @@ namespace OpenSim
504 } 504 }
505 505
506 /// <summary> 506 /// <summary>
507 /// Remove a region from the simulator without deleting it permanently.
508 /// </summary>
509 /// <param name="scene"></param>
510 /// <returns></returns>
511 public void CloseRegion(Scene scene)
512 {
513 // only need to check this if we are not at the
514 // root level
515 if ((m_sceneManager.CurrentScene != null) &&
516 (m_sceneManager.CurrentScene.RegionInfo.RegionID == scene.RegionInfo.RegionID))
517 {
518 m_sceneManager.TrySetCurrentScene("..");
519 }
520
521 m_sceneManager.CloseScene(scene);
522
523 }
524
525 /// <summary>
526 /// Remove a region from the simulator without deleting it permanently.
527 /// </summary>
528 /// <param name="name"></param>
529 /// <returns></returns>
530 public void CloseRegion(string name)
531 {
532 Scene target;
533 if (m_sceneManager.TryGetScene(name, out target))
534 CloseRegion(target);
535 }
536
537 /// <summary>
507 /// Create a scene and its initial base structures. 538 /// Create a scene and its initial base structures.
508 /// </summary> 539 /// </summary>
509 /// <param name="regionInfo"></param> 540 /// <param name="regionInfo"></param>