aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/RegionInfo.cs
diff options
context:
space:
mode:
authorMelanie Thielker2009-06-25 15:48:54 +0000
committerMelanie Thielker2009-06-25 15:48:54 +0000
commitd9528bd06e770d9d0bfc1c34d83abb02e7489e66 (patch)
tree34aa2d5d244d188213357441254fd5b826af2767 /OpenSim/Framework/RegionInfo.cs
parentAdded a note to the ScenePresence.UpdateMovement() method, to remind everyone... (diff)
downloadopensim-SC_OLD-d9528bd06e770d9d0bfc1c34d83abb02e7489e66.zip
opensim-SC_OLD-d9528bd06e770d9d0bfc1c34d83abb02e7489e66.tar.gz
opensim-SC_OLD-d9528bd06e770d9d0bfc1c34d83abb02e7489e66.tar.bz2
opensim-SC_OLD-d9528bd06e770d9d0bfc1c34d83abb02e7489e66.tar.xz
Allow the reading of ini files instead of xml files when reading region
definitions from the file system
Diffstat (limited to 'OpenSim/Framework/RegionInfo.cs')
-rw-r--r--OpenSim/Framework/RegionInfo.cs160
1 files changed, 116 insertions, 44 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index db23af9..2423097 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -209,7 +209,7 @@ namespace OpenSim.Framework
209 public bool isSandbox = false; 209 public bool isSandbox = false;
210 private EstateSettings m_estateSettings; 210 private EstateSettings m_estateSettings;
211 private RegionSettings m_regionSettings; 211 private RegionSettings m_regionSettings;
212 //private IConfigSource m_configSource = null; 212 // private IConfigSource m_configSource = null;
213 213
214 public UUID MasterAvatarAssignedUUID = UUID.Zero; 214 public UUID MasterAvatarAssignedUUID = UUID.Zero;
215 public string MasterAvatarFirstName = String.Empty; 215 public string MasterAvatarFirstName = String.Empty;
@@ -238,18 +238,51 @@ namespace OpenSim.Framework
238 // access the same database server. Since estate settings are lodaed 238 // access the same database server. Since estate settings are lodaed
239 // from there, that should be sufficient for full remote administration 239 // from there, that should be sufficient for full remote administration
240 240
241 public RegionInfo(string description, string filename, bool skipConsoleConfig, IConfigSource configSource) 241 // File based loading
242 //
243 public RegionInfo(string description, string filename, bool skipConsoleConfig, IConfigSource configSource) : this(description, filename, skipConsoleConfig, configSource, String.Empty)
242 { 244 {
243 //m_configSource = configSource; 245 }
246
247 public RegionInfo(string description, string filename, bool skipConsoleConfig, IConfigSource configSource, string configName)
248 {
249 // m_configSource = configSource;
250
251 if (filename.ToLower().EndsWith(".ini"))
252 {
253 IConfigSource source = new IniConfigSource(filename);
254
255 ReadNiniConfig(source, configName);
256
257 return;
258 }
259
260 try
261 {
262 // This will throw if it's not legal Nini XML format
263 // and thereby toss it to the legacy loader
264 //
265 IConfigSource xmlsource = new XmlConfigSource(filename);
266
267 ReadNiniConfig(xmlsource, configName);
268
269 return;
270 }
271 catch (Exception)
272 {
273 }
274
244 configMember = 275 configMember =
245 new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); 276 new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig);
246 configMember.performConfigurationRetrieve(); 277 configMember.performConfigurationRetrieve();
247 RegionFile = filename; 278 RegionFile = filename;
248 } 279 }
249 280
281 // The web loader uses this
282 //
250 public RegionInfo(string description, XmlNode xmlNode, bool skipConsoleConfig, IConfigSource configSource) 283 public RegionInfo(string description, XmlNode xmlNode, bool skipConsoleConfig, IConfigSource configSource)
251 { 284 {
252 //m_configSource = configSource; 285 // m_configSource = configSource;
253 configMember = 286 configMember =
254 new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); 287 new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig);
255 configMember.performConfigurationRetrieve(); 288 configMember.performConfigurationRetrieve();
@@ -355,53 +388,92 @@ namespace OpenSim.Framework
355 m_internalEndPoint = tmpEPE; 388 m_internalEndPoint = tmpEPE;
356 } 389 }
357 390
358 //not in use, should swap to nini though. 391 private void ReadNiniConfig(IConfigSource source, string name)
359 public void LoadFromNiniSource(IConfigSource source)
360 { 392 {
361 LoadFromNiniSource(source, "RegionInfo"); 393 if (name == String.Empty)
362 } 394 name = source.Configs[0].Name;
363 395
364 //not in use, should swap to nini though. 396 if (source.Configs[name] == null)
365 public void LoadFromNiniSource(IConfigSource source, string sectionName) 397 throw new Exception("Config name does not exist");
366 {
367 string errorMessage = String.Empty;
368 RegionID = new UUID(source.Configs[sectionName].GetString("Region_ID", UUID.Random().ToString()));
369 RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test");
370 m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000"));
371 m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000"));
372 // this.DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db");
373 398
374 string ipAddress = source.Configs[sectionName].GetString("internal_ip_address", "0.0.0.0"); 399 IConfig config = source.Configs[name];
375 IPAddress ipAddressResult;
376 if (IPAddress.TryParse(ipAddress, out ipAddressResult))
377 {
378 m_internalEndPoint = new IPEndPoint(ipAddressResult, 0);
379 }
380 else
381 {
382 errorMessage = "needs an IP Address (IPAddress)";
383 }
384 m_internalEndPoint.Port =
385 source.Configs[sectionName].GetInt("internal_ip_port", (int) ConfigSettings.DefaultRegionHttpPort);
386 400
387 string externalHost = source.Configs[sectionName].GetString("external_host_name", "127.0.0.1"); 401 // UUID
388 if (externalHost != "SYSTEMIP") 402 //
389 { 403 string regionUUID = config.GetString("RegionUUID", string.Empty);
390 m_externalHostName = externalHost; 404
391 } 405 if (regionUUID == String.Empty)
392 else 406 throw new Exception("A region UUID is required");
393 { 407
408 RegionID = new UUID(regionUUID);
409 originRegionID = RegionID; // What IS this?!
410
411
412 // Region name
413 //
414 RegionName = name;
415
416
417 // Region location
418 //
419 string location = config.GetString("Location", String.Empty);
420
421 if (location == String.Empty)
422 throw new Exception("Location is required");
423
424 string[] locationElements = location.Split(new char[] {','});
425
426 m_regionLocX = Convert.ToUInt32(locationElements[0]);
427 m_regionLocY = Convert.ToUInt32(locationElements[1]);
428
429
430 // Datastore
431 //
432 DataStore = config.GetString("Datastore", String.Empty);
433
434
435 // Internal IP
436 //
437 IPAddress address = IPAddress.Parse(config.GetString("InternalAddress", "127.0.0.1"));
438 int port = config.GetInt("InternalPort", 9000);
439
440 m_internalEndPoint = new IPEndPoint(address, port);
441
442 m_allow_alternate_ports = config.GetBoolean("AllowAlternatePorts", true);
443
444 // External IP
445 //
446 string externalName = config.GetString("ExternalHostName", "SYSTEMIP");
447 if (externalName == "SYSTEMIP")
394 m_externalHostName = Util.GetLocalHost().ToString(); 448 m_externalHostName = Util.GetLocalHost().ToString();
395 } 449 else
450 m_externalHostName = externalName;
396 451
397 MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test");
398 MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User");
399 MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test");
400 452
401 if (errorMessage != String.Empty) 453 // Master avatar cruft
402 { 454 //
403 // a error 455 string masterAvatarUUID = config.GetString("MasterAvatarUUID", UUID.Zero.ToString());
404 } 456 MasterAvatarAssignedUUID = new UUID(masterAvatarUUID);
457
458 MasterAvatarFirstName = config.GetString("MasterAvatarFirstName", String.Empty);
459 MasterAvatarLastName = config.GetString("MasterAvatarLastName", String.Empty);
460 MasterAvatarSandboxPassword = config.GetString("MasterAvatarSandboxPassword", String.Empty);
461
462
463 // Prim stuff
464 //
465 m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 256);
466
467 m_physPrimMax = config.GetInt("PhysicalPrimMax", 10);
468
469 m_clampPrimSize = config.GetBoolean("ClampPrimSize", false);
470
471 m_objectCapacity = config.GetInt("MaxPrims", 15000);
472
473
474 // Multi-tenancy
475 //
476 ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString()));
405 } 477 }
406 478
407 public bool ignoreIncomingConfiguration(string configuration_key, object configuration_result) 479 public bool ignoreIncomingConfiguration(string configuration_key, object configuration_result)