aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie Thielker2014-08-23 19:38:08 +0200
committerMelanie Thielker2014-08-23 19:38:08 +0200
commit1fc5dadc604daebd4aeaf6954ac64f45fdfc7a2f (patch)
tree1898e9eee54d9cfbddea03b50d1b2c7c577a07cc
parentFix a null ref that will cause an exception if a grid region doesnt' specify ... (diff)
downloadopensim-SC_OLD-1fc5dadc604daebd4aeaf6954ac64f45fdfc7a2f.zip
opensim-SC_OLD-1fc5dadc604daebd4aeaf6954ac64f45fdfc7a2f.tar.gz
opensim-SC_OLD-1fc5dadc604daebd4aeaf6954ac64f45fdfc7a2f.tar.bz2
opensim-SC_OLD-1fc5dadc604daebd4aeaf6954ac64f45fdfc7a2f.tar.xz
Add an admin message to refesh a region's map tile. Will be used to periodically
rebuild the world map to clean out unused tiles.
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs27
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs6
-rw-r--r--OpenSim/Region/Framework/Interfaces/IMapTileModule.cs40
3 files changed, 71 insertions, 2 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index e50dac6..d2a5c43 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -164,6 +164,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
164 164
165 // Misc 165 // Misc
166 availableMethods["admin_refresh_search"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRefreshSearch); 166 availableMethods["admin_refresh_search"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRefreshSearch);
167 availableMethods["admin_refresh_map"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcRefreshMap);
167 availableMethods["admin_get_opensim_version"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcGetOpenSimVersion); 168 availableMethods["admin_get_opensim_version"] = (req, ep) => InvokeXmlRpcMethod(req, ep, XmlRpcGetOpenSimVersion);
168 169
169 // Either enable full remote functionality or just selected features 170 // Either enable full remote functionality or just selected features
@@ -2048,6 +2049,32 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2048 m_log.Info("[RADMIN]: Refresh Search Request complete"); 2049 m_log.Info("[RADMIN]: Refresh Search Request complete");
2049 } 2050 }
2050 2051
2052 private void XmlRpcRefreshMap(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
2053 {
2054 m_log.Info("[RADMIN]: Received Refresh Map Request");
2055
2056 Hashtable responseData = (Hashtable)response.Value;
2057 Hashtable requestData = (Hashtable)request.Params[0];
2058
2059 CheckRegionParams(requestData, responseData);
2060
2061 Scene scene = null;
2062 GetSceneFromRegionParams(requestData, responseData, out scene);
2063
2064 IMapTileModule mapTileModule = scene.RequestModuleInterface<IMapTileModule>();
2065 if (mapTileModule != null)
2066 {
2067 mapTileModule.UploadMapTile(scene);
2068 responseData["success"] = true;
2069 }
2070 else
2071 {
2072 responseData["success"] = false;
2073 }
2074
2075 m_log.Info("[RADMIN]: Refresh Map Request complete");
2076 }
2077
2051 private void XmlRpcGetOpenSimVersion(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient) 2078 private void XmlRpcGetOpenSimVersion(XmlRpcRequest request, XmlRpcResponse response, IPEndPoint remoteClient)
2052 { 2079 {
2053 m_log.Info("[RADMIN]: Received Get OpenSim Version Request"); 2080 m_log.Info("[RADMIN]: Received Get OpenSim Version Request");
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
index 40bedc1..96182cd 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/MapImage/MapImageServiceModule.cs
@@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
53 /// </remarks> 53 /// </remarks>
54 54
55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MapImageServiceModule")] 55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MapImageServiceModule")]
56 public class MapImageServiceModule : ISharedRegionModule 56 public class MapImageServiceModule : ISharedRegionModule, IMapTileModule
57 { 57 {
58 private static readonly ILog m_log = 58 private static readonly ILog m_log =
59 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 59 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -143,6 +143,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
143 lock (m_scenes) 143 lock (m_scenes)
144 m_scenes[scene.RegionInfo.RegionID] = scene; 144 m_scenes[scene.RegionInfo.RegionID] = scene;
145 145
146 scene.RegisterModuleInterface<IMapTileModule>(this);
147
146 scene.EventManager.OnRegionReadyStatusChange += s => { if (s.Ready) UploadMapTile(s); }; 148 scene.EventManager.OnRegionReadyStatusChange += s => { if (s.Ready) UploadMapTile(s); };
147 } 149 }
148 150
@@ -193,7 +195,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
193 ///<summary> 195 ///<summary>
194 /// 196 ///
195 ///</summary> 197 ///</summary>
196 private void UploadMapTile(IScene scene) 198 public void UploadMapTile(IScene scene)
197 { 199 {
198 m_log.DebugFormat("[MAP IMAGE SERVICE MODULE]: upload maptile for {0}", scene.RegionInfo.RegionName); 200 m_log.DebugFormat("[MAP IMAGE SERVICE MODULE]: upload maptile for {0}", scene.RegionInfo.RegionName);
199 201
diff --git a/OpenSim/Region/Framework/Interfaces/IMapTileModule.cs b/OpenSim/Region/Framework/Interfaces/IMapTileModule.cs
new file mode 100644
index 0000000..4d64236
--- /dev/null
+++ b/OpenSim/Region/Framework/Interfaces/IMapTileModule.cs
@@ -0,0 +1,40 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29using OpenSim.Framework;
30
31namespace OpenSim.Region.Framework.Interfaces
32{
33 public interface IMapTileModule
34 {
35 /// <summary>
36 /// Upload a new maptile
37 /// </summary>
38 void UploadMapTile(IScene scene);
39 }
40}