aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
authorMelanie2010-09-13 16:16:40 +0100
committerMelanie2010-09-13 16:17:38 +0100
commit6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e (patch)
tree1e7bf4fddcf559886c6b2babf13cf4b2ca8829a1 /OpenSim/Region/Framework/Scenes/Scene.cs
parentMerge branch 'careminster-presence-refactor' of ssh://melanie@3dhosting.de/va... (diff)
parentFix unit test SceneSetupHelpers to load the mock simulation data store (diff)
downloadopensim-SC-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.zip
opensim-SC-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.tar.gz
opensim-SC-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.tar.bz2
opensim-SC-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.tar.xz
Merge branch 'master' into careminster-presence-refactor
The modules will need to be updated for this to compile and run again. Please don't use until I do the companion commit to modules later on.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs429
1 files changed, 226 insertions, 203 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index be342ab..0e1b4b1 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -57,55 +57,21 @@ namespace OpenSim.Region.Framework.Scenes
57 57
58 public partial class Scene : SceneBase 58 public partial class Scene : SceneBase
59 { 59 {
60 public delegate void SynchronizeSceneHandler(Scene scene);
61 public SynchronizeSceneHandler SynchronizeScene = null;
62
63 /* Used by the loadbalancer plugin on GForge */
64 protected int m_splitRegionID = 0;
65 public int SplitRegionID
66 {
67 get { return m_splitRegionID; }
68 set { m_splitRegionID = value; }
69 }
70
71 private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L; 60 private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L;
72 private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L; 61 private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L;
73 62
74 #region Fields 63 public delegate void SynchronizeSceneHandler(Scene scene);
75 64
76 protected Timer m_restartWaitTimer = new Timer(); 65 #region Fields
77 66
67 public SynchronizeSceneHandler SynchronizeScene;
78 public SimStatsReporter StatsReporter; 68 public SimStatsReporter StatsReporter;
79
80 protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
81 protected List<RegionInfo> m_neighbours = new List<RegionInfo>();
82
83 private volatile int m_bordersLocked = 0;
84 public bool BordersLocked
85 {
86 get { return m_bordersLocked == 1; }
87 set
88 {
89 if (value == true)
90 m_bordersLocked = 1;
91 else
92 m_bordersLocked = 0;
93 }
94 }
95 public List<Border> NorthBorders = new List<Border>(); 69 public List<Border> NorthBorders = new List<Border>();
96 public List<Border> EastBorders = new List<Border>(); 70 public List<Border> EastBorders = new List<Border>();
97 public List<Border> SouthBorders = new List<Border>(); 71 public List<Border> SouthBorders = new List<Border>();
98 public List<Border> WestBorders = new List<Border>(); 72 public List<Border> WestBorders = new List<Border>();
99 73
100 /// <value> 74 /// <summary>Are we applying physics to any of the prims in this scene?</summary>
101 /// The scene graph for this scene
102 /// </value>
103 /// TODO: Possibly stop other classes being able to manipulate this directly.
104 private SceneGraph m_sceneGraph;
105
106 /// <summary>
107 /// Are we applying physics to any of the prims in this scene?
108 /// </summary>
109 public bool m_physicalPrim; 75 public bool m_physicalPrim;
110 public float m_maxNonphys = 256; 76 public float m_maxNonphys = 256;
111 public float m_maxPhys = 10; 77 public float m_maxPhys = 10;
@@ -119,25 +85,131 @@ namespace OpenSim.Region.Framework.Scenes
119 // root agents when ACL denies access to root agent 85 // root agents when ACL denies access to root agent
120 public bool m_strictAccessControl = true; 86 public bool m_strictAccessControl = true;
121 public int MaxUndoCount = 5; 87 public int MaxUndoCount = 5;
88 public bool LoginsDisabled = true;
89 public bool LoadingPrims;
90 public IXfer XferManager;
91
92 // the minimum time that must elapse before a changed object will be considered for persisted
93 public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L;
94 // the maximum time that must elapse before a changed object will be considered for persisted
95 public long m_persistAfter = DEFAULT_MAX_TIME_FOR_PERSISTENCE * 10000000L;
96
97 protected int m_splitRegionID;
98 protected Timer m_restartWaitTimer = new Timer();
99 protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
100 protected List<RegionInfo> m_neighbours = new List<RegionInfo>();
101 protected string m_simulatorVersion = "OpenSimulator Server";
102 protected ModuleLoader m_moduleLoader;
103 protected AgentCircuitManager m_authenticateHandler;
104 protected SceneCommunicationService m_sceneGridService;
105 protected ISnmpModule m_snmpService = null;
106
107 protected ISimulationDataService m_SimulationDataService;
108 protected IEstateDataService m_EstateDataService;
109 protected IAssetService m_AssetService;
110 protected IAuthorizationService m_AuthorizationService;
111 protected IInventoryService m_InventoryService;
112 protected IGridService m_GridService;
113 protected ILibraryService m_LibraryService;
114 protected ISimulationService m_simulationService;
115 protected IAuthenticationService m_AuthenticationService;
116 protected IPresenceService m_PresenceService;
117 protected IUserAccountService m_UserAccountService;
118 protected IAvatarService m_AvatarService;
119 protected IGridUserService m_GridUserService;
120
121 protected IXMLRPC m_xmlrpcModule;
122 protected IWorldComm m_worldCommModule;
123 protected IAvatarFactory m_AvatarFactory;
124 protected IConfigSource m_config;
125 protected IRegionSerialiserModule m_serialiser;
126 protected IDialogModule m_dialogModule;
127 protected IEntityTransferModule m_teleportModule;
128 protected ICapabilitiesModule m_capsModule;
129 // Central Update Loop
130 protected int m_fps = 10;
131 protected uint m_frame;
132 protected float m_timespan = 0.089f;
133 protected DateTime m_lastupdate = DateTime.UtcNow;
134
135 // TODO: Possibly stop other classes being able to manipulate this directly.
136 private SceneGraph m_sceneGraph;
137 private volatile int m_bordersLocked;
122 private int m_RestartTimerCounter; 138 private int m_RestartTimerCounter;
123 private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing 139 private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing
124 private int m_incrementsof15seconds; 140 private int m_incrementsof15seconds;
125 private volatile bool m_backingup; 141 private volatile bool m_backingup;
126
127 private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); 142 private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
128 private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); 143 private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>();
144 private Object m_heartbeatLock = new Object();
129 145
130 protected string m_simulatorVersion = "OpenSimulator Server"; 146 private int m_update_physics = 1;
147 private int m_update_entitymovement = 1;
148 private int m_update_objects = 1; // Update objects which have scheduled themselves for updates
149 private int m_update_presences = 1; // Update scene presence movements
150 private int m_update_events = 1;
151 private int m_update_backup = 200;
152 private int m_update_terrain = 50;
153 private int m_update_land = 1;
154 private int m_update_coarse_locations = 50;
131 155
132 protected ModuleLoader m_moduleLoader; 156 private int frameMS;
133 protected StorageManager m_storageManager; 157 private int physicsMS2;
134 protected AgentCircuitManager m_authenticateHandler; 158 private int physicsMS;
159 private int otherMS;
160 private int tempOnRezMS;
161 private int eventMS;
162 private int backupMS;
163 private int terrainMS;
164 private int landMS;
165 private int lastCompletedFrame;
135 166
136 protected SceneCommunicationService m_sceneGridService;
137 public bool LoginsDisabled = true;
138 public bool LoadingPrims = false;
139 public bool CombineRegions = false; 167 public bool CombineRegions = false;
168 private bool m_physics_enabled = true;
169 private bool m_scripts_enabled = true;
170 private string m_defaultScriptEngine;
171 private int m_LastLogin;
172 private Thread HeartbeatThread;
173 private volatile bool shuttingdown;
174
175 private int m_lastUpdate;
176 private bool m_firstHeartbeat = true;
177
178 private object m_deleting_scene_object = new object();
179 private object m_cleaningAttachments = new object();
180
181 private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time;
182 private bool m_reprioritizationEnabled = true;
183 private double m_reprioritizationInterval = 5000.0;
184 private double m_rootReprioritizationDistance = 10.0;
185 private double m_childReprioritizationDistance = 20.0;
186
187 private Timer m_mapGenerationTimer = new Timer();
188 private bool m_generateMaptiles;
189
190 #endregion Fields
140 191
192 #region Properties
193
194 /* Used by the loadbalancer plugin on GForge */
195 public int SplitRegionID
196 {
197 get { return m_splitRegionID; }
198 set { m_splitRegionID = value; }
199 }
200
201 public bool BordersLocked
202 {
203 get { return m_bordersLocked == 1; }
204 set
205 {
206 if (value == true)
207 m_bordersLocked = 1;
208 else
209 m_bordersLocked = 0;
210 }
211 }
212
141 public new float TimeDilation 213 public new float TimeDilation
142 { 214 {
143 get { return m_sceneGraph.PhysicsScene.TimeDilation; } 215 get { return m_sceneGraph.PhysicsScene.TimeDilation; }
@@ -148,9 +220,6 @@ namespace OpenSim.Region.Framework.Scenes
148 get { return m_sceneGridService; } 220 get { return m_sceneGridService; }
149 } 221 }
150 222
151 public IXfer XferManager;
152
153 protected ISnmpModule m_snmpService = null;
154 public ISnmpModule SnmpService 223 public ISnmpModule SnmpService
155 { 224 {
156 get 225 get
@@ -164,10 +233,41 @@ namespace OpenSim.Region.Framework.Scenes
164 } 233 }
165 } 234 }
166 235
167 protected IAssetService m_AssetService; 236 public ISimulationDataService SimulationDataService
168 protected IAuthorizationService m_AuthorizationService; 237 {
238 get
239 {
240 if (m_SimulationDataService == null)
241 {
242 m_SimulationDataService = RequestModuleInterface<ISimulationDataService>();
169 243
170 private Object m_heartbeatLock = new Object(); 244 if (m_SimulationDataService == null)
245 {
246 throw new Exception("No ISimulationDataService available.");
247 }
248 }
249
250 return m_SimulationDataService;
251 }
252 }
253
254 public IEstateDataService EstateDataService
255 {
256 get
257 {
258 if (m_EstateDataService == null)
259 {
260 m_EstateDataService = RequestModuleInterface<IEstateDataService>();
261
262 if (m_EstateDataService == null)
263 {
264 throw new Exception("No IEstateDataService available.");
265 }
266 }
267
268 return m_EstateDataService;
269 }
270 }
171 271
172 public IAssetService AssetService 272 public IAssetService AssetService
173 { 273 {
@@ -206,8 +306,6 @@ namespace OpenSim.Region.Framework.Scenes
206 } 306 }
207 } 307 }
208 308
209 protected IInventoryService m_InventoryService;
210
211 public IInventoryService InventoryService 309 public IInventoryService InventoryService
212 { 310 {
213 get 311 get
@@ -226,8 +324,6 @@ namespace OpenSim.Region.Framework.Scenes
226 } 324 }
227 } 325 }
228 326
229 protected IGridService m_GridService;
230
231 public IGridService GridService 327 public IGridService GridService
232 { 328 {
233 get 329 get
@@ -246,8 +342,6 @@ namespace OpenSim.Region.Framework.Scenes
246 } 342 }
247 } 343 }
248 344
249 protected ILibraryService m_LibraryService;
250
251 public ILibraryService LibraryService 345 public ILibraryService LibraryService
252 { 346 {
253 get 347 get
@@ -259,7 +353,6 @@ namespace OpenSim.Region.Framework.Scenes
259 } 353 }
260 } 354 }
261 355
262 protected ISimulationService m_simulationService;
263 public ISimulationService SimulationService 356 public ISimulationService SimulationService
264 { 357 {
265 get 358 get
@@ -270,7 +363,6 @@ namespace OpenSim.Region.Framework.Scenes
270 } 363 }
271 } 364 }
272 365
273 protected IAuthenticationService m_AuthenticationService;
274 public IAuthenticationService AuthenticationService 366 public IAuthenticationService AuthenticationService
275 { 367 {
276 get 368 get
@@ -281,7 +373,6 @@ namespace OpenSim.Region.Framework.Scenes
281 } 373 }
282 } 374 }
283 375
284 protected IPresenceService m_PresenceService;
285 public IPresenceService PresenceService 376 public IPresenceService PresenceService
286 { 377 {
287 get 378 get
@@ -291,7 +382,7 @@ namespace OpenSim.Region.Framework.Scenes
291 return m_PresenceService; 382 return m_PresenceService;
292 } 383 }
293 } 384 }
294 protected IUserAccountService m_UserAccountService; 385
295 public IUserAccountService UserAccountService 386 public IUserAccountService UserAccountService
296 { 387 {
297 get 388 get
@@ -302,8 +393,7 @@ namespace OpenSim.Region.Framework.Scenes
302 } 393 }
303 } 394 }
304 395
305 protected OpenSim.Services.Interfaces.IAvatarService m_AvatarService; 396 public IAvatarService AvatarService
306 public OpenSim.Services.Interfaces.IAvatarService AvatarService
307 { 397 {
308 get 398 get
309 { 399 {
@@ -313,7 +403,6 @@ namespace OpenSim.Region.Framework.Scenes
313 } 403 }
314 } 404 }
315 405
316 protected IGridUserService m_GridUserService;
317 public IGridUserService GridUserService 406 public IGridUserService GridUserService
318 { 407 {
319 get 408 get
@@ -324,58 +413,18 @@ namespace OpenSim.Region.Framework.Scenes
324 } 413 }
325 } 414 }
326 415
327 protected IXMLRPC m_xmlrpcModule;
328 protected IWorldComm m_worldCommModule;
329 public IAttachmentsModule AttachmentsModule { get; set; } 416 public IAttachmentsModule AttachmentsModule { get; set; }
330 protected IAvatarFactory m_AvatarFactory; 417
331 public IAvatarFactory AvatarFactory 418 public IAvatarFactory AvatarFactory
332 { 419 {
333 get { return m_AvatarFactory; } 420 get { return m_AvatarFactory; }
334 } 421 }
335 protected IConfigSource m_config;
336 protected IRegionSerialiserModule m_serialiser;
337 protected IDialogModule m_dialogModule;
338 protected IEntityTransferModule m_teleportModule;
339 422
340 protected ICapabilitiesModule m_capsModule;
341 public ICapabilitiesModule CapsModule 423 public ICapabilitiesModule CapsModule
342 { 424 {
343 get { return m_capsModule; } 425 get { return m_capsModule; }
344 } 426 }
345 427
346 protected override IConfigSource GetConfig()
347 {
348 return m_config;
349 }
350
351 // Central Update Loop
352
353 protected int m_fps = 10;
354 protected uint m_frame;
355 protected float m_timespan = 0.089f;
356 protected DateTime m_lastupdate = DateTime.UtcNow;
357
358 private int m_update_physics = 1;
359 private int m_update_entitymovement = 1;
360 private int m_update_objects = 1; // Update objects which have scheduled themselves for updates
361 private int m_update_presences = 1; // Update scene presence movements
362 private int m_update_events = 1;
363 private int m_update_backup = 200;
364 private int m_update_terrain = 50;
365 private int m_update_land = 1;
366 private int m_update_coarse_locations = 50;
367
368 private int frameMS;
369 private int physicsMS2;
370 private int physicsMS;
371 private int otherMS;
372 private int tempOnRezMS;
373 private int eventMS;
374 private int backupMS;
375 private int terrainMS;
376 private int landMS;
377 private int lastCompletedFrame;
378
379 public int MonitorFrameTime { get { return frameMS; } } 428 public int MonitorFrameTime { get { return frameMS; } }
380 public int MonitorPhysicsUpdateTime { get { return physicsMS; } } 429 public int MonitorPhysicsUpdateTime { get { return physicsMS; } }
381 public int MonitorPhysicsSyncTime { get { return physicsMS2; } } 430 public int MonitorPhysicsSyncTime { get { return physicsMS2; } }
@@ -387,37 +436,6 @@ namespace OpenSim.Region.Framework.Scenes
387 public int MonitorLandTime { get { return landMS; } } 436 public int MonitorLandTime { get { return landMS; } }
388 public int MonitorLastFrameTick { get { return lastCompletedFrame; } } 437 public int MonitorLastFrameTick { get { return lastCompletedFrame; } }
389 438
390 private bool m_physics_enabled = true;
391 private bool m_scripts_enabled = true;
392 private string m_defaultScriptEngine;
393 private int m_LastLogin;
394 private Thread HeartbeatThread;
395 private volatile bool shuttingdown;
396
397 private int m_lastUpdate;
398 private bool m_firstHeartbeat = true;
399
400 private object m_deleting_scene_object = new object();
401 private object m_cleaningAttachments = new object();
402
403 // the minimum time that must elapse before a changed object will be considered for persisted
404 public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L;
405 // the maximum time that must elapse before a changed object will be considered for persisted
406 public long m_persistAfter = DEFAULT_MAX_TIME_FOR_PERSISTENCE * 10000000L;
407
408 private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time;
409 private bool m_reprioritizationEnabled = true;
410 private double m_reprioritizationInterval = 5000.0;
411 private double m_rootReprioritizationDistance = 10.0;
412 private double m_childReprioritizationDistance = 20.0;
413
414 private Timer m_mapGenerationTimer = new Timer();
415 bool m_generateMaptiles = false;
416
417 #endregion
418
419 #region Properties
420
421 public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return m_priorityScheme; } } 439 public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return m_priorityScheme; } }
422 public bool IsReprioritizationEnabled { get { return m_reprioritizationEnabled; } } 440 public bool IsReprioritizationEnabled { get { return m_reprioritizationEnabled; } }
423 public double ReprioritizationInterval { get { return m_reprioritizationInterval; } } 441 public double ReprioritizationInterval { get { return m_reprioritizationInterval; } }
@@ -497,13 +515,13 @@ namespace OpenSim.Region.Framework.Scenes
497 set { m_sceneGraph.RestorePresences = value; } 515 set { m_sceneGraph.RestorePresences = value; }
498 } 516 }
499 517
500 #endregion 518 #endregion Properties
501 519
502 #region Constructors 520 #region Constructors
503 521
504 public Scene(RegionInfo regInfo, AgentCircuitManager authen, 522 public Scene(RegionInfo regInfo, AgentCircuitManager authen,
505 SceneCommunicationService sceneGridService, 523 SceneCommunicationService sceneGridService,
506 StorageManager storeManager, 524 ISimulationDataService simDataService, IEstateDataService estateDataService,
507 ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, 525 ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim,
508 bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) 526 bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion)
509 { 527 {
@@ -539,7 +557,8 @@ namespace OpenSim.Region.Framework.Scenes
539 m_moduleLoader = moduleLoader; 557 m_moduleLoader = moduleLoader;
540 m_authenticateHandler = authen; 558 m_authenticateHandler = authen;
541 m_sceneGridService = sceneGridService; 559 m_sceneGridService = sceneGridService;
542 m_storageManager = storeManager; 560 m_SimulationDataService = simDataService;
561 m_EstateDataService = estateDataService;
543 m_regInfo = regInfo; 562 m_regInfo = regInfo;
544 m_regionHandle = m_regInfo.RegionHandle; 563 m_regionHandle = m_regInfo.RegionHandle;
545 m_regionName = m_regInfo.RegionName; 564 m_regionName = m_regInfo.RegionName;
@@ -558,13 +577,11 @@ namespace OpenSim.Region.Framework.Scenes
558 #region Region Settings 577 #region Region Settings
559 578
560 // Load region settings 579 // Load region settings
561 m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); 580 m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(m_regInfo.RegionID);
562 m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(m_regInfo.RegionID);
563 581
564 if (m_storageManager.EstateDataStore != null) 582 m_regInfo.RegionSettings = simDataService.LoadRegionSettings(m_regInfo.RegionID);
565 { 583 if (estateDataService != null)
566 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); 584 m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false);
567 }
568 585
569 #endregion Region Settings 586 #endregion Region Settings
570 587
@@ -574,9 +591,9 @@ namespace OpenSim.Region.Framework.Scenes
574 591
575 //Bind Storage Manager functions to some land manager functions for this scene 592 //Bind Storage Manager functions to some land manager functions for this scene
576 EventManager.OnLandObjectAdded += 593 EventManager.OnLandObjectAdded +=
577 new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject); 594 new EventManager.LandObjectAdded(simDataService.StoreLandObject);
578 EventManager.OnLandObjectRemoved += 595 EventManager.OnLandObjectRemoved +=
579 new EventManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject); 596 new EventManager.LandObjectRemoved(simDataService.RemoveLandObject);
580 597
581 m_sceneGraph = new SceneGraph(this, m_regInfo); 598 m_sceneGraph = new SceneGraph(this, m_regInfo);
582 599
@@ -1062,29 +1079,30 @@ namespace OpenSim.Region.Framework.Scenes
1062 if (ScriptEngine) 1079 if (ScriptEngine)
1063 { 1080 {
1064 m_log.Info("Stopping all Scripts in Scene"); 1081 m_log.Info("Stopping all Scripts in Scene");
1065 foreach (EntityBase ent in Entities) 1082
1083 EntityBase[] entities = Entities.GetEntities();
1084 foreach (EntityBase ent in entities)
1066 { 1085 {
1067 if (ent is SceneObjectGroup) 1086 if (ent is SceneObjectGroup)
1068 { 1087 ((SceneObjectGroup)ent).RemoveScriptInstances(false);
1069 ((SceneObjectGroup) ent).RemoveScriptInstances(false);
1070 }
1071 } 1088 }
1072 } 1089 }
1073 else 1090 else
1074 { 1091 {
1075 m_log.Info("Starting all Scripts in Scene"); 1092 m_log.Info("Starting all Scripts in Scene");
1076 lock (Entities) 1093
1094 EntityBase[] entities = Entities.GetEntities();
1095 foreach (EntityBase ent in entities)
1077 { 1096 {
1078 foreach (EntityBase ent in Entities) 1097 if (ent is SceneObjectGroup)
1079 { 1098 {
1080 if (ent is SceneObjectGroup) 1099 SceneObjectGroup sog = (SceneObjectGroup)ent;
1081 { 1100 sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
1082 ((SceneObjectGroup)ent).CreateScriptInstances(0, false, DefaultScriptEngine, 0); 1101 sog.ResumeScripts();
1083 ((SceneObjectGroup)ent).ResumeScripts();
1084 }
1085 } 1102 }
1086 } 1103 }
1087 } 1104 }
1105
1088 m_scripts_enabled = !ScriptEngine; 1106 m_scripts_enabled = !ScriptEngine;
1089 m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); 1107 m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine");
1090 } 1108 }
@@ -1131,12 +1149,12 @@ namespace OpenSim.Region.Framework.Scenes
1131 shuttingdown = true; 1149 shuttingdown = true;
1132 1150
1133 m_log.Debug("[SCENE]: Persisting changed objects"); 1151 m_log.Debug("[SCENE]: Persisting changed objects");
1134 List<EntityBase> entities = GetEntities(); 1152 EntityBase[] entities = GetEntities();
1135 foreach (EntityBase entity in entities) 1153 foreach (EntityBase entity in entities)
1136 { 1154 {
1137 if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged) 1155 if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged)
1138 { 1156 {
1139 ((SceneObjectGroup)entity).ProcessBackup(m_storageManager.DataStore, false); 1157 ((SceneObjectGroup)entity).ProcessBackup(SimulationDataService, false);
1140 } 1158 }
1141 } 1159 }
1142 1160
@@ -1192,8 +1210,9 @@ namespace OpenSim.Region.Framework.Scenes
1192 while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) 1210 while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
1193 { 1211 {
1194 MainConsole.Instance.Output("The current estate has no owner set."); 1212 MainConsole.Instance.Output("The current estate has no owner set.");
1195 string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test"); 1213 List<char> excluded = new List<char>(new char[1]{' '});
1196 string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User"); 1214 string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
1215 string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);
1197 1216
1198 UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last); 1217 UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last);
1199 1218
@@ -1577,7 +1596,7 @@ namespace OpenSim.Region.Framework.Scenes
1577 { 1596 {
1578 lock (m_returns) 1597 lock (m_returns)
1579 { 1598 {
1580 EventManager.TriggerOnBackup(m_storageManager.DataStore, forced); 1599 EventManager.TriggerOnBackup(SimulationDataService, forced);
1581 m_backingup = false; 1600 m_backingup = false;
1582 1601
1583 foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns) 1602 foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns)
@@ -1618,7 +1637,7 @@ namespace OpenSim.Region.Framework.Scenes
1618 { 1637 {
1619 if (group != null) 1638 if (group != null)
1620 { 1639 {
1621 group.ProcessBackup(m_storageManager.DataStore, true); 1640 group.ProcessBackup(SimulationDataService, true);
1622 } 1641 }
1623 } 1642 }
1624 1643
@@ -1660,20 +1679,19 @@ namespace OpenSim.Region.Framework.Scenes
1660 /// </summary> 1679 /// </summary>
1661 public void SaveTerrain() 1680 public void SaveTerrain()
1662 { 1681 {
1663 m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); 1682 SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
1664 } 1683 }
1665 1684
1666 public void StoreWindlightProfile(RegionLightShareData wl) 1685 public void StoreWindlightProfile(RegionLightShareData wl)
1667 { 1686 {
1668 m_regInfo.WindlightSettings = wl; 1687 m_regInfo.WindlightSettings = wl;
1669 wl.Save(); 1688 SimulationDataService.StoreRegionWindlightSettings(wl);
1670 m_storageManager.DataStore.StoreRegionWindlightSettings(wl);
1671 m_eventManager.TriggerOnSaveNewWindlightProfile(); 1689 m_eventManager.TriggerOnSaveNewWindlightProfile();
1672 } 1690 }
1673 1691
1674 public void LoadWindlightProfile() 1692 public void LoadWindlightProfile()
1675 { 1693 {
1676 m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(RegionInfo.RegionID); 1694 m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(RegionInfo.RegionID);
1677 m_eventManager.TriggerOnSaveNewWindlightProfile(); 1695 m_eventManager.TriggerOnSaveNewWindlightProfile();
1678 } 1696 }
1679 1697
@@ -1684,13 +1702,13 @@ namespace OpenSim.Region.Framework.Scenes
1684 { 1702 {
1685 try 1703 try
1686 { 1704 {
1687 double[,] map = m_storageManager.DataStore.LoadTerrain(RegionInfo.RegionID); 1705 double[,] map = SimulationDataService.LoadTerrain(RegionInfo.RegionID);
1688 if (map == null) 1706 if (map == null)
1689 { 1707 {
1690 m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain."); 1708 m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain.");
1691 Heightmap = new TerrainChannel(); 1709 Heightmap = new TerrainChannel();
1692 1710
1693 m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); 1711 SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
1694 } 1712 }
1695 else 1713 else
1696 { 1714 {
@@ -1707,7 +1725,7 @@ namespace OpenSim.Region.Framework.Scenes
1707 { 1725 {
1708 Heightmap = new TerrainChannel(); 1726 Heightmap = new TerrainChannel();
1709 1727
1710 m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); 1728 SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
1711 } 1729 }
1712 } 1730 }
1713 catch (Exception e) 1731 catch (Exception e)
@@ -1754,7 +1772,7 @@ namespace OpenSim.Region.Framework.Scenes
1754 public void loadAllLandObjectsFromStorage(UUID regionID) 1772 public void loadAllLandObjectsFromStorage(UUID regionID)
1755 { 1773 {
1756 m_log.Info("[SCENE]: Loading land objects from storage"); 1774 m_log.Info("[SCENE]: Loading land objects from storage");
1757 List<LandData> landData = m_storageManager.DataStore.LoadLandObjects(regionID); 1775 List<LandData> landData = SimulationDataService.LoadLandObjects(regionID);
1758 1776
1759 if (LandChannel != null) 1777 if (LandChannel != null)
1760 { 1778 {
@@ -1785,7 +1803,7 @@ namespace OpenSim.Region.Framework.Scenes
1785 LoadingPrims = true; 1803 LoadingPrims = true;
1786 m_log.Info("[SCENE]: Loading objects from datastore"); 1804 m_log.Info("[SCENE]: Loading objects from datastore");
1787 1805
1788 List<SceneObjectGroup> PrimsFromDB = m_storageManager.DataStore.LoadObjects(regionID); 1806 List<SceneObjectGroup> PrimsFromDB = SimulationDataService.LoadObjects(regionID);
1789 1807
1790 m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count + " objects from the datastore"); 1808 m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count + " objects from the datastore");
1791 1809
@@ -1978,7 +1996,7 @@ namespace OpenSim.Region.Framework.Scenes
1978 sceneObject.ScheduleGroupForFullUpdate(); 1996 sceneObject.ScheduleGroupForFullUpdate();
1979 1997
1980 return sceneObject; 1998 return sceneObject;
1981 } 1999 }
1982 2000
1983 /// <summary> 2001 /// <summary>
1984 /// Add an object into the scene that has come from storage 2002 /// Add an object into the scene that has come from storage
@@ -2074,7 +2092,7 @@ namespace OpenSim.Region.Framework.Scenes
2074 /// <returns></returns> 2092 /// <returns></returns>
2075 public bool AddNewSceneObject( 2093 public bool AddNewSceneObject(
2076 SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) 2094 SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
2077 { 2095 {
2078 return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel); 2096 return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel);
2079 } 2097 }
2080 2098
@@ -2094,8 +2112,7 @@ namespace OpenSim.Region.Framework.Scenes
2094 List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); 2112 List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>();
2095 lock (Entities) 2113 lock (Entities)
2096 { 2114 {
2097 ICollection<EntityBase> entities = new List<EntityBase>(Entities); 2115 EntityBase[] entities = Entities.GetEntities();
2098
2099 foreach (EntityBase e in entities) 2116 foreach (EntityBase e in entities)
2100 { 2117 {
2101 if (e is SceneObjectGroup) 2118 if (e is SceneObjectGroup)
@@ -2190,12 +2207,12 @@ namespace OpenSim.Region.Framework.Scenes
2190 // group has recently been delinked from another group but that this change has not been persisted 2207 // group has recently been delinked from another group but that this change has not been persisted
2191 // to the DB. 2208 // to the DB.
2192 ForceSceneObjectBackup(so); 2209 ForceSceneObjectBackup(so);
2193 so.DetachFromBackup(); 2210 so.DetachFromBackup();
2194 m_storageManager.DataStore.RemoveObject(so.UUID, m_regInfo.RegionID); 2211 SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID);
2195 } 2212 }
2196 2213
2197 // We need to keep track of this state in case this group is still queued for further backup. 2214 // We need to keep track of this state in case this group is still queued for further backup.
2198 so.IsDeleted = true; 2215 so.IsDeleted = true;
2199 2216
2200 return true; 2217 return true;
2201 } 2218 }
@@ -2482,7 +2499,7 @@ namespace OpenSim.Region.Framework.Scenes
2482 ScenePresence sp = GetScenePresence(userID); 2499 ScenePresence sp = GetScenePresence(userID);
2483 if (sp != null && AttachmentsModule != null) 2500 if (sp != null && AttachmentsModule != null)
2484 { 2501 {
2485 uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID); 2502 uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID);
2486 AttachmentsModule.RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, attPt); 2503 AttachmentsModule.RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, attPt);
2487 } 2504 }
2488 2505
@@ -2531,7 +2548,7 @@ namespace OpenSim.Region.Framework.Scenes
2531 sceneObject.RootPart.AddFlag(PrimFlags.Phantom); 2548 sceneObject.RootPart.AddFlag(PrimFlags.Phantom);
2532 2549
2533 // Don't sent a full update here because this will cause full updates to be sent twice for 2550 // Don't sent a full update here because this will cause full updates to be sent twice for
2534 // attachments on region crossings, resulting in viewer glitches. 2551 // attachments on region crossings, resulting in viewer glitches.
2535 AddRestoredSceneObject(sceneObject, false, false, false); 2552 AddRestoredSceneObject(sceneObject, false, false, false);
2536 2553
2537 // Handle attachment special case 2554 // Handle attachment special case
@@ -2788,7 +2805,7 @@ namespace OpenSim.Region.Framework.Scenes
2788 } 2805 }
2789 2806
2790 public virtual void SubscribeToClientPrimEvents(IClientAPI client) 2807 public virtual void SubscribeToClientPrimEvents(IClientAPI client)
2791 { 2808 {
2792 client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition; 2809 client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition;
2793 client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; 2810 client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition;
2794 client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation; 2811 client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation;
@@ -2824,7 +2841,7 @@ namespace OpenSim.Region.Framework.Scenes
2824 client.OnUndo += m_sceneGraph.HandleUndo; 2841 client.OnUndo += m_sceneGraph.HandleUndo;
2825 client.OnRedo += m_sceneGraph.HandleRedo; 2842 client.OnRedo += m_sceneGraph.HandleRedo;
2826 client.OnObjectDescription += m_sceneGraph.PrimDescription; 2843 client.OnObjectDescription += m_sceneGraph.PrimDescription;
2827 client.OnObjectDrop += m_sceneGraph.DropObject; 2844 client.OnObjectDrop += m_sceneGraph.DropObject;
2828 client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; 2845 client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable;
2829 client.OnObjectOwner += ObjectOwner; 2846 client.OnObjectOwner += ObjectOwner;
2830 } 2847 }
@@ -3804,7 +3821,7 @@ namespace OpenSim.Region.Framework.Scenes
3804 public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) 3821 public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying)
3805 { 3822 {
3806 ScenePresence presence = GetScenePresence(agentID); 3823 ScenePresence presence = GetScenePresence(agentID);
3807 if(presence != null) 3824 if (presence != null)
3808 { 3825 {
3809 try 3826 try
3810 { 3827 {
@@ -4083,6 +4100,11 @@ namespace OpenSim.Region.Framework.Scenes
4083 4100
4084 #region Other Methods 4101 #region Other Methods
4085 4102
4103 protected override IConfigSource GetConfig()
4104 {
4105 return m_config;
4106 }
4107
4086 #endregion 4108 #endregion
4087 4109
4088 public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) 4110 public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set)
@@ -4107,9 +4129,8 @@ namespace OpenSim.Region.Framework.Scenes
4107 /// </summary> 4129 /// </summary>
4108 public void ForceClientUpdate() 4130 public void ForceClientUpdate()
4109 { 4131 {
4110 List<EntityBase> EntityList = GetEntities(); 4132 EntityBase[] entityList = GetEntities();
4111 4133 foreach (EntityBase ent in entityList)
4112 foreach (EntityBase ent in EntityList)
4113 { 4134 {
4114 if (ent is SceneObjectGroup) 4135 if (ent is SceneObjectGroup)
4115 { 4136 {
@@ -4127,9 +4148,8 @@ namespace OpenSim.Region.Framework.Scenes
4127 { 4148 {
4128 m_log.Debug("Searching for Primitive: '" + cmdparams[2] + "'"); 4149 m_log.Debug("Searching for Primitive: '" + cmdparams[2] + "'");
4129 4150
4130 List<EntityBase> EntityList = GetEntities(); 4151 EntityBase[] entityList = GetEntities();
4131 4152 foreach (EntityBase ent in entityList)
4132 foreach (EntityBase ent in EntityList)
4133 { 4153 {
4134 if (ent is SceneObjectGroup) 4154 if (ent is SceneObjectGroup)
4135 { 4155 {
@@ -4498,7 +4518,7 @@ namespace OpenSim.Region.Framework.Scenes
4498 /// will not affect the original list of objects in the scene. 4518 /// will not affect the original list of objects in the scene.
4499 /// </summary> 4519 /// </summary>
4500 /// <returns></returns> 4520 /// <returns></returns>
4501 public List<EntityBase> GetEntities() 4521 public EntityBase[] GetEntities()
4502 { 4522 {
4503 return m_sceneGraph.GetEntities(); 4523 return m_sceneGraph.GetEntities();
4504 } 4524 }
@@ -4532,9 +4552,8 @@ namespace OpenSim.Region.Framework.Scenes
4532 4552
4533 public void CleanTempObjects() 4553 public void CleanTempObjects()
4534 { 4554 {
4535 List<EntityBase> objs = GetEntities(); 4555 EntityBase[] entities = GetEntities();
4536 4556 foreach (EntityBase obj in entities)
4537 foreach (EntityBase obj in objs)
4538 { 4557 {
4539 if (obj is SceneObjectGroup) 4558 if (obj is SceneObjectGroup)
4540 { 4559 {
@@ -4554,7 +4573,7 @@ namespace OpenSim.Region.Framework.Scenes
4554 4573
4555 public void DeleteFromStorage(UUID uuid) 4574 public void DeleteFromStorage(UUID uuid)
4556 { 4575 {
4557 m_storageManager.DataStore.RemoveObject(uuid, m_regInfo.RegionID); 4576 SimulationDataService.RemoveObject(uuid, m_regInfo.RegionID);
4558 } 4577 }
4559 4578
4560 public int GetHealth() 4579 public int GetHealth()
@@ -4963,17 +4982,21 @@ namespace OpenSim.Region.Framework.Scenes
4963 4982
4964 public List<UUID> GetEstateRegions(int estateID) 4983 public List<UUID> GetEstateRegions(int estateID)
4965 { 4984 {
4966 if (m_storageManager.EstateDataStore == null) 4985 IEstateDataService estateDataService = EstateDataService;
4967 return new List<UUID>(); 4986 if (estateDataService == null)
4987 return new List<UUID>(0);
4968 4988
4969 return m_storageManager.EstateDataStore.GetRegions(estateID); 4989 return estateDataService.GetRegions(estateID);
4970 } 4990 }
4971 4991
4972 public void ReloadEstateData() 4992 public void ReloadEstateData()
4973 { 4993 {
4974 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); 4994 IEstateDataService estateDataService = EstateDataService;
4975 4995 if (estateDataService != null)
4976 TriggerEstateSunUpdate(); 4996 {
4997 m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false);
4998 TriggerEstateSunUpdate();
4999 }
4977 } 5000 }
4978 5001
4979 public void TriggerEstateSunUpdate() 5002 public void TriggerEstateSunUpdate()