diff options
author | Diva Canto | 2015-01-07 11:04:23 -0800 |
---|---|---|
committer | Diva Canto | 2015-01-07 11:04:23 -0800 |
commit | 46ab59723d62ecd22ebe8c797e1d510514ef35da (patch) | |
tree | 019e8e006de13dc0831d87f4ae8cb4e0456562ad /OpenSim/Region/DataSnapshot/DataSnapshotManager.cs | |
parent | Donation of robust network connectors for estate service, as promised. This a... (diff) | |
download | opensim-SC_OLD-46ab59723d62ecd22ebe8c797e1d510514ef35da.zip opensim-SC_OLD-46ab59723d62ecd22ebe8c797e1d510514ef35da.tar.gz opensim-SC_OLD-46ab59723d62ecd22ebe8c797e1d510514ef35da.tar.bz2 opensim-SC_OLD-46ab59723d62ecd22ebe8c797e1d510514ef35da.tar.xz |
Added a different/better way of specifying data services in DataSnapshot -- using DATA_SRV_ keys, one per service. This allows 3rd party modules to add data services automatically.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/DataSnapshot/DataSnapshotManager.cs | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs index ddaf8de..f7b2338 100644 --- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs +++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs | |||
@@ -29,8 +29,10 @@ | |||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Linq; | ||
32 | using System.Net; | 33 | using System.Net; |
33 | using System.Reflection; | 34 | using System.Reflection; |
35 | using System.Text; | ||
34 | using System.Xml; | 36 | using System.Xml; |
35 | using log4net; | 37 | using log4net; |
36 | using Nini.Config; | 38 | using Nini.Config; |
@@ -131,9 +133,12 @@ namespace OpenSim.Region.DataSnapshot | |||
131 | m_period = config.Configs["DataSnapshot"].GetInt("default_snapshot_period", m_period); | 133 | m_period = config.Configs["DataSnapshot"].GetInt("default_snapshot_period", m_period); |
132 | m_maxStales = config.Configs["DataSnapshot"].GetInt("max_changes_before_update", m_maxStales); | 134 | m_maxStales = config.Configs["DataSnapshot"].GetInt("max_changes_before_update", m_maxStales); |
133 | m_snapsDir = config.Configs["DataSnapshot"].GetString("snapshot_cache_directory", m_snapsDir); | 135 | m_snapsDir = config.Configs["DataSnapshot"].GetString("snapshot_cache_directory", m_snapsDir); |
134 | m_dataServices = config.Configs["DataSnapshot"].GetString("data_services", m_dataServices); | ||
135 | m_listener_port = config.Configs["Network"].GetString("http_listener_port", m_listener_port); | 136 | m_listener_port = config.Configs["Network"].GetString("http_listener_port", m_listener_port); |
136 | 137 | ||
138 | m_dataServices = config.Configs["DataSnapshot"].GetString("data_services", m_dataServices); | ||
139 | // New way of spec'ing data services, one per line | ||
140 | AddDataServicesVars(config.Configs["DataSnapshot"]); | ||
141 | |||
137 | String[] annoying_string_array = config.Configs["DataSnapshot"].GetString("disable_modules", "").Split(".".ToCharArray()); | 142 | String[] annoying_string_array = config.Configs["DataSnapshot"].GetString("disable_modules", "").Split(".".ToCharArray()); |
138 | foreach (String bloody_wanker in annoying_string_array) | 143 | foreach (String bloody_wanker in annoying_string_array) |
139 | { | 144 | { |
@@ -289,6 +294,28 @@ namespace OpenSim.Region.DataSnapshot | |||
289 | return null; | 294 | return null; |
290 | } | 295 | } |
291 | 296 | ||
297 | private void AddDataServicesVars(IConfig config) | ||
298 | { | ||
299 | // Make sure the services given this way aren't in m_dataServices already | ||
300 | List<string> servs = new List<string>(m_dataServices.Split(new char[] { ';' })); | ||
301 | |||
302 | StringBuilder sb = new StringBuilder(); | ||
303 | string[] keys = config.GetKeys(); | ||
304 | |||
305 | if (keys.Length > 0) | ||
306 | { | ||
307 | IEnumerable<string> serviceKeys = keys.Where(value => value.StartsWith("DATA_SRV_")); | ||
308 | foreach (string serviceKey in serviceKeys) | ||
309 | { | ||
310 | string keyValue = config.GetString(serviceKey, string.Empty).Trim(); | ||
311 | if (!servs.Contains(keyValue)) | ||
312 | sb.Append(keyValue).Append(";"); | ||
313 | } | ||
314 | } | ||
315 | |||
316 | m_dataServices = (m_dataServices == "noservices") ? sb.ToString() : sb.Append(m_dataServices).ToString(); | ||
317 | } | ||
318 | |||
292 | #endregion | 319 | #endregion |
293 | 320 | ||
294 | #region [Public] Snapshot storage functions | 321 | #region [Public] Snapshot storage functions |