aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework')
-rw-r--r--OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs33
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs8
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs211
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs2
10 files changed, 154 insertions, 120 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
index 4ea85a8..8329af0 100644
--- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
@@ -43,7 +43,7 @@ using Caps=OpenSim.Framework.Capabilities.Caps;
43 43
44namespace OpenSim.Region.CoreModules.Framework 44namespace OpenSim.Region.CoreModules.Framework
45{ 45{
46 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 46 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "CapabilitiesModule")]
47 public class CapabilitiesModule : INonSharedRegionModule, ICapabilitiesModule 47 public class CapabilitiesModule : INonSharedRegionModule, ICapabilitiesModule
48 { 48 {
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index 90fe430..3cb1901 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -43,9 +43,11 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
43using OpenMetaverse; 43using OpenMetaverse;
44using log4net; 44using log4net;
45using Nini.Config; 45using Nini.Config;
46using Mono.Addins;
46 47
47namespace OpenSim.Region.CoreModules.Framework.EntityTransfer 48namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
48{ 49{
50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EntityTransferModule")]
49 public class EntityTransferModule : INonSharedRegionModule, IEntityTransferModule 51 public class EntityTransferModule : INonSharedRegionModule, IEntityTransferModule
50 { 52 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -672,13 +674,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
672 sp.Reset(); 674 sp.Reset();
673 } 675 }
674 676
675 // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! 677 // Commented pending deletion since this method no longer appears to do anything at all
676 if (sp.Scene.NeedSceneCacheClear(sp.UUID)) 678// // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
677 { 679// if (sp.Scene.NeedSceneCacheClear(sp.UUID))
678 m_log.DebugFormat( 680// {
679 "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed", 681// m_log.DebugFormat(
680 sp.UUID); 682// "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed",
681 } 683// sp.UUID);
684// }
682 685
683 m_entityTransferStateMachine.ResetFromTransit(sp.UUID); 686 m_entityTransferStateMachine.ResetFromTransit(sp.UUID);
684 } 687 }
@@ -1237,14 +1240,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1237 1240
1238 AgentHasMovedAway(agent, false); 1241 AgentHasMovedAway(agent, false);
1239 1242
1240 // the user may change their profile information in other region, 1243// // the user may change their profile information in other region,
1241 // so the userinfo in UserProfileCache is not reliable any more, delete it 1244// // so the userinfo in UserProfileCache is not reliable any more, delete it
1242 // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE! 1245// // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
1243 if (agent.Scene.NeedSceneCacheClear(agent.UUID)) 1246// if (agent.Scene.NeedSceneCacheClear(agent.UUID))
1244 { 1247// {
1245 m_log.DebugFormat( 1248// m_log.DebugFormat(
1246 "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID); 1249// "[ENTITY TRANSFER MODULE]: User {0} is going to another region", agent.UUID);
1247 } 1250// }
1248 1251
1249 //m_log.Debug("AFTER CROSS"); 1252 //m_log.Debug("AFTER CROSS");
1250 //Scene.DumpChildrenSeeds(UUID); 1253 //Scene.DumpChildrenSeeds(UUID);
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 679be18..41ca13b 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -42,9 +42,11 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
42using OpenMetaverse; 42using OpenMetaverse;
43using log4net; 43using log4net;
44using Nini.Config; 44using Nini.Config;
45using Mono.Addins;
45 46
46namespace OpenSim.Region.CoreModules.Framework.EntityTransfer 47namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
47{ 48{
49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGEntityTransferModule")]
48 public class HGEntityTransferModule 50 public class HGEntityTransferModule
49 : EntityTransferModule, INonSharedRegionModule, IEntityTransferModule, IUserAgentVerificationModule 51 : EntityTransferModule, INonSharedRegionModule, IEntityTransferModule, IUserAgentVerificationModule
50 { 52 {
@@ -259,8 +261,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
259 if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0) 261 if (flags == -1 /* no region in DB */ || (flags & (int)OpenSim.Framework.RegionFlags.Hyperlink) != 0)
260 { 262 {
261 // this user is going to another grid 263 // this user is going to another grid
262 // check if HyperGrid teleport is allowed, based on user level 264 // for local users, check if HyperGrid teleport is allowed, based on user level
263 if (sp.UserLevel < m_levelHGTeleport) 265 if (Scene.UserManagementModule.IsLocalGridUser(sp.UUID) && sp.UserLevel < m_levelHGTeleport)
264 { 266 {
265 m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unable to HG teleport agent due to insufficient UserLevel."); 267 m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unable to HG teleport agent due to insufficient UserLevel.");
266 reason = "Hypergrid teleport not allowed"; 268 reason = "Hypergrid teleport not allowed";
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index 80257bd..964efda 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -42,9 +42,11 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
42using OpenMetaverse; 42using OpenMetaverse;
43using log4net; 43using log4net;
44using Nini.Config; 44using Nini.Config;
45using Mono.Addins;
45 46
46namespace OpenSim.Region.CoreModules.Framework.InventoryAccess 47namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
47{ 48{
49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGInventoryAccessModule")]
48 public class HGInventoryAccessModule : BasicInventoryAccessModule, INonSharedRegionModule, IInventoryAccessModule 50 public class HGInventoryAccessModule : BasicInventoryAccessModule, INonSharedRegionModule, IInventoryAccessModule
49 { 51 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -92,7 +94,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
92 m_HomeURI = thisModuleConfig.GetString("HomeURI", m_HomeURI); 94 m_HomeURI = thisModuleConfig.GetString("HomeURI", m_HomeURI);
93 m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true); 95 m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true);
94 m_ThisGatekeeper = thisModuleConfig.GetString("Gatekeeper", string.Empty); 96 m_ThisGatekeeper = thisModuleConfig.GetString("Gatekeeper", string.Empty);
95 m_RestrictInventoryAccessAbroad = thisModuleConfig.GetBoolean("RestrictInventoryAccessAbroad", false); 97 m_RestrictInventoryAccessAbroad = thisModuleConfig.GetBoolean("RestrictInventoryAccessAbroad", true);
96 } 98 }
97 else 99 else
98 m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!"); 100 m_log.Warn("[HG INVENTORY ACCESS MODULE]: HGInventoryAccessModule configs not found. ProfileServerURI not set!");
@@ -351,6 +353,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
351 353
352 private void ProcessInventoryForArriving(IClientAPI client) 354 private void ProcessInventoryForArriving(IClientAPI client)
353 { 355 {
356 // No-op for now, but we may need to do something for freign users inventory
354 } 357 }
355 358
356 // 359 //
@@ -397,6 +400,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
397 400
398 private void ProcessInventoryForLeaving(IClientAPI client) 401 private void ProcessInventoryForLeaving(IClientAPI client)
399 { 402 {
403 // No-op for now
400 } 404 }
401 405
402 #endregion 406 #endregion
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 8b34c28..8b7c16e 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -46,9 +46,11 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
46using OpenMetaverse; 46using OpenMetaverse;
47using log4net; 47using log4net;
48using Nini.Config; 48using Nini.Config;
49using Mono.Addins;
49 50
50namespace OpenSim.Region.CoreModules.Framework.InventoryAccess 51namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
51{ 52{
53 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BasicInventoryAccessModule")]
52 public class BasicInventoryAccessModule : INonSharedRegionModule, IInventoryAccessModule 54 public class BasicInventoryAccessModule : INonSharedRegionModule, IInventoryAccessModule
53 { 55 {
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 56 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -180,12 +182,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
180 if (!m_Scene.Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) 182 if (!m_Scene.Permissions.CanCreateUserInventory(invType, remoteClient.AgentId))
181 return; 183 return;
182 184
183 InventoryFolderBase f = new InventoryFolderBase(folderID, remoteClient.AgentId);
184 InventoryFolderBase folder = m_Scene.InventoryService.GetFolder(f);
185
186 if (folder == null || folder.Owner != remoteClient.AgentId)
187 return;
188
189 if (transactionID == UUID.Zero) 185 if (transactionID == UUID.Zero)
190 { 186 {
191 ScenePresence presence; 187 ScenePresence presence;
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
index 21d8bd7..b768257 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
@@ -49,7 +49,7 @@ using OpenSim.Tests.Common.Mock;
49namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests 49namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
50{ 50{
51 [TestFixture] 51 [TestFixture]
52 public class InventoryAccessModuleTests 52 public class InventoryAccessModuleTests : OpenSimTestCase
53 { 53 {
54 protected TestScene m_scene; 54 protected TestScene m_scene;
55 protected BasicInventoryAccessModule m_iam; 55 protected BasicInventoryAccessModule m_iam;
diff --git a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs
index 3155ce7..ec22146 100644
--- a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs
@@ -41,10 +41,12 @@ using OpenSim.Server.Base;
41 41
42using OpenMetaverse; 42using OpenMetaverse;
43using log4net; 43using log4net;
44using Mono.Addins;
44using Nini.Config; 45using Nini.Config;
45 46
46namespace OpenSim.Region.CoreModules.Framework.Library 47namespace OpenSim.Region.CoreModules.Framework.Library
47{ 48{
49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LibraryModule")]
48 public class LibraryModule : ISharedRegionModule 50 public class LibraryModule : ISharedRegionModule
49 { 51 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
index e411585..d84460a 100644
--- a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
@@ -38,10 +38,12 @@ using OpenSim.Region.CoreModules.Framework.Monitoring.Alerts;
38using OpenSim.Region.CoreModules.Framework.Monitoring.Monitors; 38using OpenSim.Region.CoreModules.Framework.Monitoring.Monitors;
39using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using Mono.Addins;
41 42
42namespace OpenSim.Region.CoreModules.Framework.Monitoring 43namespace OpenSim.Region.CoreModules.Framework.Monitoring
43{ 44{
44 public class MonitorModule : IRegionModule 45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MonitorModule")]
46 public class MonitorModule : INonSharedRegionModule
45 { 47 {
46 /// <summary> 48 /// <summary>
47 /// Is this module enabled? 49 /// Is this module enabled?
@@ -62,14 +64,14 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
62 private readonly List<IAlert> m_alerts = new List<IAlert>(); 64 private readonly List<IAlert> m_alerts = new List<IAlert>();
63 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 65 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
64 66
65 #region Implementation of IRegionModule
66
67 public MonitorModule() 67 public MonitorModule()
68 { 68 {
69 Enabled = true; 69 Enabled = true;
70 } 70 }
71 71
72 public void Initialise(Scene scene, IConfigSource source) 72 #region Implementation of INonSharedRegionModule
73
74 public void Initialise(IConfigSource source)
73 { 75 {
74 IConfig cnfg = source.Configs["Monitoring"]; 76 IConfig cnfg = source.Configs["Monitoring"];
75 77
@@ -79,6 +81,13 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
79 if (!Enabled) 81 if (!Enabled)
80 return; 82 return;
81 83
84 }
85
86 public void AddRegion(Scene scene)
87 {
88 if (!Enabled)
89 return;
90
82 m_scene = scene; 91 m_scene = scene;
83 92
84 m_scene.AddCommand("General", this, "monitor report", 93 m_scene.AddCommand("General", this, "monitor report",
@@ -89,101 +98,42 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
89 MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID, StatsPage); 98 MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID, StatsPage);
90 MainServer.Instance.AddHTTPHandler( 99 MainServer.Instance.AddHTTPHandler(
91 "/monitorstats/" + Uri.EscapeDataString(m_scene.RegionInfo.RegionName), StatsPage); 100 "/monitorstats/" + Uri.EscapeDataString(m_scene.RegionInfo.RegionName), StatsPage);
101
102 AddMonitors();
92 } 103 }
93 104
94 public void DebugMonitors(string module, string[] args) 105 public void RemoveRegion(Scene scene)
95 { 106 {
96 foreach (IMonitor monitor in m_staticMonitors) 107 if (!Enabled)
97 { 108 return;
98 MainConsole.Instance.OutputFormat(
99 "[MONITOR MODULE]: {0} reports {1} = {2}",
100 m_scene.RegionInfo.RegionName, monitor.GetFriendlyName(), monitor.GetFriendlyValue());
101 }
102 109
103 foreach (KeyValuePair<string, float> tuple in m_scene.StatsReporter.GetExtraSimStats()) 110 MainServer.Instance.RemoveHTTPHandler("GET", "/monitorstats/" + m_scene.RegionInfo.RegionID);
104 { 111 MainServer.Instance.RemoveHTTPHandler("GET", "/monitorstats/" + Uri.EscapeDataString(m_scene.RegionInfo.RegionName));
105 MainConsole.Instance.OutputFormat( 112 m_scene = null;
106 "[MONITOR MODULE]: {0} reports {1} = {2}",
107 m_scene.RegionInfo.RegionName, tuple.Key, tuple.Value);
108 }
109 } 113 }
110 114
111 public void TestAlerts() 115 public void Close()
112 { 116 {
113 foreach (IAlert alert in m_alerts)
114 {
115 alert.Test();
116 }
117 } 117 }
118 118
119 public Hashtable StatsPage(Hashtable request) 119 public string Name
120 { 120 {
121 // If request was for a specific monitor 121 get { return "Region Health Monitoring Module"; }
122 // eg url/?monitor=Monitor.Name 122 }
123 if (request.ContainsKey("monitor"))
124 {
125 string monID = (string) request["monitor"];
126
127 foreach (IMonitor monitor in m_staticMonitors)
128 {
129 string elemName = monitor.ToString();
130 if (elemName.StartsWith(monitor.GetType().Namespace))
131 elemName = elemName.Substring(monitor.GetType().Namespace.Length + 1);
132
133 if (elemName == monID || monitor.ToString() == monID)
134 {
135 Hashtable ereply3 = new Hashtable();
136
137 ereply3["int_response_code"] = 404; // 200 OK
138 ereply3["str_response_string"] = monitor.GetValue().ToString();
139 ereply3["content_type"] = "text/plain";
140
141 return ereply3;
142 }
143 }
144
145 // FIXME: Arguably this should also be done with dynamic monitors but I'm not sure what the above code
146 // is even doing. Why are we inspecting the type of the monitor???
147
148 // No monitor with that name
149 Hashtable ereply2 = new Hashtable();
150
151 ereply2["int_response_code"] = 404; // 200 OK
152 ereply2["str_response_string"] = "No such monitor";
153 ereply2["content_type"] = "text/plain";
154
155 return ereply2;
156 }
157
158 string xml = "<data>";
159 foreach (IMonitor monitor in m_staticMonitors)
160 {
161 string elemName = monitor.GetName();
162 xml += "<" + elemName + ">" + monitor.GetValue().ToString() + "</" + elemName + ">";
163// m_log.DebugFormat("[MONITOR MODULE]: {0} = {1}", elemName, monitor.GetValue());
164 }
165
166 foreach (KeyValuePair<string, float> tuple in m_scene.StatsReporter.GetExtraSimStats())
167 {
168 xml += "<" + tuple.Key + ">" + tuple.Value + "</" + tuple.Key + ">";
169 }
170
171 xml += "</data>";
172
173 Hashtable ereply = new Hashtable();
174
175 ereply["int_response_code"] = 200; // 200 OK
176 ereply["str_response_string"] = xml;
177 ereply["content_type"] = "text/xml";
178 123
179 return ereply; 124 public void RegionLoaded(Scene scene)
125 {
180 } 126 }
181 127
182 public void PostInitialise() 128 public Type ReplaceableInterface
183 { 129 {
184 if (!Enabled) 130 get { return null; }
185 return; 131 }
132
133 #endregion
186 134
135 public void AddMonitors()
136 {
187 m_staticMonitors.Add(new AgentCountMonitor(m_scene)); 137 m_staticMonitors.Add(new AgentCountMonitor(m_scene));
188 m_staticMonitors.Add(new ChildAgentCountMonitor(m_scene)); 138 m_staticMonitors.Add(new ChildAgentCountMonitor(m_scene));
189 m_staticMonitors.Add(new GCMemoryMonitor()); 139 m_staticMonitors.Add(new GCMemoryMonitor());
@@ -196,7 +146,7 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
196 m_staticMonitors.Add(new EventFrameMonitor(m_scene)); 146 m_staticMonitors.Add(new EventFrameMonitor(m_scene));
197 m_staticMonitors.Add(new LandFrameMonitor(m_scene)); 147 m_staticMonitors.Add(new LandFrameMonitor(m_scene));
198 m_staticMonitors.Add(new LastFrameTimeMonitor(m_scene)); 148 m_staticMonitors.Add(new LastFrameTimeMonitor(m_scene));
199 149
200 m_staticMonitors.Add( 150 m_staticMonitors.Add(
201 new GenericMonitor( 151 new GenericMonitor(
202 m_scene, 152 m_scene,
@@ -357,25 +307,98 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
357 } 307 }
358 } 308 }
359 309
360 void OnTriggerAlert(System.Type reporter, string reason, bool fatal) 310 public void DebugMonitors(string module, string[] args)
361 { 311 {
362 m_log.Error("[Monitor] " + reporter.Name + " for " + m_scene.RegionInfo.RegionName + " reports " + reason + " (Fatal: " + fatal + ")"); 312 foreach (IMonitor monitor in m_staticMonitors)
313 {
314 MainConsole.Instance.OutputFormat(
315 "[MONITOR MODULE]: {0} reports {1} = {2}",
316 m_scene.RegionInfo.RegionName, monitor.GetFriendlyName(), monitor.GetFriendlyValue());
317 }
318
319 foreach (KeyValuePair<string, float> tuple in m_scene.StatsReporter.GetExtraSimStats())
320 {
321 MainConsole.Instance.OutputFormat(
322 "[MONITOR MODULE]: {0} reports {1} = {2}",
323 m_scene.RegionInfo.RegionName, tuple.Key, tuple.Value);
324 }
363 } 325 }
364 326
365 public void Close() 327 public void TestAlerts()
366 { 328 {
329 foreach (IAlert alert in m_alerts)
330 {
331 alert.Test();
332 }
367 } 333 }
368 334
369 public string Name 335 public Hashtable StatsPage(Hashtable request)
370 { 336 {
371 get { return "Region Health Monitoring Module"; } 337 // If request was for a specific monitor
338 // eg url/?monitor=Monitor.Name
339 if (request.ContainsKey("monitor"))
340 {
341 string monID = (string) request["monitor"];
342
343 foreach (IMonitor monitor in m_staticMonitors)
344 {
345 string elemName = monitor.ToString();
346 if (elemName.StartsWith(monitor.GetType().Namespace))
347 elemName = elemName.Substring(monitor.GetType().Namespace.Length + 1);
348
349 if (elemName == monID || monitor.ToString() == monID)
350 {
351 Hashtable ereply3 = new Hashtable();
352
353 ereply3["int_response_code"] = 404; // 200 OK
354 ereply3["str_response_string"] = monitor.GetValue().ToString();
355 ereply3["content_type"] = "text/plain";
356
357 return ereply3;
358 }
359 }
360
361 // FIXME: Arguably this should also be done with dynamic monitors but I'm not sure what the above code
362 // is even doing. Why are we inspecting the type of the monitor???
363
364 // No monitor with that name
365 Hashtable ereply2 = new Hashtable();
366
367 ereply2["int_response_code"] = 404; // 200 OK
368 ereply2["str_response_string"] = "No such monitor";
369 ereply2["content_type"] = "text/plain";
370
371 return ereply2;
372 }
373
374 string xml = "<data>";
375 foreach (IMonitor monitor in m_staticMonitors)
376 {
377 string elemName = monitor.GetName();
378 xml += "<" + elemName + ">" + monitor.GetValue().ToString() + "</" + elemName + ">";
379// m_log.DebugFormat("[MONITOR MODULE]: {0} = {1}", elemName, monitor.GetValue());
380 }
381
382 foreach (KeyValuePair<string, float> tuple in m_scene.StatsReporter.GetExtraSimStats())
383 {
384 xml += "<" + tuple.Key + ">" + tuple.Value + "</" + tuple.Key + ">";
385 }
386
387 xml += "</data>";
388
389 Hashtable ereply = new Hashtable();
390
391 ereply["int_response_code"] = 200; // 200 OK
392 ereply["str_response_string"] = xml;
393 ereply["content_type"] = "text/xml";
394
395 return ereply;
372 } 396 }
373 397
374 public bool IsSharedModule 398 void OnTriggerAlert(System.Type reporter, string reason, bool fatal)
375 { 399 {
376 get { return false; } 400 m_log.Error("[Monitor] " + reporter.Name + " for " + m_scene.RegionInfo.RegionName + " reports " + reason + " (Fatal: " + fatal + ")");
377 } 401 }
378 402
379 #endregion
380 } 403 }
381} 404}
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
index acefc97..4ef57fe 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/HGUserManagementModule.cs
@@ -41,9 +41,11 @@ using OpenMetaverse;
41using OpenMetaverse.Packets; 41using OpenMetaverse.Packets;
42using log4net; 42using log4net;
43using Nini.Config; 43using Nini.Config;
44using Mono.Addins;
44 45
45namespace OpenSim.Region.CoreModules.Framework.UserManagement 46namespace OpenSim.Region.CoreModules.Framework.UserManagement
46{ 47{
48 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "HGUserManagementModule")]
47 public class HGUserManagementModule : UserManagementModule, ISharedRegionModule, IUserManagement 49 public class HGUserManagementModule : UserManagementModule, ISharedRegionModule, IUserManagement
48 { 50 {
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
index b4811da..86e7004 100644
--- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -42,6 +42,7 @@ using OpenMetaverse;
42using OpenMetaverse.Packets; 42using OpenMetaverse.Packets;
43using log4net; 43using log4net;
44using Nini.Config; 44using Nini.Config;
45using Mono.Addins;
45 46
46namespace OpenSim.Region.CoreModules.Framework.UserManagement 47namespace OpenSim.Region.CoreModules.Framework.UserManagement
47{ 48{
@@ -54,6 +55,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
54 public Dictionary<string, object> ServerURLs { get; set; } 55 public Dictionary<string, object> ServerURLs { get; set; }
55 } 56 }
56 57
58 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "UserManagementModule")]
57 public class UserManagementModule : ISharedRegionModule, IUserManagement 59 public class UserManagementModule : ISharedRegionModule, IUserManagement
58 { 60 {
59 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 61 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);